rapidxml.hpp
Go to the documentation of this file.
1 // #pragma once is deliberately not used to make it possible to include both ArmarX and Simox rapidxml
2 #ifndef __RAPIDXML_H_INCLUDE__
3 #define __RAPIDXML_H_INCLUDE__
4 
5 // Copyright (C) 2006, 2009 Marcin Kalicinski
6 // Version 1.13
7 // Revision $DateTime: 2009/05/13 01:46:17 $
8 //! \file rapidxml.hpp This file contains rapidxml parser and DOM implementation
9 
10 // If standard library is disabled, user must provide implementations of required functions and typedefs
11 #if !defined(RAPIDXML_NO_STDLIB)
12 #include <cstdlib> // For std::size_t
13 #include <cassert> // For assert
14 #include <new> // For placement new
15 #endif
16 
17 // On MSVC, disable "conditional expression is constant" warning (level 4).
18 // This warning is almost impossible to avoid with certain types of templated code
19 #ifdef _MSC_VER
20 #pragma warning(push)
21 #pragma warning(disable:4127) // Conditional expression is constant
22 #endif
23 
24 ///////////////////////////////////////////////////////////////////////////
25 // RAPIDXML_PARSE_ERROR
26 
27 #if defined(RAPIDXML_NO_EXCEPTIONS)
28 
29 #define RAPIDXML_PARSE_ERROR(what, where) { parse_error_handler(what, where); assert(0); }
30 
31 namespace rapidxml
32 {
33  //! When exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS,
34  //! this function is called to notify user about the error.
35  //! It must be defined by the user.
36  //! <br><br>
37  //! This function cannot return. If it does, the results are undefined.
38  //! <br><br>
39  //! A very simple definition might look like that:
40  //! <pre>
41  //! void %rapidxml::%parse_error_handler(const char *what, void *where)
42  //! {
43  //! std::cout << "Parse error: " << what << "\n";
44  //! std::abort();
45  //! }
46  //! </pre>
47  //! \param what Human readable description of the error.
48  //! \param where Pointer to character data where error was detected.
49  void parse_error_handler(const char* what, void* where);
50 }
51 
52 #else
53 
54 #include <exception> // For std::exception
55 
56 #define RAPIDXML_PARSE_ERROR(what, where) throw parse_error(what, where)
57 
58 namespace rapidxml
59 {
60 
61  //! Parse error exception.
62  //! This exception is thrown by the parser when an error occurs.
63  //! Use what() function to get human-readable error message.
64  //! Use where() function to get a pointer to position within source text where error was detected.
65  //! <br><br>
66  //! If throwing exceptions by the parser is undesirable,
67  //! it can be disabled by defining RAPIDXML_NO_EXCEPTIONS macro before rapidxml.hpp is included.
68  //! This will cause the parser to call rapidxml::parse_error_handler() function instead of throwing an exception.
69  //! This function must be defined by the user.
70  //! <br><br>
71  //! This class derives from <code>std::exception</code> class.
72  class parse_error: public std::exception
73  {
74 
75  public:
76 
77  //! Constructs parse error
78  parse_error(const char* what, void* where)
79  : m_what(what)
80  , m_where(where)
81  {
82  }
83 
84  //! Gets human readable description of error.
85  //! \return Pointer to null terminated description of the error.
86  const char* what() const noexcept override
87  {
88  return m_what;
89  }
90 
91  //! Gets pointer to character data where error happened.
92  //! Ch should be the same as char type of xml_document that produced the error.
93  //! \return Pointer to location within the parsed string where error occured.
94  template<class Ch>
95  Ch* where() const
96  {
97  return reinterpret_cast<Ch*>(m_where);
98  }
99 
100  private:
101 
102  const char* m_what;
103  void* m_where;
104 
105  };
106 }
107 
108 #endif
109 
110 ///////////////////////////////////////////////////////////////////////////
111 // Pool sizes
112 
113 #ifndef RAPIDXML_STATIC_POOL_SIZE
114 // Size of static memory block of memory_pool.
115 // Define RAPIDXML_STATIC_POOL_SIZE before including rapidxml.hpp if you want to override the default value.
116 // No dynamic memory allocations are performed by memory_pool until static memory is exhausted.
117 #define RAPIDXML_STATIC_POOL_SIZE (64 * 1024)
118 #endif
119 
120 #ifndef RAPIDXML_DYNAMIC_POOL_SIZE
121 // Size of dynamic memory block of memory_pool.
122 // Define RAPIDXML_DYNAMIC_POOL_SIZE before including rapidxml.hpp if you want to override the default value.
123 // After the static block is exhausted, dynamic blocks with approximately this size are allocated by memory_pool.
124 #define RAPIDXML_DYNAMIC_POOL_SIZE (64 * 1024)
125 #endif
126 
127 #ifndef RAPIDXML_ALIGNMENT
128 // Memory allocation alignment.
129 // Define RAPIDXML_ALIGNMENT before including rapidxml.hpp if you want to override the default value, which is the size of pointer.
130 // All memory allocations for nodes, attributes and strings will be aligned to this value.
131 // This must be a power of 2 and at least 1, otherwise memory_pool will not work.
132 #define RAPIDXML_ALIGNMENT sizeof(void *)
133 #endif
134 
135 namespace rapidxml
136 {
137  // Forward declarations
138  template<class Ch> class xml_node;
139  template<class Ch> class xml_attribute;
140  template<class Ch> class xml_document;
141 
142  //! Enumeration listing all node types produced by the parser.
143  //! Use xml_node::type() function to query node type.
145  {
146  node_document, //!< A document node. Name and value are empty.
147  node_element, //!< An element node. Name contains element name. Value contains text of first data node.
148  node_data, //!< A data node. Name is empty. Value contains data text.
149  node_cdata, //!< A CDATA node. Name is empty. Value contains data text.
150  node_comment, //!< A comment node. Name is empty. Value contains comment text.
151  node_declaration, //!< A declaration node. Name and value are empty. Declaration parameters (version, encoding and standalone) are in node attributes.
152  node_doctype, //!< A DOCTYPE node. Name is empty. Value contains DOCTYPE text.
153  node_pi //!< A PI node. Name contains target. Value contains instructions.
154  };
155 
156  ///////////////////////////////////////////////////////////////////////
157  // Parsing flags
158 
159  //! Parse flag instructing the parser to not create data nodes.
160  //! Text of first data node will still be placed in value of parent element, unless rapidxml::parse_no_element_values flag is also specified.
161  //! Can be combined with other flags by use of | operator.
162  //! <br><br>
163  //! See xml_document::parse() function.
164  const int parse_no_data_nodes = 0x1;
165 
166  //! Parse flag instructing the parser to not use text of first data node as a value of parent element.
167  //! Can be combined with other flags by use of | operator.
168  //! Note that child data nodes of element node take precendence over its value when printing.
169  //! That is, if element has one or more child data nodes <em>and</em> a value, the value will be ignored.
170  //! Use rapidxml::parse_no_data_nodes flag to prevent creation of data nodes if you want to manipulate data using values of elements.
171  //! <br><br>
172  //! See xml_document::parse() function.
173  const int parse_no_element_values = 0x2;
174 
175  //! Parse flag instructing the parser to not place zero terminators after strings in the source text.
176  //! By default zero terminators are placed, modifying source text.
177  //! Can be combined with other flags by use of | operator.
178  //! <br><br>
179  //! See xml_document::parse() function.
181 
182  //! Parse flag instructing the parser to not translate entities in the source text.
183  //! By default entities are translated, modifying source text.
184  //! Can be combined with other flags by use of | operator.
185  //! <br><br>
186  //! See xml_document::parse() function.
188 
189  //! Parse flag instructing the parser to disable UTF-8 handling and assume plain 8 bit characters.
190  //! By default, UTF-8 handling is enabled.
191  //! Can be combined with other flags by use of | operator.
192  //! <br><br>
193  //! See xml_document::parse() function.
194  const int parse_no_utf8 = 0x10;
195 
196  //! Parse flag instructing the parser to create XML declaration node.
197  //! By default, declaration node is not created.
198  //! Can be combined with other flags by use of | operator.
199  //! <br><br>
200  //! See xml_document::parse() function.
201  const int parse_declaration_node = 0x20;
202 
203  //! Parse flag instructing the parser to create comments nodes.
204  //! By default, comment nodes are not created.
205  //! Can be combined with other flags by use of | operator.
206  //! <br><br>
207  //! See xml_document::parse() function.
208  const int parse_comment_nodes = 0x40;
209 
210  //! Parse flag instructing the parser to create DOCTYPE node.
211  //! By default, doctype node is not created.
212  //! Although W3C specification allows at most one DOCTYPE node, RapidXml will silently accept documents with more than one.
213  //! Can be combined with other flags by use of | operator.
214  //! <br><br>
215  //! See xml_document::parse() function.
216  const int parse_doctype_node = 0x80;
217 
218  //! Parse flag instructing the parser to create PI nodes.
219  //! By default, PI nodes are not created.
220  //! Can be combined with other flags by use of | operator.
221  //! <br><br>
222  //! See xml_document::parse() function.
223  const int parse_pi_nodes = 0x100;
224 
225  //! Parse flag instructing the parser to validate closing tag names.
226  //! If not set, name inside closing tag is irrelevant to the parser.
227  //! By default, closing tags are not validated.
228  //! Can be combined with other flags by use of | operator.
229  //! <br><br>
230  //! See xml_document::parse() function.
231  const int parse_validate_closing_tags = 0x200;
232 
233  //! Parse flag instructing the parser to trim all leading and trailing whitespace of data nodes.
234  //! By default, whitespace is not trimmed.
235  //! This flag does not cause the parser to modify source text.
236  //! Can be combined with other flags by use of | operator.
237  //! <br><br>
238  //! See xml_document::parse() function.
239  const int parse_trim_whitespace = 0x400;
240 
241  //! Parse flag instructing the parser to condense all whitespace runs of data nodes to a single space character.
242  //! Trimming of leading and trailing whitespace of data is controlled by rapidxml::parse_trim_whitespace flag.
243  //! By default, whitespace is not normalized.
244  //! If this flag is specified, source text will be modified.
245  //! Can be combined with other flags by use of | operator.
246  //! <br><br>
247  //! See xml_document::parse() function.
248  const int parse_normalize_whitespace = 0x800;
249 
250  // Compound flags
251 
252  //! Parse flags which represent default behaviour of the parser.
253  //! This is always equal to 0, so that all other flags can be simply ored together.
254  //! Normally there is no need to inconveniently disable flags by anding with their negated (~) values.
255  //! This also means that meaning of each flag is a <i>negation</i> of the default setting.
256  //! For example, if flag name is rapidxml::parse_no_utf8, it means that utf-8 is <i>enabled</i> by default,
257  //! and using the flag will disable it.
258  //! <br><br>
259  //! See xml_document::parse() function.
260  const int parse_default = 0;
261 
262  //! A combination of parse flags that forbids any modifications of the source text.
263  //! This also results in faster parsing. However, note that the following will occur:
264  //! <ul>
265  //! <li>names and values of nodes will not be zero terminated, you have to use xml_base::name_size() and xml_base::value_size() functions to determine where name and value ends</li>
266  //! <li>entities will not be translated</li>
267  //! <li>whitespace will not be normalized</li>
268  //! </ul>
269  //! See xml_document::parse() function.
271 
272  //! A combination of parse flags resulting in fastest possible parsing, without sacrificing important data.
273  //! <br><br>
274  //! See xml_document::parse() function.
276 
277  //! A combination of parse flags resulting in largest amount of data being extracted.
278  //! This usually results in slowest parsing.
279  //! <br><br>
280  //! See xml_document::parse() function.
282 
283  ///////////////////////////////////////////////////////////////////////
284  // Internals
285 
286  //! \cond internal
287  namespace internal
288  {
289 
290  // Struct that contains lookup tables for the parser
291  // It must be a template to allow correct linking (because it has static data members, which are defined in a header file).
292  template<int Dummy>
293  struct lookup_tables
294  {
295  static const unsigned char lookup_whitespace[256]; // Whitespace table
296  static const unsigned char lookup_node_name[256]; // Node name table
297  static const unsigned char lookup_text[256]; // Text table
298  static const unsigned char lookup_text_pure_no_ws[256]; // Text table
299  static const unsigned char lookup_text_pure_with_ws[256]; // Text table
300  static const unsigned char lookup_attribute_name[256]; // Attribute name table
301  static const unsigned char lookup_attribute_data_1[256]; // Attribute data table with single quote
302  static const unsigned char lookup_attribute_data_1_pure[256]; // Attribute data table with single quote
303  static const unsigned char lookup_attribute_data_2[256]; // Attribute data table with double quotes
304  static const unsigned char lookup_attribute_data_2_pure[256]; // Attribute data table with double quotes
305  static const unsigned char lookup_digits[256]; // Digits
306  static const unsigned char lookup_upcase[256]; // To uppercase conversion table for ASCII characters
307  };
308 
309  // Find length of the string
310  template<class Ch>
311  inline std::size_t measure(const Ch* p)
312  {
313  const Ch* tmp = p;
314 
315  while (*tmp)
316  {
317  ++tmp;
318  }
319 
320  return tmp - p;
321  }
322 
323  // Compare strings for equality
324  template<class Ch>
325  inline bool compare(const Ch* p1, std::size_t size1, const Ch* p2, std::size_t size2, bool case_sensitive)
326  {
327  if (size1 != size2)
328  {
329  return false;
330  }
331 
332  if (case_sensitive)
333  {
334  for (const Ch* end = p1 + size1; p1 < end; ++p1, ++p2)
335  if (*p1 != *p2)
336  {
337  return false;
338  }
339  }
340  else
341  {
342  for (const Ch* end = p1 + size1; p1 < end; ++p1, ++p2)
343  if (lookup_tables<0>::lookup_upcase[static_cast<unsigned char>(*p1)] != lookup_tables<0>::lookup_upcase[static_cast<unsigned char>(*p2)])
344  {
345  return false;
346  }
347  }
348 
349  return true;
350  }
351  }
352  //! \endcond
353 
354  ///////////////////////////////////////////////////////////////////////
355  // Memory pool
356 
357  //! This class is used by the parser to create new nodes and attributes, without overheads of dynamic memory allocation.
358  //! In most cases, you will not need to use this class directly.
359  //! However, if you need to create nodes manually or modify names/values of nodes,
360  //! you are encouraged to use memory_pool of relevant xml_document to allocate the memory.
361  //! Not only is this faster than allocating them by using <code>new</code> operator,
362  //! but also their lifetime will be tied to the lifetime of document,
363  //! possibly simplyfing memory management.
364  //! <br><br>
365  //! Call allocate_node() or allocate_attribute() functions to obtain new nodes or attributes from the pool.
366  //! You can also call allocate_string() function to allocate strings.
367  //! Such strings can then be used as names or values of nodes without worrying about their lifetime.
368  //! Note that there is no <code>free()</code> function -- all allocations are freed at once when clear() function is called,
369  //! or when the pool is destroyed.
370  //! <br><br>
371  //! It is also possible to create a standalone memory_pool, and use it
372  //! to allocate nodes, whose lifetime will not be tied to any document.
373  //! <br><br>
374  //! Pool maintains <code>RAPIDXML_STATIC_POOL_SIZE</code> bytes of statically allocated memory.
375  //! Until static memory is exhausted, no dynamic memory allocations are done.
376  //! When static memory is exhausted, pool allocates additional blocks of memory of size <code>RAPIDXML_DYNAMIC_POOL_SIZE</code> each,
377  //! by using global <code>new[]</code> and <code>delete[]</code> operators.
378  //! This behaviour can be changed by setting custom allocation routines.
379  //! Use set_allocator() function to set them.
380  //! <br><br>
381  //! Allocations for nodes, attributes and strings are aligned at <code>RAPIDXML_ALIGNMENT</code> bytes.
382  //! This value defaults to the size of pointer on target architecture.
383  //! <br><br>
384  //! To obtain absolutely top performance from the parser,
385  //! it is important that all nodes are allocated from a single, contiguous block of memory.
386  //! Otherwise, cache misses when jumping between two (or more) disjoint blocks of memory can slow down parsing quite considerably.
387  //! If required, you can tweak <code>RAPIDXML_STATIC_POOL_SIZE</code>, <code>RAPIDXML_DYNAMIC_POOL_SIZE</code> and <code>RAPIDXML_ALIGNMENT</code>
388  //! to obtain best wasted memory to performance compromise.
389  //! To do it, define their values before rapidxml.hpp file is included.
390  //! \param Ch Character type of created nodes.
391  template<class Ch = char>
393  {
394 
395  public:
396 
397  //! \cond internal
398  typedef void* (alloc_func)(std::size_t); // Type of user-defined function used to allocate memory
399  typedef void (free_func)(void*); // Type of user-defined function used to free memory
400  //! \endcond
401 
402  //! Constructs empty pool with default allocator functions.
404  : m_alloc_func(nullptr)
405  , m_free_func(nullptr)
406  {
407  init();
408  }
409 
410  //! Destroys pool and frees all the memory.
411  //! This causes memory occupied by nodes allocated by the pool to be freed.
412  //! Nodes allocated from the pool are no longer valid.
414  {
415  clear();
416  }
417 
418  //! Allocates a new node from the pool, and optionally assigns name and value to it.
419  //! If the allocation request cannot be accomodated, this function will throw <code>std::bad_alloc</code>.
420  //! If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function
421  //! will call rapidxml::parse_error_handler() function.
422  //! \param type Type of node to create.
423  //! \param name Name to assign to the node, or 0 to assign no name.
424  //! \param value Value to assign to the node, or 0 to assign no value.
425  //! \param name_size Size of name to assign, or 0 to automatically calculate size from name string.
426  //! \param value_size Size of value to assign, or 0 to automatically calculate size from value string.
427  //! \return Pointer to allocated node. This pointer will never be NULL.
429  const Ch* name = nullptr, const Ch* value = nullptr,
430  std::size_t name_size = 0, std::size_t value_size = 0)
431  {
432  void* memory = allocate_aligned(sizeof(xml_node<Ch>));
433  xml_node<Ch>* node = new (memory) xml_node<Ch>(type);
434 
435  if (name)
436  {
437  if (name_size > 0)
438  {
439  node->name(name, name_size);
440  }
441  else
442  {
443  node->name(name);
444  }
445  }
446 
447  if (value)
448  {
449  if (value_size > 0)
450  {
451  node->value(value, value_size);
452  }
453  else
454  {
455  node->value(value);
456  }
457  }
458 
459  return node;
460  }
461 
462  //! Allocates a new attribute from the pool, and optionally assigns name and value to it.
463  //! If the allocation request cannot be accomodated, this function will throw <code>std::bad_alloc</code>.
464  //! If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function
465  //! will call rapidxml::parse_error_handler() function.
466  //! \param name Name to assign to the attribute, or 0 to assign no name.
467  //! \param value Value to assign to the attribute, or 0 to assign no value.
468  //! \param name_size Size of name to assign, or 0 to automatically calculate size from name string.
469  //! \param value_size Size of value to assign, or 0 to automatically calculate size from value string.
470  //! \return Pointer to allocated attribute. This pointer will never be NULL.
471  xml_attribute<Ch>* allocate_attribute(const Ch* name = nullptr, const Ch* value = nullptr,
472  std::size_t name_size = 0, std::size_t value_size = 0)
473  {
474  void* memory = allocate_aligned(sizeof(xml_attribute<Ch>));
475  xml_attribute<Ch>* attribute = new (memory) xml_attribute<Ch>;
476 
477  if (name)
478  {
479  if (name_size > 0)
480  {
481  attribute->name(name, name_size);
482  }
483  else
484  {
485  attribute->name(name);
486  }
487  }
488 
489  if (value)
490  {
491  if (value_size > 0)
492  {
493  attribute->value(value, value_size);
494  }
495  else
496  {
497  attribute->value(value);
498  }
499  }
500 
501  return attribute;
502  }
503 
504  //! Allocates a char array of given size from the pool, and optionally copies a given string to it.
505  //! If the allocation request cannot be accomodated, this function will throw <code>std::bad_alloc</code>.
506  //! If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function
507  //! will call rapidxml::parse_error_handler() function.
508  //! \param source String to initialize the allocated memory with, or 0 to not initialize it.
509  //! \param size Number of characters to allocate, or zero to calculate it automatically from source string length; if size is 0, source string must be specified and null terminated.
510  //! \return Pointer to allocated char array. This pointer will never be NULL.
511  Ch* allocate_string(const Ch* source = 0, std::size_t size = 0)
512  {
513  assert(source || size); // Either source or size (or both) must be specified
514 
515  if (size == 0)
516  {
517  size = internal::measure(source) + 1;
518  }
519 
520  Ch* result = static_cast<Ch*>(allocate_aligned(size * sizeof(Ch)));
521 
522  if (source)
523  for (std::size_t i = 0; i < size; ++i)
524  {
525  result[i] = source[i];
526  }
527 
528  return result;
529  }
530 
531  //! Clones an xml_node and its hierarchy of child nodes and attributes.
532  //! Nodes and attributes are allocated from this memory pool.
533  //! Names and values are not cloned, they are shared between the clone and the source.
534  //! Result node can be optionally specified as a second parameter,
535  //! in which case its contents will be replaced with cloned source node.
536  //! This is useful when you want to clone entire document.
537  //! \param source Node to clone.
538  //! \param result Node to put results in, or 0 to automatically allocate result node
539  //! \return Pointer to cloned node. This pointer will never be NULL.
541  {
542  // Prepare result node
543  if (result)
544  {
545  result->remove_all_attributes();
546  result->remove_all_nodes();
547  result->type(source->type());
548  }
549  else
550  {
551  result = allocate_node(source->type());
552  }
553 
554  // Clone name and value
555  result->name(source->name(), source->name_size());
556  result->value(source->value(), source->value_size());
557 
558  // Clone child nodes and attributes
559  for (xml_node<Ch>* child = source->first_node(); child; child = child->next_sibling())
560  {
561  result->append_node(clone_node(child));
562  }
563 
564  for (xml_attribute<Ch>* attr = source->first_attribute(); attr; attr = attr->next_attribute())
565  {
566  result->append_attribute(allocate_attribute(attr->name(), attr->value(), attr->name_size(), attr->value_size()));
567  }
568 
569  return result;
570  }
571 
572  //! Clears the pool.
573  //! This causes memory occupied by nodes allocated by the pool to be freed.
574  //! Any nodes or strings allocated from the pool will no longer be valid.
575  void clear()
576  {
577  while (m_begin != m_static_memory)
578  {
579  char* previous_begin = reinterpret_cast<header*>(align(m_begin))->previous_begin;
580 
581  if (m_free_func)
582  {
583  m_free_func(m_begin);
584  }
585  else
586  {
587  delete[] m_begin;
588  }
589 
590  m_begin = previous_begin;
591  }
592 
593  init();
594  }
595 
596  //! Sets or resets the user-defined memory allocation functions for the pool.
597  //! This can only be called when no memory is allocated from the pool yet, otherwise results are undefined.
598  //! Allocation function must not return invalid pointer on failure. It should either throw,
599  //! stop the program, or use <code>longjmp()</code> function to pass control to other place of program.
600  //! If it returns invalid pointer, results are undefined.
601  //! <br><br>
602  //! User defined allocation functions must have the following forms:
603  //! <br><code>
604  //! <br>void *allocate(std::size_t size);
605  //! <br>void free(void *pointer);
606  //! </code><br>
607  //! \param af Allocation function, or 0 to restore default function
608  //! \param ff Free function, or 0 to restore default function
609  void set_allocator(alloc_func* af, free_func* ff)
610  {
611  assert(m_begin == m_static_memory && m_ptr == align(m_begin)); // Verify that no memory is allocated yet
612  m_alloc_func = af;
613  m_free_func = ff;
614  }
615 
616  private:
617 
618  struct header
619  {
620  char* previous_begin;
621  };
622 
623  void init()
624  {
625  m_begin = m_static_memory;
626  m_ptr = align(m_begin);
627  m_end = m_static_memory + sizeof(m_static_memory);
628  }
629 
630  char* align(char* ptr)
631  {
632  std::size_t alignment = ((RAPIDXML_ALIGNMENT - (std::size_t(ptr) & (RAPIDXML_ALIGNMENT - 1))) & (RAPIDXML_ALIGNMENT - 1));
633  return ptr + alignment;
634  }
635 
636  char* allocate_raw(std::size_t size)
637  {
638  // Allocate
639  void* memory;
640 
641  if (m_alloc_func) // Allocate memory using either user-specified allocation function or global operator new[]
642  {
643  memory = m_alloc_func(size);
644  assert(memory); // Allocator is not allowed to return 0, on failure it must either throw, stop the program or use longjmp
645  }
646  else
647  {
648  memory = new char[size];
649 #ifdef RAPIDXML_NO_EXCEPTIONS
650 
651  if (!memory) // If exceptions are disabled, verify memory allocation, because new will not be able to throw bad_alloc
652  {
653  RAPIDXML_PARSE_ERROR("out of memory", 0);
654  }
655 
656 #endif
657  }
658 
659  return static_cast<char*>(memory);
660  }
661 
662  void* allocate_aligned(std::size_t size)
663  {
664  // Calculate aligned pointer
665  char* result = align(m_ptr);
666 
667  // If not enough memory left in current pool, allocate a new pool
668  if (result + size > m_end)
669  {
670  // Calculate required pool size (may be bigger than RAPIDXML_DYNAMIC_POOL_SIZE)
671  std::size_t pool_size = RAPIDXML_DYNAMIC_POOL_SIZE;
672 
673  if (pool_size < size)
674  {
675  pool_size = size;
676  }
677 
678  // Allocate
679  std::size_t alloc_size = sizeof(header) + (2 * RAPIDXML_ALIGNMENT - 2) + pool_size; // 2 alignments required in worst case: one for header, one for actual allocation
680  char* raw_memory = allocate_raw(alloc_size);
681 
682  // Setup new pool in allocated memory
683  char* pool = align(raw_memory);
684  header* new_header = reinterpret_cast<header*>(pool);
685  new_header->previous_begin = m_begin;
686  m_begin = raw_memory;
687  m_ptr = pool + sizeof(header);
688  m_end = raw_memory + alloc_size;
689 
690  // Calculate aligned pointer again using new pool
691  result = align(m_ptr);
692  }
693 
694  // Update pool and return aligned pointer
695  m_ptr = result + size;
696  return result;
697  }
698 
699  char* m_begin; // Start of raw memory making up current pool
700  char* m_ptr; // First free byte in current pool
701  char* m_end; // One past last available byte in current pool
702  char m_static_memory[RAPIDXML_STATIC_POOL_SIZE]; // Static raw memory
703  alloc_func* m_alloc_func; // Allocator function, or 0 if default is to be used
704  free_func* m_free_func; // Free function, or 0 if default is to be used
705  };
706 
707  ///////////////////////////////////////////////////////////////////////////
708  // XML base
709 
710  //! Base class for xml_node and xml_attribute implementing common functions:
711  //! name(), name_size(), value(), value_size() and parent().
712  //! \param Ch Character type to use
713  template<class Ch = char>
714  class xml_base
715  {
716 
717  public:
718 
719  ///////////////////////////////////////////////////////////////////////////
720  // Construction & destruction
721 
722  // Construct a base with empty name, value and parent
724  : m_name(nullptr)
725  , m_value(nullptr)
726  , m_parent(nullptr)
727  {
728  }
729 
730  ///////////////////////////////////////////////////////////////////////////
731  // Node data access
732 
733  //! Gets name of the node.
734  //! Interpretation of name depends on type of node.
735  //! Note that name will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse.
736  //! <br><br>
737  //! Use name_size() function to determine length of the name.
738  //! \return Name of node, or empty string if node has no name.
739  Ch* name() const
740  {
741  return m_name ? m_name : nullstr();
742  }
743 
744  //! Gets size of node name, not including terminator character.
745  //! This function works correctly irrespective of whether name is or is not zero terminated.
746  //! \return Size of node name, in characters.
747  std::size_t name_size() const
748  {
749  return m_name ? m_name_size : 0;
750  }
751 
752  //! Gets value of node.
753  //! Interpretation of value depends on type of node.
754  //! Note that value will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse.
755  //! <br><br>
756  //! Use value_size() function to determine length of the value.
757  //! \return Value of node, or empty string if node has no value.
758  Ch* value() const
759  {
760  return m_value ? m_value : nullstr();
761  }
762 
763  //! Gets size of node value, not including terminator character.
764  //! This function works correctly irrespective of whether value is or is not zero terminated.
765  //! \return Size of node value, in characters.
766  std::size_t value_size() const
767  {
768  return m_value ? m_value_size : 0;
769  }
770 
771  ///////////////////////////////////////////////////////////////////////////
772  // Node modification
773 
774  //! Sets name of node to a non zero-terminated string.
775  //! See \ref ownership_of_strings.
776  //! <br><br>
777  //! Note that node does not own its name or value, it only stores a pointer to it.
778  //! It will not delete or otherwise free the pointer on destruction.
779  //! It is reponsibility of the user to properly manage lifetime of the string.
780  //! The easiest way to achieve it is to use memory_pool of the document to allocate the string -
781  //! on destruction of the document the string will be automatically freed.
782  //! <br><br>
783  //! Size of name must be specified separately, because name does not have to be zero terminated.
784  //! Use name(const Ch *) function to have the length automatically calculated (string must be zero terminated).
785  //! \param name Name of node to set. Does not have to be zero terminated.
786  //! \param size Size of name, in characters. This does not include zero terminator, if one is present.
787  void name(const Ch* name, std::size_t size)
788  {
789  m_name = const_cast<Ch*>(name);
790  m_name_size = size;
791  }
792 
793  //! Sets name of node to a zero-terminated string.
794  //! See also \ref ownership_of_strings and xml_node::name(const Ch *, std::size_t).
795  //! \param name Name of node to set. Must be zero terminated.
796  void name(const Ch* name)
797  {
798  this->name(name, internal::measure(name));
799  }
800 
801  //! Sets value of node to a non zero-terminated string.
802  //! See \ref ownership_of_strings.
803  //! <br><br>
804  //! Note that node does not own its name or value, it only stores a pointer to it.
805  //! It will not delete or otherwise free the pointer on destruction.
806  //! It is reponsibility of the user to properly manage lifetime of the string.
807  //! The easiest way to achieve it is to use memory_pool of the document to allocate the string -
808  //! on destruction of the document the string will be automatically freed.
809  //! <br><br>
810  //! Size of value must be specified separately, because it does not have to be zero terminated.
811  //! Use value(const Ch *) function to have the length automatically calculated (string must be zero terminated).
812  //! <br><br>
813  //! If an element has a child node of type node_data, it will take precedence over element value when printing.
814  //! If you want to manipulate data of elements using values, use parser flag rapidxml::parse_no_data_nodes to prevent creation of data nodes by the parser.
815  //! \param value value of node to set. Does not have to be zero terminated.
816  //! \param size Size of value, in characters. This does not include zero terminator, if one is present.
817  void value(const Ch* value, std::size_t size)
818  {
819  m_value = const_cast<Ch*>(value);
820  m_value_size = size;
821  }
822 
823  //! Sets value of node to a zero-terminated string.
824  //! See also \ref ownership_of_strings and xml_node::value(const Ch *, std::size_t).
825  //! \param value Vame of node to set. Must be zero terminated.
826  void value(const Ch* value)
827  {
828  this->value(value, internal::measure(value));
829  }
830 
831  ///////////////////////////////////////////////////////////////////////////
832  // Related nodes access
833 
834  //! Gets node parent.
835  //! \return Pointer to parent node, or 0 if there is no parent.
837  {
838  return m_parent;
839  }
840 
841  protected:
842 
843  // Return empty string
844  static Ch* nullstr()
845  {
846  static Ch zero = Ch('\0');
847  return &zero;
848  }
849 
850  Ch* m_name; // Name of node, or 0 if no name
851  Ch* m_value; // Value of node, or 0 if no value
852  std::size_t m_name_size; // Length of node name, or undefined of no name
853  std::size_t m_value_size; // Length of node value, or undefined if no value
854  xml_node<Ch>* m_parent; // Pointer to parent node, or 0 if none
855 
856  };
857 
858  //! Class representing attribute node of XML document.
859  //! Each attribute has name and value strings, which are available through name() and value() functions (inherited from xml_base).
860  //! Note that after parse, both name and value of attribute will point to interior of source text used for parsing.
861  //! Thus, this text must persist in memory for the lifetime of attribute.
862  //! \param Ch Character type to use.
863  template<class Ch = char>
864  class xml_attribute: public xml_base<Ch>
865  {
866 
867  friend class xml_node<Ch>;
868 
869  public:
870 
871  ///////////////////////////////////////////////////////////////////////////
872  // Construction & destruction
873 
874  //! Constructs an empty attribute with the specified type.
875  //! Consider using memory_pool of appropriate xml_document if allocating attributes manually.
877  {
878  }
879 
880  ///////////////////////////////////////////////////////////////////////////
881  // Related nodes access
882 
883  //! Gets document of which attribute is a child.
884  //! \return Pointer to document that contains this attribute, or 0 if there is no parent document.
886  {
887  if (xml_node<Ch>* node = this->parent())
888  {
889  while (node->parent())
890  {
891  node = node->parent();
892  }
893 
894  return node->type() == node_document ? static_cast<xml_document<Ch> *>(node) : 0;
895  }
896  else
897  {
898  return 0;
899  }
900  }
901 
902  //! Gets previous attribute, optionally matching attribute name.
903  //! \param name Name of attribute to find, or 0 to return previous attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
904  //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string
905  //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters
906  //! \return Pointer to found attribute, or 0 if not found.
907  xml_attribute<Ch>* previous_attribute(const Ch* name = 0, std::size_t name_size = 0, bool case_sensitive = true) const
908  {
909  if (name)
910  {
911  if (name_size == 0)
912  {
913  name_size = internal::measure(name);
914  }
915 
916  for (xml_attribute<Ch>* attribute = m_prev_attribute; attribute; attribute = attribute->m_prev_attribute)
917  if (internal::compare(attribute->name(), attribute->name_size(), name, name_size, case_sensitive))
918  {
919  return attribute;
920  }
921 
922  return 0;
923  }
924  else
925  {
926  return this->m_parent ? m_prev_attribute : 0;
927  }
928  }
929 
930  //! Gets next attribute, optionally matching attribute name.
931  //! \param name Name of attribute to find, or 0 to return next attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
932  //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string
933  //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters
934  //! \return Pointer to found attribute, or 0 if not found.
935  xml_attribute<Ch>* next_attribute(const Ch* name = nullptr, std::size_t name_size = 0, bool case_sensitive = true) const
936  {
937  if (name)
938  {
939  if (name_size == 0)
940  {
941  name_size = internal::measure(name);
942  }
943 
944  for (xml_attribute<Ch>* attribute = m_next_attribute; attribute; attribute = attribute->m_next_attribute)
945  if (internal::compare(attribute->name(), attribute->name_size(), name, name_size, case_sensitive))
946  {
947  return attribute;
948  }
949 
950  return nullptr;
951  }
952  else
953  {
954  return this->m_parent ? m_next_attribute : nullptr;
955  }
956  }
957 
958  private:
959 
960  xml_attribute<Ch>* m_prev_attribute; // Pointer to previous sibling of attribute, or 0 if none; only valid if parent is non-zero
961  xml_attribute<Ch>* m_next_attribute; // Pointer to next sibling of attribute, or 0 if none; only valid if parent is non-zero
962 
963  };
964 
965  ///////////////////////////////////////////////////////////////////////////
966  // XML node
967 
968  //! Class representing a node of XML document.
969  //! Each node may have associated name and value strings, which are available through name() and value() functions.
970  //! Interpretation of name and value depends on type of the node.
971  //! Type of node can be determined by using type() function.
972  //! <br><br>
973  //! Note that after parse, both name and value of node, if any, will point interior of source text used for parsing.
974  //! Thus, this text must persist in the memory for the lifetime of node.
975  //! \param Ch Character type to use.
976  template<class Ch = char>
977  class xml_node: public xml_base<Ch>
978  {
979 
980  public:
981 
982  ///////////////////////////////////////////////////////////////////////////
983  // Construction & destruction
984 
985  //! Constructs an empty node with the specified type.
986  //! Consider using memory_pool of appropriate document to allocate nodes manually.
987  //! \param type Type of node to construct.
989  : m_type(type)
990  , m_first_node(nullptr)
991  , m_first_attribute(nullptr)
992  {
993  }
994 
995  ///////////////////////////////////////////////////////////////////////////
996  // Node data access
997 
998  //! Gets type of node.
999  //! \return Type of node.
1000  node_type type() const
1001  {
1002  return m_type;
1003  }
1004 
1005  ///////////////////////////////////////////////////////////////////////////
1006  // Related nodes access
1007 
1008  //! Gets document of which node is a child.
1009  //! \return Pointer to document that contains this node, or 0 if there is no parent document.
1011  {
1012  xml_node<Ch>* node = const_cast<xml_node<Ch> *>(this);
1013 
1014  while (node->parent())
1015  {
1016  node = node->parent();
1017  }
1018 
1019  return node->type() == node_document ? static_cast<xml_document<Ch> *>(node) : 0;
1020  }
1021 
1022  //! Gets first child node, optionally matching node name.
1023  //! \param name Name of child to find, or 0 to return first child regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
1024  //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string
1025  //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters
1026  //! \return Pointer to found child, or 0 if not found.
1027  xml_node<Ch>* first_node(const Ch* name = nullptr, std::size_t name_size = 0, bool case_sensitive = true) const
1028  {
1029  if (name)
1030  {
1031  if (name_size == 0)
1032  {
1033  name_size = internal::measure(name);
1034  }
1035 
1036  for (xml_node<Ch>* child = m_first_node; child; child = child->next_sibling())
1037  if (internal::compare(child->name(), child->name_size(), name, name_size, case_sensitive))
1038  {
1039  return child;
1040  }
1041 
1042  return nullptr;
1043  }
1044  else
1045  {
1046  return m_first_node;
1047  }
1048  }
1049 
1050  //! Gets last child node, optionally matching node name.
1051  //! Behaviour is undefined if node has no children.
1052  //! Use first_node() to test if node has children.
1053  //! \param name Name of child to find, or 0 to return last child regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
1054  //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string
1055  //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters
1056  //! \return Pointer to found child, or 0 if not found.
1057  xml_node<Ch>* last_node(const Ch* name = 0, std::size_t name_size = 0, bool case_sensitive = true) const
1058  {
1059  assert(m_first_node); // Cannot query for last child if node has no children
1060 
1061  if (name)
1062  {
1063  if (name_size == 0)
1064  {
1065  name_size = internal::measure(name);
1066  }
1067 
1068  for (xml_node<Ch>* child = m_last_node; child; child = child->previous_sibling())
1069  if (internal::compare(child->name(), child->name_size(), name, name_size, case_sensitive))
1070  {
1071  return child;
1072  }
1073 
1074  return 0;
1075  }
1076  else
1077  {
1078  return m_last_node;
1079  }
1080  }
1081 
1082  //! Gets previous sibling node, optionally matching node name.
1083  //! Behaviour is undefined if node has no parent.
1084  //! Use parent() to test if node has a parent.
1085  //! \param name Name of sibling to find, or 0 to return previous sibling regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
1086  //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string
1087  //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters
1088  //! \return Pointer to found sibling, or 0 if not found.
1089  xml_node<Ch>* previous_sibling(const Ch* name = 0, std::size_t name_size = 0, bool case_sensitive = true) const
1090  {
1091  assert(this->m_parent); // Cannot query for siblings if node has no parent
1092 
1093  if (name)
1094  {
1095  if (name_size == 0)
1096  {
1097  name_size = internal::measure(name);
1098  }
1099 
1100  for (xml_node<Ch>* sibling = m_prev_sibling; sibling; sibling = sibling->m_prev_sibling)
1101  if (internal::compare(sibling->name(), sibling->name_size(), name, name_size, case_sensitive))
1102  {
1103  return sibling;
1104  }
1105 
1106  return 0;
1107  }
1108  else
1109  {
1110  return m_prev_sibling;
1111  }
1112  }
1113 
1114  //! Gets next sibling node, optionally matching node name.
1115  //! Behaviour is undefined if node has no parent.
1116  //! Use parent() to test if node has a parent.
1117  //! \param name Name of sibling to find, or 0 to return next sibling regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
1118  //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string
1119  //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters
1120  //! \return Pointer to found sibling, or 0 if not found.
1121  xml_node<Ch>* next_sibling(const Ch* name = nullptr, std::size_t name_size = 0, bool case_sensitive = true) const
1122  {
1123  assert(this->m_parent); // Cannot query for siblings if node has no parent
1124 
1125  if (name)
1126  {
1127  if (name_size == 0)
1128  {
1129  name_size = internal::measure(name);
1130  }
1131 
1132  for (xml_node<Ch>* sibling = m_next_sibling; sibling; sibling = sibling->m_next_sibling)
1133  if (internal::compare(sibling->name(), sibling->name_size(), name, name_size, case_sensitive))
1134  {
1135  return sibling;
1136  }
1137 
1138  return nullptr;
1139  }
1140  else
1141  {
1142  return m_next_sibling;
1143  }
1144  }
1145 
1146  //! Gets first attribute of node, optionally matching attribute name.
1147  //! \param name Name of attribute to find, or 0 to return first attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
1148  //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string
1149  //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters
1150  //! \return Pointer to found attribute, or 0 if not found.
1151  xml_attribute<Ch>* first_attribute(const Ch* name = nullptr, std::size_t name_size = 0, bool case_sensitive = true) const
1152  {
1153  if (name)
1154  {
1155  if (name_size == 0)
1156  {
1157  name_size = internal::measure(name);
1158  }
1159 
1160  for (xml_attribute<Ch>* attribute = m_first_attribute; attribute; attribute = attribute->m_next_attribute)
1161  if (internal::compare(attribute->name(), attribute->name_size(), name, name_size, case_sensitive))
1162  {
1163  return attribute;
1164  }
1165 
1166  return nullptr;
1167  }
1168  else
1169  {
1170  return m_first_attribute;
1171  }
1172  }
1173 
1174  //! Gets last attribute of node, optionally matching attribute name.
1175  //! \param name Name of attribute to find, or 0 to return last attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero
1176  //! \param name_size Size of name, in characters, or 0 to have size calculated automatically from string
1177  //! \param case_sensitive Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters
1178  //! \return Pointer to found attribute, or 0 if not found.
1179  xml_attribute<Ch>* last_attribute(const Ch* name = 0, std::size_t name_size = 0, bool case_sensitive = true) const
1180  {
1181  if (name)
1182  {
1183  if (name_size == 0)
1184  {
1185  name_size = internal::measure(name);
1186  }
1187 
1188  for (xml_attribute<Ch>* attribute = m_last_attribute; attribute; attribute = attribute->m_prev_attribute)
1189  if (internal::compare(attribute->name(), attribute->name_size(), name, name_size, case_sensitive))
1190  {
1191  return attribute;
1192  }
1193 
1194  return 0;
1195  }
1196  else
1197  {
1198  return m_first_attribute ? m_last_attribute : 0;
1199  }
1200  }
1201 
1202  ///////////////////////////////////////////////////////////////////////////
1203  // Node modification
1204 
1205  //! Sets type of node.
1206  //! \param type Type of node to set.
1208  {
1209  m_type = type;
1210  }
1211 
1212  ///////////////////////////////////////////////////////////////////////////
1213  // Node manipulation
1214 
1215  //! Prepends a new child node.
1216  //! The prepended child becomes the first child, and all existing children are moved one position back.
1217  //! \param child Node to prepend.
1219  {
1220  assert(child && !child->parent() && child->type() != node_document);
1221 
1222  if (first_node())
1223  {
1224  child->m_next_sibling = m_first_node;
1225  m_first_node->m_prev_sibling = child;
1226  }
1227  else
1228  {
1229  child->m_next_sibling = 0;
1230  m_last_node = child;
1231  }
1232 
1233  m_first_node = child;
1234  child->m_parent = this;
1235  child->m_prev_sibling = 0;
1236  }
1237 
1238  //! Appends a new child node.
1239  //! The appended child becomes the last child.
1240  //! \param child Node to append.
1242  {
1243  assert(child && !child->parent() && child->type() != node_document);
1244 
1245  if (first_node())
1246  {
1247  child->m_prev_sibling = m_last_node;
1248  m_last_node->m_next_sibling = child;
1249  }
1250  else
1251  {
1252  child->m_prev_sibling = nullptr;
1253  m_first_node = child;
1254  }
1255 
1256  m_last_node = child;
1257  child->m_parent = this;
1258  child->m_next_sibling = nullptr;
1259  }
1260 
1261  //! Inserts a new child node at specified place inside the node.
1262  //! All children after and including the specified node are moved one position back.
1263  //! \param where Place where to insert the child, or 0 to insert at the back.
1264  //! \param child Node to insert.
1266  {
1267  assert(!where || where->parent() == this);
1268  assert(child && !child->parent() && child->type() != node_document);
1269 
1270  if (where == m_first_node)
1271  {
1272  prepend_node(child);
1273  }
1274  else if (where == 0)
1275  {
1276  append_node(child);
1277  }
1278  else
1279  {
1280  child->m_prev_sibling = where->m_prev_sibling;
1281  child->m_next_sibling = where;
1282  where->m_prev_sibling->m_next_sibling = child;
1283  where->m_prev_sibling = child;
1284  child->m_parent = this;
1285  }
1286  }
1287 
1288  //! Removes first child node.
1289  //! If node has no children, behaviour is undefined.
1290  //! Use first_node() to test if node has children.
1292  {
1293  assert(first_node());
1294  xml_node<Ch>* child = m_first_node;
1295  m_first_node = child->m_next_sibling;
1296 
1297  if (child->m_next_sibling)
1298  {
1299  child->m_next_sibling->m_prev_sibling = 0;
1300  }
1301  else
1302  {
1303  m_last_node = 0;
1304  }
1305 
1306  child->m_parent = 0;
1307  }
1308 
1309  //! Removes last child of the node.
1310  //! If node has no children, behaviour is undefined.
1311  //! Use first_node() to test if node has children.
1313  {
1314  assert(first_node());
1315  xml_node<Ch>* child = m_last_node;
1316 
1317  if (child->m_prev_sibling)
1318  {
1319  m_last_node = child->m_prev_sibling;
1320  child->m_prev_sibling->m_next_sibling = 0;
1321  }
1322  else
1323  {
1324  m_first_node = 0;
1325  }
1326 
1327  child->m_parent = 0;
1328  }
1329 
1330  //! Removes specified child from the node
1331  // \param where Pointer to child to be removed.
1333  {
1334  assert(where && where->parent() == this);
1335  assert(first_node());
1336 
1337  if (where == m_first_node)
1338  {
1340  }
1341  else if (where == m_last_node)
1342  {
1343  remove_last_node();
1344  }
1345  else
1346  {
1347  where->m_prev_sibling->m_next_sibling = where->m_next_sibling;
1348  where->m_next_sibling->m_prev_sibling = where->m_prev_sibling;
1349  where->m_parent = 0;
1350  }
1351  }
1352 
1353  //! Removes all child nodes (but not attributes).
1355  {
1356  for (xml_node<Ch>* node = first_node(); node; node = node->m_next_sibling)
1357  {
1358  node->m_parent = nullptr;
1359  }
1360 
1361  m_first_node = nullptr;
1362  }
1363 
1364  //! Prepends a new attribute to the node.
1365  //! \param attribute Attribute to prepend.
1367  {
1368  assert(attribute && !attribute->parent());
1369 
1370  if (first_attribute())
1371  {
1372  attribute->m_next_attribute = m_first_attribute;
1373  m_first_attribute->m_prev_attribute = attribute;
1374  }
1375  else
1376  {
1377  attribute->m_next_attribute = 0;
1378  m_last_attribute = attribute;
1379  }
1380 
1381  m_first_attribute = attribute;
1382  attribute->m_parent = this;
1383  attribute->m_prev_attribute = 0;
1384  }
1385 
1386  //! Appends a new attribute to the node.
1387  //! \param attribute Attribute to append.
1389  {
1390  assert(attribute && !attribute->parent());
1391 
1392  if (first_attribute())
1393  {
1394  attribute->m_prev_attribute = m_last_attribute;
1395  m_last_attribute->m_next_attribute = attribute;
1396  }
1397  else
1398  {
1399  attribute->m_prev_attribute = nullptr;
1400  m_first_attribute = attribute;
1401  }
1402 
1403  m_last_attribute = attribute;
1404  attribute->m_parent = this;
1405  attribute->m_next_attribute = nullptr;
1406  }
1407 
1408  //! Inserts a new attribute at specified place inside the node.
1409  //! All attributes after and including the specified attribute are moved one position back.
1410  //! \param where Place where to insert the attribute, or 0 to insert at the back.
1411  //! \param attribute Attribute to insert.
1413  {
1414  assert(!where || where->parent() == this);
1415  assert(attribute && !attribute->parent());
1416 
1417  if (where == m_first_attribute)
1418  {
1419  prepend_attribute(attribute);
1420  }
1421  else if (where == 0)
1422  {
1423  append_attribute(attribute);
1424  }
1425  else
1426  {
1427  attribute->m_prev_attribute = where->m_prev_attribute;
1428  attribute->m_next_attribute = where;
1429  where->m_prev_attribute->m_next_attribute = attribute;
1430  where->m_prev_attribute = attribute;
1431  attribute->m_parent = this;
1432  }
1433  }
1434 
1435  //! Removes first attribute of the node.
1436  //! If node has no attributes, behaviour is undefined.
1437  //! Use first_attribute() to test if node has attributes.
1439  {
1440  assert(first_attribute());
1441  xml_attribute<Ch>* attribute = m_first_attribute;
1442 
1443  if (attribute->m_next_attribute)
1444  {
1445  attribute->m_next_attribute->m_prev_attribute = 0;
1446  }
1447  else
1448  {
1449  m_last_attribute = 0;
1450  }
1451 
1452  attribute->m_parent = 0;
1453  m_first_attribute = attribute->m_next_attribute;
1454  }
1455 
1456  //! Removes last attribute of the node.
1457  //! If node has no attributes, behaviour is undefined.
1458  //! Use first_attribute() to test if node has attributes.
1460  {
1461  assert(first_attribute());
1462  xml_attribute<Ch>* attribute = m_last_attribute;
1463 
1464  if (attribute->m_prev_attribute)
1465  {
1466  attribute->m_prev_attribute->m_next_attribute = 0;
1467  m_last_attribute = attribute->m_prev_attribute;
1468  }
1469  else
1470  {
1471  m_first_attribute = 0;
1472  }
1473 
1474  attribute->m_parent = 0;
1475  }
1476 
1477  //! Removes specified attribute from node.
1478  //! \param where Pointer to attribute to be removed.
1480  {
1481  assert(first_attribute() && where->parent() == this);
1482 
1483  if (where == m_first_attribute)
1484  {
1486  }
1487  else if (where == m_last_attribute)
1488  {
1490  }
1491  else
1492  {
1493  where->m_prev_attribute->m_next_attribute = where->m_next_attribute;
1494  where->m_next_attribute->m_prev_attribute = where->m_prev_attribute;
1495  where->m_parent = 0;
1496  }
1497  }
1498 
1499  //! Removes all attributes of node.
1501  {
1502  for (xml_attribute<Ch>* attribute = first_attribute(); attribute; attribute = attribute->m_next_attribute)
1503  {
1504  attribute->m_parent = nullptr;
1505  }
1506 
1507  m_first_attribute = nullptr;
1508  }
1509 
1510  private:
1511 
1512  ///////////////////////////////////////////////////////////////////////////
1513  // Restrictions
1514 
1515  // No copying
1516  xml_node(const xml_node&);
1517  void operator =(const xml_node&);
1518 
1519  ///////////////////////////////////////////////////////////////////////////
1520  // Data members
1521 
1522  // Note that some of the pointers below have UNDEFINED values if certain other pointers are 0.
1523  // This is required for maximum performance, as it allows the parser to omit initialization of
1524  // unneded/redundant values.
1525  //
1526  // The rules are as follows:
1527  // 1. first_node and first_attribute contain valid pointers, or 0 if node has no children/attributes respectively
1528  // 2. last_node and last_attribute are valid only if node has at least one child/attribute respectively, otherwise they contain garbage
1529  // 3. prev_sibling and next_sibling are valid only if node has a parent, otherwise they contain garbage
1530 
1531  node_type m_type; // Type of node; always valid
1532  xml_node<Ch>* m_first_node; // Pointer to first child node, or 0 if none; always valid
1533  xml_node<Ch>* m_last_node; // Pointer to last child node, or 0 if none; this value is only valid if m_first_node is non-zero
1534  xml_attribute<Ch>* m_first_attribute; // Pointer to first attribute of node, or 0 if none; always valid
1535  xml_attribute<Ch>* m_last_attribute; // Pointer to last attribute of node, or 0 if none; this value is only valid if m_first_attribute is non-zero
1536  xml_node<Ch>* m_prev_sibling; // Pointer to previous sibling of node, or 0 if none; this value is only valid if m_parent is non-zero
1537  xml_node<Ch>* m_next_sibling; // Pointer to next sibling of node, or 0 if none; this value is only valid if m_parent is non-zero
1538 
1539  };
1540 
1541  ///////////////////////////////////////////////////////////////////////////
1542  // XML document
1543 
1544  //! This class represents root of the DOM hierarchy.
1545  //! It is also an xml_node and a memory_pool through public inheritance.
1546  //! Use parse() function to build a DOM tree from a zero-terminated XML text string.
1547  //! parse() function allocates memory for nodes and attributes by using functions of xml_document,
1548  //! which are inherited from memory_pool.
1549  //! To access root node of the document, use the document itself, as if it was an xml_node.
1550  //! \param Ch Character type to use.
1551  template<class Ch = char>
1552  class xml_document: public xml_node<Ch>, public memory_pool<Ch>
1553  {
1554 
1555  public:
1556 
1557  //! Constructs empty XML document
1559  : xml_node<Ch>(node_document)
1560  {
1561  }
1562 
1563  //! Parses zero-terminated XML string according to given flags.
1564  //! Passed string will be modified by the parser, unless rapidxml::parse_non_destructive flag is used.
1565  //! The string must persist for the lifetime of the document.
1566  //! In case of error, rapidxml::parse_error exception will be thrown.
1567  //! <br><br>
1568  //! If you want to parse contents of a file, you must first load the file into the memory, and pass pointer to its beginning.
1569  //! Make sure that data is zero-terminated.
1570  //! <br><br>
1571  //! Document can be parsed into multiple times.
1572  //! Each new call to parse removes previous nodes and attributes (if any), but does not clear memory pool.
1573  //! \param text XML data to parse; pointer is non-const to denote fact that this data may be modified by the parser.
1574  template<int Flags>
1575  void parse(Ch* text)
1576  {
1577  assert(text);
1578 
1579  // Remove current contents
1580  this->remove_all_nodes();
1581  this->remove_all_attributes();
1582 
1583  // Parse BOM, if any
1584  parse_bom<Flags>(text);
1585 
1586  // Parse children
1587  while (1)
1588  {
1589  // Skip whitespace before node
1590  skip<whitespace_pred, Flags>(text);
1591 
1592  if (*text == 0)
1593  {
1594  break;
1595  }
1596 
1597  // Parse and append new child
1598  if (*text == Ch('<'))
1599  {
1600  ++text; // Skip '<'
1601 
1602  if (xml_node<Ch>* node = parse_node<Flags>(text))
1603  {
1604  this->append_node(node);
1605  }
1606  }
1607  else
1608  {
1609  RAPIDXML_PARSE_ERROR("expected <", text);
1610  }
1611  }
1612 
1613  }
1614 
1615  //! Clears the document by deleting all nodes and clearing the memory pool.
1616  //! All nodes owned by document pool are destroyed.
1617  void clear()
1618  {
1619  this->remove_all_nodes();
1620  this->remove_all_attributes();
1622  }
1623 
1624  private:
1625 
1626  ///////////////////////////////////////////////////////////////////////
1627  // Internal character utility functions
1628 
1629  // Detect whitespace character
1630  struct whitespace_pred
1631  {
1632  static unsigned char test(Ch ch)
1633  {
1634  return internal::lookup_tables<0>::lookup_whitespace[static_cast<unsigned char>(ch)];
1635  }
1636  };
1637 
1638  // Detect node name character
1639  struct node_name_pred
1640  {
1641  static unsigned char test(Ch ch)
1642  {
1643  return internal::lookup_tables<0>::lookup_node_name[static_cast<unsigned char>(ch)];
1644  }
1645  };
1646 
1647  // Detect attribute name character
1648  struct attribute_name_pred
1649  {
1650  static unsigned char test(Ch ch)
1651  {
1652  return internal::lookup_tables<0>::lookup_attribute_name[static_cast<unsigned char>(ch)];
1653  }
1654  };
1655 
1656  // Detect text character (PCDATA)
1657  struct text_pred
1658  {
1659  static unsigned char test(Ch ch)
1660  {
1661  return internal::lookup_tables<0>::lookup_text[static_cast<unsigned char>(ch)];
1662  }
1663  };
1664 
1665  // Detect text character (PCDATA) that does not require processing
1666  struct text_pure_no_ws_pred
1667  {
1668  static unsigned char test(Ch ch)
1669  {
1670  return internal::lookup_tables<0>::lookup_text_pure_no_ws[static_cast<unsigned char>(ch)];
1671  }
1672  };
1673 
1674  // Detect text character (PCDATA) that does not require processing
1675  struct text_pure_with_ws_pred
1676  {
1677  static unsigned char test(Ch ch)
1678  {
1679  return internal::lookup_tables<0>::lookup_text_pure_with_ws[static_cast<unsigned char>(ch)];
1680  }
1681  };
1682 
1683  // Detect attribute value character
1684  template<Ch Quote>
1685  struct attribute_value_pred
1686  {
1687  static unsigned char test(Ch ch)
1688  {
1689  if (Quote == Ch('\''))
1690  {
1691  return internal::lookup_tables<0>::lookup_attribute_data_1[static_cast<unsigned char>(ch)];
1692  }
1693 
1694  if (Quote == Ch('\"'))
1695  {
1696  return internal::lookup_tables<0>::lookup_attribute_data_2[static_cast<unsigned char>(ch)];
1697  }
1698 
1699  return 0; // Should never be executed, to avoid warnings on Comeau
1700  }
1701  };
1702 
1703  // Detect attribute value character
1704  template<Ch Quote>
1705  struct attribute_value_pure_pred
1706  {
1707  static unsigned char test(Ch ch)
1708  {
1709  if (Quote == Ch('\''))
1710  {
1711  return internal::lookup_tables<0>::lookup_attribute_data_1_pure[static_cast<unsigned char>(ch)];
1712  }
1713 
1714  if (Quote == Ch('\"'))
1715  {
1716  return internal::lookup_tables<0>::lookup_attribute_data_2_pure[static_cast<unsigned char>(ch)];
1717  }
1718 
1719  return 0; // Should never be executed, to avoid warnings on Comeau
1720  }
1721  };
1722 
1723  // Insert coded character, using UTF8 or 8-bit ASCII
1724  template<int Flags>
1725  static void insert_coded_character(Ch*& text, unsigned long code)
1726  {
1727  if (Flags & parse_no_utf8)
1728  {
1729  // Insert 8-bit ASCII character
1730  // Todo: possibly verify that code is less than 256 and use replacement char otherwise?
1731  text[0] = static_cast<unsigned char>(code);
1732  text += 1;
1733  }
1734  else
1735  {
1736  // Insert UTF8 sequence
1737  if (code < 0x80) // 1 byte sequence
1738  {
1739  text[0] = static_cast<unsigned char>(code);
1740  text += 1;
1741  }
1742  else if (code < 0x800) // 2 byte sequence
1743  {
1744  text[1] = static_cast<unsigned char>((code | 0x80) & 0xBF);
1745  code >>= 6;
1746  text[0] = static_cast<unsigned char>(code | 0xC0);
1747  text += 2;
1748  }
1749  else if (code < 0x10000) // 3 byte sequence
1750  {
1751  text[2] = static_cast<unsigned char>((code | 0x80) & 0xBF);
1752  code >>= 6;
1753  text[1] = static_cast<unsigned char>((code | 0x80) & 0xBF);
1754  code >>= 6;
1755  text[0] = static_cast<unsigned char>(code | 0xE0);
1756  text += 3;
1757  }
1758  else if (code < 0x110000) // 4 byte sequence
1759  {
1760  text[3] = static_cast<unsigned char>((code | 0x80) & 0xBF);
1761  code >>= 6;
1762  text[2] = static_cast<unsigned char>((code | 0x80) & 0xBF);
1763  code >>= 6;
1764  text[1] = static_cast<unsigned char>((code | 0x80) & 0xBF);
1765  code >>= 6;
1766  text[0] = static_cast<unsigned char>(code | 0xF0);
1767  text += 4;
1768  }
1769  else // Invalid, only codes up to 0x10FFFF are allowed in Unicode
1770  {
1771  RAPIDXML_PARSE_ERROR("invalid numeric character entity", text);
1772  }
1773  }
1774  }
1775 
1776  // Skip characters until predicate evaluates to true
1777  template<class StopPred, int Flags>
1778  static void skip(Ch*& text)
1779  {
1780  Ch* tmp = text;
1781 
1782  while (StopPred::test(*tmp))
1783  {
1784  ++tmp;
1785  }
1786 
1787  text = tmp;
1788  }
1789 
1790  // Skip characters until predicate evaluates to true while doing the following:
1791  // - replacing XML character entity references with proper characters (&apos; &amp; &quot; &lt; &gt; &#...;)
1792  // - condensing whitespace sequences to single space character
1793  template<class StopPred, class StopPredPure, int Flags>
1794  static Ch* skip_and_expand_character_refs(Ch*& text)
1795  {
1796  // If entity translation, whitespace condense and whitespace trimming is disabled, use plain skip
1797  if (Flags & parse_no_entity_translation &&
1798  !(Flags & parse_normalize_whitespace) &&
1799  !(Flags & parse_trim_whitespace))
1800  {
1801  skip<StopPred, Flags>(text);
1802  return text;
1803  }
1804 
1805  // Use simple skip until first modification is detected
1806  skip<StopPredPure, Flags>(text);
1807 
1808  // Use translation skip
1809  Ch* src = text;
1810  Ch* dest = src;
1811 
1812  while (StopPred::test(*src))
1813  {
1814  // If entity translation is enabled
1815  if (!(Flags & parse_no_entity_translation))
1816  {
1817  // Test if replacement is needed
1818  if (src[0] == Ch('&'))
1819  {
1820  switch (src[1])
1821  {
1822 
1823  // &amp; &apos;
1824  case Ch('a'):
1825  if (src[2] == Ch('m') && src[3] == Ch('p') && src[4] == Ch(';'))
1826  {
1827  *dest = Ch('&');
1828  ++dest;
1829  src += 5;
1830  continue;
1831  }
1832 
1833  if (src[2] == Ch('p') && src[3] == Ch('o') && src[4] == Ch('s') && src[5] == Ch(';'))
1834  {
1835  *dest = Ch('\'');
1836  ++dest;
1837  src += 6;
1838  continue;
1839  }
1840 
1841  break;
1842 
1843  // &quot;
1844  case Ch('q'):
1845  if (src[2] == Ch('u') && src[3] == Ch('o') && src[4] == Ch('t') && src[5] == Ch(';'))
1846  {
1847  *dest = Ch('"');
1848  ++dest;
1849  src += 6;
1850  continue;
1851  }
1852 
1853  break;
1854 
1855  // &gt;
1856  case Ch('g'):
1857  if (src[2] == Ch('t') && src[3] == Ch(';'))
1858  {
1859  *dest = Ch('>');
1860  ++dest;
1861  src += 4;
1862  continue;
1863  }
1864 
1865  break;
1866 
1867  // &lt;
1868  case Ch('l'):
1869  if (src[2] == Ch('t') && src[3] == Ch(';'))
1870  {
1871  *dest = Ch('<');
1872  ++dest;
1873  src += 4;
1874  continue;
1875  }
1876 
1877  break;
1878 
1879  // &#...; - assumes ASCII
1880  case Ch('#'):
1881  if (src[2] == Ch('x'))
1882  {
1883  unsigned long code = 0;
1884  src += 3; // Skip &#x
1885 
1886  while (1)
1887  {
1888  unsigned char digit = internal::lookup_tables<0>::lookup_digits[static_cast<unsigned char>(*src)];
1889 
1890  if (digit == 0xFF)
1891  {
1892  break;
1893  }
1894 
1895  code = code * 16 + digit;
1896  ++src;
1897  }
1898 
1899  insert_coded_character<Flags>(dest, code); // Put character in output
1900  }
1901  else
1902  {
1903  unsigned long code = 0;
1904  src += 2; // Skip &#
1905 
1906  while (1)
1907  {
1908  unsigned char digit = internal::lookup_tables<0>::lookup_digits[static_cast<unsigned char>(*src)];
1909 
1910  if (digit == 0xFF)
1911  {
1912  break;
1913  }
1914 
1915  code = code * 10 + digit;
1916  ++src;
1917  }
1918 
1919  insert_coded_character<Flags>(dest, code); // Put character in output
1920  }
1921 
1922  if (*src == Ch(';'))
1923  {
1924  ++src;
1925  }
1926  else
1927  {
1928  RAPIDXML_PARSE_ERROR("expected ;", src);
1929  }
1930 
1931  continue;
1932 
1933  // Something else
1934  default:
1935  // Ignore, just copy '&' verbatim
1936  break;
1937 
1938  }
1939  }
1940  }
1941 
1942  // If whitespace condensing is enabled
1943  if (Flags & parse_normalize_whitespace)
1944  {
1945  // Test if condensing is needed
1946  if (whitespace_pred::test(*src))
1947  {
1948  *dest = Ch(' ');
1949  ++dest; // Put single space in dest
1950  ++src; // Skip first whitespace char
1951 
1952  // Skip remaining whitespace chars
1953  while (whitespace_pred::test(*src))
1954  {
1955  ++src;
1956  }
1957 
1958  continue;
1959  }
1960  }
1961 
1962  // No replacement, only copy character
1963  *dest++ = *src++;
1964 
1965  }
1966 
1967  // Return new end
1968  text = src;
1969  return dest;
1970 
1971  }
1972 
1973  ///////////////////////////////////////////////////////////////////////
1974  // Internal parsing functions
1975 
1976  // Parse BOM, if any
1977  template<int Flags>
1978  void parse_bom(Ch*& text)
1979  {
1980  // UTF-8?
1981  if (static_cast<unsigned char>(text[0]) == 0xEF &&
1982  static_cast<unsigned char>(text[1]) == 0xBB &&
1983  static_cast<unsigned char>(text[2]) == 0xBF)
1984  {
1985  text += 3; // Skup utf-8 bom
1986  }
1987  }
1988 
1989  // Parse XML declaration (<?xml...)
1990  template<int Flags>
1991  xml_node<Ch>* parse_xml_declaration(Ch*& text)
1992  {
1993  // If parsing of declaration is disabled
1994  if (!(Flags & parse_declaration_node))
1995  {
1996  // Skip until end of declaration
1997  while (text[0] != Ch('?') || text[1] != Ch('>'))
1998  {
1999  if (!text[0])
2000  {
2001  RAPIDXML_PARSE_ERROR("unexpected end of data", text);
2002  }
2003 
2004  ++text;
2005  }
2006 
2007  text += 2; // Skip '?>'
2008  return nullptr;
2009  }
2010 
2011  // Create declaration
2012  xml_node<Ch>* declaration = this->allocate_node(node_declaration);
2013 
2014  // Skip whitespace before attributes or ?>
2015  skip<whitespace_pred, Flags>(text);
2016 
2017  // Parse declaration attributes
2018  parse_node_attributes<Flags>(text, declaration);
2019 
2020  // Skip ?>
2021  if (text[0] != Ch('?') || text[1] != Ch('>'))
2022  {
2023  RAPIDXML_PARSE_ERROR("expected ?>", text);
2024  }
2025 
2026  text += 2;
2027 
2028  return declaration;
2029  }
2030 
2031  // Parse XML comment (<!--...)
2032  template<int Flags>
2033  xml_node<Ch>* parse_comment(Ch*& text)
2034  {
2035  // If parsing of comments is disabled
2036  if (!(Flags & parse_comment_nodes))
2037  {
2038  // Skip until end of comment
2039  while (text[0] != Ch('-') || text[1] != Ch('-') || text[2] != Ch('>'))
2040  {
2041  if (!text[0])
2042  {
2043  RAPIDXML_PARSE_ERROR("unexpected end of data", text);
2044  }
2045 
2046  ++text;
2047  }
2048 
2049  text += 3; // Skip '-->'
2050  return nullptr; // Do not produce comment node
2051  }
2052 
2053  // Remember value start
2054  Ch* value = text;
2055 
2056  // Skip until end of comment
2057  while (text[0] != Ch('-') || text[1] != Ch('-') || text[2] != Ch('>'))
2058  {
2059  if (!text[0])
2060  {
2061  RAPIDXML_PARSE_ERROR("unexpected end of data", text);
2062  }
2063 
2064  ++text;
2065  }
2066 
2067  // Create comment node
2068  xml_node<Ch>* comment = this->allocate_node(node_comment);
2069  comment->value(value, text - value);
2070 
2071  // Place zero terminator after comment value
2072  if (!(Flags & parse_no_string_terminators))
2073  {
2074  *text = Ch('\0');
2075  }
2076 
2077  text += 3; // Skip '-->'
2078  return comment;
2079  }
2080 
2081  // Parse DOCTYPE
2082  template<int Flags>
2083  xml_node<Ch>* parse_doctype(Ch*& text)
2084  {
2085  // Remember value start
2086  Ch* value = text;
2087 
2088  // Skip to >
2089  while (*text != Ch('>'))
2090  {
2091  // Determine character type
2092  switch (*text)
2093  {
2094 
2095  // If '[' encountered, scan for matching ending ']' using naive algorithm with depth
2096  // This works for all W3C test files except for 2 most wicked
2097  case Ch('['):
2098  {
2099  ++text; // Skip '['
2100  int depth = 1;
2101 
2102  while (depth > 0)
2103  {
2104  switch (*text)
2105  {
2106  case Ch('['):
2107  ++depth;
2108  break;
2109 
2110  case Ch(']'):
2111  --depth;
2112  break;
2113 
2114  case 0:
2115  RAPIDXML_PARSE_ERROR("unexpected end of data", text);
2116  }
2117 
2118  ++text;
2119  }
2120 
2121  break;
2122  }
2123 
2124  // Error on end of text
2125  case Ch('\0'):
2126  RAPIDXML_PARSE_ERROR("unexpected end of data", text);
2127 
2128  // Other character, skip it
2129  default:
2130  ++text;
2131 
2132  }
2133  }
2134 
2135  // If DOCTYPE nodes enabled
2136  if (Flags & parse_doctype_node)
2137  {
2138  // Create a new doctype node
2139  xml_node<Ch>* doctype = this->allocate_node(node_doctype);
2140  doctype->value(value, text - value);
2141 
2142  // Place zero terminator after value
2143  if (!(Flags & parse_no_string_terminators))
2144  {
2145  *text = Ch('\0');
2146  }
2147 
2148  text += 1; // skip '>'
2149  return doctype;
2150  }
2151  else
2152  {
2153  text += 1; // skip '>'
2154  return nullptr;
2155  }
2156 
2157  }
2158 
2159  // Parse PI
2160  template<int Flags>
2161  xml_node<Ch>* parse_pi(Ch*& text)
2162  {
2163  // If creation of PI nodes is enabled
2164  if (Flags & parse_pi_nodes)
2165  {
2166  // Create pi node
2167  xml_node<Ch>* pi = this->allocate_node(node_pi);
2168 
2169  // Extract PI target name
2170  Ch* name = text;
2171  skip<node_name_pred, Flags>(text);
2172 
2173  if (text == name)
2174  {
2175  RAPIDXML_PARSE_ERROR("expected PI target", text);
2176  }
2177 
2178  pi->name(name, text - name);
2179 
2180  // Skip whitespace between pi target and pi
2181  skip<whitespace_pred, Flags>(text);
2182 
2183  // Remember start of pi
2184  Ch* value = text;
2185 
2186  // Skip to '?>'
2187  while (text[0] != Ch('?') || text[1] != Ch('>'))
2188  {
2189  if (*text == Ch('\0'))
2190  {
2191  RAPIDXML_PARSE_ERROR("unexpected end of data", text);
2192  }
2193 
2194  ++text;
2195  }
2196 
2197  // Set pi value (verbatim, no entity expansion or whitespace normalization)
2198  pi->value(value, text - value);
2199 
2200  // Place zero terminator after name and value
2201  if (!(Flags & parse_no_string_terminators))
2202  {
2203  pi->name()[pi->name_size()] = Ch('\0');
2204  pi->value()[pi->value_size()] = Ch('\0');
2205  }
2206 
2207  text += 2; // Skip '?>'
2208  return pi;
2209  }
2210  else
2211  {
2212  // Skip to '?>'
2213  while (text[0] != Ch('?') || text[1] != Ch('>'))
2214  {
2215  if (*text == Ch('\0'))
2216  {
2217  RAPIDXML_PARSE_ERROR("unexpected end of data", text);
2218  }
2219 
2220  ++text;
2221  }
2222 
2223  text += 2; // Skip '?>'
2224  return nullptr;
2225  }
2226  }
2227 
2228  // Parse and append data
2229  // Return character that ends data.
2230  // This is necessary because this character might have been overwritten by a terminating 0
2231  template<int Flags>
2232  Ch parse_and_append_data(xml_node<Ch>* node, Ch*& text, Ch* contents_start)
2233  {
2234  // Backup to contents start if whitespace trimming is disabled
2235  if (!(Flags & parse_trim_whitespace))
2236  {
2237  text = contents_start;
2238  }
2239 
2240  // Skip until end of data
2241  Ch* value = text, *end;
2242 
2243  if (Flags & parse_normalize_whitespace)
2244  {
2245  end = skip_and_expand_character_refs<text_pred, text_pure_with_ws_pred, Flags>(text);
2246  }
2247  else
2248  {
2249  end = skip_and_expand_character_refs<text_pred, text_pure_no_ws_pred, Flags>(text);
2250  }
2251 
2252  // Trim trailing whitespace if flag is set; leading was already trimmed by whitespace skip after >
2253  if (Flags & parse_trim_whitespace)
2254  {
2255  if (Flags & parse_normalize_whitespace)
2256  {
2257  // Whitespace is already condensed to single space characters by skipping function, so just trim 1 char off the end
2258  if (*(end - 1) == Ch(' '))
2259  {
2260  --end;
2261  }
2262  }
2263  else
2264  {
2265  // Backup until non-whitespace character is found
2266  while (whitespace_pred::test(*(end - 1)))
2267  {
2268  --end;
2269  }
2270  }
2271  }
2272 
2273  // If characters are still left between end and value (this test is only necessary if normalization is enabled)
2274  // Create new data node
2275  if (!(Flags & parse_no_data_nodes))
2276  {
2277  xml_node<Ch>* data = this->allocate_node(node_data);
2278  data->value(value, end - value);
2279  node->append_node(data);
2280  }
2281 
2282  // Add data to parent node if no data exists yet
2283  if (!(Flags & parse_no_element_values))
2284  if (*node->value() == Ch('\0'))
2285  {
2286  node->value(value, end - value);
2287  }
2288 
2289  // Place zero terminator after value
2290  if (!(Flags & parse_no_string_terminators))
2291  {
2292  Ch ch = *text;
2293  *end = Ch('\0');
2294  return ch; // Return character that ends data; this is required because zero terminator overwritten it
2295  }
2296 
2297  // Return character that ends data
2298  return *text;
2299  }
2300 
2301  // Parse CDATA
2302  template<int Flags>
2303  xml_node<Ch>* parse_cdata(Ch*& text)
2304  {
2305  // If CDATA is disabled
2306  if (Flags & parse_no_data_nodes)
2307  {
2308  // Skip until end of cdata
2309  while (text[0] != Ch(']') || text[1] != Ch(']') || text[2] != Ch('>'))
2310  {
2311  if (!text[0])
2312  {
2313  RAPIDXML_PARSE_ERROR("unexpected end of data", text);
2314  }
2315 
2316  ++text;
2317  }
2318 
2319  text += 3; // Skip ]]>
2320  return nullptr; // Do not produce CDATA node
2321  }
2322 
2323  // Skip until end of cdata
2324  Ch* value = text;
2325 
2326  while (text[0] != Ch(']') || text[1] != Ch(']') || text[2] != Ch('>'))
2327  {
2328  if (!text[0])
2329  {
2330  RAPIDXML_PARSE_ERROR("unexpected end of data", text);
2331  }
2332 
2333  ++text;
2334  }
2335 
2336  // Create new cdata node
2337  xml_node<Ch>* cdata = this->allocate_node(node_cdata);
2338  cdata->value(value, text - value);
2339 
2340  // Place zero terminator after value
2341  if (!(Flags & parse_no_string_terminators))
2342  {
2343  *text = Ch('\0');
2344  }
2345 
2346  text += 3; // Skip ]]>
2347  return cdata;
2348  }
2349 
2350  // Parse element node
2351  template<int Flags>
2352  xml_node<Ch>* parse_element(Ch*& text)
2353  {
2354  // Create element node
2355  xml_node<Ch>* element = this->allocate_node(node_element);
2356 
2357  // Extract element name
2358  Ch* name = text;
2359  skip<node_name_pred, Flags>(text);
2360 
2361  if (text == name)
2362  {
2363  RAPIDXML_PARSE_ERROR("expected element name", text);
2364  }
2365 
2366  element->name(name, text - name);
2367 
2368  // Skip whitespace between element name and attributes or >
2369  skip<whitespace_pred, Flags>(text);
2370 
2371  // Parse attributes, if any
2372  parse_node_attributes<Flags>(text, element);
2373 
2374  // Determine ending type
2375  if (*text == Ch('>'))
2376  {
2377  ++text;
2378  parse_node_contents<Flags>(text, element);
2379  }
2380  else if (*text == Ch('/'))
2381  {
2382  ++text;
2383 
2384  if (*text != Ch('>'))
2385  {
2386  RAPIDXML_PARSE_ERROR("expected >", text);
2387  }
2388 
2389  ++text;
2390  }
2391  else
2392  {
2393  RAPIDXML_PARSE_ERROR("expected >", text);
2394  }
2395 
2396  // Place zero terminator after name
2397  if (!(Flags & parse_no_string_terminators))
2398  {
2399  element->name()[element->name_size()] = Ch('\0');
2400  }
2401 
2402  // Return parsed element
2403  return element;
2404  }
2405 
2406  // Determine node type, and parse it
2407  template<int Flags>
2408  xml_node<Ch>* parse_node(Ch*& text)
2409  {
2410  // Parse proper node type
2411  switch (text[0])
2412  {
2413 
2414  // <...
2415  default:
2416  // Parse and append element node
2417  return parse_element<Flags>(text);
2418 
2419  // <?...
2420  case Ch('?'):
2421  ++text; // Skip ?
2422 
2423  if ((text[0] == Ch('x') || text[0] == Ch('X')) &&
2424  (text[1] == Ch('m') || text[1] == Ch('M')) &&
2425  (text[2] == Ch('l') || text[2] == Ch('L')) &&
2426  whitespace_pred::test(text[3]))
2427  {
2428  // '<?xml ' - xml declaration
2429  text += 4; // Skip 'xml '
2430  return parse_xml_declaration<Flags>(text);
2431  }
2432  else
2433  {
2434  // Parse PI
2435  return parse_pi<Flags>(text);
2436  }
2437 
2438  // <!...
2439  case Ch('!'):
2440 
2441  // Parse proper subset of <! node
2442  switch (text[1])
2443  {
2444 
2445  // <!-
2446  case Ch('-'):
2447  if (text[2] == Ch('-'))
2448  {
2449  // '<!--' - xml comment
2450  text += 3; // Skip '!--'
2451  return parse_comment<Flags>(text);
2452  }
2453 
2454  break;
2455 
2456  // <![
2457  case Ch('['):
2458  if (text[2] == Ch('C') && text[3] == Ch('D') && text[4] == Ch('A') &&
2459  text[5] == Ch('T') && text[6] == Ch('A') && text[7] == Ch('['))
2460  {
2461  // '<![CDATA[' - cdata
2462  text += 8; // Skip '![CDATA['
2463  return parse_cdata<Flags>(text);
2464  }
2465 
2466  break;
2467 
2468  // <!D
2469  case Ch('D'):
2470  if (text[2] == Ch('O') && text[3] == Ch('C') && text[4] == Ch('T') &&
2471  text[5] == Ch('Y') && text[6] == Ch('P') && text[7] == Ch('E') &&
2472  whitespace_pred::test(text[8]))
2473  {
2474  // '<!DOCTYPE ' - doctype
2475  text += 9; // skip '!DOCTYPE '
2476  return parse_doctype<Flags>(text);
2477  }
2478 
2479  } // switch
2480 
2481  // Attempt to skip other, unrecognized node types starting with <!
2482  ++text; // Skip !
2483 
2484  while (*text != Ch('>'))
2485  {
2486  if (*text == 0)
2487  {
2488  RAPIDXML_PARSE_ERROR("unexpected end of data", text);
2489  }
2490 
2491  ++text;
2492  }
2493 
2494  ++text; // Skip '>'
2495  return nullptr; // No node recognized
2496 
2497  }
2498  }
2499 
2500  // Parse contents of the node - children, data etc.
2501  template<int Flags>
2502  void parse_node_contents(Ch*& text, xml_node<Ch>* node)
2503  {
2504  // For all children and text
2505  while (1)
2506  {
2507  // Skip whitespace between > and node contents
2508  Ch* contents_start = text; // Store start of node contents before whitespace is skipped
2509  skip<whitespace_pred, Flags>(text);
2510  Ch next_char = *text;
2511 
2512  // After data nodes, instead of continuing the loop, control jumps here.
2513  // This is because zero termination inside parse_and_append_data() function
2514  // would wreak havoc with the above code.
2515  // Also, skipping whitespace after data nodes is unnecessary.
2516 after_data_node:
2517 
2518  // Determine what comes next: node closing, child node, data node, or 0?
2519  switch (next_char)
2520  {
2521 
2522  // Node closing or child node
2523  case Ch('<'):
2524  if (text[1] == Ch('/'))
2525  {
2526  // Node closing
2527  text += 2; // Skip '</'
2528 
2529  if (Flags & parse_validate_closing_tags)
2530  {
2531  // Skip and validate closing tag name
2532  Ch* closing_name = text;
2533  skip<node_name_pred, Flags>(text);
2534 
2535  if (!internal::compare(node->name(), node->name_size(), closing_name, text - closing_name, true))
2536  {
2537  RAPIDXML_PARSE_ERROR("invalid closing tag name", text);
2538  }
2539  }
2540  else
2541  {
2542  // No validation, just skip name
2543  skip<node_name_pred, Flags>(text);
2544  }
2545 
2546  // Skip remaining whitespace after node name
2547  skip<whitespace_pred, Flags>(text);
2548 
2549  if (*text != Ch('>'))
2550  {
2551  RAPIDXML_PARSE_ERROR("expected >", text);
2552  }
2553 
2554  ++text; // Skip '>'
2555  return; // Node closed, finished parsing contents
2556  }
2557  else
2558  {
2559  // Child node
2560  ++text; // Skip '<'
2561 
2562  if (xml_node<Ch>* child = parse_node<Flags>(text))
2563  {
2564  node->append_node(child);
2565  }
2566  }
2567 
2568  break;
2569 
2570  // End of data - error
2571  case Ch('\0'):
2572  RAPIDXML_PARSE_ERROR("unexpected end of data", text);
2573 
2574  // Data node
2575  default:
2576  next_char = parse_and_append_data<Flags>(node, text, contents_start);
2577  goto after_data_node; // Bypass regular processing after data nodes
2578 
2579  }
2580  }
2581  }
2582 
2583  // Parse XML attributes of the node
2584  template<int Flags>
2585  void parse_node_attributes(Ch*& text, xml_node<Ch>* node)
2586  {
2587  // For all attributes
2588  while (attribute_name_pred::test(*text))
2589  {
2590  // Extract attribute name
2591  Ch* name = text;
2592  ++text; // Skip first character of attribute name
2593  skip<attribute_name_pred, Flags>(text);
2594 
2595  if (text == name)
2596  {
2597  RAPIDXML_PARSE_ERROR("expected attribute name", name);
2598  }
2599 
2600  // Create new attribute
2601  xml_attribute<Ch>* attribute = this->allocate_attribute();
2602  attribute->name(name, text - name);
2603  node->append_attribute(attribute);
2604 
2605  // Skip whitespace after attribute name
2606  skip<whitespace_pred, Flags>(text);
2607 
2608  // Skip =
2609  if (*text != Ch('='))
2610  {
2611  RAPIDXML_PARSE_ERROR("expected =", text);
2612  }
2613 
2614  ++text;
2615 
2616  // Add terminating zero after name
2617  if (!(Flags & parse_no_string_terminators))
2618  {
2619  attribute->name()[attribute->name_size()] = 0;
2620  }
2621 
2622  // Skip whitespace after =
2623  skip<whitespace_pred, Flags>(text);
2624 
2625  // Skip quote and remember if it was ' or "
2626  Ch quote = *text;
2627 
2628  if (quote != Ch('\'') && quote != Ch('"'))
2629  {
2630  RAPIDXML_PARSE_ERROR("expected ' or \"", text);
2631  }
2632 
2633  ++text;
2634 
2635  // Extract attribute value and expand char refs in it
2636  Ch* value = text, *end;
2637  const int AttFlags = Flags & ~parse_normalize_whitespace; // No whitespace normalization in attributes
2638 
2639  if (quote == Ch('\''))
2640  {
2641  end = skip_and_expand_character_refs < attribute_value_pred < Ch('\'') >, attribute_value_pure_pred < Ch('\'') >, AttFlags > (text);
2642  }
2643  else
2644  {
2645  end = skip_and_expand_character_refs < attribute_value_pred < Ch('"') >, attribute_value_pure_pred < Ch('"') >, AttFlags > (text);
2646  }
2647 
2648  // Set attribute value
2649  attribute->value(value, end - value);
2650 
2651  // Make sure that end quote is present
2652  if (*text != quote)
2653  {
2654  RAPIDXML_PARSE_ERROR("expected ' or \"", text);
2655  }
2656 
2657  ++text; // Skip quote
2658 
2659  // Add terminating zero after value
2660  if (!(Flags & parse_no_string_terminators))
2661  {
2662  attribute->value()[attribute->value_size()] = 0;
2663  }
2664 
2665  // Skip whitespace after attribute value
2666  skip<whitespace_pred, Flags>(text);
2667  }
2668  }
2669 
2670  };
2671 
2672  //! \cond internal
2673  namespace internal
2674  {
2675 
2676  // Whitespace (space \n \r \t)
2677  template<int Dummy>
2678  const unsigned char lookup_tables<Dummy>::lookup_whitespace[256] =
2679  {
2680  // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2681  0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, // 0
2682  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1
2683  1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 2
2684  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 3
2685  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 4
2686  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 5
2687  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6
2688  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 7
2689  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 8
2690  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 9
2691  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // A
2692  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // B
2693  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // C
2694  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // D
2695  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // E
2696  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // F
2697  };
2698 
2699  // Node name (anything but space \n \r \t / > ? \0)
2700  template<int Dummy>
2701  const unsigned char lookup_tables<Dummy>::lookup_node_name[256] =
2702  {
2703  // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2704  0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, // 0
2705  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1
2706  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, // 2
2707  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, // 3
2708  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4
2709  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5
2710  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6
2711  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7
2712  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8
2713  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9
2714  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A
2715  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B
2716  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C
2717  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D
2718  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E
2719  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F
2720  };
2721 
2722  // Text (i.e. PCDATA) (anything but < \0)
2723  template<int Dummy>
2724  const unsigned char lookup_tables<Dummy>::lookup_text[256] =
2725  {
2726  // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2727  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0
2728  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1
2729  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2
2730  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, // 3
2731  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4
2732  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5
2733  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6
2734  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7
2735  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8
2736  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9
2737  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A
2738  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B
2739  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C
2740  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D
2741  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E
2742  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F
2743  };
2744 
2745  // Text (i.e. PCDATA) that does not require processing when ws normalization is disabled
2746  // (anything but < \0 &)
2747  template<int Dummy>
2748  const unsigned char lookup_tables<Dummy>::lookup_text_pure_no_ws[256] =
2749  {
2750  // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2751  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0
2752  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1
2753  1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2
2754  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, // 3
2755  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4
2756  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5
2757  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6
2758  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7
2759  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8
2760  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9
2761  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A
2762  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B
2763  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C
2764  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D
2765  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E
2766  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F
2767  };
2768 
2769  // Text (i.e. PCDATA) that does not require processing when ws normalizationis is enabled
2770  // (anything but < \0 & space \n \r \t)
2771  template<int Dummy>
2772  const unsigned char lookup_tables<Dummy>::lookup_text_pure_with_ws[256] =
2773  {
2774  // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2775  0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, // 0
2776  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1
2777  0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2
2778  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, // 3
2779  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4
2780  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5
2781  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6
2782  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7
2783  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8
2784  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9
2785  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A
2786  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B
2787  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C
2788  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D
2789  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E
2790  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F
2791  };
2792 
2793  // Attribute name (anything but space \n \r \t / < > = ? ! \0)
2794  template<int Dummy>
2795  const unsigned char lookup_tables<Dummy>::lookup_attribute_name[256] =
2796  {
2797  // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2798  0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, // 0
2799  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1
2800  0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, // 2
2801  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, // 3
2802  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4
2803  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5
2804  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6
2805  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7
2806  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8
2807  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9
2808  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A
2809  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B
2810  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C
2811  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D
2812  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E
2813  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F
2814  };
2815 
2816  // Attribute data with single quote (anything but ' \0)
2817  template<int Dummy>
2818  const unsigned char lookup_tables<Dummy>::lookup_attribute_data_1[256] =
2819  {
2820  // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2821  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0
2822  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1
2823  1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, // 2
2824  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 3
2825  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4
2826  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5
2827  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6
2828  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7
2829  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8
2830  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9
2831  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A
2832  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B
2833  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C
2834  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D
2835  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E
2836  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F
2837  };
2838 
2839  // Attribute data with single quote that does not require processing (anything but ' \0 &)
2840  template<int Dummy>
2841  const unsigned char lookup_tables<Dummy>::lookup_attribute_data_1_pure[256] =
2842  {
2843  // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2844  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0
2845  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1
2846  1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, // 2
2847  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 3
2848  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4
2849  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5
2850  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6
2851  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7
2852  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8
2853  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9
2854  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A
2855  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B
2856  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C
2857  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D
2858  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E
2859  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F
2860  };
2861 
2862  // Attribute data with double quote (anything but " \0)
2863  template<int Dummy>
2864  const unsigned char lookup_tables<Dummy>::lookup_attribute_data_2[256] =
2865  {
2866  // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2867  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0
2868  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1
2869  1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2
2870  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 3
2871  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4
2872  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5
2873  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6
2874  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7
2875  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8
2876  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9
2877  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A
2878  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B
2879  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C
2880  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D
2881  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E
2882  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F
2883  };
2884 
2885  // Attribute data with double quote that does not require processing (anything but " \0 &)
2886  template<int Dummy>
2887  const unsigned char lookup_tables<Dummy>::lookup_attribute_data_2_pure[256] =
2888  {
2889  // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2890  0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0
2891  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1
2892  1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 2
2893  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 3
2894  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 4
2895  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 5
2896  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 6
2897  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 7
2898  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 8
2899  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 9
2900  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A
2901  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B
2902  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // C
2903  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // D
2904  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // E
2905  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // F
2906  };
2907 
2908  // Digits (dec and hex, 255 denotes end of numeric character reference)
2909  template<int Dummy>
2910  const unsigned char lookup_tables<Dummy>::lookup_digits[256] =
2911  {
2912  // 0 1 2 3 4 5 6 7 8 9 A B C D E F
2913  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 0
2914  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 1
2915  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 2
2916  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 255, 255, 255, 255, 255, 255, // 3
2917  255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 4
2918  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 5
2919  255, 10, 11, 12, 13, 14, 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 6
2920  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 7
2921  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 8
2922  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 9
2923  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // A
2924  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // B
2925  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // C
2926  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // D
2927  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // E
2928  255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 // F
2929  };
2930 
2931  // Upper case conversion
2932  template<int Dummy>
2933  const unsigned char lookup_tables<Dummy>::lookup_upcase[256] =
2934  {
2935  // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A B C D E F
2936  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0
2937  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, // 1
2938  32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, // 2
2939  48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, // 3
2940  64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 4
2941  80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, // 5
2942  96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 6
2943  80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 123, 124, 125, 126, 127, // 7
2944  128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, // 8
2945  144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, // 9
2946  160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, // A
2947  176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, // B
2948  192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, // C
2949  208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, // D
2950  224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, // E
2951  240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255 // F
2952  };
2953  }
2954  //! \endcond
2955 
2956 }
2957 
2958 // Undefine internal macros
2959 #undef RAPIDXML_PARSE_ERROR
2960 
2961 // On MSVC, restore warnings state
2962 #ifdef _MSC_VER
2963 #pragma warning(pop)
2964 #endif
2965 
2966 #endif
2967 
files
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE The MIT Marcin Kalicinski Permission is hereby free of to any person obtaining a copy of this software and associated documentation files(the "Software")
rapidxml::xml_node::remove_last_attribute
void remove_last_attribute()
Removes last attribute of the node.
Definition: rapidxml.hpp:1459
rapidxml::parse_comment_nodes
const int parse_comment_nodes
Parse flag instructing the parser to create comments nodes.
Definition: rapidxml.hpp:208
distribute
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this distribute
Definition: license.txt:11
rapidxml::xml_attribute::xml_attribute
xml_attribute()
Constructs an empty attribute with the specified type.
Definition: rapidxml.hpp:876
CLAIM
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE The MIT Marcin Kalicinski Permission is hereby free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to and or sell copies of the and to permit persons to whom the Software is furnished to do subject to the following WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM
Definition: license.txt:49
FROM
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR ARISING FROM
Definition: license.txt:28
licenses
Use of this software is granted under one of the following two licenses
Definition: license.txt:1
rapidxml::xml_base::nullstr
static Ch * nullstr()
Definition: rapidxml.hpp:844
rapidxml::xml_attribute::previous_attribute
xml_attribute< Ch > * previous_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets previous attribute, optionally matching attribute name.
Definition: rapidxml.hpp:907
rapidxml::xml_base::m_name_size
std::size_t m_name_size
Definition: rapidxml.hpp:852
granted
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby granted
Definition: license.txt:5
rapidxml::parse_error::what
const char * what() const noexcept override
Gets human readable description of error.
Definition: rapidxml.hpp:86
rapidxml::xml_node::next_sibling
xml_node< Ch > * next_sibling(const Ch *name=nullptr, std::size_t name_size=0, bool case_sensitive=true) const
Gets next sibling node, optionally matching node name.
Definition: rapidxml.hpp:1121
rapidxml::parse_no_data_nodes
const int parse_no_data_nodes
Parse flag instructing the parser to not create data nodes.
Definition: rapidxml.hpp:164
publish
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE The MIT Marcin Kalicinski Permission is hereby free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to publish
Definition: license.txt:39
rapidxml::node_data
@ node_data
A data node. Name is empty. Value contains data text.
Definition: rapidxml.hpp:148
conditions
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE The MIT Marcin Kalicinski Permission is hereby free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to and or sell copies of the and to permit persons to whom the Software is furnished to do subject to the following conditions
Definition: license.txt:46
rapidxml::xml_node::remove_first_node
void remove_first_node()
Removes first child node.
Definition: rapidxml.hpp:1291
rapidxml::xml_base::name
void name(const Ch *name, std::size_t size)
Sets name of node to a non zero-terminated string.
Definition: rapidxml.hpp:787
execute
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this execute
Definition: license.txt:12
part
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in part
Definition: license.txt:18
rapidxml::xml_node::previous_sibling
xml_node< Ch > * previous_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets previous sibling node, optionally matching node name.
Definition: rapidxml.hpp:1089
rapidxml::xml_node::remove_last_node
void remove_last_node()
Removes last child of the node.
Definition: rapidxml.hpp:1312
rapidxml::xml_base::xml_base
xml_base()
Definition: rapidxml.hpp:723
rapidxml::xml_attribute::next_attribute
xml_attribute< Ch > * next_attribute(const Ch *name=nullptr, std::size_t name_size=0, bool case_sensitive=true) const
Gets next attribute, optionally matching attribute name.
Definition: rapidxml.hpp:935
restriction
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE The MIT Marcin Kalicinski Permission is hereby free of to any person obtaining a copy of this software and associated documentation to deal in the Software without restriction
Definition: license.txt:38
rapidxml::xml_node::remove_all_attributes
void remove_all_attributes()
Removes all attributes of node.
Definition: rapidxml.hpp:1500
rapidxml::parse_normalize_whitespace
const int parse_normalize_whitespace
Parse flag instructing the parser to condense all whitespace runs of data nodes to a single space cha...
Definition: rapidxml.hpp:248
rapidxml::node_element
@ node_element
An element node. Name contains element name. Value contains text of first data node.
Definition: rapidxml.hpp:147
rapidxml::memory_pool::clear
void clear()
Clears the pool.
Definition: rapidxml.hpp:575
rapidxml::xml_node::last_attribute
xml_attribute< Ch > * last_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets last attribute of node, optionally matching attribute name.
Definition: rapidxml.hpp:1179
rapidxml::xml_base::m_value_size
std::size_t m_value_size
Definition: rapidxml.hpp:853
rapidxml::parse_fastest
const int parse_fastest
A combination of parse flags resulting in fastest possible parsing, without sacrificing important dat...
Definition: rapidxml.hpp:275
rapidxml::node_declaration
@ node_declaration
A declaration node. Name and value are empty. Declaration parameters (version, encoding and standalon...
Definition: rapidxml.hpp:151
display
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this display
Definition: license.txt:11
OTHERWISE
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR OTHERWISE
Definition: license.txt:27
rapidxml::parse_no_utf8
const int parse_no_utf8
Parse flag instructing the parser to disable UTF-8 handling and assume plain 8 bit characters.
Definition: rapidxml.hpp:194
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
IMPLIED
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR IMPLIED
Definition: license.txt:24
rapidxml::parse_error::parse_error
parse_error(const char *what, void *where)
Constructs parse error.
Definition: rapidxml.hpp:78
rapidxml::parse_pi_nodes
const int parse_pi_nodes
Parse flag instructing the parser to create PI nodes.
Definition: rapidxml.hpp:223
rapidxml::node_document
@ node_document
A document node. Name and value are empty.
Definition: rapidxml.hpp:146
rapidxml::xml_node::first_attribute
xml_attribute< Ch > * first_attribute(const Ch *name=nullptr, std::size_t name_size=0, bool case_sensitive=true) const
Gets first attribute of node, optionally matching attribute name.
Definition: rapidxml.hpp:1151
RAPIDXML_ALIGNMENT
#define RAPIDXML_ALIGNMENT
Definition: rapidxml.hpp:132
PURPOSE
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE
Definition: license.txt:25
rapidxml::parse_no_element_values
const int parse_no_element_values
Parse flag instructing the parser to not use text of first data node as a value of parent element.
Definition: rapidxml.hpp:173
so
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do so
Definition: license.txt:14
rapidxml::memory_pool::allocate_attribute
xml_attribute< Ch > * allocate_attribute(const Ch *name=nullptr, const Ch *value=nullptr, std::size_t name_size=0, std::size_t value_size=0)
Allocates a new attribute from the pool, and optionally assigns name and value to it.
Definition: rapidxml.hpp:471
INCLUDING
Introduction Thank you for taking interest in our work and downloading this software This library implements the algorithm described in the paper R R R Klein Efficient RANSAC for Point Cloud Shape in Computer Graphics Blackwell June If you use this software you should cite the aforementioned paper in any resulting publication Please send comments or bug reports to Ruwen Roland INCLUDING
Definition: ReadMe.txt:43
switch
switch(yytype)
Definition: Grammar.cpp:736
use
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE The MIT Marcin Kalicinski Permission is hereby free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: license.txt:39
pi
#define pi
Definition: Transition.cpp:37
rapidxml::xml_attribute
Class representing attribute node of XML document.
Definition: rapidxml.hpp:139
RAPIDXML_STATIC_POOL_SIZE
#define RAPIDXML_STATIC_POOL_SIZE
Definition: rapidxml.hpp:117
rapidxml::parse_full
const int parse_full
A combination of parse flags resulting in largest amount of data being extracted.
Definition: rapidxml.hpp:281
merge
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE The MIT Marcin Kalicinski Permission is hereby free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to merge
Definition: license.txt:39
rapidxml::xml_attribute::document
xml_document< Ch > * document() const
Gets document of which attribute is a child.
Definition: rapidxml.hpp:885
rapidxml::memory_pool::allocate_string
Ch * allocate_string(const Ch *source=0, std::size_t size=0)
Allocates a char array of given size from the pool, and optionally copies a given string to it.
Definition: rapidxml.hpp:511
rapidxml::xml_node::prepend_attribute
void prepend_attribute(xml_attribute< Ch > *attribute)
Prepends a new attribute to the node.
Definition: rapidxml.hpp:1366
armarx::armem::client::query_fns::all
auto all()
Definition: query_fns.h:10
armarx::ctrlutil::a
double a(double t, double a0, double j)
Definition: CtrlUtil.h:45
rapidxml::xml_node::remove_first_attribute
void remove_first_attribute()
Removes first attribute of the node.
Definition: rapidxml.hpp:1438
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
TO
Introduction Thank you for taking interest in our work and downloading this software This library implements the algorithm described in the paper R R R Klein Efficient RANSAC for Point Cloud Shape in Computer Graphics Blackwell June If you use this software you should cite the aforementioned paper in any resulting publication Please send comments or bug reports to Ruwen Roland BUT NOT LIMITED TO
Definition: ReadMe.txt:44
rapidxml::xml_base::name
Ch * name() const
Gets name of the node.
Definition: rapidxml.hpp:739
copy
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE The MIT Marcin Kalicinski Permission is hereby free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to copy
Definition: license.txt:39
rapidxml::xml_base::value
void value(const Ch *value, std::size_t size)
Sets value of node to a non zero-terminated string.
Definition: rapidxml.hpp:817
if
if(!yyvaluep)
Definition: Grammar.cpp:724
rapidxml
Definition: rapidxml.hpp:58
rapidxml::xml_node::insert_attribute
void insert_attribute(xml_attribute< Ch > *where, xml_attribute< Ch > *attribute)
Inserts a new attribute at specified place inside the node.
Definition: rapidxml.hpp:1412
grant
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license grant
Definition: license.txt:17
rapidxml::parse_validate_closing_tags
const int parse_validate_closing_tags
Parse flag instructing the parser to validate closing tag names.
Definition: rapidxml.hpp:231
rapidxml::node_pi
@ node_pi
A PI node. Name contains target. Value contains instructions.
Definition: rapidxml.hpp:153
rapidxml::memory_pool::allocate_node
xml_node< Ch > * allocate_node(node_type type, const Ch *name=nullptr, const Ch *value=nullptr, std::size_t name_size=0, std::size_t value_size=0)
Allocates a new node from the pool, and optionally assigns name and value to it.
Definition: rapidxml.hpp:428
rapidxml::parse_doctype_node
const int parse_doctype_node
Parse flag instructing the parser to create DOCTYPE node.
Definition: rapidxml.hpp:216
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
rapidxml::parse_non_destructive
const int parse_non_destructive
A combination of parse flags that forbids any modifications of the source text.
Definition: rapidxml.hpp:270
TORT
Introduction Thank you for taking interest in our work and downloading this software This library implements the algorithm described in the paper R R R Klein Efficient RANSAC for Point Cloud Shape in Computer Graphics Blackwell June If you use this software you should cite the aforementioned paper in any resulting publication Please send comments or bug reports to Ruwen Roland BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE
rapidxml::xml_node::type
void type(node_type type)
Sets type of node.
Definition: rapidxml.hpp:1207
License
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE The MIT License
Definition: license.txt:32
RAPIDXML_DYNAMIC_POOL_SIZE
#define RAPIDXML_DYNAMIC_POOL_SIZE
Definition: rapidxml.hpp:124
RAPIDXML_PARSE_ERROR
#define RAPIDXML_PARSE_ERROR(what, where)
Definition: rapidxml.hpp:56
rapidxml::xml_base::name
void name(const Ch *name)
Sets name of node to a zero-terminated string.
Definition: rapidxml.hpp:796
rapidxml::xml_node::remove_attribute
void remove_attribute(xml_attribute< Ch > *where)
Removes specified attribute from node.
Definition: rapidxml.hpp:1479
rapidxml::xml_node::last_node
xml_node< Ch > * last_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets last child node, optionally matching node name.
Definition: rapidxml.hpp:1057
rapidxml::xml_base::m_name
Ch * m_name
Definition: rapidxml.hpp:850
rapidxml::xml_base::m_value
Ch * m_value
Definition: rapidxml.hpp:851
rapidxml::xml_node::insert_node
void insert_node(xml_node< Ch > *where, xml_node< Ch > *child)
Inserts a new child node at specified place inside the node.
Definition: rapidxml.hpp:1265
disclaimer
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following disclaimer
Definition: license.txt:17
rapidxml::parse_error::where
Ch * where() const
Gets pointer to character data where error happened.
Definition: rapidxml.hpp:95
Software
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the Software
Definition: license.txt:12
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:681
rapidxml::node_cdata
@ node_cdata
A CDATA node. Name is empty. Value contains data text.
Definition: rapidxml.hpp:149
CONTRACT
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN CONTRACT
Definition: license.txt:27
rapidxml::xml_node::first_node
xml_node< Ch > * first_node(const Ch *name=nullptr, std::size_t name_size=0, bool case_sensitive=true) const
Gets first child node, optionally matching node name.
Definition: rapidxml.hpp:1027
rapidxml::xml_node::prepend_node
void prepend_node(xml_node< Ch > *child)
Prepends a new child node.
Definition: rapidxml.hpp:1218
rapidxml::parse_trim_whitespace
const int parse_trim_whitespace
Parse flag instructing the parser to trim all leading and trailing whitespace of data nodes.
Definition: rapidxml.hpp:239
rapidxml::xml_node::remove_node
void remove_node(xml_node< Ch > *where)
Removes specified child from the node.
Definition: rapidxml.hpp:1332
rapidxml::parse_default
const int parse_default
Parse flags which represent default behaviour of the parser.
Definition: rapidxml.hpp:260
rapidxml::xml_document
This class represents root of the DOM hierarchy.
Definition: rapidxml.hpp:140
armarx::detail::compare
int compare(const T &lhs, const T &rhs)
Definition: TreeWidgetBuilder.h:278
modify
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE The MIT Marcin Kalicinski Permission is hereby free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to modify
Definition: license.txt:39
charge
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of charge
Definition: license.txt:9
A
class A(deque< T, A >)) ARMARX_OVERLOAD_STD_HASH_FOR_ITERABLE((class T
Enables hashing of std::list.
reproduce
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this reproduce
Definition: license.txt:11
rapidxml::memory_pool::clone_node
xml_node< Ch > * clone_node(const xml_node< Ch > *source, xml_node< Ch > *result=0)
Clones an xml_node and its hierarchy of child nodes and attributes.
Definition: rapidxml.hpp:540
rapidxml::xml_node
Class representing a node of XML document.
Definition: rapidxml.hpp:138
rapidxml::memory_pool::set_allocator
void set_allocator(alloc_func *af, free_func *ff)
Sets or resets the user-defined memory allocation functions for the pool.
Definition: rapidxml.hpp:609
rapidxml::node_type
node_type
Enumeration listing all node types produced by the parser.
Definition: rapidxml.hpp:144
rapidxml::parse_no_entity_translation
const int parse_no_entity_translation
Parse flag instructing the parser to not translate entities in the source text.
Definition: rapidxml.hpp:187
DAMAGES
Introduction Thank you for taking interest in our work and downloading this software This library implements the algorithm described in the paper R R R Klein Efficient RANSAC for Point Cloud Shape in Computer Graphics Blackwell June If you use this software you should cite the aforementioned paper in any resulting publication Please send comments or bug reports to Ruwen Roland BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA, OR PROFITS;OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY
rapidxml::xml_node::append_node
void append_node(xml_node< Ch > *child)
Appends a new child node.
Definition: rapidxml.hpp:1241
rapidxml::xml_node::type
node_type type() const
Gets type of node.
Definition: rapidxml.hpp:1000
following
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the following
Definition: license.txt:16
rapidxml::parse_no_string_terminators
const int parse_no_string_terminators
Parse flag instructing the parser to not place zero terminators after strings in the source text.
Definition: rapidxml.hpp:180
rapidxml::parse_declaration_node
const int parse_declaration_node
Parse flag instructing the parser to create XML declaration node.
Definition: rapidxml.hpp:201
August
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version August
Definition: license.txt:4
rapidxml::node_doctype
@ node_doctype
A DOCTYPE node. Name is empty. Value contains DOCTYPE text.
Definition: rapidxml.hpp:152
rapidxml::xml_base::name_size
std::size_t name_size() const
Gets size of node name, not including terminator character.
Definition: rapidxml.hpp:747
rapidxml::memory_pool::memory_pool
memory_pool()
Constructs empty pool with default allocator functions.
Definition: rapidxml.hpp:403
MERCHANTABILITY
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
Definition: license.txt:24
rapidxml::xml_node::append_attribute
void append_attribute(xml_attribute< Ch > *attribute)
Appends a new attribute to the node.
Definition: rapidxml.hpp:1388
LIABILITY
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY
Definition: license.txt:27
rapidxml::xml_node::document
xml_document< Ch > * document() const
Gets document of which node is a child.
Definition: rapidxml.hpp:1010
rapidxml::xml_base::value
void value(const Ch *value)
Sets value of node to a zero-terminated string.
Definition: rapidxml.hpp:826
rapidxml::xml_base::value
Ch * value() const
Gets value of node.
Definition: rapidxml.hpp:758
KIND
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY KIND
Definition: license.txt:23
rapidxml::xml_document::parse
void parse(Ch *text)
Parses zero-terminated XML string according to given flags.
Definition: rapidxml.hpp:1575
rapidxml::memory_pool
This class is used by the parser to create new nodes and attributes, without overheads of dynamic mem...
Definition: rapidxml.hpp:392
sublicense
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE The MIT Marcin Kalicinski Permission is hereby free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to sublicense
Definition: license.txt:39
rapidxml::parse_error
Parse error exception.
Definition: rapidxml.hpp:72
rapidxml::memory_pool::~memory_pool
~memory_pool()
Destroys pool and frees all the memory.
Definition: rapidxml.hpp:413
rapidxml::xml_base::value_size
std::size_t value_size() const
Gets size of node value, not including terminator character.
Definition: rapidxml.hpp:766
rapidxml::xml_node::xml_node
xml_node(node_type type)
Constructs an empty node with the specified type.
Definition: rapidxml.hpp:988
rapidxml::xml_base::m_parent
xml_node< Ch > * m_parent
Definition: rapidxml.hpp:854
license
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this license(the "Software") to use
rapidxml::xml_base
Base class for xml_node and xml_attribute implementing common functions: name(), name_size(),...
Definition: rapidxml.hpp:714
rapidxml::xml_document::xml_document
xml_document()
Constructs empty XML document.
Definition: rapidxml.hpp:1558
IS
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS IS
Definition: license.txt:23
rapidxml::xml_node::remove_all_nodes
void remove_all_nodes()
Removes all child nodes (but not attributes).
Definition: rapidxml.hpp:1354
rapidxml::xml_base::parent
xml_node< Ch > * parent() const
Gets node parent.
Definition: rapidxml.hpp:836
rapidxml::xml_document::clear
void clear()
Clears the document by deleting all nodes and clearing the memory pool.
Definition: rapidxml.hpp:1617
rapidxml::node_comment
@ node_comment
A comment node. Name is empty. Value contains comment text.
Definition: rapidxml.hpp:150