mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 14:40:26 -05:00
Framework changes to prepare for ensemble file set
This commit is contained in:
1 parent
14ddd373d3
commit
fc6d9fb38d
4 files changed
+24
-3
No files matched your search
@@ -139,6 +139,14 @@ QString PdmDocument::documentAsString()
|
||||
return content;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
const caf::PdmFieldHandle* PdmDocument::fileNameHandle() const
|
||||
{
|
||||
return dynamic_cast<const caf::PdmFieldHandle*>( &m_fileName );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -63,7 +63,8 @@ public:
|
||||
static void updateUiIconStateRecursively( PdmObjectHandle* root );
|
||||
|
||||
protected:
|
||||
QString documentAsString();
|
||||
QString documentAsString();
|
||||
const PdmFieldHandle* fileNameHandle() const;
|
||||
|
||||
private:
|
||||
void writeDocumentToXmlStream( QXmlStreamWriter& xmlStream );
|
||||
|
||||
@@ -136,8 +136,7 @@ void PdmXmlObjectHandle::readFields( QXmlStreamReader& xmlStream, PdmObjectFacto
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void PdmXmlObjectHandle::writeFields( QXmlStreamWriter& xmlStream ) const
|
||||
{
|
||||
std::vector<PdmFieldHandle*> fields = m_owner->fields();
|
||||
for ( const auto& fieldHandle : fields )
|
||||
for ( const auto& fieldHandle : fieldsForExport() )
|
||||
{
|
||||
const PdmXmlFieldHandle* field = fieldHandle->xmlCapability();
|
||||
if ( field && field->isIOWritable() )
|
||||
@@ -311,6 +310,16 @@ bool PdmXmlObjectHandle::isValidXmlElementName( const QString& name )
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<caf::PdmFieldHandle*> PdmXmlObjectHandle::fieldsForExport() const
|
||||
{
|
||||
if ( !m_owner ) return {};
|
||||
|
||||
return m_owner->fields();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -70,6 +70,9 @@ protected: // Virtual
|
||||
/// Re-implement to make sure your fields have correct data before saving
|
||||
virtual void setupBeforeSave() {};
|
||||
|
||||
/// Override this method if you need to exclude or reorder fields for export to XML
|
||||
[[nodiscard]] virtual std::vector<PdmFieldHandle*> fieldsForExport() const;
|
||||
|
||||
/// This method is intended to be used in macros to make compile time errors
|
||||
// if user uses them on wrong type of objects
|
||||
bool isInheritedFromPdmXmlSerializable() { return true; }
|
||||
|
||||
Reference in new issue
Block a user