45 return CMarkupSTL::IntoElem();
58 bool bVal = CMarkupSTL::OutOfElem();
76 std::string strTagPath, strVal;
77 std::deque<std::string> aryTemp;
81 for(iIndex=0; iIndex<iSize; iIndex++)
86 strTagPath =
"\\" + strVal + strTagPath;
88 strTagPath = strVal + strTagPath;
90 aryTemp.push_front(strVal);
96 strVal = GetChildTagName();
97 if( !strVal.empty() ) strTagPath += (
"\\" + strVal);
100 for(iIndex=0; iIndex<iSize; iIndex++)
102 strVal = aryTemp[iIndex];
124 std::string strError;
125 strError =
" Element: " +
FullTagPath() +
" Value: " + strValue;
139 for(iIndex=0; iIndex<iSize; iIndex++)
164 if(!SetDoc(strXml.c_str()))
165 THROW_ERROR(Std_Err_lDeserializingXml, Std_Err_strDeserializingXml);
181 if(CMarkupSTL::FindElem(strElementName.c_str()))
189 THROW_PARAM_ERROR(Std_Err_lElementNotFound, Std_Err_strElementNotFound,
"Element", (
FullTagPath(
false) +
"\\" + strElementName));
207 while(FindChildElem())
231 for(iPos=0; iPos<=iIndex; iPos++)
236 THROW_PARAM_ERROR(Std_Err_lInvalidIndex, Std_Err_strInvalidIndex,
"Index", iIndex);
259 if(CMarkupSTL::FindChildElem(strElementName.c_str()))
262 THROW_PARAM_ERROR(Std_Err_lElementNotFound, Std_Err_strElementNotFound,
"Element", (
FullTagPath(
false) +
"\\" + strElementName));
295 {
return GetChildData();}
310 return GetChildData();
329 strVal = GetChildData();
348 strVal = GetChildData();
352 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
355 THROW_TEXT_ERROR(Std_Err_lNotIntegerType, Std_Err_strNotIntegerType,
ValueErrorString(strVal));
358 return atol(strVal.c_str());
376 strVal = GetChildData();
380 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
383 THROW_TEXT_ERROR(Std_Err_lNotIntegerType, Std_Err_strNotIntegerType,
ValueErrorString(strVal));
386 return atol(strVal.c_str());
407 strVal = GetChildData();
411 lVal = atol(strVal.c_str());
433 strVal = GetChildData();
437 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
440 THROW_TEXT_ERROR(Std_Err_lNotIntegerType, Std_Err_strNotIntegerType,
ValueErrorString(strVal));
443 return atoi(strVal.c_str());
461 strVal = GetChildData();
465 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
468 THROW_TEXT_ERROR(Std_Err_lNotIntegerType, Std_Err_strNotIntegerType,
ValueErrorString(strVal));
471 return atoi(strVal.c_str());
492 strVal = GetChildData();
496 iVal = atoi(strVal.c_str());
518 strVal = GetChildData();
522 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
525 return atof(strVal.c_str());
543 strVal = GetChildData();
547 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
550 return atof(strVal.c_str());
571 strVal = GetChildData();
575 dblVal = atof(strVal.c_str());
597 strVal = GetChildData();
601 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
604 return (
float) atof(strVal.c_str());
622 strVal = GetChildData();
626 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
629 return (
float) atof(strVal.c_str());
650 strVal = GetChildData();
654 fltVal = (float) atof(strVal.c_str());
676 strVal = GetChildData();
679 if(strVal ==
"TRUE" || strVal ==
"1")
681 else if(strVal ==
"FALSE" || strVal ==
"0")
684 THROW_TEXT_ERROR(Std_Err_lNotBoolType, Std_Err_strNotBoolType,
ValueErrorString(strVal));
704 strVal = GetChildData();
707 if(strVal ==
"TRUE" || strVal ==
"1")
709 else if(strVal ==
"FALSE" || strVal ==
"0")
712 THROW_TEXT_ERROR(Std_Err_lNotBoolType, Std_Err_strNotBoolType,
ValueErrorString(strVal));
735 strVal = GetChildData();
738 if(strVal ==
"TRUE" || strVal ==
"1")
740 else if(strVal ==
"FALSE" || strVal ==
"0")
772 if(!AddElem(strElementName.c_str(), strData.c_str()))
773 THROW_PARAM_ERROR(Std_Err_lAddingElement, Std_Err_strAddingElement,
"Element", (
FullTagPath(
false) +
"\\" + strElementName));
787 if(!AddChildElem(strElementName.c_str(), strVal.c_str()))
788 THROW_PARAM_ERROR(Std_Err_lAddingElement, Std_Err_strAddingElement,
"Element", (
FullTagPath(
false) +
"\\" + strElementName));
816 std::ostringstream oStream;
817 int iVal = (int) cVal;
834 std::ostringstream oStream;
835 int iVal = (int) cVal;
852 std::ostringstream oStream;
869 std::ostringstream oStream;
886 std::ostringstream oStream;
903 std::ostringstream oStream;
943 SetData(strCData.c_str(), 1);
962 std::string strVal = GetAttrib(strAttribName.c_str());
967 THROW_TEXT_ERROR(Std_Err_lBlankAttrib, Std_Err_strBlankAttrib,
ValueErrorString(strVal));
991 strVal = GetAttrib(strAttribName.c_str());
997 THROW_TEXT_ERROR(Std_Err_lBlankAttrib, Std_Err_strBlankAttrib,
ValueErrorString(strVal));
1003 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
1006 THROW_TEXT_ERROR(Std_Err_lNotIntegerType, Std_Err_strNotIntegerType,
ValueErrorString(strVal));
1009 return atol(strVal.c_str());
1028 strVal = GetAttrib(strAttribName.c_str());
1034 THROW_TEXT_ERROR(Std_Err_lBlankAttrib, Std_Err_strBlankAttrib,
ValueErrorString(strVal));
1040 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
1043 THROW_TEXT_ERROR(Std_Err_lNotIntegerType, Std_Err_strNotIntegerType,
ValueErrorString(strVal));
1046 return atoi(strVal.c_str());
1065 strVal = GetAttrib(strAttribName.c_str());
1071 THROW_TEXT_ERROR(Std_Err_lBlankAttrib, Std_Err_strBlankAttrib,
ValueErrorString(strVal));
1077 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
1080 return atof(strVal.c_str());
1099 strVal = GetAttrib(strAttribName.c_str());
1105 THROW_TEXT_ERROR(Std_Err_lBlankAttrib, Std_Err_strBlankAttrib,
ValueErrorString(strVal));
1111 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
1114 return (
float) atof(strVal.c_str());
1133 strVal = GetAttrib(strAttribName.c_str());
1139 THROW_TEXT_ERROR(Std_Err_lBlankAttrib, Std_Err_strBlankAttrib,
ValueErrorString(strVal));
1144 if(strVal ==
"TRUE" || strVal ==
"1")
1146 else if(strVal ==
"FALSE" || strVal ==
"0")
1149 THROW_TEXT_ERROR(Std_Err_lNotBoolType, Std_Err_strNotBoolType,
ValueErrorString(strVal));
1165 if(!CMarkupSTL::SetAttrib(strAttribName.c_str(), strData.c_str()))
1166 THROW_PARAM_ERROR(Std_Err_lSettingAttrib, Std_Err_strSettingAttrib,
"Attrib", (
FullTagPath(
false) +
"\\" + strAttribName));
1180 std::ostringstream oStream;
1181 int iVal = (int) cVal;
1184 SetAttrib(strAttribName, oStream.str());
1198 std::ostringstream oStream;
1199 int iVal = (int) cVal;
1202 SetAttrib(strAttribName, oStream.str());
1216 std::ostringstream oStream;
1219 SetAttrib(strAttribName, oStream.str());
1233 std::ostringstream oStream;
1236 SetAttrib(strAttribName, oStream.str());
1250 std::ostringstream oStream;
1253 SetAttrib(strAttribName, oStream.str());
1267 std::ostringstream oStream;
1270 SetAttrib(strAttribName, oStream.str());
1309 std::string strVal = GetChildAttrib(strAttribName.c_str());
1314 THROW_TEXT_ERROR(Std_Err_lBlankAttrib, Std_Err_strBlankAttrib,
ValueErrorString(strVal));
1316 strVal = strDefault;
1338 strVal = GetChildAttrib(strAttribName.c_str());
1345 THROW_TEXT_ERROR(Std_Err_lBlankAttrib, Std_Err_strBlankAttrib,
ValueErrorString(strVal));
1348 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
1351 THROW_TEXT_ERROR(Std_Err_lNotIntegerType, Std_Err_strNotIntegerType,
ValueErrorString(strVal));
1354 return atol(strVal.c_str());
1373 strVal = GetChildAttrib(strAttribName.c_str());
1380 THROW_TEXT_ERROR(Std_Err_lBlankAttrib, Std_Err_strBlankAttrib,
ValueErrorString(strVal));
1383 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
1386 THROW_TEXT_ERROR(Std_Err_lNotIntegerType, Std_Err_strNotIntegerType,
ValueErrorString(strVal));
1389 return atoi(strVal.c_str());
1408 strVal = GetChildAttrib(strAttribName.c_str());
1415 THROW_TEXT_ERROR(Std_Err_lBlankAttrib, Std_Err_strBlankAttrib,
ValueErrorString(strVal));
1418 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
1421 return atof(strVal.c_str());
1440 strVal = GetChildAttrib(strAttribName.c_str());
1447 THROW_TEXT_ERROR(Std_Err_lBlankAttrib, Std_Err_strBlankAttrib,
ValueErrorString(strVal));
1450 THROW_TEXT_ERROR(Std_Err_lNotNumericType, Std_Err_strNotNumericType,
ValueErrorString(strVal));
1453 return (
float) atof(strVal.c_str());
1472 strVal = GetChildAttrib(strAttribName.c_str());
1479 THROW_TEXT_ERROR(Std_Err_lBlankAttrib, Std_Err_strBlankAttrib,
ValueErrorString(strVal));
1481 if(strVal ==
"TRUE" || strVal ==
"1")
1483 else if(strVal ==
"FALSE" || strVal ==
"0")
1486 THROW_TEXT_ERROR(Std_Err_lNotBoolType, Std_Err_strNotBoolType,
ValueErrorString(strVal));
1502 if(!CMarkupSTL::SetChildAttrib(strAttribName.c_str(), strVal.c_str()))
1503 THROW_PARAM_ERROR(Std_Err_lSettingAttrib, Std_Err_strSettingAttrib,
"Attrib", (
FullTagPath(
false) +
"\\" + strAttribName));
1517 std::ostringstream oStream;
1518 int iVal = (int) cVal;
1535 std::ostringstream oStream;
1536 int iVal = (int) cVal;
1553 std::ostringstream oStream;
1570 std::ostringstream oStream;
1587 std::ostringstream oStream;
1604 std::ostringstream oStream;
1642 if(!AddChildSubDoc(strDoc.c_str()))
1643 THROW_ERROR(Std_Err_lAddingChildDoc, Std_Err_strAddingChildDoc);
1656 return GetChildSubDoc();
1669 std::string strTagName;
1672 strTagName = GetTagName();
1688 THROW_ERROR(Std_Err_lFilenameBlank, Std_Err_strFilenameBlank);
1690 if(!CMarkupSTL::Load(strFilename.c_str()))
1694 std::string strError = STR(
"\nFilename: ") + strFilename + STR(
"\nReason: ") + m_strError;
1695 THROW_TEXT_ERROR(Std_Err_lOpeningFile, Std_Err_strOpeningFile, strError);
1698 THROW_PARAM_ERROR(Std_Err_lOpeningFile, Std_Err_strOpeningFile,
"Filename", strFilename);
1714 THROW_ERROR(Std_Err_lFilenameBlank, Std_Err_strFilenameBlank);
1716 if(!CMarkupSTL::Save(strFilename.c_str()))
1717 THROW_PARAM_ERROR(Std_Err_lOpeningFile, Std_Err_strOpeningFile,
"Filename", strFilename);
virtual int GetAttribInt(std::string strAttribName, bool bThrowError=true, int iDefault=0)
Gets an attribute int.
virtual void Deserialize(std::string &strXml)
Deserializes a string into an xml document.
virtual ~CStdXml()
Destructor.
virtual bool FindChildElement(std::string strElementName, bool fThrowError=true)
Finds a child element by name.
virtual void AddChildCData(std::string strElementName, std::string strCData)
Adds a child CDATA section.
virtual double GetChildAttribDouble(std::string strAttribName, bool bThrowError=true, double dblDefault=0)
Gets a child attribute double.
virtual float GetChildFloat()
Gets a float value from the currently selected element.
virtual int GetChildInt()
Gets an integer value from the currently selected element.
virtual void Save(std::string strFilename)
Saves am xml data file.
virtual int GetChildAttribInt(std::string strAttribName, bool bThrowError=true, int iDefault=0)
Gets a child attribute int.
virtual float GetChildAttribFloat(std::string strAttribName, bool bThrowError=true, float fltDefault=0)
Gets a child attribute float.
bool Std_IsNumeric(std::string strVal)
Tests if this string is a number.
CStdXml()
Default constructor.
virtual bool FindElement(std::string strElementName, bool fThrowError=true)
Finds an element with the specified name.
virtual void AddChildElement(std::string strElementName)
Adds a child element to current element.
virtual bool IntoElem()
Goes into the next element where the cursor is located.
virtual bool GetChildAttribBool(std::string strAttribName, bool bThrowError=true, bool bDefault=false)
Gets a child attribute bool.
virtual bool GetAttribBool(std::string strAttribName, bool bThrowError=true, bool bDefault=false)
Gets an attribute bool.
std::string Std_Trim(std::string strVal)
Trims a string.
virtual void SetChildAttrib(std::string strAttribName, std::string strVal)
Sets a child attribute.
virtual std::string GetChildDoc()
Gets a child document.
virtual long GetChildLong()
Gets a long value from the currently selected element.
virtual double GetChildDouble()
Gets a double value from the currently selected element.
virtual void Load(std::string strFilename)
Loads an xml data file.
virtual bool GetChildBool()
Gets a bool value from the currently selected element.
virtual float GetAttribFloat(std::string strAttribName, bool bThrowError=true, float fltDefault=0)
Gets an attribute float.
virtual double GetAttribDouble(std::string strAttribName, bool bThrowError=true, double dblDefault=0)
Gets an attribute double.
virtual std::string GetParentTagName()
Gets the parent tag name.
Namespace for the standard utility objects.
std::stack< std::string > m_aryTagStack
Stack of tags.
virtual std::string GetChildAttribString(std::string strAttribName, bool bCanBeBlank=false, bool bThrowError=true, std::string strDefault="")
Gets a child attribute string.
virtual std::string Serialize()
Serializes the document to a string.
virtual int NumberOfChildren()
Gets the number of children of the current element.
bool Std_IsIntegerType(std::string strVal)
Tests if this string is an integer.
virtual std::string GetAttribString(std::string strAttribName, bool bCanBeBlank=false, bool bThrowError=true, std::string strDefault="")
Gets an attribute string of an element.
virtual std::string ValueErrorString(std::string strValue)
Generates a value error string.
virtual bool OutOfElem()
Goes out of the element where the cursor is located.
bool Std_IsBlank(std::string strVal)
Trims a string and tests if a string is blank.
virtual long GetAttribLong(std::string strAttribName, bool bThrowError=true, long lDefault=0)
Gets an attribute long.
virtual bool IntoChildElement(std::string strElementName, bool bThrowError=true)
Goes into the child element with the specified name.
virtual std::string GetChildString()
Gets a string value from the currently selected element.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
virtual void SetAttrib(std::string strAttribName, std::string strVal)
Sets an attribute.
virtual bool FindChildByIndex(int iIndex, bool bThrowError=true)
Finds a child element by index.
virtual long GetChildAttribLong(std::string strAttribName, bool bThrowError=true, long lDefault=0)
Gets a child attribute long.
virtual std::string FullTagPath(bool bAddChildName=true)
Full tag path.
virtual void AddChildDoc(std::string &strDoc)
Adds a child document.
virtual void ClearTagStack()
Clears the tag stack.
virtual void AddElement(std::string strElementName, std::string strData="")
Adds an element to current element.