summaryrefslogtreecommitdiff
path: root/src/pugixml.hpp
AgeCommit message (Collapse)Author
2018-01-07Update all copyright notices to specify year 2018Arseny Kapoulkine
2017-09-25Implement move support for xml_documentArseny Kapoulkine
This change implements the initial version of move construction and assignment support for documents. When moving a document to another document, we always make sure move target is in "clean" state (empty document), and proceed by relocating all structures in the most efficient way possible. Complications arise from the fact that the root (document) node is embedded into xml_document object, so all pointers to it have to change; this includes parent pointers of all first-level children as well as allocator pointers in all memory pages and previous pointer in the first on-heap memory page. Additionally, compact mode makes everything even more complicated because some of the pointers we need to update are stored in the hash table (in fact, document first_child pointer is very likely to be there; some parent pointers in first-level children will be using compact_shared_parent but some won't be) which requires allocating a new hash table which can fail. Some details of this process are not fully fleshed out, especially for compact mode; and this definitely requires many tests.
2017-06-22Deprecate xml_document::load(const char*) and xml_node::select_single_nodeArseny Kapoulkine
These functions were deprecated via comments in 1.5 but never got the deprecated attribute; now is the time! Using deprecated functions produces a warning; to silence it, this change moves the relevant tests to a separate translation unit that has deprecation disabled.
2017-01-26Update copyright year to 2017Arseny Kapoulkine
2016-11-09Add format_no_empty_element_tags flagArseny Kapoulkine
Setting this flag outputs start and end tag for every element, including empty elements. Fixes #118.
2016-11-09Update version to 1.8 everywhereArseny Kapoulkine
2016-11-07Rename xml_document::create/destroy for consistencyArseny Kapoulkine
2016-11-06Reduce MSVC version cutoff for move semantics supportArseny Kapoulkine
MSVC 2010 supported move semantics (partially - but should be good enough for our use case).
2016-11-06Refactor move semantics support detectionArseny Kapoulkine
Do it in one place and set PUGIXML_HAS_MOVE if it's available.
2016-11-06Add VS2013 check for C++11 availability (#121)iFarbod
VS 2013 supports C++11, but __cplusplus macro isn't updated, and it is 199711 so the old check always fails, even though the compiler supports c++11.
2016-10-18Fix a comment before PUGIXML_OVERRIDE macroPavel Kryukov
2016-10-05Add 'override' keyword if C++11 is enabledPavel Kryukov
2016-02-02Implement set/set_value/operator= for long typesArseny Kapoulkine
This makes the coverage for basic numeric types complete (sans long double). Fixes #78.
2016-01-24Fix whitespace issuesStephan Beyer
Git warns when it finds "whitespace errors". This commit gets rid of these whitespace errors for code and adoc files.
2016-01-12Adjust parse_embed_pcdata documentationArseny Kapoulkine
Since round-tripping should not be a problem any more don't mention it.
2016-01-08Add initial support for parse_embed_pcdataArseny Kapoulkine
When this flag is true, PCDATA value is saved to the parent element instead of allocating a new node. This prevents some documents from round-tripping since it loses information, but can provide a significant memory reduction and parsing speedup for some documents.
2015-12-31Update all license/copyright texts to 2016Arseny Kapoulkine
2015-10-10Update version to 1.7Arseny Kapoulkine
2015-09-20Remove extra const from operator= declarationArseny Kapoulkine
This does not really matter too much but it's better to be consistent.
2015-05-14Implement xml_node::attribute with a hintArseny Kapoulkine
Extra argument 'hint' is used to start the attribute lookup; if the attribute is not found the lookup is restarted from the beginning of the attriubte list. This allows to optimize attribute lookups if you need to get many attributes from the node and can make assumptions about the likely ordering. The code is correct regardless of the order, but it is faster than using vanilla lookups if the order matches the calling order. Fixes #30.
2015-04-21XPath: Implement move semantics supportArseny Kapoulkine
xpath_query, xpath_node_set and xpath_variable_set are now moveable. This is a nice performance optimization for variable/node sets, and enables storing xpath_query in containers without using pointers (it's only possible now since the query is not copyable).
2015-04-15Implement copy ctor/assignment for xpath_variable_setArseny Kapoulkine
xpath_variable_set is essentially an associative container; it's about time it became copyable. Implementation is slightly tricky due to out of memory handling. Both copy ctor and assignment operator have strong exception guarantee (even if exceptions are disabled! which translates to "roll back on allocation errors").
2015-04-15Minor xpath_variable refactoringArseny Kapoulkine
The type of the variable is now initialized correctly in the ctor, so that there is no interim invalid state.
2015-04-14Fix xpath_node_set assignment to provide strong exception guaranteeArseny Kapoulkine
Since the type of the set was updated before assignment, assigning in out-of-memory condition could change the type to not match the content.
2015-04-13Refactor format_indent_attributes implementationArseny Kapoulkine
Fix code style and revert redundant parameters/whitespace changes. Also remove format_each_attribute_on_new_line - we're only introducing one extra formatting flag. The flag implies format_indent but does not include its bitmask. Also add a few more tests. Fixes #14.
2015-04-14add align each attribute on new line support with format_indent_attributehalex2005
2015-03-20Update year to 2015Arseny Kapoulkine
2015-03-18Update version to 1.6Arseny Kapoulkine
2015-01-16docs: Add missing float setters to referenceArseny Kapoulkine
Also fix the float/double member order in the header file.
2015-01-16Convert spaces to tabsArseny Kapoulkine
2015-01-16Merge pull request #27 from sdoiel61/masterArseny Kapoulkine
Make float/double round-trip This change also adds xml_text::set and xml_attribute::set_value overloads for float so that float is only printed using just enough digits to represent float, instead of enough digits to represent double.
2015-01-16Add a couple of more overloads for floatsSteve Doiel
2015-01-16Fix attribute round trip for float as wellSteve Doiel
2015-01-09Simplify header-only mode usageArseny Kapoulkine
It's sufficient to define PUGIXML_HEADER_ONLY anywhere now, source is included automatically. This is a second attempt; this time it includes a workaround for QMake bug that caused it to generate incorrect Makefile.
2015-01-06Add xml_text::set for floatSteve Doiel
Make float/double round-trip
2014-11-17Update version to 1.5Arseny Kapoulkine
2014-11-17Rename xml_document::load to load_stringArseny Kapoulkine
This should completely eliminate the confusion between load and load_file. Of course, for compatibility reasons we have to preserve the old variant - it will be deprecated in a future version and subsequently removed.
2014-10-19XPath: Rename xml_node::select_single_node to ::select_nodeArseny Kapoulkine
select_node is shorter and mistyping nodes as node or vice versa should not lead to any issues since return types are substantially different. select_single_node method still works and will be deprecated with an attribute and removed at some point. git-svn-id: https://pugixml.googlecode.com/svn/trunk@1065 99668b35-9821-0410-8761-19e4c4f06640
2014-10-19XPath: Introduce xpath_query::evaluate_nodeArseny Kapoulkine
This method is equivalent to xml_node::select_single_node. This makes select_single_node faster in certain cases by avoiding an allocation and - more importantly - paves the way for future step optimizations. git-svn-id: https://pugixml.googlecode.com/svn/trunk@1064 99668b35-9821-0410-8761-19e4c4f06640
2014-10-03Reorganize xml_memory_page structureArseny Kapoulkine
The page no longer contains 'data' field to use sizeof everywhere instead of offsetof/sizeof inconsistency (that is required because some compilers don't recognize offsetof as compile-time constant). The page no longer contains 'memory' field that is now encoded as an offset byte before the page - this allows us to save one pointer from the static page in the document to keep the size the same as in v1.2 (binary compatibility). git-svn-id: https://pugixml.googlecode.com/svn/trunk@1046 99668b35-9821-0410-8761-19e4c4f06640
2014-10-01Disable document_order optimization after move/append_buffer.Arseny Kapoulkine
Moving nodes results in node order being different from order of allocated names/values; since move is O(1) we can't mark the moved nodes in a subtree so we have to disable the optimization for the entire document. Similarly, if a node is composed of multiple buffers, comparing nodes in different buffers does not result in meaningful order. Since we value correctness over performance, mark the entire document in these cases to disable sorting optimization. git-svn-id: https://pugixml.googlecode.com/svn/trunk@1034 99668b35-9821-0410-8761-19e4c4f06640
2014-10-01Add header bit for 'name or value is shared' flagArseny Kapoulkine
This is required to make it possible to use a pointer to one of the buffers with the document data in nodes but keep offset_debug and (more importantly) XPath document order comparison optimization working. The change increases memory page alignment to 64 bytes (so requires +32 bytes for every page allocation, which should not be a problem - even with non-default 4k pages this is <1% extra cost, with default 32k pages the overhead is 0.1%) git-svn-id: https://pugixml.googlecode.com/svn/trunk@1031 99668b35-9821-0410-8761-19e4c4f06640
2014-08-10Implement node moving functions.Arseny Kapoulkine
The operations itself are O(1) since they just rearrange pointers. However, the validation step is O(logN) due to a sanity check to prevent recursive trees. git-svn-id: https://pugixml.googlecode.com/svn/trunk@1002 99668b35-9821-0410-8761-19e4c4f06640
2014-05-04Add xpath_node_set::iterator that is the same as const_iterator.Arseny Kapoulkine
Exposing true mutable iterators allows the user to violate sorting order contract. However, some generic algorithms (i.e. Boost ForEach) require iterator methods to be present. git-svn-id: https://pugixml.googlecode.com/svn/trunk@998 99668b35-9821-0410-8761-19e4c4f06640
2014-02-25Revert automatic support for header-only mode since it creates problems with ↵Arseny Kapoulkine
qmake. Qmake treats all files that are #include-d as header files, even if the #include is guarded by an #ifdef. It looks like the only solution that allows for transparent header-only support based on preprocessor define involves moving the actual source into a separate header file and including this file in pugixml.cpp. Let's not do it yet. git-svn-id: https://pugixml.googlecode.com/svn/trunk@990 99668b35-9821-0410-8761-19e4c4f06640
2014-02-25Add parse_trim_pcdata parse option.Arseny Kapoulkine
git-svn-id: https://pugixml.googlecode.com/svn/trunk@987 99668b35-9821-0410-8761-19e4c4f06640
2014-02-11Implement document fragment parsing.Arseny Kapoulkine
Introduce a notable behavior change in default parsing mode: documents without a document element node are now considered invalid. This is technically a breaking change, however the amount of documents it affects is very small, all parsed data still persists, and lack of this check results in very confusing behavior in a number of cases. In order to be able to parse documents without an element node, a fragment parsing flag is introduced. Parsing a buffer in fragment mode treats the buffer as a fragment of a valid XML. As a consequence, top-level PCDATA is added to the tree; additionally, there are no restrictions on the number of nodes -- so documents without a document element are considered valid. Due to the way parsing works internally, load_buffer_inplace occasionally can not preserve the document contents if it's parsed in a fragment mode. While unfortunate, this problem is fundamental; since the use case is relatively obscure, hopefully documenting this shortcoming will be enough. git-svn-id: https://pugixml.googlecode.com/svn/trunk@980 99668b35-9821-0410-8761-19e4c4f06640
2014-02-10Update PUGIXML_VERSION defineArseny Kapoulkine
git-svn-id: https://pugixml.googlecode.com/svn/trunk@973 99668b35-9821-0410-8761-19e4c4f06640
2014-02-08Update version to 1.4 and copyright year to 2014.Arseny Kapoulkine
Add tentative changelog for 1.4 to the documentation. Since Google Code no longer allows file upload, replace download links with GitHub release links. git-svn-id: http://pugixml.googlecode.com/svn/trunk@968 99668b35-9821-0410-8761-19e4c4f06640
2014-02-08Enable long long support for C++11 and for MSVC 2008+Arseny Kapoulkine
git-svn-id: http://pugixml.googlecode.com/svn/trunk@967 99668b35-9821-0410-8761-19e4c4f06640