mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
CAF: expose inheritance stack and make sure we can alias class keywords
This commit is contained in:
parent
82cf721ae8
commit
83a7ceb204
@ -96,3 +96,28 @@ void PdmObject::childrenFromClassKeyword(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
caf::PdmObject::PdmObject() : PdmObjectHandle(), PdmXmlObjectHandle(this, false), PdmUiObjectHandle(this, false)
|
||||||
|
, m_scriptable(false)
|
||||||
|
{
|
||||||
|
registerClassKeyword(classKeywordStatic());
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
QString caf::PdmObject::classKeywordStatic()
|
||||||
|
{
|
||||||
|
return classKeywordAliases().front();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<QString> caf::PdmObject::classKeywordAliases()
|
||||||
|
{
|
||||||
|
return { QString("PdmObject") };
|
||||||
|
}
|
||||||
|
@ -85,7 +85,7 @@ class PdmObjectCapability;
|
|||||||
{ \
|
{ \
|
||||||
this->isInheritedFromPdmUiObject(); \
|
this->isInheritedFromPdmUiObject(); \
|
||||||
this->isInheritedFromPdmXmlSerializable(); \
|
this->isInheritedFromPdmXmlSerializable(); \
|
||||||
this->registerClassKeyword(classKeywordStatic()); \
|
this->registerClassKeyword(classKeyword()); \
|
||||||
\
|
\
|
||||||
static caf::PdmUiItemInfo objDescr(uiName, QString(iconResourceName), toolTip, whatsThis); \
|
static caf::PdmUiItemInfo objDescr(uiName, QString(iconResourceName), toolTip, whatsThis); \
|
||||||
this->setUiItemInfo(&objDescr); \
|
this->setUiItemInfo(&objDescr); \
|
||||||
@ -141,9 +141,12 @@ namespace caf
|
|||||||
class PdmObject : public PdmObjectHandle, public PdmXmlObjectHandle, public PdmUiObjectHandle
|
class PdmObject : public PdmObjectHandle, public PdmXmlObjectHandle, public PdmUiObjectHandle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PdmObject() : PdmObjectHandle(), PdmXmlObjectHandle(this, false), PdmUiObjectHandle(this, false) {}
|
PdmObject();
|
||||||
~PdmObject() override {}
|
~PdmObject() override {}
|
||||||
|
|
||||||
|
static QString classKeywordStatic();
|
||||||
|
static std::vector<QString> classKeywordAliases();
|
||||||
|
|
||||||
/// Adds field to the internal data structure and sets the file keyword and Ui information
|
/// Adds field to the internal data structure and sets the file keyword and Ui information
|
||||||
/// Consider this method private. Please use the CAF_PDM_InitField() macro instead
|
/// Consider this method private. Please use the CAF_PDM_InitField() macro instead
|
||||||
template< typename FieldDataType >
|
template< typename FieldDataType >
|
||||||
|
@ -299,6 +299,14 @@ bool PdmXmlObjectHandle::inheritsClassWithKeyword(const QString& testClassKeywor
|
|||||||
return std::find(m_classInheritanceStack.begin(), m_classInheritanceStack.end(), testClassKeyword) != m_classInheritanceStack.end();
|
return std::find(m_classInheritanceStack.begin(), m_classInheritanceStack.end(), testClassKeyword) != m_classInheritanceStack.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
const std::list<QString>& PdmXmlObjectHandle::classInheritanceStack() const
|
||||||
|
{
|
||||||
|
return m_classInheritanceStack;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -57,7 +57,9 @@ public:
|
|||||||
void setupBeforeSaveRecursively() { setupBeforeSaveRecursively(this->m_owner); };
|
void setupBeforeSaveRecursively() { setupBeforeSaveRecursively(this->m_owner); };
|
||||||
|
|
||||||
void resolveReferencesRecursively(std::vector<PdmFieldHandle*>* fieldWithFailingResolve = nullptr);
|
void resolveReferencesRecursively(std::vector<PdmFieldHandle*>* fieldWithFailingResolve = nullptr);
|
||||||
|
bool inheritsClassWithKeyword(const QString& testClassKeyword) const;
|
||||||
|
|
||||||
|
const std::list<QString>& classInheritanceStack() const;
|
||||||
protected: // Virtual
|
protected: // Virtual
|
||||||
/// Method gets called from PdmDocument after all objects are read.
|
/// Method gets called from PdmDocument after all objects are read.
|
||||||
/// Re-implement to set up internal pointers etc. in your data structure
|
/// Re-implement to set up internal pointers etc. in your data structure
|
||||||
@ -71,7 +73,6 @@ protected: // Virtual
|
|||||||
bool isInheritedFromPdmXmlSerializable() { return true; }
|
bool isInheritedFromPdmXmlSerializable() { return true; }
|
||||||
|
|
||||||
void registerClassKeyword(const QString& registerKeyword);
|
void registerClassKeyword(const QString& registerKeyword);
|
||||||
bool inheritsClassWithKeyword(const QString& testClassKeyword) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initAfterReadRecursively(PdmObjectHandle* object);
|
void initAfterReadRecursively(PdmObjectHandle* object);
|
||||||
|
Loading…
Reference in New Issue
Block a user