7 #ifndef _DOM_CLASS_HEADER_
8 #define _DOM_CLASS_HEADER_
45 return ((str1.
Compare(str2)) < 0);
649 const tChar * pStart,
653 tBool IsIgnoreIncludesEnabled();
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
int32_t tInt32
type definition for signed integer values (32bit) (platform and compiler independent type).
void tVoid
The tVoid is always the definition for the void (non-type).
int tInt
type definition for signed integer value (platform and compiler dependent type).
double tFloat64
type definition for Float64 (64bit double values) (platform and compiler independent type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
uint32_t tUInt32
type definition for unsigned integer values (32bit) (platform and compiler independent type).
size_t tSize
type definition for a array size values, map size values etc.
representation for an element of the cDom
tVoid SetData(const cString &strData)
Sets the data of the element.
tResult ReadData(const tChar *&ptr, const tChar *pStart=nullptr)
Parses the data from the input string.
cString ToStringImpl(tUInt32 ui32Flags, tInt nIndentLevel=0) const
Converts the DOM element into a textual XML like representation.
cString GetAttribute(const cString &strName, const cString &strDefault=cString()) const
Returns the value of an attribute.
tVoid CreateChild(const std::list< cString > &lstComment, const tInt &nFlag=0)
Parses comments from and creates pseudo DOM childs.
cString ToString() const
Creates an xml representation of the element.
tUInt32 GetAttributeUInt32(const cString &strName, tUInt32 nDefault=0) const
Returns the value of an attribute interpreted as an integer.
cDOMElementList & GetChildren()
Returns a list of all child elements of the element.
tFloat64 GetAttributeFloat64(const cString &strName, tFloat64 fDefault=0.0) const
Returns the value of an attribute interpreted as a float.
cDOMAttributes m_mapAttributes
maps several attributs of the element
tResult FindNodesImpl(const tChar *strQuery, cDOMElementRefList &lstElements, tBool &bFinished, tUInt32 ui32Flags)
Find nodes who matches the query string.
static cString m_strEmptyValue
empty string
cDOM * m_pDocument
the complete xml document
tBool Exists(const cString &strName) const
Checks if an attribute exists.
tInt GetAttributeInt(const cString &strName, tInt nDefault=0) const
Returns the value of an attribute interpreted as an integer.
const cDOM & GetDocument() const
Returns the document that the element belongs to.
const cString & GetPath() const
returns the current path
cDOMElement & GetParent()
Returns the elements parent element.
tResult Free()
Frees all allocated resources.
tBool GetAttributeBool(const cString &strName, tBool bDefault=tFalse) const
Returns the value of an attribute interpreted as a boolean.
tBool MatchQuery(const tChar *ptr, tUInt32 &o_nOffset)
Matches the query with the child attributes.
cDOM & GetDocument()
Returns the document that the element belongs to.
cDOMElement * GetChild(const cString &strName)
Find the first child of that name of this element.
const cDOMAttributes & GetAttributes() const
Returns a map of alle attributes of the element.
tVoid SetName(const cString &strName)
Sets the name of the element.
tResult Delete()
Removes the element from its parent element.
static cDOMElement m_oNullElement
empty element
tResult FindNode(const tChar *strQuery, cDOMElement *&poElement)
Finds a node based on a query.
const cDOMElementList & GetChildren() const
Returns a list of all child elements of the element.
const cString & GetName() const
Returns the name of the element.
tVoid EraseAttribute(const cString &strName)
Removes an attribute.
const cString & GetData() const
Returns the data of the element.
tResult Create(const tChar *&ptr, cDOMElement *pParent, cDOM *pDocument, const tChar *pStart=nullptr)
Parses the DOM element from the input string.
cString m_strPath
the path to the element
tResult FromString(const tChar *strXML)
Creates the element from an xml string.
virtual ~cDOMElement()
Destructor.
const cDOMElement * GetChild(const cString &strName) const
Find the first child of that name of this element.
cString m_strData
raw data of the element
cDOMElement & operator=(const cDOMElement &oElement)
Copy assignment operator.
cDOMElement * m_pParent
the parent element
tBool MatchAttributes(const tChar *pString)
Matches the attributes of the DOM child.
cDOMAttributes & GetAttributes()
Returns a map of alle attributes of the element.
const cDOMElement & GetParent() const
Returns the elements parent element.
tResult CreateChild(const cString &strName, cDOMElement *&poChild)
Creates a new child element.
tVoid SetAttribute(const cString &strName, const cString &strValue)
Sets an attribute.
cDOMElementList m_lstChildren
list of all children
tResult InsertBefore(const cDOMElement &oChild, cDOMElement *pBefore)
Inserts an existing child element at a specified position.
tResult ReadAttributes(const tChar *&ptr, const tChar *pStart=nullptr)
Parses the attributes from the input string.
cString m_strName
the name of the element
tResult FindNodes(const tChar *strQuery, cDOMElementRefList &lstElements, tInt32 ui32Flags=0)
Finds nodes based on a query.
tResult InsertChild(const cDOMElement &oChild)
Adds an existing child element.
cDOM implements a XML parser which can be used to read in XML files and perform simple (!...
const cDOMElementList & GetPreRootSibling() const
For internal use only.
tResult Save(const tChar *strFilename, const tBool &bKeepIncludes=tFalse) const
Save dom to an xml file.
cString ToString() const
Creates an xml string representation of the dom.
tBool m_bIgnoreIncludesEnabled
special tag include is enabled or not
cDOMElement & GetRoot()
Returns the root element of the dom.
cDOMElementList m_lstPostRootSibling
post root siblings
static tResult SkipComment(cDOM *pDom, const tChar *&ptr, std::list< cString > &lstComment, const tChar *pStart=nullptr)
Skips xml comment sections in a string.
tResult FromString(const tChar *ptrXML, const tBool &bIgnoreIncludes=tFalse)
Create the dom from an input string.
cDOM & operator=(const cDOM &oDOM)
Copy assignment operator.
tResult Free()
Frees all allocated resources.
tVoid AddPreRootSibling(const cDOMElement &oChild)
For internal use only.
const cDOMElement & GetRoot() const
Returns the root element of the dom.
cDOMElementList m_lstPreRootSibling
pre root siblings
cFilename m_strFilePath
path of xml file
const cDOMElementList & GetPostRootSibling() const
For internal use only.
cStringList m_lstIncludedFile
list of included files
cDOMElement m_oRoot
root element of dom
tResult FindNode(const tChar *strQuery, cDOMElement *&poElement)
Finds a node based on a query, see cDOMElement::FindNode.
cString GetLastDOMError()
Returns the last error description occurred.
cString GetFilePath()
Returns the name of the file that the dom was created from.
cString m_strLastErrorDescription
if error occurs this will hold the parser error description
cStringList GetIncludedFiles()
Returns a list of files that are included in the loaded file.
tVoid AddPostRootSibling(const cDOMElement &oChild)
For internal use only.
tResult Load(const tChar *strFilename, const tBool &bIgnoreIncludes=tFalse, const tUInt32 &ui32OpenMode=cFile::OM_Read|cFile::OM_SharedRead|cFile::OM_SequentialAccess)
Loads an xml file and creates the dom.
static const tSize m_nTABSIZE
TAB Size for IndentLevel.
tVoid AddIncludedFile(const cString &strIncludedFile)
Adds an include file statement to the dom.
tVoid SetRoot(const cDOMElement &oNewRoot)
Set the root element of the dom.
tResult FindNodes(const tChar *strQuery, cDOMElementRefList &lstElements)
Finds nodes based on a query, see cDOMElement::FindNode.
virtual ~cDOM()
Destructor.
@ OM_Read
Open existing file.
@ OM_SharedRead
Allows shared read access, use in addition to flags above.
@ OM_SequentialAccess
Optimized for sequential access, use in addition to flags above.
A common result class usable as return value throughout.
tInt Compare(const _myType &strString, tSize nPos=0, tSize nLength=InvalidPos) const
This function compares a cStringA object with another string using the generic-text function _tcscmp.
#define tFalse
Value for tBool.
#define A_UTILS_DEPRECATED(_func_)
Mark a function or variable as deprecated.
#define A_UTILS_D(__pclassname_)
Helper macro for d-pattern definitions.
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
cDOMElement * cDOMElementRef
own data type for cDOMElement pointers
cDOMElementList::iterator cDOMElementItor
iterator type for cDOMElementList
string_base< cStackString > cString
cString implementation for a stack string which works on stack if string is lower than A_UTILS_DEFAUL...
cDOMElementRefList::iterator cDOMElementRefItor
iterator type for cDOMElementRefList
cDOMElementRefList::const_iterator cDOMElementRefItorConst
constant iterator type for cDOMElementRefList
cDOMElementList::const_iterator cDOMElementItorConst
constant iterator type for cDOMElementList
std::list< cDOMElement * > cDOMElementRefList
own data type for cDOMElement pointers lists
std::list< cDOMElement > cDOMElementList
own data type for cDOMElement lists
std::map< cString, cString, xml_string_compare_func > cDOMAttributes
own data type for cDOM Attributes
compare function for stl containers, e.g.
bool operator()(const cString &str1, const cString &str2) const
compare function for strings