Main MRPT website > C++ reference for MRPT 1.5.6
Classes | Macros | Typedefs | Enumerations | Functions | Variables
xmlParser.cpp File Reference
#include "xmlParser.h"
#include <Windows.h>
#include <memory.h>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <cstdlib>
Include dependency graph for xmlParser.cpp:

Go to the source code of this file.

Classes

struct  ALLXMLClearTag
 
struct  XMLCharacterEntity
 
struct  XML
 
struct  NextToken
 

Macros

#define _CRT_SECURE_NO_DEPRECATE
 
#define WIN32_LEAN_AND_MEAN
 
#define INDENTCHAR   _CXML('\t')
 
#define XML_isSPACECHAR(ch)   ((ch==_CXML('\n'))||(ch==_CXML(' '))||(ch== _CXML('\t'))||(ch==_CXML('\r')))
 
#define MEMORYINCREASE   50
 
#define LENSTR(lpsz)   (lpsz ? xstrlen(lpsz) : 0)
 
#define BASE64DECODE_READ_NEXT_CHAR(c)
 

Typedefs

typedef enum XMLTokenTypeTag XMLTokenType
 
typedef struct XML XML
 
typedef enum Attrib Attrib
 
typedef enum Status Status
 

Enumerations

enum  XMLTokenTypeTag {
  eTokenText = 0, eTokenQuotedText, eTokenTagStart, eTokenTagEnd,
  eTokenCloseTag, eTokenEquals, eTokenDeclaration, eTokenShortHandClose,
  eTokenClear, eTokenError
}
 
enum  Attrib { eAttribName = 0, eAttribEquals, eAttribValue }
 
enum  Status { eInsideTag = 0, eOutsideTag }
 

Functions

void freeXMLString (XMLSTR t)
 to free the string allocated inside the "stringDup" function or the "createXMLString" function. More...
 
int mmin (const int t1, const int t2)
 
char myIsTextWideChar (const void *b, int l)
 
char * myWideCharToMultiByte (const wchar_t *s)
 
static FILE * xfopen (XMLCSTR filename, XMLCSTR mode)
 
static int xstrlen (XMLCSTR c)
 
static int xstrnicmp (XMLCSTR c1, XMLCSTR c2, int l)
 
static int xstricmp (XMLCSTR c1, XMLCSTR c2)
 
static int xstrncmp (XMLCSTR c1, XMLCSTR c2, int l)
 
static XMLSTR xstrstr (XMLCSTR c1, XMLCSTR c2)
 
static XMLSTR xstrcpy (XMLSTR c1, XMLCSTR c2)
 
char xmltob (XMLCSTR t, char v)
 
int xmltoi (XMLCSTR t, int v)
 
long xmltol (XMLCSTR t, long v)
 
double xmltof (XMLCSTR t, double v)
 
XMLCSTR xmltoa (XMLCSTR t, XMLCSTR v)
 
XMLCHAR xmltoc (XMLCSTR t, XMLCHAR v)
 
XMLSTR stringDup (XMLCSTR lpszData, int cbData)
 Duplicate (copy in a new allocated buffer) the source string. More...
 
XMLSTR fromXMLString (XMLCSTR s, int lo, XML *pXML)
 
char myTagCompare (XMLCSTR cclose, XMLCSTR copen)
 
static XMLCHAR getNextChar (XML *pXML)
 
static NextToken GetNextToken (XML *pXML, int *pcbToken, enum XMLTokenTypeTag *pType)
 
static void myFree (void *p)
 
static voidmyRealloc (void *p, int newsize, int memInc, int sizeofElem)
 
static void CountLinesAndColumns (XMLCSTR lpXML, int nUpto, XMLResults *pResults)
 
static void charmemset (XMLSTR dest, XMLCHAR c, int l)
 

Variables

static XMLNode::XMLCharEncoding characterEncoding =XMLNode::char_encoding_UTF8
 
static char guessWideCharChars =1
 
static char dropWhiteSpace =1
 
static char removeCommentsInMiddleOfText =1
 
static ALLXMLClearTag XMLClearTags []
 
static XMLCharacterEntity XMLEntities []
 
static const char XML_utf8ByteTable [256]
 
static const char XML_legacyByteTable [256]
 
static const char XML_sjisByteTable [256]
 
static const char XML_gb2312ByteTable [256]
 
static const char XML_gbk_big5_ByteTable [256]
 
static const char * XML_ByteTable =(const char *)XML_utf8ByteTable
 
static const char base64Fillchar = _CXML('=')
 
XMLCSTR base64EncodeTable =_CXML("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
 
const unsigned char base64DecodeTable []
 

Macro Definition Documentation

#define _CRT_SECURE_NO_DEPRECATE

Definition at line 11 of file xmlParser.cpp.

#define BASE64DECODE_READ_NEXT_CHAR (   c)
Value:
do { c=base64DecodeTable[(unsigned char)data[i++]]; }while (c==97); \
if(c==98){ if(xe)*xe=eXMLErrorBase64DecodeIllegalCharacter; return 0; }
const GLfloat * c
Definition: glew.h:10088
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
Definition: glew.h:1284
const unsigned char base64DecodeTable[]
Definition: xmlParser.cpp:2663

Referenced by XMLParserBase64Tool::decode().

#define INDENTCHAR   _CXML('\t')

Definition at line 69 of file xmlParser.cpp.

Referenced by XMLNode::CreateXMLStringR().

#define LENSTR (   lpsz)    (lpsz ? xstrlen(lpsz) : 0)
#define MEMORYINCREASE   50
#define WIN32_LEAN_AND_MEAN

Definition at line 16 of file xmlParser.cpp.

#define XML_isSPACECHAR (   ch)    ((ch==_CXML('\n'))||(ch==_CXML(' '))||(ch== _CXML('\t'))||(ch==_CXML('\r')))

Typedef Documentation

typedef enum Attrib Attrib
typedef enum Status Status
typedef struct XML XML

Enumeration Type Documentation

enum Attrib
Enumerator
eAttribName 
eAttribEquals 
eAttribValue 

Definition at line 514 of file xmlParser.cpp.

enum Status
Enumerator
eInsideTag 
eOutsideTag 

Definition at line 523 of file xmlParser.cpp.

Enumerator
eTokenText 
eTokenQuotedText 
eTokenTagStart 
eTokenTagEnd 
eTokenCloseTag 
eTokenEquals 
eTokenDeclaration 
eTokenShortHandClose 
eTokenClear 
eTokenError 

Definition at line 479 of file xmlParser.cpp.

Function Documentation

static void charmemset ( XMLSTR  dest,
XMLCHAR  c,
int  l 
)
inlinestatic

Definition at line 1759 of file xmlParser.cpp.

Referenced by XMLNode::CreateXMLStringR().

static void CountLinesAndColumns ( XMLCSTR  lpXML,
int  nUpto,
XMLResults pResults 
)
static
XMLSTR fromXMLString ( XMLCSTR  s,
int  lo,
XML pXML 
)
static XMLCHAR getNextChar ( XML pXML)
inlinestatic

Definition at line 789 of file xmlParser.cpp.

References XML::lpXML, XML::nIndex, and XMLCHAR.

Referenced by CountLinesAndColumns(), and GetNextToken().

static NextToken GetNextToken ( XML pXML,
int pcbToken,
enum XMLTokenTypeTag pType 
)
static
int mmin ( const int  t1,
const int  t2 
)
inline
static void myFree ( void p)
inlinestatic
char myIsTextWideChar ( const void b,
int  l 
)

Definition at line 148 of file xmlParser.cpp.

References LPVOID().

Referenced by XMLNode::guessCharEncoding(), and XMLNode::parseFile().

static void* myRealloc ( void p,
int  newsize,
int  memInc,
int  sizeofElem 
)
inlinestatic

Definition at line 1006 of file xmlParser.cpp.

Referenced by XMLNode::addAttribute_priv(), and XMLNode::addToOrder().

char myTagCompare ( XMLCSTR  cclose,
XMLCSTR  copen 
)

Definition at line 771 of file xmlParser.cpp.

References _CXML, int(), XML_isSPACECHAR, XMLCHAR, xstrlen(), and xstrnicmp().

Referenced by XMLNode::ParseXMLElement().

char* myWideCharToMultiByte ( const wchar_t *  s)

Definition at line 175 of file xmlParser.cpp.

References XMLNode::char_encoding_UTF8, characterEncoding, and int().

Referenced by XMLNode::parseFile().

static FILE* xfopen ( XMLCSTR  filename,
XMLCSTR  mode 
)
inlinestatic
static XMLSTR xstrcpy ( XMLSTR  c1,
XMLCSTR  c2 
)
inlinestatic

Definition at line 212 of file xmlParser.cpp.

References mrpt::system::os::strcpy(), and XMLSTR.

Referenced by XMLNode::CreateXMLStringR(), and ToXMLStringTool::toXMLUnSafe().

static int xstricmp ( XMLCSTR  c1,
XMLCSTR  c2 
)
inlinestatic
static int xstrlen ( XMLCSTR  c)
inlinestatic
static int xstrncmp ( XMLCSTR  c1,
XMLCSTR  c2,
int  l 
)
inlinestatic

Definition at line 210 of file xmlParser.cpp.

Referenced by GetNextToken().

static int xstrnicmp ( XMLCSTR  c1,
XMLCSTR  c2,
int  l 
)
inlinestatic

Definition at line 207 of file xmlParser.cpp.

References mrpt::system::os::_strnicmp().

Referenced by fromXMLString(), XMLNode::guessCharEncoding(), and myTagCompare().

static XMLSTR xstrstr ( XMLCSTR  c1,
XMLCSTR  c2 
)
inlinestatic

Definition at line 211 of file xmlParser.cpp.

References XMLSTR.

Referenced by XMLNode::getChildNodeByPath(), and XMLNode::parseClearTag().

Variable Documentation

const unsigned char base64DecodeTable[]
Initial value:
= {
99,98,98,98,98,98,98,98,98,97, 97,98,98,97,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98,
98,98,97,98,98,98,98,98,98,98, 98,98,98,62,98,98,98,63,52,53, 54,55,56,57,58,59,60,61,98,98,
98,96,98,98,98, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, 15,16,17,18,19,20,21,22,23,24,
25,98,98,98,98,98,98,26,27,28, 29,30,31,32,33,34,35,36,37,38, 39,40,41,42,43,44,45,46,47,48,
49,50,51,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98,
98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98,
98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98,
98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98,98,98,98,98,
98,98,98,98,98,98,98,98,98,98, 98,98,98,98,98,98
}

Definition at line 2663 of file xmlParser.cpp.

XMLCSTR base64EncodeTable =_CXML("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")

Definition at line 2659 of file xmlParser.cpp.

const char base64Fillchar = _CXML('=')
static

Definition at line 2656 of file xmlParser.cpp.

char dropWhiteSpace =1
static
char guessWideCharChars =1
static
char removeCommentsInMiddleOfText =1
static
const char* XML_ByteTable =(const char *)XML_utf8ByteTable
static

Definition at line 470 of file xmlParser.cpp.

const char XML_gb2312ByteTable[256]
static
Initial value:
=
{
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1
}

Definition at line 430 of file xmlParser.cpp.

Referenced by XMLNode::setGlobalOptions().

const char XML_gbk_big5_ByteTable[256]
static
Initial value:
=
{
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1
}

Definition at line 450 of file xmlParser.cpp.

Referenced by XMLNode::setGlobalOptions().

const char XML_legacyByteTable[256]
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,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
}

Definition at line 410 of file xmlParser.cpp.

Referenced by XMLNode::setGlobalOptions().

const char XML_utf8ByteTable[256]
static
Initial value:
=
{
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1
}

Definition at line 381 of file xmlParser.cpp.

Referenced by XMLNode::setGlobalOptions().

ALLXMLClearTag XMLClearTags[]
static
Initial value:
=
{
{ _CXML("<![CDATA["),9, _CXML("]]>") },
{ _CXML("<!DOCTYPE"),9, _CXML(">") },
{ _CXML("<!--") ,4, _CXML("-->") },
{ _CXML("<PRE>") ,5, _CXML("</PRE>") },
{ NULL ,0, NULL }
}
#define _CXML(c)
Definition: xmlParser.h:190

Definition at line 41 of file xmlParser.cpp.

Referenced by GetNextToken().

XMLCharacterEntity XMLEntities[]
static
Initial value:
=
{
{ _CXML("&amp;" ), 5, _CXML('&' )},
{ _CXML("&lt;" ), 4, _CXML('<' )},
{ _CXML("&gt;" ), 4, _CXML('>' )},
{ _CXML("&quot;"), 6, _CXML('\"')},
{ _CXML("&apos;"), 6, _CXML('\'')},
{ NULL , 0, '\0' }
}
#define _CXML(c)
Definition: xmlParser.h:190

Definition at line 56 of file xmlParser.cpp.

Referenced by fromXMLString(), ToXMLStringTool::lengthXMLString(), and ToXMLStringTool::toXMLUnSafe().




Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018