1 #ifndef QUALISYS_NBC_NBC_MARKUP_H_INCLUDED 2 #define QUALISYS_NBC_NBC_MARKUP_H_INCLUDED 17 #define _DS(i) (i?&((const char*)m_csDoc.c_str())[m_aPos[i].nStartL]:0) 18 #define MARKUP_SETDEBUGSTATE m_pMainDS=_DS(m_iPos); m_pChildDS=_DS(m_iPosChild) 20 #define MARKUP_SETDEBUGSTATE 37 bool AddElem(
const char* szName,
const char* szData=NULL) {
return x_AddElem(szName,szData,
false,
false); };
45 bool SetDoc(
const char* szDoc);
47 bool FindElem(
const char* szName=NULL);
62 static std::string
Format(
const char *fmt, ...);
79 const char* m_pMainDS;
80 const char* m_pChildDS;
119 void Clear() { nL=0; nR=-1; nNext=0; bIsString=
false; };
120 bool Match(
const char* szName)
const;
128 void x_SetPos(
int iPosParent,
int iPos,
int iPosChild)
130 m_iPosParent = iPosParent;
132 m_iPosChild = iPosChild;
140 int x_ParseError(
const char* szError,
const char* szName = NULL);
141 static bool x_FindChar(
const char* szDoc,
int& nChar,
char c);
142 static bool x_FindAny(
const char* szDoc,
int& nChar);
145 int x_FindElem(
int iPosParent,
int iPos,
const char* szPath);
148 std::string
x_GetAttrib(
int iPos,
const char* szAttrib)
const;
149 bool x_AddElem(
const char* szName,
const char* szValue,
bool bInsert,
bool bAddChild);
151 bool x_SetAttrib(
int iPos,
const char* szAttrib,
const char* szValue);
152 void x_LocateNew(
int iPosParent,
int& iPosRel,
int& nOffset,
int nLength,
int nFlags);
154 void x_DocChange(
int nLeft,
int nReplace,
const std::string& csInsert);
155 void x_Adjust(
int iPos,
int nShift,
bool bAfterPos =
false);
156 std::string
x_TextToDoc(
const char* szText,
bool bAttrib =
false)
const;
164 std::string Mid(
const std::string &tStr,
int nFirst)
const;
165 std::string Mid(
const std::string &tStr,
int nFirst,
int nCount)
const;
166 char* GetBuffer(std::string &tStr,
int nMinLen = -1)
const;
167 void ReleaseBuffer(std::string &tStr,
int nNewLen = -1)
const;
void SetIndent(int nIndent=4)
void x_Adjust(int iPos, int nShift, bool bAfterPos=false)
static bool x_FindAny(const char *szDoc, int &nChar)
void operator=(const CMarkup &markup)
bool AddElem(const char *szName, const char *szData=NULL)
std::string GetError() const
static bool x_FindToken(TokenPos &token)
CMarkup(const CMarkup &markup)
void x_DocChange(int nLeft, int nReplace, const std::string &csInsert)
bool SetChildAttrib(const char *szAttrib, const char *szValue)
#define MARKUP_SETDEBUGSTATE
void x_SetPos(int iPosParent, int iPos, int iPosChild)
std::string GetChildAttrib(const char *szAttrib) const
static bool x_FindChar(const char *szDoc, int &nChar, char c)
bool x_AddElem(const char *szName, const char *szValue, bool bInsert, bool bAddChild)
std::string GetData() const
std::string GetAttrib(const char *szAttrib) const
bool SetDoc(const char *szDoc)
int x_FindElem(int iPosParent, int iPos, const char *szPath)
std::string x_GetAttrib(int iPos, const char *szAttrib) const
int x_ParseElem(int iPos)
std::string x_GetToken(const TokenPos &token) const
std::string x_TextToDoc(const char *szText, bool bAttrib=false) const
ElemPos(const ElemPos &pos)
bool x_SetAttrib(int iPos, const char *szAttrib, const char *szValue)
bool AddChildElem(const char *szName, const char *szData=NULL)
static std::string Format(const char *fmt,...)
CMarkup(const char *szDoc)
int x_ParseNode(TokenPos &token)
bool IsEmptyElement() const
std::vector< ElemPos > m_aPos
std::string GetDoc() const
std::string x_GetTagName(int iPos) const
bool FindChildElem(const char *szName=NULL)
std::string GetChildData() const
bool AddAttrib(const char *szAttrib, const char *szValue)
std::string GetTagName() const
std::string x_GetData(int iPos) const
bool x_FindAttrib(TokenPos &token, const char *szAttrib=NULL) const
int x_ParseError(const char *szError, const char *szName=NULL)
bool AddChildAttrib(const char *szAttrib, const char *szValue)
bool FindElem(const char *szName=NULL)
void x_LocateNew(int iPosParent, int &iPosRel, int &nOffset, int nLength, int nFlags)
std::string GetChildTagName() const
bool SetAttrib(const char *szAttrib, const char *szValue)
std::string x_TextFromDoc(int nLeft, int nRight) const