PixelLightAPI
.
|
Abstract XML base class. More...
#include <XmlBase.h>
Classes | |
struct | Cursor |
Internal structure for tracking location of items in the XML file. More... | |
Public Types | |
enum | { NoError, Error, ErrorOpeningFile, ErrorParsingElement, ErrorFailedToReadElementName, ErrorReadingElementValue, ErrorReadingAttributes, ErrorParsingEmpty, ErrorReadingEndTag, ErrorParsingUnknown, ErrorParsingComment, ErrorParsingDeclaration, ErrorDocumentEmpty, ErrorEmbeddedNull, ErrorParsingCData, ErrorDocumentTopOnly, ErrorStringCount } |
Error codes. More... | |
enum | EQueryResult { Success, NoAttribute, WrongType } |
Only used by 'Attribute::Query'-functions. More... | |
enum | EEncoding { EncodingUnknown, EncodingUTF8, EncodingLegacy } |
Used by the parsing routines. More... | |
Public Member Functions | |
virtual PLCORE_API | ~XmlBase () |
Destructor. | |
int | GetRow () const |
Return the row position, in the original source file, of this node or attribute. | |
int | GetColumn () const |
Return the column position, in the original source file, of this node or attribute. | |
void * | GetUserData () const |
Returns the user data. | |
void | SetUserData (void *pUser) |
Sets the user data. | |
virtual bool | Save (File &cFile, uint32 nDepth=0)=0 |
Save function. | |
virtual String | ToString (uint32 nDepth=0) const =0 |
Output as string function. | |
virtual const char * | Parse (const char *pszData, XmlParsingData *pData=nullptr, EEncoding nEncoding=EncodingUnknown)=0 |
Parse the given null terminated block of XML data. | |
Static Public Member Functions | |
static bool | IsWhiteSpaceCondensed () |
Return the current white space setting. | |
static void | SetCondenseWhiteSpace (bool bCondense) |
Set white space handling. | |
Protected Member Functions | |
XmlBase () | |
Default constructor. | |
Static Protected Member Functions | |
static const char * | SkipWhiteSpace (const char *pszData, EEncoding nEncoding) |
static bool | IsWhiteSpace (char c) |
static bool | IsWhiteSpace (int c) |
static const char * | ReadName (const char *pszData, String &sName, EEncoding nEncoding) |
Reads an XML name into the string provided. | |
static const char * | ReadText (const char *pszData, String &sText, bool bTrimWhiteSpace, const char *pszEndTag, bool bCaseInsensitive, EEncoding nEncoding) |
Reads text. | |
static const char * | GetEntity (const char *pszData, char *pszValue, int &nLength, EEncoding nEncoding) |
static const char * | GetChar (const char *pszData, char *pszValue, int &nLength, EEncoding nEncoding) |
static bool | StringEqual (const char *pszData, const char *pszTag, bool bIgnoreCase, EEncoding nEncoding) |
static int | IsAlpha (unsigned char nByte) |
static int | IsAlphaNum (unsigned char nByte) |
static int | ToLower (int nValue, EEncoding nEncoding) |
static void | ConvertUTF32ToUTF8 (unsigned long nInput, char *pszOutput, int &nLength) |
static void | EncodeString (const String &sInString, String &sOutString) |
Protected Attributes | |
void * | m_pUserData |
Cursor | m_cCursor |
Static Protected Attributes | |
static const unsigned char | UTF_LEAD_0 = 0xefU |
static const unsigned char | UTF_LEAD_1 = 0xbbU |
static const unsigned char | UTF_LEAD_2 = 0xbfU |
Abstract XML base class.
* A document can contain: Element (container or leaf) * Comment (leaf) * Unknown (leaf) * Declaration (leaf) * * An element can contain: Element (container or leaf) * Text (leaf) * Attributes (not on tree) * Comment (leaf) * Unknown (leaf) * * A declaration contains: Attributes (not on tree) *
anonymous enum |
Error codes.
Only used by 'Attribute::Query'-functions.
Success |
All went fine |
NoAttribute |
Attribute does not exist |
WrongType |
Invalid attribute type |
virtual PLCORE_API PLCore::XmlBase::~XmlBase | ( | ) | [virtual] |
Destructor.
PLCore::XmlBase::XmlBase | ( | ) | [protected] |
Default constructor.
bool PLCore::XmlBase::IsWhiteSpaceCondensed | ( | ) | [inline, static] |
Return the current white space setting.
void PLCore::XmlBase::SetCondenseWhiteSpace | ( | bool | bCondense | ) | [inline, static] |
Set white space handling.
[in] | bCondense | 'true' if white space condensed is set, else 'false' |
int PLCore::XmlBase::GetRow | ( | ) | const [inline] |
Return the row position, in the original source file, of this node or attribute.
int PLCore::XmlBase::GetColumn | ( | ) | const [inline] |
Return the column position, in the original source file, of this node or attribute.
void * PLCore::XmlBase::GetUserData | ( | ) | const [inline] |
Returns the user data.
void PLCore::XmlBase::SetUserData | ( | void * | pUser | ) | [inline] |
virtual bool PLCore::XmlBase::Save | ( | File & | cFile, |
uint32 | nDepth = 0 |
||
) | [pure virtual] |
Save function.
[out] | cFile | File to write in, must be opened and writable |
[in] | nDepth | Current depth |
Implemented in PLCore::XmlElement, PLCore::XmlDocument, PLCore::XmlAttribute, PLCore::XmlDeclaration, PLCore::XmlText, PLCore::XmlComment, and PLCore::XmlUnknown.
virtual String PLCore::XmlBase::ToString | ( | uint32 | nDepth = 0 | ) | const [pure virtual] |
Output as string function.
[in] | nDepth | Current depth |
Implemented in PLCore::XmlElement, PLCore::XmlDocument, PLCore::XmlAttribute, PLCore::XmlDeclaration, PLCore::XmlText, PLCore::XmlComment, and PLCore::XmlUnknown.
virtual const char* PLCore::XmlBase::Parse | ( | const char * | pszData, |
XmlParsingData * | pData = nullptr , |
||
EEncoding | nEncoding = EncodingUnknown |
||
) | [pure virtual] |
Parse the given null terminated block of XML data.
[in] | pszData | Parsing data, if a null pointer, an error will be returned |
[in] | pData | Parsing data, can be a null pointer |
[in] | nEncoding | Encoding |
Implemented in PLCore::XmlElement, PLCore::XmlDocument, PLCore::XmlAttribute, PLCore::XmlDeclaration, PLCore::XmlText, PLCore::XmlComment, and PLCore::XmlUnknown.
static const char* PLCore::XmlBase::SkipWhiteSpace | ( | const char * | pszData, |
EEncoding | nEncoding | ||
) | [static, protected] |
static bool PLCore::XmlBase::IsWhiteSpace | ( | char | c | ) | [static, protected] |
static bool PLCore::XmlBase::IsWhiteSpace | ( | int | c | ) | [static, protected] |
static const char* PLCore::XmlBase::ReadName | ( | const char * | pszData, |
String & | sName, | ||
EEncoding | nEncoding | ||
) | [static, protected] |
Reads an XML name into the string provided.
[in] | pszData | Data |
[out] | sName | Read name |
[in] | nEncoding | Encoding |
static const char* PLCore::XmlBase::ReadText | ( | const char * | pszData, |
String & | sText, | ||
bool | bTrimWhiteSpace, | ||
const char * | pszEndTag, | ||
bool | bCaseInsensitive, | ||
EEncoding | nEncoding | ||
) | [static, protected] |
Reads text.
[in] | pszData | Where to start |
[out] | sText | The string read |
[in] | bTrimWhiteSpace | Whether to keep the white space |
[in] | pszEndTag | What ends this text |
[in] | bCaseInsensitive | Whether to ignore case in the end tag |
[in] | nEncoding | The current encoding |
static const char* PLCore::XmlBase::GetEntity | ( | const char * | pszData, |
char * | pszValue, | ||
int & | nLength, | ||
EEncoding | nEncoding | ||
) | [static, protected] |
static const char* PLCore::XmlBase::GetChar | ( | const char * | pszData, |
char * | pszValue, | ||
int & | nLength, | ||
EEncoding | nEncoding | ||
) | [static, protected] |
static bool PLCore::XmlBase::StringEqual | ( | const char * | pszData, |
const char * | pszTag, | ||
bool | bIgnoreCase, | ||
EEncoding | nEncoding | ||
) | [static, protected] |
static int PLCore::XmlBase::IsAlpha | ( | unsigned char | nByte | ) | [static, protected] |
static int PLCore::XmlBase::IsAlphaNum | ( | unsigned char | nByte | ) | [static, protected] |
static int PLCore::XmlBase::ToLower | ( | int | nValue, |
EEncoding | nEncoding | ||
) | [static, protected] |
static void PLCore::XmlBase::ConvertUTF32ToUTF8 | ( | unsigned long | nInput, |
char * | pszOutput, | ||
int & | nLength | ||
) | [static, protected] |
static void PLCore::XmlBase::EncodeString | ( | const String & | sInString, |
String & | sOutString | ||
) | [static, protected] |
const unsigned char PLCore::XmlBase::UTF_LEAD_0 = 0xefU [static, protected] |
const unsigned char PLCore::XmlBase::UTF_LEAD_1 = 0xbbU [static, protected] |
const unsigned char PLCore::XmlBase::UTF_LEAD_2 = 0xbfU [static, protected] |
void* PLCore::XmlBase::m_pUserData [protected] |
User data, can be a null pointer
Cursor PLCore::XmlBase::m_cCursor [protected] |
|