Add inline variable support (external linkage for const vars)
This commit is contained in:
parent
db78afc2b7
commit
55c21ba296
@ -122,6 +122,15 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// If C++ is 2017 or higher, add 'inline' variables
|
||||
#ifndef PUGIXML_INLINE_VAR
|
||||
# ifdef __cpp_inline_variables
|
||||
# define PUGIXML_INLINE_VAR inline
|
||||
# else
|
||||
# define PUGIXML_INLINE_VAR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Character interface macros
|
||||
#ifdef PUGIXML_WCHAR_MODE
|
||||
# define PUGIXML_TEXT(t) L ## t
|
||||
@ -163,69 +172,69 @@ namespace pugi
|
||||
|
||||
// Minimal parsing mode (equivalent to turning all other flags off).
|
||||
// Only elements and PCDATA sections are added to the DOM tree, no text conversions are performed.
|
||||
const unsigned int parse_minimal = 0x0000;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_minimal = 0x0000;
|
||||
|
||||
// This flag determines if processing instructions (node_pi) are added to the DOM tree. This flag is off by default.
|
||||
const unsigned int parse_pi = 0x0001;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_pi = 0x0001;
|
||||
|
||||
// This flag determines if comments (node_comment) are added to the DOM tree. This flag is off by default.
|
||||
const unsigned int parse_comments = 0x0002;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_comments = 0x0002;
|
||||
|
||||
// This flag determines if CDATA sections (node_cdata) are added to the DOM tree. This flag is on by default.
|
||||
const unsigned int parse_cdata = 0x0004;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_cdata = 0x0004;
|
||||
|
||||
// This flag determines if plain character data (node_pcdata) that consist only of whitespace are added to the DOM tree.
|
||||
// This flag is off by default; turning it on usually results in slower parsing and more memory consumption.
|
||||
const unsigned int parse_ws_pcdata = 0x0008;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_ws_pcdata = 0x0008;
|
||||
|
||||
// This flag determines if character and entity references are expanded during parsing. This flag is on by default.
|
||||
const unsigned int parse_escapes = 0x0010;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_escapes = 0x0010;
|
||||
|
||||
// This flag determines if EOL characters are normalized (converted to #xA) during parsing. This flag is on by default.
|
||||
const unsigned int parse_eol = 0x0020;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_eol = 0x0020;
|
||||
|
||||
// This flag determines if attribute values are normalized using CDATA normalization rules during parsing. This flag is on by default.
|
||||
const unsigned int parse_wconv_attribute = 0x0040;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_wconv_attribute = 0x0040;
|
||||
|
||||
// This flag determines if attribute values are normalized using NMTOKENS normalization rules during parsing. This flag is off by default.
|
||||
const unsigned int parse_wnorm_attribute = 0x0080;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_wnorm_attribute = 0x0080;
|
||||
|
||||
// This flag determines if document declaration (node_declaration) is added to the DOM tree. This flag is off by default.
|
||||
const unsigned int parse_declaration = 0x0100;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_declaration = 0x0100;
|
||||
|
||||
// This flag determines if document type declaration (node_doctype) is added to the DOM tree. This flag is off by default.
|
||||
const unsigned int parse_doctype = 0x0200;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_doctype = 0x0200;
|
||||
|
||||
// This flag determines if plain character data (node_pcdata) that is the only child of the parent node and that consists only
|
||||
// of whitespace is added to the DOM tree.
|
||||
// This flag is off by default; turning it on may result in slower parsing and more memory consumption.
|
||||
const unsigned int parse_ws_pcdata_single = 0x0400;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_ws_pcdata_single = 0x0400;
|
||||
|
||||
// This flag determines if leading and trailing whitespace is to be removed from plain character data. This flag is off by default.
|
||||
const unsigned int parse_trim_pcdata = 0x0800;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_trim_pcdata = 0x0800;
|
||||
|
||||
// This flag determines if plain character data that does not have a parent node is added to the DOM tree, and if an empty document
|
||||
// is a valid document. This flag is off by default.
|
||||
const unsigned int parse_fragment = 0x1000;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_fragment = 0x1000;
|
||||
|
||||
// This flag determines if plain character data is be stored in the parent element's value. This significantly changes the structure of
|
||||
// the document; this flag is only recommended for parsing documents with many PCDATA nodes in memory-constrained environments.
|
||||
// This flag is off by default.
|
||||
const unsigned int parse_embed_pcdata = 0x2000;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_embed_pcdata = 0x2000;
|
||||
|
||||
// This flag determines whether determines whether the the two pcdata should be merged or not, if no intermediatory data are parsed in the document.
|
||||
// This flag is off by default.
|
||||
const unsigned int parse_merge_pcdata = 0x4000;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_merge_pcdata = 0x4000;
|
||||
|
||||
// The default parsing mode.
|
||||
// Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
|
||||
// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
|
||||
const unsigned int parse_default = parse_cdata | parse_escapes | parse_wconv_attribute | parse_eol;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_default = parse_cdata | parse_escapes | parse_wconv_attribute | parse_eol;
|
||||
|
||||
// The full parsing mode.
|
||||
// Nodes of all types are added to the DOM tree, character/reference entities are expanded,
|
||||
// End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
|
||||
const unsigned int parse_full = parse_default | parse_pi | parse_comments | parse_declaration | parse_doctype;
|
||||
PUGIXML_INLINE_VAR const unsigned int parse_full = parse_default | parse_pi | parse_comments | parse_declaration | parse_doctype;
|
||||
|
||||
// These flags determine the encoding of input data for XML document
|
||||
enum xml_encoding
|
||||
@ -245,41 +254,41 @@ namespace pugi
|
||||
// Formatting flags
|
||||
|
||||
// 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 on by default.
|
||||
const unsigned int format_indent = 0x01;
|
||||
PUGIXML_INLINE_VAR const unsigned int format_indent = 0x01;
|
||||
|
||||
// Write encoding-specific BOM to the output stream. This flag is off by default.
|
||||
const unsigned int format_write_bom = 0x02;
|
||||
PUGIXML_INLINE_VAR const unsigned int format_write_bom = 0x02;
|
||||
|
||||
// Use raw output mode (no indentation and no line breaks are written). This flag is off by default.
|
||||
const unsigned int format_raw = 0x04;
|
||||
PUGIXML_INLINE_VAR const unsigned int format_raw = 0x04;
|
||||
|
||||
// Omit default XML declaration even if there is no declaration in the document. This flag is off by default.
|
||||
const unsigned int format_no_declaration = 0x08;
|
||||
PUGIXML_INLINE_VAR const unsigned int format_no_declaration = 0x08;
|
||||
|
||||
// Don't escape attribute values and PCDATA contents. This flag is off by default.
|
||||
const unsigned int format_no_escapes = 0x10;
|
||||
PUGIXML_INLINE_VAR const unsigned int format_no_escapes = 0x10;
|
||||
|
||||
// Open file using text mode in xml_document::save_file. This enables special character (i.e. new-line) conversions on some systems. This flag is off by default.
|
||||
const unsigned int format_save_file_text = 0x20;
|
||||
PUGIXML_INLINE_VAR const unsigned int format_save_file_text = 0x20;
|
||||
|
||||
// Write every attribute on a new line with appropriate indentation. This flag is off by default.
|
||||
const unsigned int format_indent_attributes = 0x40;
|
||||
PUGIXML_INLINE_VAR const unsigned int format_indent_attributes = 0x40;
|
||||
|
||||
// Don't output empty element tags, instead writing an explicit start and end tag even if there are no children. This flag is off by default.
|
||||
const unsigned int format_no_empty_element_tags = 0x80;
|
||||
PUGIXML_INLINE_VAR const unsigned int format_no_empty_element_tags = 0x80;
|
||||
|
||||
// Skip characters belonging to range [0; 32) instead of "&#xNN;" encoding. This flag is off by default.
|
||||
const unsigned int format_skip_control_chars = 0x100;
|
||||
PUGIXML_INLINE_VAR const unsigned int format_skip_control_chars = 0x100;
|
||||
|
||||
// Use single quotes ' instead of double quotes " for enclosing attribute values. This flag is off by default.
|
||||
const unsigned int format_attribute_single_quote = 0x200;
|
||||
PUGIXML_INLINE_VAR const unsigned int format_attribute_single_quote = 0x200;
|
||||
|
||||
// The default set of formatting flags.
|
||||
// Nodes are indented depending on their depth in DOM tree, a default declaration is output if document has none.
|
||||
const unsigned int format_default = format_indent;
|
||||
PUGIXML_INLINE_VAR const unsigned int format_default = format_indent;
|
||||
|
||||
const int default_double_precision = 17;
|
||||
const int default_float_precision = 9;
|
||||
PUGIXML_INLINE_VAR const int default_double_precision = 17;
|
||||
PUGIXML_INLINE_VAR const int default_float_precision = 9;
|
||||
|
||||
// Forward declarations
|
||||
struct xml_attribute_struct;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user