Envision
A visual programming IDE for object-oriented languages
|
Public Types | |
using | FileGetterFunction = std::function< bool(QString filename, const char *&data, int &dataLength)> |
Public Member Functions | |
SimpleTextFileStore (const QString &baseDir=QString()) | |
TODO the Envision folder should be taken from the environment not hardcoded. More... | |
SimpleTextFileStore (FileGetterFunction fileGetter) | |
SimpleTextFileStore (GenericTree *externalTree) | |
virtual | ~SimpleTextFileStore () |
virtual SimpleTextFileStore * | clone () const override |
virtual QString | currentNodeType () const override |
virtual bool | isLoadingPartially () const override |
virtual QList< Model::LoadedNode > | loadAllSubNodes (Model::Node *parent, const QSet< QString > &loadPartially) override |
virtual double | loadDoubleValue () override |
virtual int | loadIntValue () override |
virtual QString | loadReferenceValue (Model::Reference *r) override |
Returns a null string if the reference is resolved and a symbolic name if the reference is unresolved. More... | |
virtual QString | loadStringValue () override |
virtual Model::Node * | loadSubNode (Model::Node *parent, const QString &name, bool loadPartially) override |
virtual void | saveDoubleValue (double value) override |
virtual void | saveIntValue (int value) override |
virtual void | saveNode (const Model::Node *node, const QString &name) override |
virtual void | saveReferenceValue (const QString &name, const Model::Node *target) override |
virtual void | saveStringValue (const QString &value) override |
Methods from Persistent Store. More... | |
void | setBaseFolder (const QString &baseFolder) |
Public Member Functions inherited from Model::PersistentStore | |
virtual | ~PersistentStore () |
Static Public Member Functions | |
static void | saveGenericTree (std::shared_ptr< GenericTree > tree, const QString &name, const QString &destDir, const QStringList &persistentUnitTypes) |
static void | setForceSinglePersistentUnit () |
Protected Member Functions | |
virtual Model::Node * | loadTree (Model::TreeManager *manager, const QString &name, bool loadPartially) override |
virtual void | saveTree (Model::TreeManager *manager, const QString &name) override |
Protected Member Functions inherited from Model::PersistentStore | |
void | setReferenceTargetr (Reference *r, Node *target) |
Private Member Functions | |
void | checkIsWorking () const |
QString | getPersistenceUnitName (const Model::Node *node) |
Returns the name of the persistent unit that corresponds to the specified node. More... | |
Model::LoadedNode | loadNewPersistenceUnit (const QString &name, Model::Node *parent, QString relativeFilePath, bool loadPartially) |
Model::LoadedNode | loadNode (Model::Node *parent, bool loadPartially) |
void | saveNewPersistenceUnit (const Model::Node *node, const QString &name) |
void | saveNodeDirectly (const Model::Node *node, const QString &name) |
Static Private Member Functions | |
static QString | relativeDirectoryPathForPersistenceUnit (const Model::Node *node) |
Returns the relative directory path to a persistent unit. More... | |
static QList< GenericNode * > | writeGenericNodeToFile (GenericNode *node, const QString &destDir, const QString &fileName, const QStringList &persistentUnitTypes) |
Private Attributes | |
QDir | baseFolder_ |
The folder where all trees are stored. More... | |
GenericTree * | externalTree_ {} |
If the tree is external, only loading is supported and the tree will not be deleted. More... | |
FileGetterFunction | fileGetter_ {} |
If specified, this function will be used to get the data of the files. More... | |
GenericNode * | genericNode_ {} |
GenericTree * | genericTree_ {} |
std::set< QString > | newFiles_ |
std::set< QString > | oldFiles_ |
bool | partiallyLoadingATree_ {} |
QMutex | storeAccess_ |
A mutex that assures exclusive tree saving and loading operations. More... | |
QStack< QDir > | treeDirs_ |
This is a stack of the the folder where the current tree is being saved to or loaded from. More... | |
Model::TreeManager * | treeManager_ {} |
The manager that requested the last load/save operation. More... | |
QList< QPair< Model::Reference *, QString > > | uninitializedReferences_ |
This is a list of all references which have been constructed and which have a target that is not yet set. More... | |
bool | working_ {} |
A flag that indicates if the store is currently in the middle of saving or loading a tree. More... | |
Static Private Attributes | |
static bool | ForceSinglePersistentUnit {false} |
If true, only a single persistent unit will be generated. More... | |
static const QString | NULL_STRING {"____NULL____"} |
using FilePersistence::SimpleTextFileStore::FileGetterFunction = std::function<bool (QString filename, const char*& data, int& dataLength)> |
FilePersistence::SimpleTextFileStore::SimpleTextFileStore | ( | const QString & | baseDir = QString() | ) |
TODO the Envision folder should be taken from the environment not hardcoded.
FilePersistence::SimpleTextFileStore::SimpleTextFileStore | ( | FileGetterFunction | fileGetter | ) |
FilePersistence::SimpleTextFileStore::SimpleTextFileStore | ( | GenericTree * | externalTree | ) |
|
virtual |
|
private |
|
overridevirtual |
Implements Model::PersistentStore.
|
overridevirtual |
Implements Model::PersistentStore.
|
private |
Returns the name of the persistent unit that corresponds to the specified node.
|
overridevirtual |
Implements Model::PersistentStore.
|
overridevirtual |
Implements Model::PersistentStore.
|
overridevirtual |
Implements Model::PersistentStore.
|
overridevirtual |
Implements Model::PersistentStore.
|
private |
|
private |
|
overridevirtual |
Returns a null string if the reference is resolved and a symbolic name if the reference is unresolved.
After the target of the reference exists in memory, the reference will be updated to point to the correct target.
Implements Model::PersistentStore.
|
overridevirtual |
Implements Model::PersistentStore.
|
overridevirtual |
Implements Model::PersistentStore.
|
overrideprotectedvirtual |
Implements Model::PersistentStore.
|
staticprivate |
Returns the relative directory path to a persistent unit.
|
overridevirtual |
Implements Model::PersistentStore.
|
static |
|
overridevirtual |
Implements Model::PersistentStore.
|
private |
|
overridevirtual |
Implements Model::PersistentStore.
|
private |
|
overridevirtual |
Implements Model::PersistentStore.
|
overridevirtual |
Methods from Persistent Store.
Implements Model::PersistentStore.
|
overrideprotectedvirtual |
Implements Model::PersistentStore.
void FilePersistence::SimpleTextFileStore::setBaseFolder | ( | const QString & | baseFolder | ) |
|
inlinestatic |
|
staticprivate |
|
private |
The folder where all trees are stored.
Each tree is a separate sub folder in the base folder.
|
private |
If the tree is external, only loading is supported and the tree will not be deleted.
|
private |
If specified, this function will be used to get the data of the files.
Only used for loading.
|
staticprivate |
If true, only a single persistent unit will be generated.
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
A mutex that assures exclusive tree saving and loading operations.
|
private |
This is a stack of the the folder where the current tree is being saved to or loaded from.
This is only valid if working is true.
|
private |
The manager that requested the last load/save operation.
|
private |
This is a list of all references which have been constructed and which have a target that is not yet set.
The second part of the pair is the target id.
|
private |
A flag that indicates if the store is currently in the middle of saving or loading a tree.