Envision
A visual programming IDE for object-oriented languages
List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
FilePersistence::GenericPersistentUnit Class Reference

Public Member Functions

 GenericPersistentUnit (const GenericPersistentUnit &other)=delete
 
 ~GenericPersistentUnit ()
 
QString extractRootNodeIDFromName () const
 
const QString & name () const
 
GenericNodenewNode ()
 
GenericNodenewNode (const char *data, int dataLength)
 
GenericNodenewNode (const GenericNode *nodeToCopy, bool force=false, bool deepCopy=false)
 If force is true then no check for ID uniqueness is performed. More...
 
GenericNodenewNode (int lineStart, int lineEndEnclusive)
 
GenericNodenewNode (Model::NodeIdType id, Model::NodeIdType parentId, const QString &label, const QString &type, const QString &value, GenericNode::ValueType valueType)
 Creates and returns a new node, with the corresponding attributes. More...
 
QPair< bool, GenericNode * > newOrExistingNode (const char *data, int dataLength)
 Returns the node according to data. More...
 
GenericNodenodeWithNullParent () const
 Returns the node that has no parent (parent is {000...}). More...
 
const char * setData (const char *data, int dataSize)
 Copies the provided data to be used for initializing child GenericNode elements. More...
 
GenericTreetree () const
 
GenericNodeunitRootNode () const
 Returns the root node for this persistence unit under the assumption that all nodes in this unit have been loaded. More...
 

Private Member Functions

 GenericPersistentUnit (GenericTree *tree, QString name, char *data=nullptr, int dataSize=0)
 
GenericNodenextNode ()
 
void releaseLastNode ()
 

Private Attributes

QList< GenericNode * > chunks_
 
char * data_ {}
 
int dataSize_ {}
 
int lastNodeIndexInLastChunk_ {}
 
QString name_
 
GenericTreetree_ {}
 

Friends

class GenericTree
 
class PiecewiseLoader
 

Constructor & Destructor Documentation

◆ ~GenericPersistentUnit()

FilePersistence::GenericPersistentUnit::~GenericPersistentUnit ( )

◆ GenericPersistentUnit() [1/2]

FilePersistence::GenericPersistentUnit::GenericPersistentUnit ( const GenericPersistentUnit other)
delete

◆ GenericPersistentUnit() [2/2]

FilePersistence::GenericPersistentUnit::GenericPersistentUnit ( GenericTree tree,
QString  name,
char *  data = nullptr,
int  dataSize = 0 
)
private

Member Function Documentation

◆ extractRootNodeIDFromName()

QString FilePersistence::GenericPersistentUnit::extractRootNodeIDFromName ( ) const

◆ name()

const QString & FilePersistence::GenericPersistentUnit::name ( ) const
inline

◆ newNode() [1/5]

GenericNode * FilePersistence::GenericPersistentUnit::newNode ( )

◆ newNode() [2/5]

GenericNode * FilePersistence::GenericPersistentUnit::newNode ( const char *  data,
int  dataLength 
)

◆ newNode() [3/5]

GenericNode * FilePersistence::GenericPersistentUnit::newNode ( const GenericNode nodeToCopy,
bool  force = false,
bool  deepCopy = false 
)

If force is true then no check for ID uniqueness is performed.

◆ newNode() [4/5]

GenericNode * FilePersistence::GenericPersistentUnit::newNode ( int  lineStart,
int  lineEndEnclusive 
)

◆ newNode() [5/5]

GenericNode * FilePersistence::GenericPersistentUnit::newNode ( Model::NodeIdType  id,
Model::NodeIdType  parentId,
const QString &  label,
const QString &  type,
const QString &  value,
GenericNode::ValueType  valueType 
)

Creates and returns a new node, with the corresponding attributes.

This method checks that a node with the same ID does not already exist.

◆ newOrExistingNode()

QPair< bool, GenericNode * > FilePersistence::GenericPersistentUnit::newOrExistingNode ( const char *  data,
int  dataLength 
)

Returns the node according to data.

If the boolean return value is true, the node was newly created and needs to be linked; Otherwise such a node already exists in the tree and that node is returned. In this case the node does not need to be linked.

◆ nextNode()

GenericNode * FilePersistence::GenericPersistentUnit::nextNode ( )
private

◆ nodeWithNullParent()

GenericNode * FilePersistence::GenericPersistentUnit::nodeWithNullParent ( ) const

Returns the node that has no parent (parent is {000...}).

This is typically the root node of the tree.

◆ releaseLastNode()

void FilePersistence::GenericPersistentUnit::releaseLastNode ( )
private

◆ setData()

const char * FilePersistence::GenericPersistentUnit::setData ( const char *  data,
int  dataSize 
)

Copies the provided data to be used for initializing child GenericNode elements.

The copy will be destroyed with the object.

Returns a pointer to the copied data.

◆ tree()

GenericTree * FilePersistence::GenericPersistentUnit::tree ( ) const
inline

◆ unitRootNode()

GenericNode * FilePersistence::GenericPersistentUnit::unitRootNode ( ) const

Returns the root node for this persistence unit under the assumption that all nodes in this unit have been loaded.

Friends And Related Function Documentation

◆ GenericTree

friend class GenericTree
friend

◆ PiecewiseLoader

friend class PiecewiseLoader
friend

Member Data Documentation

◆ chunks_

QList<GenericNode*> FilePersistence::GenericPersistentUnit::chunks_
private

◆ data_

char* FilePersistence::GenericPersistentUnit::data_ {}
private

◆ dataSize_

int FilePersistence::GenericPersistentUnit::dataSize_ {}
private

◆ lastNodeIndexInLastChunk_

int FilePersistence::GenericPersistentUnit::lastNodeIndexInLastChunk_ {}
private

◆ name_

QString FilePersistence::GenericPersistentUnit::name_
private

◆ tree_

GenericTree* FilePersistence::GenericPersistentUnit::tree_ {}
private