Envision
A visual programming IDE for object-oriented languages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
Model::CompositeNode Class Reference
Inheritance diagram for Model::CompositeNode:
Core::Reflect< Base >

Public Member Functions

 CompositeNode (const CompositeNode &other)
 
 CompositeNode (Node *parent, AttributeChain &metaData)
 
 CompositeNode (Node *parent, PersistentStore &store, bool partialHint)
 
 CompositeNode (Node *parent, PersistentStore &store, bool partialHint, AttributeChain &metaData)
 
 CompositeNode (Node *parent=nullptr)
 
virtual ~CompositeNode ()
 
virtual QList< Node * > children () const override
 
virtual CompositeNodeclone () const override
 
Nodecomment () const
 this is part of the expansion of the macro ATTRIBUTE(Model::Node, comment, setComment) but we can not include nodeMacros.h More...
 
template<typename ExtensionType >
std::unique_ptr< ExtensionType > extension ()
 
Nodeget (const CompositeIndex &attributeIndex) const
 
Nodeget (const QString &attributeName) const
 
QList< QPair< QString, Node * > > getAllAttributes (bool includeNullValues=false)
 
bool hasAttribute (const QString &attributeName)
 
CompositeIndex indexOf (const QString &nodeName) const
 
CompositeIndex indexOf (Node *node) const
 
virtual void load (PersistentStore &store) override
 
const AttributeChainmeta ()
 
void remove (const CompositeIndex &attributeIndex)
 Removes an optional node or replaces a non-optional child node with a default constructed node. More...
 
void remove (Node *childNode)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Removes an optional node or replaces a non-optional child node with a default constructed node. More...
 
void remove (QString childNodeName)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Removes an optional node or replaces a non-optional child node with a default constructed node. More...
 
virtual bool replaceChild (Node *child, Node *replacement) override
 
virtual void save (PersistentStore &store) const override
 
void set (const CompositeIndex &attributeIndex, Node *node)
 
void setComment (Node *node)
 this is part of the expansion of the macro ATTRIBUTE(Model::Node, comment, setComment) but we can not include nodeMacros.h More...
 
NodesetDefault (QString nodeName)
 Sets a child node to a newly constructed default node of the child's type and returns the new node. More...
 

Static Public Member Functions

static CompositeNodecreateDefaultInstance (Node *parent)
 
static AttributeChaingetMetaData ()
 
static int registerExtensionId ()
 
static CompositeIndex registerNewAttribute (const Attribute &attribute)
 
template<typename Extension >
static void registerNewExtension ()
 

Protected Member Functions

virtual AttributeChaintopLevelMeta ()
 

Static Protected Member Functions

static CompositeIndex registerNewAttribute (AttributeChain &metaData, const Attribute &attribute)
 
static CompositeIndex registerNewAttribute (AttributeChain &metaData, const QString &attributeName, const QString &attributeType, bool canBePartiallyLoaded, bool isOptional, bool isPersistent)
 

Private Member Functions

void checkOrCreateMandatoryAttributes (bool useUndoableAction)
 Checks that all mandatory atrributes are present and creates missing empty lists. More...
 
void removeAllNodes ()
 

Static Private Member Functions

static CompositeIndex addAttributeToInitialRegistrationList_ (CompositeIndex &index, const QString &attributeName, const QString &attributeType, bool canBePartiallyLoaded, bool isOptional, bool isPersistent)
 
static QList< QPair< CompositeIndex &, Attribute > > & attributesToRegisterAtInitialization_ ()
 

Private Attributes

AttributeChainmeta_
 
QVector< QVector< Node * > > subnodes_
 

Static Private Attributes

static bool AUTOMATICALLY_CREATE_MISSING_REQUIRED_ATTRIBUTES_ON_LOAD_ {true}
 Whether to throw an exception or simply create missing required attributes when loading. More...
 
static CompositeIndex commentIndex
 this is part of the expansion of the macro ATTRIBUTE(Model::Node, comment, setComment) but we can not include nodeMacros.h More...
 
static int nextExtensionId_ = 0
 

Additional Inherited Members

- Protected Types inherited from Core::Reflect< Base >
using Super = Reflect< Base >
 

Constructor & Destructor Documentation

◆ CompositeNode() [1/5]

Model::CompositeNode::CompositeNode ( Node parent,
AttributeChain metaData 
)

◆ CompositeNode() [2/5]

Model::CompositeNode::CompositeNode ( Node parent,
PersistentStore store,
bool  partialHint,
AttributeChain metaData 
)

◆ CompositeNode() [3/5]

Model::CompositeNode::CompositeNode ( Node parent = nullptr)

◆ CompositeNode() [4/5]

Model::CompositeNode::CompositeNode ( Node parent,
PersistentStore store,
bool  partialHint 
)

◆ CompositeNode() [5/5]

Model::CompositeNode::CompositeNode ( const CompositeNode other)

◆ ~CompositeNode()

Model::CompositeNode::~CompositeNode ( )
virtual

Member Function Documentation

◆ addAttributeToInitialRegistrationList_()

CompositeIndex Model::CompositeNode::addAttributeToInitialRegistrationList_ ( CompositeIndex index,
const QString &  attributeName,
const QString &  attributeType,
bool  canBePartiallyLoaded,
bool  isOptional,
bool  isPersistent 
)
staticprivate

◆ attributesToRegisterAtInitialization_()

QList< QPair< CompositeIndex &, Attribute > > & Model::CompositeNode::attributesToRegisterAtInitialization_ ( )
staticprivate

◆ checkOrCreateMandatoryAttributes()

void Model::CompositeNode::checkOrCreateMandatoryAttributes ( bool  useUndoableAction)
private

Checks that all mandatory atrributes are present and creates missing empty lists.

Only mandatory, missing lists are created as empty lists. If an mandatory attribute of a type other than a list is missing, this method throws an exception.

◆ children()

QList< Node * > Model::CompositeNode::children ( ) const
overridevirtual

◆ clone()

CompositeNode * Model::CompositeNode::clone ( ) const
overridevirtual

◆ comment()

Node * Model::CompositeNode::comment ( ) const
inline

this is part of the expansion of the macro ATTRIBUTE(Model::Node, comment, setComment) but we can not include nodeMacros.h

◆ createDefaultInstance()

CompositeNode * Model::CompositeNode::createDefaultInstance ( Node parent)
static

◆ extension()

template<typename ExtensionType >
std::unique_ptr< ExtensionType > Model::CompositeNode::extension

◆ get() [1/2]

Node * Model::CompositeNode::get ( const CompositeIndex attributeIndex) const
inline

◆ get() [2/2]

Node * Model::CompositeNode::get ( const QString &  attributeName) const

◆ getAllAttributes()

QList< QPair< QString, Node * > > Model::CompositeNode::getAllAttributes ( bool  includeNullValues = false)

◆ getMetaData()

AttributeChain & Model::CompositeNode::getMetaData ( )
static

◆ hasAttribute()

bool Model::CompositeNode::hasAttribute ( const QString &  attributeName)

◆ indexOf() [1/2]

CompositeIndex Model::CompositeNode::indexOf ( const QString &  nodeName) const

◆ indexOf() [2/2]

CompositeIndex Model::CompositeNode::indexOf ( Node node) const

◆ load()

void Model::CompositeNode::load ( PersistentStore store)
overridevirtual

◆ meta()

const AttributeChain & Model::CompositeNode::meta ( )
inline

◆ registerExtensionId()

int Model::CompositeNode::registerExtensionId ( )
inlinestatic

◆ registerNewAttribute() [1/3]

CompositeIndex Model::CompositeNode::registerNewAttribute ( AttributeChain metaData,
const Attribute attribute 
)
staticprotected

◆ registerNewAttribute() [2/3]

CompositeIndex Model::CompositeNode::registerNewAttribute ( AttributeChain metaData,
const QString &  attributeName,
const QString &  attributeType,
bool  canBePartiallyLoaded,
bool  isOptional,
bool  isPersistent 
)
staticprotected

◆ registerNewAttribute() [3/3]

CompositeIndex Model::CompositeNode::registerNewAttribute ( const Attribute attribute)
static

◆ registerNewExtension()

template<typename Extension >
void Model::CompositeNode::registerNewExtension
inlinestatic

◆ remove() [1/3]

void Model::CompositeNode::remove ( const CompositeIndex attributeIndex)

Removes an optional node or replaces a non-optional child node with a default constructed node.

The node is specified by the attributeIndex.

◆ remove() [2/3]

void Model::CompositeNode::remove ( Node childNode)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Removes an optional node or replaces a non-optional child node with a default constructed node.

The node removed is childNode. It must not be null.

◆ remove() [3/3]

void Model::CompositeNode::remove ( QString  childNodeName)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Removes an optional node or replaces a non-optional child node with a default constructed node.

The node removed has the name childNodeName. It must not be null.

◆ removeAllNodes()

void Model::CompositeNode::removeAllNodes ( )
private

◆ replaceChild()

bool Model::CompositeNode::replaceChild ( Node child,
Node replacement 
)
overridevirtual

◆ save()

void Model::CompositeNode::save ( PersistentStore store) const
overridevirtual

◆ set()

void Model::CompositeNode::set ( const CompositeIndex attributeIndex,
Node node 
)

◆ setComment()

void Model::CompositeNode::setComment ( Node node)
inline

this is part of the expansion of the macro ATTRIBUTE(Model::Node, comment, setComment) but we can not include nodeMacros.h

◆ setDefault()

Node * Model::CompositeNode::setDefault ( QString  nodeName)

Sets a child node to a newly constructed default node of the child's type and returns the new node.

◆ topLevelMeta()

AttributeChain & Model::CompositeNode::topLevelMeta ( )
protectedvirtual

Member Data Documentation

◆ AUTOMATICALLY_CREATE_MISSING_REQUIRED_ATTRIBUTES_ON_LOAD_

bool Model::CompositeNode::AUTOMATICALLY_CREATE_MISSING_REQUIRED_ATTRIBUTES_ON_LOAD_ {true}
staticprivate

Whether to throw an exception or simply create missing required attributes when loading.

Setting this to false might catch bugs, but will result in new versions being incompatible with old ones

◆ commentIndex

CompositeIndex Model::CompositeNode::commentIndex
staticprivate
Initial value:
=
addAttributeToInitialRegistrationList_(commentIndex, "comment", "Node", false, true, true)
static CompositeIndex commentIndex
this is part of the expansion of the macro ATTRIBUTE(Model::Node, comment, setComment) but we can not...
Definition: CompositeNode.h:192
static CompositeIndex addAttributeToInitialRegistrationList_(CompositeIndex &index, const QString &attributeName, const QString &attributeType, bool canBePartiallyLoaded, bool isOptional, bool isPersistent)
Definition: CompositeNode.cpp:187

this is part of the expansion of the macro ATTRIBUTE(Model::Node, comment, setComment) but we can not include nodeMacros.h

◆ meta_

AttributeChain& Model::CompositeNode::meta_
private

◆ nextExtensionId_

int Model::CompositeNode::nextExtensionId_ = 0
staticprivate

◆ subnodes_

QVector<QVector<Node*> > Model::CompositeNode::subnodes_
private