SHAPER  9.12.0
Config_DataModelReader Class Reference

Class that reads data model definition XML for further processing in the XGUI_DataModel. More...

Inheritance diagram for Config_DataModelReader:
Inheritance graph

Public Member Functions

CONFIG_EXPORT Config_DataModelReader ()
 
CONFIG_EXPORT std::string rootType () const
 Returns name of type of tree items in root. More...
 
CONFIG_EXPORT size_t rootFoldersNumber () const
 Returns number of folders under root. More...
 
CONFIG_EXPORT std::string rootFolderName (int theId) const
 Returns name of the folder by its Id. More...
 
CONFIG_EXPORT std::string rootFolderType (int theId) const
 Returns data type in the folder by its Id. More...
 
CONFIG_EXPORT std::string rootFolderIcon (int theId) const
 Returns icon of a folder by its Id. More...
 
CONFIG_EXPORT int rootFolderId (std::string theType) const
 Returns id of a folder containing the given type. More...
 
CONFIG_EXPORT bool rootShowEmpty (int theId) const
 Returns true if the folder can be shown without items. More...
 
CONFIG_EXPORT std::string rootFolderFeatures (const std::string &theFolderName) const
 Returns list of features attached to folder with name theFolderName in sub-document. More...
 
CONFIG_EXPORT std::string subType () const
 Returns name of type of tree items in sub document. More...
 
CONFIG_EXPORT size_t subFoldersNumber () const
 Returns number of folders under sub document. More...
 
CONFIG_EXPORT std::string subFolderName (int theId) const
 Returns name of the folder by its Id. More...
 
CONFIG_EXPORT std::string subFolderType (int theId) const
 Returns data type in the folder by its Id. More...
 
CONFIG_EXPORT std::string subFolderIcon (int theId) const
 Returns icon of a folder by its Id. More...
 
CONFIG_EXPORT bool subShowEmpty (int theId) const
 Returns true if the folder can be shown without items. More...
 
CONFIG_EXPORT int subFolderId (std::string theType) const
 Returns id of a folder containing the given type. More...
 
CONFIG_EXPORT std::string subFolderFeatures (const std::string &theFolderName) const
 Returns list of features attached to folder with name theFolderName in sub-document. More...
 
CONFIG_EXPORT bool isAttachToResult () const
 Returns true if the sub-document data tree has to be attached to Part Result node Otherwise it has to be connected to Part feature node. More...
 
CONFIG_EXPORT void readAll ()
 
CONFIG_EXPORT xmlNodePtr findRoot (const std::string theDocumentPath="")
 
CONFIG_EXPORT const char * encoding () const
 

Static Public Member Functions

static CONFIG_EXPORT std::string resourcesConfigFile ()
 
static CONFIG_EXPORT std::string pluginConfigFile ()
 
static CONFIG_EXPORT std::string findConfigFile (const std::string theFileName, const int theFindIndex=0)
 Checks all possible paths to configuration file given Uses theFindIndex if several solutions can be found (this is the number of solution to find) More...
 

Protected Member Functions

virtual void processNode (xmlNodePtr theNode)
 Overloaded method. Defines how to process each node. More...
 
virtual void cleanup (xmlNodePtr aNode)
 
virtual bool processChildren (xmlNodePtr aNode)
 Defines which nodes should be processed recursively. Virtual. The default impl is to read all nodes. More...
 
void readRecursively (xmlNodePtr theParent)
 
xmlNodePtr node (void *theNode)
 void* -> xmlNodePtr More...
 
std::string getNodeName (xmlNodePtr theNode)
 Gets xml node name. More...
 
void storeAttribute (xmlNodePtr theNode, const char *theNodeAttribute, bool doClean=false)
 Stores an attribute in internal map for later use. More...
 
std::string restoreAttribute (xmlNodePtr theNode, const char *theNodeAttribute)
 Restores an attribute from internal map. More...
 
std::string restoreAttribute (const char *theNodeName, const char *theNodeAttribute)
 Restores an attribute from internal map. More...
 
bool cleanupAttribute (xmlNodePtr theNode, const char *theNodeAttribute)
 Cleanups attribute from cache. More...
 
bool cleanupAttribute (const char *theNodeName, const char *theNodeAttribute)
 Cleanups attribute from cache. More...
 

Protected Attributes

std::string myDocumentPath
 Path to the xml document. More...
 
xmlDocPtr myXmlDoc
 Root of the xml document. More...
 
std::string myRootFileName
 name of the root file More...
 
std::map< std::string, std::string > myCachedAttributes
 A map to store all parent's attributes. More...
 
bool isFromMemory
 

Detailed Description

Class that reads data model definition XML for further processing in the XGUI_DataModel.

Constructor & Destructor Documentation

◆ Config_DataModelReader()

Config_DataModelReader::Config_DataModelReader ( )

Constructor

Member Function Documentation

◆ rootType()

CONFIG_EXPORT std::string Config_DataModelReader::rootType ( ) const
inline

Returns name of type of tree items in root.

◆ rootFoldersNumber()

CONFIG_EXPORT size_t Config_DataModelReader::rootFoldersNumber ( ) const
inline

Returns number of folders under root.

◆ rootFolderName()

CONFIG_EXPORT std::string Config_DataModelReader::rootFolderName ( int  theId) const
inline

Returns name of the folder by its Id.

Parameters
theIdid of the folder

◆ rootFolderType()

CONFIG_EXPORT std::string Config_DataModelReader::rootFolderType ( int  theId) const
inline

Returns data type in the folder by its Id.

Parameters
theIdid of the folder

◆ rootFolderIcon()

CONFIG_EXPORT std::string Config_DataModelReader::rootFolderIcon ( int  theId) const
inline

Returns icon of a folder by its Id.

Parameters
theIdid of the folder

◆ rootFolderId()

int Config_DataModelReader::rootFolderId ( std::string  theType) const

Returns id of a folder containing the given type.

Parameters
theTypetype of objects in folder

◆ rootShowEmpty()

CONFIG_EXPORT bool Config_DataModelReader::rootShowEmpty ( int  theId) const
inline

Returns true if the folder can be shown without items.

Parameters
theIdid of the folder

◆ rootFolderFeatures()

std::string Config_DataModelReader::rootFolderFeatures ( const std::string &  theFolderName) const

Returns list of features attached to folder with name theFolderName in sub-document.

Parameters
theFolderNamea name of the folder

◆ subType()

CONFIG_EXPORT std::string Config_DataModelReader::subType ( ) const
inline

Returns name of type of tree items in sub document.

◆ subFoldersNumber()

CONFIG_EXPORT size_t Config_DataModelReader::subFoldersNumber ( ) const
inline

Returns number of folders under sub document.

◆ subFolderName()

CONFIG_EXPORT std::string Config_DataModelReader::subFolderName ( int  theId) const
inline

Returns name of the folder by its Id.

Parameters
theIdid of the folder

◆ subFolderType()

CONFIG_EXPORT std::string Config_DataModelReader::subFolderType ( int  theId) const
inline

Returns data type in the folder by its Id.

Parameters
theIdid of the folder

◆ subFolderIcon()

CONFIG_EXPORT std::string Config_DataModelReader::subFolderIcon ( int  theId) const
inline

Returns icon of a folder by its Id.

Parameters
theIdid of the folder

◆ subShowEmpty()

CONFIG_EXPORT bool Config_DataModelReader::subShowEmpty ( int  theId) const
inline

Returns true if the folder can be shown without items.

Parameters
theIdid of the folder

◆ subFolderId()

int Config_DataModelReader::subFolderId ( std::string  theType) const

Returns id of a folder containing the given type.

Parameters
theTypetype of objects in folder

◆ subFolderFeatures()

std::string Config_DataModelReader::subFolderFeatures ( const std::string &  theFolderName) const

Returns list of features attached to folder with name theFolderName in sub-document.

Parameters
theFolderNamea name of the folder

◆ isAttachToResult()

CONFIG_EXPORT bool Config_DataModelReader::isAttachToResult ( ) const
inline

Returns true if the sub-document data tree has to be attached to Part Result node Otherwise it has to be connected to Part feature node.

◆ processNode()

void Config_DataModelReader::processNode ( xmlNodePtr  theNode)
protectedvirtual

Overloaded method. Defines how to process each node.

Reimplemented from Config_XMLReader.

◆ resourcesConfigFile()

std::string Config_XMLReader::resourcesConfigFile ( )
staticinherited

Returns a path to resource files (created from ROOT_DIR environment variable)

Returns
string value

◆ pluginConfigFile()

std::string Config_XMLReader::pluginConfigFile ( )
staticinherited

Returns a path to the plugins.xml file (created from ROOT_DIR environment variable)

Returns
string value

◆ readAll()

void Config_XMLReader::readAll ( )
inherited

Read all nodes in associated xml file, recursively if processChildren(xmlNode) is true for the xmlNode. For each read node the processNode will be called.

◆ findRoot()

xmlNodePtr Config_XMLReader::findRoot ( const std::string  theDocumentPath = "")
inherited

Returns xmlNodePtr to the root of reader's document or NULL if not found. If the path to the document to read is empty, uses myDocumentPath.

◆ findConfigFile()

std::string Config_XMLReader::findConfigFile ( const std::string  theFileName,
const int  theFindIndex = 0 
)
staticinherited

Checks all possible paths to configuration file given Uses theFindIndex if several solutions can be found (this is the number of solution to find)

◆ cleanup()

void Config_XMLReader::cleanup ( xmlNodePtr  aNode)
protectedvirtualinherited

This method gives an ability to finalize processing of a node, when reader is about to leave the node (node and all it's children are processed)

Reimplemented in Config_ValidatorReader, and Config_FeatureReader.

◆ processChildren()

bool Config_XMLReader::processChildren ( xmlNodePtr  aNode)
protectedvirtualinherited

Defines which nodes should be processed recursively. Virtual. The default impl is to read all nodes.

Reimplemented in Config_WidgetReader, Config_ValidatorReader, Config_ModuleReader, and Config_FeatureReader.

◆ readRecursively()

void Config_XMLReader::readRecursively ( xmlNodePtr  theParent)
protectedinherited

Calls processNode() for each child (for some - recursively) of the given node.

See also
ReadAll()

◆ node()

xmlNodePtr Config_XMLReader::node ( void *  theNode)
protectedinherited

void* -> xmlNodePtr

◆ getNodeName()

std::string Config_XMLReader::getNodeName ( xmlNodePtr  theNode)
protectedinherited

Gets xml node name.

◆ storeAttribute()

void Config_XMLReader::storeAttribute ( xmlNodePtr  theNode,
const char *  theNodeAttribute,
bool  doClean = false 
)
protectedinherited

Stores an attribute in internal map for later use.

Key is "Node_Name:Node_Attribute" and value is getProperty(theNodeAttribute)

◆ restoreAttribute() [1/2]

std::string Config_XMLReader::restoreAttribute ( xmlNodePtr  theNode,
const char *  theNodeAttribute 
)
protectedinherited

Restores an attribute from internal map.

◆ restoreAttribute() [2/2]

std::string Config_XMLReader::restoreAttribute ( const char *  theNodeName,
const char *  theNodeAttribute 
)
protectedinherited

Restores an attribute from internal map.

◆ cleanupAttribute() [1/2]

bool Config_XMLReader::cleanupAttribute ( xmlNodePtr  theNode,
const char *  theNodeAttribute 
)
protectedinherited

Cleanups attribute from cache.

◆ cleanupAttribute() [2/2]

bool Config_XMLReader::cleanupAttribute ( const char *  theNodeName,
const char *  theNodeAttribute 
)
protectedinherited

Cleanups attribute from cache.

Field Documentation

◆ myDocumentPath

std::string Config_XMLReader::myDocumentPath
protectedinherited

Path to the xml document.

◆ myXmlDoc

xmlDocPtr Config_XMLReader::myXmlDoc
protectedinherited

Root of the xml document.

◆ myRootFileName

std::string Config_XMLReader::myRootFileName
protectedinherited

name of the root file

◆ myCachedAttributes

std::map<std::string, std::string> Config_XMLReader::myCachedAttributes
protectedinherited

A map to store all parent's attributes.

The key has from "Node_Name:Node_Attribute"