![]() |
VR-Forces 5.0.3 Developer's Guide
|
Represent an earth file and functionalities to update the file.
Classes | |
| class | XmlElementKey |
Public Types | |
| typedef std::vector < osgEarth::Util::XmlText * > | XmlTextList |
| typedef std::vector < DtOsgEarthFile * > | ExternalFileList |
Public Member Functions | |
| DtOsgEarthFile (const DtUnicode &fileName) | |
| virtual | ~DtOsgEarthFile () |
| void | load () |
| void | parseTextAndElements () |
| void | update (const XmlElementKey &key, const osgEarth::Config &config) |
| void | updateName (const XmlElementKey &key, const std::string &newName) |
| void | modify (const XmlElementKey &key, const osgEarth::Config &config) |
| void | add (const XmlElementKey &key, const osgEarth::Config &config) |
| void | remove (const XmlElementKey &key) |
| void | move (const XmlElementKey &key, int newIndex) |
| void | addTextNode (const XmlElementKey &key, const std::string &text) |
| osgEarth::Util::XmlElement * | findChildElement (osgEarth::Util::XmlElement *element, const XmlElementKey &key) |
| osgEarth::Util::XmlElement * | findParentElement (osgEarth::Util::XmlElement *element, const XmlElementKey &key) |
| void | updateConfig (size_t startPos, osgEarth::Util::XmlElement *element, const osgEarth::Config &config) |
| void | modifyConfig (size_t startPos, osgEarth::Util::XmlElement *element, const osgEarth::Config &config) |
| void | updateXmlText (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &text) |
| osgEarth::Util::XmlText * | findXmlTextNode (osgEarth::Util::XmlElement *element) |
| void | modifyTextNode (osgEarth::XmlElement *element, const std::string &text) |
| std::set< std::string > | getUniqueChildKeysOfConfig (const osgEarth::Config &config) const |
| std::set< std::string > | getUniqueChildKeysOfElement (const osgEarth::Util::XmlElement *element) const |
| std::string | findNameOfConfig (const osgEarth::Config &config) |
| virtual bool | checkExternalReference (const std::string &text) |
| virtual bool | findUrl (const std::string &text, std::string &url) |
| virtual void | parseExternalReference (const std::string &text) |
| DtUnicode | fileName () const |
| const ExternalFileList & | externalFileList () const |
| virtual const DtOsgEarthFile * | findOsgEarthFileByFileName (const DtUnicode &fileName) const |
| std::vector< std::pair < std::string, std::string > > | getXmlElementNodes () const |
| virtual XmlElementKey | getXmlElementKey (const osgEarth::XmlElement *parent, const osgEarth::XmlElement *element) const |
| virtual osgEarth::XmlElement * | root () |
| virtual bool | findXmlElementKey (const std::string &type, const std::string &name, DtOsgEarthFile::XmlElementKey &key) const |
| virtual bool | findXmlElementKey (osgEarth::Util::XmlElement *element, const std::string &type, const std::string &name, DtOsgEarthFile::XmlElementKey &key, int currentDepth=0, int maxDepth=2) const |
| virtual void | setFileName (const DtUnicode &fileName) |
| virtual void | save () |
| virtual void | save (const DtUnicode &fileName) |
| virtual std::string | getXmlElementType (const osgEarth::Util::XmlElement *element) const |
| virtual int | getXmlElementIndex (const osgEarth::Util::XmlElement *parent, const osgEarth::Util::XmlElement *element) const |
| virtual std::string | getXmlElementName (const osgEarth::Util::XmlElement *element) const |
| DtOsgEarthFile * | findOsgEarthFile (const std::string &type, const std::string &name) |
Protected Member Functions | |
| virtual void | processXmlNode (const osgEarth::Util::XmlNode *node) |
| virtual void | processXmlElement (const osgEarth::Util::XmlElement *element) |
| virtual void | processXmlText (const osgEarth::Util::XmlText *text) |
| void | addOrModifyConfig (size_t startPos, osgEarth::XmlElement *element, const osgEarth::Config &config, int index) |
| void | addOrModifySimpleConfig (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &key, const std::string &value, int index) |
| void | addOrModifyNonSimpleConfig (size_t startPos, osgEarth::Util::XmlElement *element, const osgEarth::Config &config, int index) |
| virtual bool | modifyXmlAttribute (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &key, const std::string &newValue) |
| virtual bool | removeXmlAttribute (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &key) |
| virtual bool | removeXmlElement (size_t startPos, osgEarth::Util::XmlElement *parent, const std::string &key, int index) |
| virtual bool | moveXmlElement (size_t startPos, osgEarth::Util::XmlElement *parent, const std::string &key, int index, int newIndex) |
| virtual bool | modifyXmlSimpleElement (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &key, const std::string &newValue, int index) |
| virtual bool | addXmlAttribute (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &key, const std::string &newValue) |
| virtual bool | addXmlSimpleElement (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &key, const std::string &newValue, int index) |
| virtual bool | addXmlNonSimpleElement (size_t startPos, osgEarth::Util::XmlElement *element, const osgEarth::Config &config, int index) |
| virtual bool | addXmlTextNode (size_t startPos, osgEarth::Util::XmlElement *element, const std::string &text) |
| virtual std::string | getConfigString (const osgEarth::Config &config) |
| virtual std::string | getXmlAttributeString (const std::string &key, const std::string &value) |
| virtual std::string | getSimpleConfigString (const std::string &key, const std::string &value) |
| virtual void | updateAttribute (osgEarth::Util::XmlElement *element, const std::string &key, const std::string &newValue) |
| virtual void | removeAttribute (osgEarth::Util::XmlElement *element, const std::string &key) |
| virtual void | removeElement (osgEarth::Util::XmlElement *element, const std::string &key, int index) |
| virtual void | updateSimpleElement (osgEarth::Util::XmlElement *element, const std::string &key, const std::string &newValue, int index) |
| virtual void | addAttribute (osgEarth::Util::XmlElement *element, const std::string &key, const std::string &value) |
| virtual void | addSimpleElement (osgEarth::Util::XmlElement *element, const std::string &key, const std::string &newValue) |
| virtual void | addNonSimpleElement (osgEarth::Util::XmlElement *element, osgEarth::Util::XmlElement *child) |
| virtual void | addTextNode (osgEarth::Util::XmlElement *element, const std::string &text) |
| virtual bool | hasAttribute (const osgEarth::Util::XmlElement *element, const std::string &key) |
| virtual osgEarth::XmlElement * | findSubElement (const osgEarth::Util::XmlElement *element, const std::string &key, int index) |
| virtual int | findSubElementMaximumIndex (const osgEarth::XmlElement *element, const std::string &key) |
| virtual bool | hasChild (const osgEarth::Config &config, const std::string &key, int index) |
| virtual size_t | findStartPos (size_t startPos, const osgEarth::Util::XmlElement *element, const XmlElementKey &key) |
| virtual std::string | getElementStartPattern (const std::string &key) const |
| virtual std::string | getElementEndPattern (const osgEarth::Util::XmlElement *element) const |
| virtual std::string | getElementEndPattern (const std::string &key) const |
| virtual std::string | getAttributeStartPattern (const std::string &key) const |
| virtual bool | getAttributeValue (size_t startPos, size_t endPos, const std::string &key, std::string &value) const |
| virtual bool | getElementValue (size_t startPos, size_t endPos, const std::string &key, std::string &value) const |
| std::string | formatValue (const std::string &value) const |
| virtual bool | isReservedKeyWord (const std::string &key) const |
| virtual bool | ifElementHasChild (osgEarth::Util::XmlElement *root, const std::string &type, const std::string &name, int currentDepth=0, int maxDepth=2) |
Protected Attributes | |
| osgEarth::Util::XmlElement * | myRoot |
| ExternalFileList | myExternalFileList |
| std::string | myModifiedText |
| std::string | myOriginalText |
| DtUnicode | myFileName |
Private Member Functions | |
| DtOsgEarthFile () | |
| DtOsgEarthFile (const DtOsgEarthFile &) | |
| DtOsgEarthFile & | operator= (const DtOsgEarthFile &) |
| typedef std::vector<osgEarth::Util::XmlText*> makVrv::DtOsgEarthFile::XmlTextList |
| typedef std::vector<DtOsgEarthFile*> makVrv::DtOsgEarthFile::ExternalFileList |
| makVrv::DtOsgEarthFile::DtOsgEarthFile | ( | const DtUnicode & | fileName | ) |
The default constructor.
| fileName | The file name of the earth file. |
|
virtual |
Destructor.
|
private |
Private default constructor not implimented.
|
private |
Copy Constructor not implemented – Copy not allowed.
| void makVrv::DtOsgEarthFile::load | ( | ) |
Loads the earth file and parse the elements.
| void makVrv::DtOsgEarthFile::parseTextAndElements | ( | ) |
Parse the elements and text nodes in the earth file.
| void makVrv::DtOsgEarthFile::update | ( | const XmlElementKey & | key, |
| const osgEarth::Config & | config | ||
| ) |
Updates an element in the earth file with the given config option.
| key | The key of the element. |
| config | The config used to update the element, must have the same key type. |
| void makVrv::DtOsgEarthFile::updateName | ( | const XmlElementKey & | key, |
| const std::string & | newName | ||
| ) |
Updates the name attribute in the config option.
| void makVrv::DtOsgEarthFile::modify | ( | const XmlElementKey & | key, |
| const osgEarth::Config & | config | ||
| ) |
| void makVrv::DtOsgEarthFile::add | ( | const XmlElementKey & | key, |
| const osgEarth::Config & | config | ||
| ) |
Adds a config under the element specified by the key.
| key | The key of the element. |
| config | The config to add. |
| void makVrv::DtOsgEarthFile::remove | ( | const XmlElementKey & | key | ) |
Removes an element specified by the key.
| void makVrv::DtOsgEarthFile::move | ( | const XmlElementKey & | key, |
| int | newIndex | ||
| ) |
Moves an element specified by the key to the new index.
| void makVrv::DtOsgEarthFile::addTextNode | ( | const XmlElementKey & | key, |
| const std::string & | text | ||
| ) |
Adds a text node under the element specified by the key.
| osgEarth::Util::XmlElement* makVrv::DtOsgEarthFile::findChildElement | ( | osgEarth::Util::XmlElement * | element, |
| const XmlElementKey & | key | ||
| ) |
Finds the child element with the given key.
| element | The parent element. |
| key | The key of child element. |
| osgEarth::Util::XmlElement* makVrv::DtOsgEarthFile::findParentElement | ( | osgEarth::Util::XmlElement * | element, |
| const XmlElementKey & | key | ||
| ) |
Finds the direct parent element with the given key.
| element | The top level parent element. |
| key | The key of child element. |
| void makVrv::DtOsgEarthFile::updateConfig | ( | size_t | startPos, |
| osgEarth::Util::XmlElement * | element, | ||
| const osgEarth::Config & | config | ||
| ) |
Updates the element with the config.
| startPos | The start string location to search for the element in the earth file. |
| element | The element to update. |
| config | The config used to update. |
| void makVrv::DtOsgEarthFile::modifyConfig | ( | size_t | startPos, |
| osgEarth::Util::XmlElement * | element, | ||
| const osgEarth::Config & | config | ||
| ) |
| void makVrv::DtOsgEarthFile::updateXmlText | ( | size_t | startPos, |
| osgEarth::Util::XmlElement * | element, | ||
| const std::string & | text | ||
| ) |
Updates the text node in the element.
| startPos | The start string location to search for the element in the earth file. Usually the the start position of the parent config. |
| element | The element to update. |
| text | The text to update. |
| osgEarth::Util::XmlText* makVrv::DtOsgEarthFile::findXmlTextNode | ( | osgEarth::Util::XmlElement * | element | ) |
Finds the text node child of the element if any.
| element | The parent element of the text node if any. |
| void makVrv::DtOsgEarthFile::modifyTextNode | ( | osgEarth::XmlElement * | element, |
| const std::string & | text | ||
| ) |
Modified the first text node found under element.
| element | The parent element of the textn node. |
| std::set<std::string> makVrv::DtOsgEarthFile::getUniqueChildKeysOfConfig | ( | const osgEarth::Config & | config | ) | const |
Gets a list of unique keys of the children under the config.
| std::set<std::string> makVrv::DtOsgEarthFile::getUniqueChildKeysOfElement | ( | const osgEarth::Util::XmlElement * | element | ) | const |
Gets a list of unique keys of the children under the element.
| std::string makVrv::DtOsgEarthFile::findNameOfConfig | ( | const osgEarth::Config & | config | ) |
Finds the name attribute of the config.
| config | The config to find. |
|
virtual |
Check if the string contains any external files.
|
virtual |
Finds the url contained in the string.
| text | The string to search for url. |
|
virtual |
Parses the external include file from a string.
| DtUnicode makVrv::DtOsgEarthFile::fileName | ( | ) | const |
Gets the file name of this earth file.
| const ExternalFileList& makVrv::DtOsgEarthFile::externalFileList | ( | ) | const |
Gets the list of external files in this earth file.
|
virtual |
Finds the earth file with the file name.
| std::vector< std::pair<std::string, std::string> > makVrv::DtOsgEarthFile::getXmlElementNodes | ( | ) | const |
Finds all the elements in this earth file.
|
virtual |
Gets the key of the element.
| parent | The parent of element. |
| element | The element. |
|
virtual |
Gets the root node of the earth file.
|
virtual |
Checks if the file contains the element with the given type and name.
| type | The type of the element. |
| name | The name of the element. |
|
virtual |
Recursively finds the element with the given type and name. Constrain max recursive depth to save performance.
| element | The root element to start searching. |
| type | The type of the element. |
| name | The name of the element. |
| currentDepth | The current depth of the recursion. |
| maxDepth | The max depth of the recursion, recurstion stops at this level. |
|
virtual |
Sets the directory of the file.
|
virtual |
Saves the content of this earth file.
|
virtual |
Saves the content of this earth file to the directory specified.
|
virtual |
Gets the type of the element.
|
virtual |
Gets the index of the element under its parent.
| parent | The parent element. |
| element | The element. |
|
virtual |
Gets the name attribute of the element if any.
| DtOsgEarthFile* makVrv::DtOsgEarthFile::findOsgEarthFile | ( | const std::string & | type, |
| const std::string & | name | ||
| ) |
Finds the earth file that contains element with the given type and name.
|
protectedvirtual |
Processes the XmlNode, used to find the external reference file.
|
protectedvirtual |
Processes the XmlElement, used to find the external reference file.
|
protectedvirtual |
Processes the XmlText, used to find the external reference file.
|
protected |
Adds or modifies an element with the given config.
| startPos | The start string location to search for the element in the earth file. Usually the start position of the parent config. |
| element | The element to modify. |
| config | The config used to update the element. |
| index | The index of the config. |
|
protected |
Adds or modifies an element with a simple config(config with no children).
| startPos | The start string location to search for the element in the earth file. Usually the start position of the parent config. |
| element | The element to modify. |
| key | The key of the config. |
| value | The value of the config. |
| index | The index of the config. |
|
protected |
Adds or modifies an element with a non simple config(at least one child).
| startPos | The start string location to search for the element in the earth file. Usually the start position of the parent config. |
| element | The element to modify. |
| config | The config used to update the element. |
| index | The index of the config. |
|
protectedvirtual |
Modifies the attribute of an element.
| startPos | The start string location to search for the element in the earth file. Usually the start position of the parent config. |
| element | The element whose attribute to modify. |
| key | The key of the attribute. |
| newValue | The new value of the attribute. |
|
protectedvirtual |
Removes the attribute of an element.
| startPos | The start string location to search for the element in the earth file. Usually the start position of the parent config. |
| element | The element whose attribute to remove. |
| key | The key of the attribute. |
|
protectedvirtual |
Removes the child element of an element.
| startPos | The start string location to search for the element in the earth file. Usually the start position of the parent config. |
| element | The element whose child element to remove. |
| key | The key of the child element. |
| index | The index of the child element. |
|
protectedvirtual |
Moves the child element of an element to a new position.
| startPos | The start string location to search for the element in the earth file. Usually the start position of the parent config. |
| element | The element whose child element to move. |
| key | The key of the child element. |
| index | The index of the child element. |
| index | The new index of the child element. |
|
protectedvirtual |
Modified the child simple element(config with no children) of an element.
| startPos | The start string location to search for the element in the earth file. Usually the start position of the parent config. |
| element | The element whose child element to modify. |
| key | The key of the child element. |
| newValue | The new value of the simple element. |
| index | The index of the child element. |
|
protectedvirtual |
Addes an attribute to the element.
| startPos | The start string location to search for the element in the earth file. Usually the start position of the parent config. |
| element | The element to add attribute. |
| key | The key of the attribute. |
| newValue | The new value of the simple element. |
|
protectedvirtual |
Addes a simple config(element with no children) to the element.
| startPos | The start string location to search for the element in the earth file. Usually the start position of the parent config. |
| element | The element to add a child simple config(config with no children). |
| key | The key of the attribute. |
| newValue | The new value of the simple element. |
|
protectedvirtual |
Adds a non simple config(element has at least 1 child) to the element.
| startPos | The start string location to search for the element in the earth file. Usually the start position of the parent config. |
| element | The element to add a non simple config(config has at least 1 child). |
| key | The key of the attribute. |
| index | The index of the child element. |
|
protectedvirtual |
Adds a text node to the element.
| startPos | The start string location to search for the element in the earth file. Usually the start position of the parent config. |
| element | The element to add a non simple config(config has at least 1 child). |
| text | The content of the text node. |
|
protectedvirtual |
Serialize the config to a string.
| config | The config to serialize. |
|
protectedvirtual |
Serialize the attribute to a string.
| key | The key of the attribute. |
| value | The value of the attribute. |
|
protectedvirtual |
Serialize the simple config(config with no children) to a string.
| key | The key of the config. |
| value | The value of the config. |
|
protectedvirtual |
Updates the attribute of a xml element.
| element | The parent element. |
| key | The key of the attribute. |
| newValue | The new value of the attribute. |
|
protectedvirtual |
Removes the attribute of a xml element.
| element | The parent element. |
| key | The key of the attribute. |
| newValue | The new value of the attribute. |
|
protectedvirtual |
Removes an element with the given key and index.
| element | The parent element. |
| key | The key of the element. |
| index | The index of the element. |
|
protectedvirtual |
Updates the simple element(element with no children).
| element | The parent element. |
| key | The key of the element. |
| newValue | The new value of the element. |
| index | The index of the element. |
|
protectedvirtual |
Adds an attribute to the element.
| element | The element to add attribute. |
| key | The key of the attribute. |
| value | The value of the attribute. |
|
protectedvirtual |
Adds a simple element(element with no children) to the element.
| element | The parent element. |
| key | The key of the simple element. |
| value | The value of the simple element. |
|
protectedvirtual |
Adds a non simple element to the element.
| element | The parent element. |
| child | The element to be added. |
| value | The value of the simple element. |
|
protectedvirtual |
Adds a text node to the element.
| element | The parent element. |
| text | The content of the text node. |
|
protectedvirtual |
Checks if an element has an attribute.
| key | The key of the attribute. |
|
protectedvirtual |
Finds the sub element with the given key and index.
| element | The parent element. |
| key | The key of the sub element. |
| index | The index of the sub element. |
|
protectedvirtual |
Finds the maximum index of a sub element.
| element | The parent element. |
| key | The key of the sub element. |
|
protectedvirtual |
Checks if a config has child with the given key and index.
| config | The config. |
| key | The key of the child. |
| index | The index of the child. |
|
protectedvirtual |
Finds the start position of the element.
| startPos | The start string location of the parent element. |
| element | The element to find. |
| key | The key of the element. |
|
protectedvirtual |
Gets ths start string pattern of the element, ""<key" etc.
|
protectedvirtual |
Gets ths end string pattern of the element.
|
protectedvirtual |
Gets ths end string pattern of the element.
|
protectedvirtual |
Gets the start string pattern of the attribute.
|
protectedvirtual |
Gets the value of an attribute.
| startPos | The start string location to search for the attribute in the earth file. Usually the start position of the parent config. |
| endPos | The end string location to search for the attribute in the earth file. |
| key | The key of the attribute. |
| value | The value of the attribute. |
|
protectedvirtual |
Gets the value of an element.
| startPos | The start string location to search for the attribute in the earth file. Usually the start position of the parent config. |
| endPos | The end string location to search for the attribute in the earth file. |
| key | The key of the element. |
| value | The value of the element. |
|
protected |
Formalizes the value.
| value | The value to formalize. |
|
protectedvirtual |
Checks if the key is reserved, reserved keys are ignored.
| key | The key of the config. |
|
protectedvirtual |
Recursively checks if the child with the given type and name exists. Constrain max recursive depth to save performance.
| root | The root element to start searching. |
| type | The type of the element. |
| name | The name of the element. |
| currentDepth | The current depth of the recursion. |
| maxDepth | The max depth of the recursion, recurstion stops at this level. |
|
private |
Assignment Operator not implemented – Copy not allowed.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |