Main MRPT website > C++ reference for MRPT 1.5.7
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

◆ _CRT_SECURE_NO_DEPRECATE

#define _CRT_SECURE_NO_DEPRECATE

Definition at line 11 of file xmlParser.cpp.

◆ BASE64DECODE_READ_NEXT_CHAR

#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 GLubyte * c
Definition: glext.h:5590
const unsigned char base64DecodeTable[]
Definition: xmlParser.cpp:2663
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3520

Referenced by XMLParserBase64Tool::decode().

◆ INDENTCHAR

#define INDENTCHAR   _CXML('\t')

Definition at line 69 of file xmlParser.cpp.

Referenced by XMLNode::CreateXMLStringR().

◆ LENSTR

#define LENSTR (   lpsz)    (lpsz ? xstrlen(lpsz) : 0)

◆ MEMORYINCREASE

#define MEMORYINCREASE   50

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 16 of file xmlParser.cpp.

◆ XML_isSPACECHAR

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

Typedef Documentation

◆ Attrib

typedef enum Attrib Attrib

◆ Status

typedef enum Status Status

◆ XML

typedef struct XML XML

◆ XMLTokenType

Enumeration Type Documentation

◆ Attrib

enum Attrib
Enumerator
eAttribName 
eAttribEquals 
eAttribValue 

Definition at line 514 of file xmlParser.cpp.

◆ Status

enum Status
Enumerator
eInsideTag 
eOutsideTag 

Definition at line 523 of file xmlParser.cpp.

◆ XMLTokenTypeTag

Enumerator
eTokenText 
eTokenQuotedText 
eTokenTagStart 
eTokenTagEnd 
eTokenCloseTag 
eTokenEquals 
eTokenDeclaration 
eTokenShortHandClose 
eTokenClear 
eTokenError 

Definition at line 479 of file xmlParser.cpp.

Function Documentation

◆ charmemset()

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

Definition at line 1759 of file xmlParser.cpp.

Referenced by XMLNode::CreateXMLStringR().

◆ CountLinesAndColumns()

static void CountLinesAndColumns ( XMLCSTR  lpXML,
int  nUpto,
XMLResults pResults 
)
static

◆ fromXMLString()

XMLSTR fromXMLString ( XMLCSTR  s,
int  lo,
XML pXML 
)

◆ getNextChar()

static XMLCHAR getNextChar ( XML pXML)
inlinestatic

Definition at line 789 of file xmlParser.cpp.

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

Referenced by CountLinesAndColumns(), and GetNextToken().

◆ GetNextToken()

static NextToken GetNextToken ( XML pXML,
int *  pcbToken,
enum XMLTokenTypeTag pType 
)
static

◆ mmin()

int mmin ( const int  t1,
const int  t2 
)
inline

◆ myFree()

static void myFree ( void p)
inlinestatic

◆ myIsTextWideChar()

char myIsTextWideChar ( const void b,
int  l 
)

Definition at line 148 of file xmlParser.cpp.

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

◆ myRealloc()

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().

◆ myTagCompare()

char myTagCompare ( XMLCSTR  cclose,
XMLCSTR  copen 
)

Definition at line 771 of file xmlParser.cpp.

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

Referenced by XMLNode::ParseXMLElement().

◆ myWideCharToMultiByte()

char* myWideCharToMultiByte ( const wchar_t *  s)

Definition at line 175 of file xmlParser.cpp.

References XMLNode::char_encoding_UTF8, and characterEncoding.

Referenced by XMLNode::parseFile().

◆ xfopen()

static FILE* xfopen ( XMLCSTR  filename,
XMLCSTR  mode 
)
inlinestatic

◆ xstrcpy()

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().

◆ xstricmp()

static int xstricmp ( XMLCSTR  c1,
XMLCSTR  c2 
)
inlinestatic

◆ xstrlen()

static int xstrlen ( XMLCSTR  c)
inlinestatic

◆ xstrncmp()

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

Definition at line 210 of file xmlParser.cpp.

Referenced by GetNextToken().

◆ xstrnicmp()

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().

◆ xstrstr()

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

◆ base64DecodeTable

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.

Referenced by XMLParserBase64Tool::decodeSize().

◆ base64EncodeTable

XMLCSTR base64EncodeTable =_CXML("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")

Definition at line 2659 of file xmlParser.cpp.

Referenced by XMLParserBase64Tool::encode().

◆ base64Fillchar

const char base64Fillchar = _CXML('=')
static

Definition at line 2656 of file xmlParser.cpp.

Referenced by XMLParserBase64Tool::decodeSize(), and XMLParserBase64Tool::encode().

◆ characterEncoding

◆ dropWhiteSpace

char dropWhiteSpace =1
static

◆ guessWideCharChars

char guessWideCharChars =1
static

◆ removeCommentsInMiddleOfText

char removeCommentsInMiddleOfText =1
static

◆ XML_ByteTable

const char* XML_ByteTable =(const char *)XML_utf8ByteTable
static

◆ XML_gb2312ByteTable

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().

◆ XML_gbk_big5_ByteTable

const char XML_gbk_big5_ByteTable[256]
static
Initial value:
=
{
0,1,1,1,1,1,1,1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1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
}

Definition at line 401 of file xmlParser.cpp.

Referenced by XMLNode::setGlobalOptions().

◆ XML_sjisByteTable

const char XML_sjisByteTable[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,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,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,
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().

◆ XML_utf8ByteTable

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::guessCharEncoding(), and XMLNode::setGlobalOptions().

◆ XMLClearTags

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 XMLNode::addClear_priv(), GetNextToken(), XMLNode::maybeAddTxT(), and XMLNode::parseClearTag().

◆ XMLEntities

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.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019