mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 22:13:25 -06:00
#2361 AppFwk : Template specialization of stream operator for vector of FilePath
This commit is contained in:
parent
f86b13adc8
commit
97822cbd2c
@ -14,12 +14,15 @@ include_directories (
|
|||||||
set( PROJECT_FILES
|
set( PROJECT_FILES
|
||||||
cafInternalPdmFieldIoHelper.cpp
|
cafInternalPdmFieldIoHelper.cpp
|
||||||
cafInternalPdmFieldIoHelper.h
|
cafInternalPdmFieldIoHelper.h
|
||||||
|
cafInternalPdmFilePathStreamOperators.cpp
|
||||||
|
cafInternalPdmFilePathStreamOperators.h
|
||||||
cafInternalPdmStreamOperators.cpp
|
cafInternalPdmStreamOperators.cpp
|
||||||
cafInternalPdmStreamOperators.h
|
cafInternalPdmStreamOperators.h
|
||||||
cafInternalPdmXmlFieldCapability.h
|
cafInternalPdmXmlFieldCapability.h
|
||||||
cafInternalPdmXmlFieldCapability.inl
|
cafInternalPdmXmlFieldCapability.inl
|
||||||
cafInternalPdmXmlFieldReaderWriter.cpp
|
cafInternalPdmXmlFieldReaderWriter.cpp
|
||||||
cafInternalPdmXmlFieldReaderWriter.h
|
cafInternalPdmXmlFieldReaderWriter.h
|
||||||
|
|
||||||
cafPdmXmlFieldHandle.cpp
|
cafPdmXmlFieldHandle.cpp
|
||||||
cafPdmXmlFieldHandle.h
|
cafPdmXmlFieldHandle.h
|
||||||
cafPdmXmlObjectHandle.cpp
|
cafPdmXmlObjectHandle.cpp
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
#include "cafInternalPdmFilePathStreamOperators.h"
|
||||||
|
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QTextStream& operator<<(QTextStream& str, const std::vector<caf::FilePath>& filePathObjects)
|
||||||
|
{
|
||||||
|
for (const auto& filePath : filePathObjects)
|
||||||
|
{
|
||||||
|
str << filePath << ";";
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QTextStream& operator>>(QTextStream& str, std::vector<caf::FilePath>& filePathObjects)
|
||||||
|
{
|
||||||
|
QString stringSeparatedBySemicolon;
|
||||||
|
|
||||||
|
while (str.status() == QTextStream::Ok)
|
||||||
|
{
|
||||||
|
// Read QChar to avoid white space trimming when reading QString
|
||||||
|
QChar singleChar;
|
||||||
|
str >> singleChar;
|
||||||
|
|
||||||
|
stringSeparatedBySemicolon += singleChar;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList splitBySemicolon = stringSeparatedBySemicolon.split(";");
|
||||||
|
for (const auto& s : splitBySemicolon )
|
||||||
|
{
|
||||||
|
filePathObjects.push_back(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "cafFilePath.h"
|
||||||
|
|
||||||
|
#include <QTextStream>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
QTextStream& operator << (QTextStream& str, const std::vector<caf::FilePath>& sobj);
|
||||||
|
QTextStream& operator >> (QTextStream& str, std::vector<caf::FilePath>& sobj);
|
@ -5,6 +5,7 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
#include "cafInternalPdmStreamOperators.h"
|
#include "cafInternalPdmStreamOperators.h"
|
||||||
|
#include "cafInternalPdmFilePathStreamOperators.h"
|
||||||
#include "cafPdmReferenceHelper.h"
|
#include "cafPdmReferenceHelper.h"
|
||||||
#include "cafInternalPdmFieldIoHelper.h"
|
#include "cafInternalPdmFieldIoHelper.h"
|
||||||
|
|
||||||
|
@ -36,11 +36,13 @@
|
|||||||
|
|
||||||
#include "cafPdmUiDefaultObjectEditor.h"
|
#include "cafPdmUiDefaultObjectEditor.h"
|
||||||
|
|
||||||
|
#include "cafFilePath.h"
|
||||||
#include "cafPdmField.h"
|
#include "cafPdmField.h"
|
||||||
#include "cafPdmProxyValueField.h"
|
#include "cafPdmProxyValueField.h"
|
||||||
#include "cafPdmUiCheckBoxEditor.h"
|
#include "cafPdmUiCheckBoxEditor.h"
|
||||||
#include "cafPdmUiDateEditor.h"
|
#include "cafPdmUiDateEditor.h"
|
||||||
#include "cafPdmUiFieldEditorHandle.h"
|
#include "cafPdmUiFieldEditorHandle.h"
|
||||||
|
#include "cafPdmUiFilePathEditor.h"
|
||||||
#include "cafPdmUiLineEditor.h"
|
#include "cafPdmUiLineEditor.h"
|
||||||
#include "cafPdmUiListEditor.h"
|
#include "cafPdmUiListEditor.h"
|
||||||
|
|
||||||
@ -64,6 +66,8 @@ CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiListEditor, std::vector<int>);
|
|||||||
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiListEditor, std::vector<unsigned int>);
|
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiListEditor, std::vector<unsigned int>);
|
||||||
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiListEditor, std::vector<float>);
|
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiListEditor, std::vector<float>);
|
||||||
|
|
||||||
|
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiFilePathEditor, FilePath);
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user