Spinning Topp Logo BlackTopp Studios
inc
xmlenumerations.h
Go to the documentation of this file.
1 // © Copyright 2010 - 2016 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 /*
41  *
42  * Software, Files, Libraries and all other items referenced in this clause refers only
43  * to the contents of this file and associated documentation.
44  *
45  * Pugixml parser - version 1.0
46  * --------------------------------------------------------
47  * Copyright © 2006-2012, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
48  * Report bugs and download new versions at http://pugixml.org/
49  *
50  * This library is distributed under the MIT License. See notice at the end
51  * of this file.
52  *
53  * This work is based on the pugxml parser, which is:
54  * Copyright © 2003, by Kristen Wegner (kristen@tima.net)
55  */
56 
57 #ifndef _xmlenums_h
58 #define _xmlenums_h
59 
60 /// @file
61 /// @brief Enumerations and constant values used primarily in the XML system but useful for interacting with it in other places.
62 
63 #include "datatypes.h"
64 
65 
66 
67 namespace Mezzanine
68 {
69  namespace XML
70  {
71  // Parsing options
72 
73  /// @brief Minimal parsing mode (equivalent to turning all other flags off).
74  /// @details Only elements and PCDATA sections are added to the DOM tree, no text conversions are performed.
75  const unsigned int ParseMinimal = 0x0000;
76  /// @brief This flag determines if processing instructions (NodePi) are added to the DOM tree. This flag is off by default.
77  const unsigned int ParsePi = 0x0001;
78  /// @brief This flag determines if comments (NodeComment) are added to the DOM tree. This flag is off by default.
79  const unsigned int ParseComments = 0x0002;
80  /// @brief This flag determines if CDATA sections (NodeCdata) are added to the DOM tree. This flag is on by default.
81  const unsigned int ParseCdata = 0x0004;
82  /// @brief This flag determines if plain character data (NodePcdata) that consist only of whitespace are added to the DOM tree.
83  /// @details This flag is off by default; turning it on usually results in slower parsing and more memory consumption.
84  const unsigned int ParseWsPcdata = 0x0008;
85  /// @brief This flag determines if character and entity references are expanded during parsing. This flag is on by default.
86  const unsigned int ParseEscapes = 0x0010;
87  /// @brief This flag determines if EOL characters are normalized (converted to \#xA) during parsing. This flag is on by default.
88  const unsigned int ParseEol = 0x0020;
89  /// @brief This flag determines if attribute values are normalized using CDATA normalization rules during parsing. This flag is on by default.
90  const unsigned int ParseWconvAttribute = 0x0040;
91  /// @brief This flag determines if attribute values are normalized using NMTOKENS normalization rules during parsing. This flag is off by default.
92  const unsigned int ParseWnormAttribute = 0x0080;
93  /// @brief This flag determines if document declaration (NodeDeclaration) is added to the DOM tree. This flag is off by default.
94  const unsigned int ParseDeclaration = 0x0100;
95  /// @brief This flag determines if document type declaration (NodeDoctype) is added to the DOM tree. This flag is off by default.
96  const unsigned int ParseDocType = 0x0200;
97  /// @brief This flag determines if plain character data (NodePcdata) that is the only child of the parent node and that consists only of whitespace is added to the DOM tree.
98  /// @details This flag is off by default; turning it on may Result in slower parsing and more memory consumption.
99  const unsigned int ParseWsPcdata_single = 0x0400;
100 
101  /// @brief The default parsing mode.
102  /// @details Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
103  /// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
104  const unsigned int ParseDefault = ParseCdata | ParseEscapes | ParseWconvAttribute | ParseEol;
105  /// @brief The full parsing mode.
106  /// @details Nodes of all types are added to the DOM tree, character/reference entities are expanded,
107  /// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
108  const unsigned int ParseFull = ParseDefault | ParsePi | ParseComments | ParseDeclaration | ParseDocType;
109 
110  /// @brief These flags determine the encoding of input data for an XML document.
111  enum Encoding
112  {
113  EncodingAuto, ///< Auto-detect input DocumentEncoding using BOM or < / <? detection; use UTF8 if BOM is not found
114  EncodingUTF8, ///< UTF8 DocumentEncoding
115  EncodingUTF16LE, ///< Little-endian UTF16
116  EncodingUTF16BE, ///< Big-endian UTF16n
117  EncodingUTF16, ///< UTF16 with native endianness
118  EncodingUTF32LE, ///< Little-endian UTF32
119  EncodingUTF32BE, ///< Big-endian UTF32
120  EncodingUTF32, ///< UTF32 with native endianness
121  Encodingwchar_t, ///< The same document encoding wchar_t has (usually either UTF16 or UTF32)
122  EncodingLatin1 ///< Also called IEC_8859-1 a common encoding on windows, see http://en.wikipedia.org/wiki/ISO/IEC_8859-1 for furhter
123  };
124 
125  // Formatting flags
126 
127  /// @brief Indent the nodes that are written to output stream with as many indentation strings as deep the node is in DOM tree. This flag is off by default.
128  const unsigned int FormatIndent = 0x01;
129  /// @brief Write encoding-specific Byte Order Mark (BOM) to the output stream. This flag is off by default.
130  const unsigned int FormatWriteBom = 0x02;
131  /// @brief Use raw output mode (no indentation and no line breaks are written). This flag is on by default.
132  const unsigned int FormatRaw = 0x04;
133  /// @brief Omit default XML declaration even if there is no declaration in the document. This flag is off by default.
134  const unsigned int FormatNoDeclaration = 0x08;
135  /// @brief Don't escape GetAttribute Values and PCDATA contents. This flag is off by default.
136  const unsigned int FormatNoEscapes = 0x10;
137  /// @brief Open file using text mode in XML::Document::SaveFile. This enables special character (i.e. new-line) conversions on some systems. This flag is off by default.
138  const unsigned int FormatSaveFileText = 0x20;
139  /// @brief The default set of formatting flags. Only FormatRaw is enabled.
140  /// @note PugiXML defaults to FormatIndent which is not well suited to computer to computer transmission as games commonly do
141  const unsigned int FormatDefault = FormatRaw;
142 
143  /// @brief The types of nodes that could be in the XML Tree.
144  enum NodeType
145  {
146  NodeNull, ///< Empty (null) node handle
147  NodeDocument, ///< A document tree's absolute GetRoot
148  NodeElement, ///< Element tag, i.e. '<node/>'
149  NodePcdata, ///< Plain character data, i.e. 'text'
150  NodeCdata, ///< Character data, i.e. '<![CDATA[text]]>'
151  NodeComment, ///< Comment tag, i.e. '<!-- text -->'
152  NodePi, ///< Processing instruction, i.e. '<?Name?>'
153  NodeDeclaration, ///< Document declaration, i.e. '<?xml version="1.0"?>'
154  NodeDocType ///< Document Type declaration, i.e. '<!DOCTYPE doc>'
155  };
156 
157  /// @brief These statuses are used to help determine what issues, if any the parser had. Returned by @ref Mezzanine::XML::ParseResult instances.
159  {
160  StatusOk = 0, ///< This is returned to indicated there where no issues parsing the XML document.
161 
162  StatusFileNotFound, ///< File was not found during a loading from filename attempt.
163  StatusIOError, ///< Error reading from file or stream.
164 
165  StatusOutOfMemory, ///< Could not allocate memory.
166  StatusInternalError, ///< An unkown error, currently nothing should be able to return this status.
167 
168  StatusUnrecognizedTag, ///< The parser could not determine type of tag.
169 
170  StatusBadProcessingInstruction, ///< Parsing error occurred while parsing document declaration/processing instruction.
171  StatusBadComment, ///< Parsing error occurred while parsing comment.
172  StatusBadCdata, ///< Parsing error occurred while parsing CDATA section.
173  StatusBadDocType, ///< Parsing error occurred while parsing document type declaration.
174  StatusBadPcdata, ///< Parsing error occurred while parsing PCDATA section.
175  StatusBadStartElement, ///< Parsing error occurred while parsing start element tag.
176  StatusBadAttribute, ///< Parsing error occurred while parsing element attribute.
177  StatusBadEndElement, ///< Parsing error occurred while parsing end element tag.
178  StatusEndElementMismatch ///< There was a mismatch of start-end tags (closing tag had incorrect name, some tag was not closed or there was an excessive closing tag).
179  };
180 
181  /// @brief XPathQuery return type
183  {
184  XPathTypeNone, ///< Unknown Type (query failed to compile)
185  XPathTypeNodeSet, ///< Node set (XPathNodeSet)
186  XPathTypeNumber, ///< Number This corresponds to a double or Real.
187  XPathTypeString, ///< Corresponds to the String type.
188  XPathTypeBoole ///< Boole.
189  };
190  }
191 } // /namespace Mezzanine
192 
193 
194 
195 #endif // Include guard
196 
197 /*
198  *
199  * Software, Files, Libraries and all other items referenced in this clause refers only
200  * to the contents of this file and associated documentation.
201  *
202  * Copyright © 2006-2012 Arseny Kapoulkine
203  *
204  * Permission is hereby granted, free of charge, to any person
205  * obtaining a copy of this software and associated documentation
206  * files (the "Software"), to deal in the Software without
207  * restriction, including without limitation the rights to use,
208  * copy, modify, merge, publish, distribute, sublicense, and/or sell
209  * copies of the Software, and to permit persons to whom the
210  * Software is furnished to do so, subject to the following
211  * conditions:
212  *
213  * The above copyright notice and this permission notice shall be
214  * included in all copies or substantial portions of the Software.
215  *
216  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
217  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
218  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
219  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
220  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
221  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
222  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
223  * OTHER DEALINGS IN THE SOFTWARE.
224  */
const unsigned int ParseWnormAttribute
This flag determines if attribute values are normalized using NMTOKENS normalization rules during par...
const unsigned int ParseEol
This flag determines if EOL characters are normalized (converted to #xA) during parsing. This flag is on by default.
XPathValueType
XPathQuery return type.
const unsigned int ParseWconvAttribute
This flag determines if attribute values are normalized using CDATA normalization rules during parsin...
Character data, i.e. ''.
The parser could not determine type of tag.
const unsigned int ParseMinimal
Minimal parsing mode (equivalent to turning all other flags off).
All the definitions for datatypes as well as some basic conversion functions are defined here...
Parsing error occurred while parsing comment.
A document tree's absolute GetRoot.
Processing instruction, i.e. ''.
Parsing error occurred while parsing document type declaration.
const unsigned int ParseDefault
The default parsing mode.
Error reading from file or stream.
UTF8 DocumentEncoding.
const unsigned int ParseWsPcdata
This flag determines if plain character data (NodePcdata) that consist only of whitespace are added t...
const unsigned int ParseFull
The full parsing mode.
This is returned to indicated there where no issues parsing the XML document.
Number This corresponds to a double or Real.
const unsigned int FormatSaveFileText
Open file using text mode in XML::Document::SaveFile. This enables special character (i...
Encoding
These flags determine the encoding of input data for an XML document.
Plain character data, i.e. 'text'.
Auto-detect input DocumentEncoding using BOM or < /
const unsigned int FormatNoDeclaration
Omit default XML declaration even if there is no declaration in the document. This flag is off by def...
Parsing error occurred while parsing document declaration/processing instruction. ...
Parsing error occurred while parsing end element tag.
NodeType
The types of nodes that could be in the XML Tree.
const unsigned int ParseDeclaration
This flag determines if document declaration (NodeDeclaration) is added to the DOM tree...
Parsing error occurred while parsing start element tag.
An unkown error, currently nothing should be able to return this status.
File was not found during a loading from filename attempt.
The same document encoding wchar_t has (usually either UTF16 or UTF32)
Corresponds to the String type.
const unsigned int FormatDefault
The default set of formatting flags. Only FormatRaw is enabled.
Parsing error occurred while parsing CDATA section.
Document Type declaration, i.e. ''.
Comment tag, i.e. ''.
Unknown Type (query failed to compile)
UTF32 with native endianness.
ParseStatus
These statuses are used to help determine what issues, if any the parser had. Returned by Mezzanine::...
Document declaration, i.e. ''.
UTF16 with native endianness.
const unsigned int ParseEscapes
This flag determines if character and entity references are expanded during parsing. This flag is on by default.
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
const unsigned int ParseDocType
This flag determines if document type declaration (NodeDoctype) is added to the DOM tree...
Parsing error occurred while parsing element attribute.
const unsigned int FormatRaw
Use raw output mode (no indentation and no line breaks are written). This flag is on by default...
const unsigned int ParseCdata
This flag determines if CDATA sections (NodeCdata) are added to the DOM tree. This flag is on by defa...
There was a mismatch of start-end tags (closing tag had incorrect name, some tag was not closed or th...
Element tag, i.e. ''.
Parsing error occurred while parsing PCDATA section.
const unsigned int ParseComments
This flag determines if comments (NodeComment) are added to the DOM tree. This flag is off by default...
Node set (XPathNodeSet)
Could not allocate memory.
const unsigned int FormatWriteBom
Write encoding-specific Byte Order Mark (BOM) to the output stream. This flag is off by default...
Also called IEC_8859-1 a common encoding on windows, see http://en.wikipedia.org/wiki/ISO/IEC_8859-1 ...
const unsigned int ParseWsPcdata_single
This flag determines if plain character data (NodePcdata) that is the only child of the parent node a...
const unsigned int FormatNoEscapes
Don't escape GetAttribute Values and PCDATA contents. This flag is off by default.
const unsigned int ParsePi
This flag determines if processing instructions (NodePi) are added to the DOM tree. This flag is off by default.
Empty (null) node handle.
const unsigned int FormatIndent
Indent the nodes that are written to output stream with as many indentation strings as deep the node ...