diff --git a/cereal/.gitignore b/3rdparty/cereal/.gitignore similarity index 100% rename from cereal/.gitignore rename to 3rdparty/cereal/.gitignore diff --git a/cereal/.travis.yml b/3rdparty/cereal/.travis.yml similarity index 100% rename from cereal/.travis.yml rename to 3rdparty/cereal/.travis.yml diff --git a/cereal/CMakeLists.txt b/3rdparty/cereal/CMakeLists.txt similarity index 100% rename from cereal/CMakeLists.txt rename to 3rdparty/cereal/CMakeLists.txt diff --git a/cereal/LICENSE b/3rdparty/cereal/LICENSE similarity index 100% rename from cereal/LICENSE rename to 3rdparty/cereal/LICENSE diff --git a/cereal/README.md b/3rdparty/cereal/README.md similarity index 100% rename from cereal/README.md rename to 3rdparty/cereal/README.md diff --git a/cereal/appveyor.yml b/3rdparty/cereal/appveyor.yml similarity index 100% rename from cereal/appveyor.yml rename to 3rdparty/cereal/appveyor.yml diff --git a/cereal/doc/CMakeLists.txt b/3rdparty/cereal/doc/CMakeLists.txt similarity index 100% rename from cereal/doc/CMakeLists.txt rename to 3rdparty/cereal/doc/CMakeLists.txt diff --git a/cereal/doc/DoxygenLayout.xml b/3rdparty/cereal/doc/DoxygenLayout.xml similarity index 100% rename from cereal/doc/DoxygenLayout.xml rename to 3rdparty/cereal/doc/DoxygenLayout.xml diff --git a/cereal/doc/doxygen.in b/3rdparty/cereal/doc/doxygen.in similarity index 100% rename from cereal/doc/doxygen.in rename to 3rdparty/cereal/doc/doxygen.in diff --git a/cereal/doc/footer.html b/3rdparty/cereal/doc/footer.html similarity index 100% rename from cereal/doc/footer.html rename to 3rdparty/cereal/doc/footer.html diff --git a/cereal/doc/mainpage.dox b/3rdparty/cereal/doc/mainpage.dox similarity index 100% rename from cereal/doc/mainpage.dox rename to 3rdparty/cereal/doc/mainpage.dox diff --git a/cereal/include/cereal/access.hpp b/3rdparty/cereal/include/cereal/access.hpp similarity index 100% rename from cereal/include/cereal/access.hpp rename to 3rdparty/cereal/include/cereal/access.hpp diff --git a/cereal/include/cereal/archives/adapters.hpp b/3rdparty/cereal/include/cereal/archives/adapters.hpp similarity index 100% rename from cereal/include/cereal/archives/adapters.hpp rename to 3rdparty/cereal/include/cereal/archives/adapters.hpp diff --git a/cereal/include/cereal/archives/binary.hpp b/3rdparty/cereal/include/cereal/archives/binary.hpp similarity index 100% rename from cereal/include/cereal/archives/binary.hpp rename to 3rdparty/cereal/include/cereal/archives/binary.hpp diff --git a/cereal/include/cereal/archives/json.hpp b/3rdparty/cereal/include/cereal/archives/json.hpp similarity index 100% rename from cereal/include/cereal/archives/json.hpp rename to 3rdparty/cereal/include/cereal/archives/json.hpp diff --git a/cereal/include/cereal/archives/portable_binary.hpp b/3rdparty/cereal/include/cereal/archives/portable_binary.hpp similarity index 100% rename from cereal/include/cereal/archives/portable_binary.hpp rename to 3rdparty/cereal/include/cereal/archives/portable_binary.hpp diff --git a/cereal/include/cereal/archives/xml.hpp b/3rdparty/cereal/include/cereal/archives/xml.hpp similarity index 100% rename from cereal/include/cereal/archives/xml.hpp rename to 3rdparty/cereal/include/cereal/archives/xml.hpp diff --git a/cereal/include/cereal/cereal.hpp b/3rdparty/cereal/include/cereal/cereal.hpp similarity index 100% rename from cereal/include/cereal/cereal.hpp rename to 3rdparty/cereal/include/cereal/cereal.hpp diff --git a/cereal/include/cereal/details/helpers.hpp b/3rdparty/cereal/include/cereal/details/helpers.hpp similarity index 100% rename from cereal/include/cereal/details/helpers.hpp rename to 3rdparty/cereal/include/cereal/details/helpers.hpp diff --git a/cereal/include/cereal/details/polymorphic_impl.hpp b/3rdparty/cereal/include/cereal/details/polymorphic_impl.hpp similarity index 100% rename from cereal/include/cereal/details/polymorphic_impl.hpp rename to 3rdparty/cereal/include/cereal/details/polymorphic_impl.hpp diff --git a/cereal/include/cereal/details/polymorphic_impl_fwd.hpp b/3rdparty/cereal/include/cereal/details/polymorphic_impl_fwd.hpp similarity index 100% rename from cereal/include/cereal/details/polymorphic_impl_fwd.hpp rename to 3rdparty/cereal/include/cereal/details/polymorphic_impl_fwd.hpp diff --git a/cereal/include/cereal/details/static_object.hpp b/3rdparty/cereal/include/cereal/details/static_object.hpp similarity index 100% rename from cereal/include/cereal/details/static_object.hpp rename to 3rdparty/cereal/include/cereal/details/static_object.hpp diff --git a/cereal/include/cereal/details/traits.hpp b/3rdparty/cereal/include/cereal/details/traits.hpp similarity index 100% rename from cereal/include/cereal/details/traits.hpp rename to 3rdparty/cereal/include/cereal/details/traits.hpp diff --git a/cereal/include/cereal/details/util.hpp b/3rdparty/cereal/include/cereal/details/util.hpp similarity index 100% rename from cereal/include/cereal/details/util.hpp rename to 3rdparty/cereal/include/cereal/details/util.hpp diff --git a/cereal/include/cereal/external/base64.hpp b/3rdparty/cereal/include/cereal/external/base64.hpp similarity index 100% rename from cereal/include/cereal/external/base64.hpp rename to 3rdparty/cereal/include/cereal/external/base64.hpp diff --git a/cereal/include/cereal/external/rapidjson/allocators.h b/3rdparty/cereal/include/cereal/external/rapidjson/allocators.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/allocators.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/allocators.h diff --git a/cereal/include/cereal/external/rapidjson/cursorstreamwrapper.h b/3rdparty/cereal/include/cereal/external/rapidjson/cursorstreamwrapper.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/cursorstreamwrapper.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/cursorstreamwrapper.h diff --git a/cereal/include/cereal/external/rapidjson/document.h b/3rdparty/cereal/include/cereal/external/rapidjson/document.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/document.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/document.h diff --git a/cereal/include/cereal/external/rapidjson/encodedstream.h b/3rdparty/cereal/include/cereal/external/rapidjson/encodedstream.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/encodedstream.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/encodedstream.h diff --git a/cereal/include/cereal/external/rapidjson/encodings.h b/3rdparty/cereal/include/cereal/external/rapidjson/encodings.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/encodings.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/encodings.h diff --git a/cereal/include/cereal/external/rapidjson/error/en.h b/3rdparty/cereal/include/cereal/external/rapidjson/error/en.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/error/en.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/error/en.h diff --git a/cereal/include/cereal/external/rapidjson/error/error.h b/3rdparty/cereal/include/cereal/external/rapidjson/error/error.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/error/error.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/error/error.h diff --git a/cereal/include/cereal/external/rapidjson/filereadstream.h b/3rdparty/cereal/include/cereal/external/rapidjson/filereadstream.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/filereadstream.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/filereadstream.h diff --git a/cereal/include/cereal/external/rapidjson/filewritestream.h b/3rdparty/cereal/include/cereal/external/rapidjson/filewritestream.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/filewritestream.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/filewritestream.h diff --git a/cereal/include/cereal/external/rapidjson/fwd.h b/3rdparty/cereal/include/cereal/external/rapidjson/fwd.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/fwd.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/fwd.h diff --git a/cereal/include/cereal/external/rapidjson/internal/biginteger.h b/3rdparty/cereal/include/cereal/external/rapidjson/internal/biginteger.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/internal/biginteger.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/internal/biginteger.h diff --git a/cereal/include/cereal/external/rapidjson/internal/diyfp.h b/3rdparty/cereal/include/cereal/external/rapidjson/internal/diyfp.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/internal/diyfp.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/internal/diyfp.h diff --git a/cereal/include/cereal/external/rapidjson/internal/dtoa.h b/3rdparty/cereal/include/cereal/external/rapidjson/internal/dtoa.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/internal/dtoa.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/internal/dtoa.h diff --git a/cereal/include/cereal/external/rapidjson/internal/ieee754.h b/3rdparty/cereal/include/cereal/external/rapidjson/internal/ieee754.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/internal/ieee754.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/internal/ieee754.h diff --git a/cereal/include/cereal/external/rapidjson/internal/itoa.h b/3rdparty/cereal/include/cereal/external/rapidjson/internal/itoa.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/internal/itoa.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/internal/itoa.h diff --git a/cereal/include/cereal/external/rapidjson/internal/meta.h b/3rdparty/cereal/include/cereal/external/rapidjson/internal/meta.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/internal/meta.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/internal/meta.h diff --git a/cereal/include/cereal/external/rapidjson/internal/pow10.h b/3rdparty/cereal/include/cereal/external/rapidjson/internal/pow10.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/internal/pow10.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/internal/pow10.h diff --git a/cereal/include/cereal/external/rapidjson/internal/regex.h b/3rdparty/cereal/include/cereal/external/rapidjson/internal/regex.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/internal/regex.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/internal/regex.h diff --git a/cereal/include/cereal/external/rapidjson/internal/stack.h b/3rdparty/cereal/include/cereal/external/rapidjson/internal/stack.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/internal/stack.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/internal/stack.h diff --git a/cereal/include/cereal/external/rapidjson/internal/strfunc.h b/3rdparty/cereal/include/cereal/external/rapidjson/internal/strfunc.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/internal/strfunc.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/internal/strfunc.h diff --git a/cereal/include/cereal/external/rapidjson/internal/strtod.h b/3rdparty/cereal/include/cereal/external/rapidjson/internal/strtod.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/internal/strtod.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/internal/strtod.h diff --git a/cereal/include/cereal/external/rapidjson/internal/swap.h b/3rdparty/cereal/include/cereal/external/rapidjson/internal/swap.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/internal/swap.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/internal/swap.h diff --git a/cereal/include/cereal/external/rapidjson/istreamwrapper.h b/3rdparty/cereal/include/cereal/external/rapidjson/istreamwrapper.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/istreamwrapper.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/istreamwrapper.h diff --git a/cereal/include/cereal/external/rapidjson/memorybuffer.h b/3rdparty/cereal/include/cereal/external/rapidjson/memorybuffer.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/memorybuffer.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/memorybuffer.h diff --git a/cereal/include/cereal/external/rapidjson/memorystream.h b/3rdparty/cereal/include/cereal/external/rapidjson/memorystream.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/memorystream.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/memorystream.h diff --git a/cereal/include/cereal/external/rapidjson/msinttypes/inttypes.h b/3rdparty/cereal/include/cereal/external/rapidjson/msinttypes/inttypes.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/msinttypes/inttypes.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/msinttypes/inttypes.h diff --git a/cereal/include/cereal/external/rapidjson/msinttypes/stdint.h b/3rdparty/cereal/include/cereal/external/rapidjson/msinttypes/stdint.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/msinttypes/stdint.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/msinttypes/stdint.h diff --git a/cereal/include/cereal/external/rapidjson/ostreamwrapper.h b/3rdparty/cereal/include/cereal/external/rapidjson/ostreamwrapper.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/ostreamwrapper.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/ostreamwrapper.h diff --git a/cereal/include/cereal/external/rapidjson/pointer.h b/3rdparty/cereal/include/cereal/external/rapidjson/pointer.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/pointer.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/pointer.h diff --git a/cereal/include/cereal/external/rapidjson/prettywriter.h b/3rdparty/cereal/include/cereal/external/rapidjson/prettywriter.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/prettywriter.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/prettywriter.h diff --git a/cereal/include/cereal/external/rapidjson/rapidjson.h b/3rdparty/cereal/include/cereal/external/rapidjson/rapidjson.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/rapidjson.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/rapidjson.h diff --git a/cereal/include/cereal/external/rapidjson/reader.h b/3rdparty/cereal/include/cereal/external/rapidjson/reader.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/reader.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/reader.h diff --git a/cereal/include/cereal/external/rapidjson/schema.h b/3rdparty/cereal/include/cereal/external/rapidjson/schema.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/schema.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/schema.h diff --git a/cereal/include/cereal/external/rapidjson/stream.h b/3rdparty/cereal/include/cereal/external/rapidjson/stream.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/stream.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/stream.h diff --git a/cereal/include/cereal/external/rapidjson/stringbuffer.h b/3rdparty/cereal/include/cereal/external/rapidjson/stringbuffer.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/stringbuffer.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/stringbuffer.h diff --git a/cereal/include/cereal/external/rapidjson/writer.h b/3rdparty/cereal/include/cereal/external/rapidjson/writer.h similarity index 100% rename from cereal/include/cereal/external/rapidjson/writer.h rename to 3rdparty/cereal/include/cereal/external/rapidjson/writer.h diff --git a/cereal/include/cereal/external/rapidxml/license.txt b/3rdparty/cereal/include/cereal/external/rapidxml/license.txt similarity index 98% rename from cereal/include/cereal/external/rapidxml/license.txt rename to 3rdparty/cereal/include/cereal/external/rapidxml/license.txt index 0095bc72f..140983180 100644 --- a/cereal/include/cereal/external/rapidxml/license.txt +++ b/3rdparty/cereal/include/cereal/external/rapidxml/license.txt @@ -1,52 +1,52 @@ -Use of this software is granted under one of the following two licenses, -to be chosen freely by the user. - -1. Boost Software License - Version 1.0 - August 17th, 2003 -=============================================================================== - -Copyright (c) 2006, 2007 Marcin Kalicinski - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, 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", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - -2. The MIT License -=============================================================================== - -Copyright (c) 2006, 2007 Marcin Kalicinski - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. +Use of this software is granted under one of the following two licenses, +to be chosen freely by the user. + +1. Boost Software License - Version 1.0 - August 17th, 2003 +=============================================================================== + +Copyright (c) 2006, 2007 Marcin Kalicinski + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, 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", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +2. The MIT License +=============================================================================== + +Copyright (c) 2006, 2007 Marcin Kalicinski + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/cereal/include/cereal/external/rapidxml/manual.html b/3rdparty/cereal/include/cereal/external/rapidxml/manual.html similarity index 99% rename from cereal/include/cereal/external/rapidxml/manual.html rename to 3rdparty/cereal/include/cereal/external/rapidxml/manual.html index 4e6a5f1a9..2c422703f 100644 --- a/cereal/include/cereal/external/rapidxml/manual.html +++ b/3rdparty/cereal/include/cereal/external/rapidxml/manual.html @@ -1,406 +1,406 @@ -

RAPIDXML Manual

Version 1.13

Copyright (C) 2006, 2009 Marcin Kalicinski
See accompanying file license.txt for license information.

Table of Contents

1. What is RapidXml?
1.1 Dependencies And Compatibility
1.2 Character Types And Encodings
1.3 Error Handling
1.4 Memory Allocation
1.5 W3C Compliance
1.6 API Design
1.7 Reliability
1.8 Acknowledgements
2. Two Minute Tutorial
2.1 Parsing
2.2 Accessing The DOM Tree
2.3 Modifying The DOM Tree
2.4 Printing XML
3. Differences From Regular XML Parsers
3.1 Lifetime Of Source Text
3.2 Ownership Of Strings
3.3 Destructive Vs Non-Destructive Mode
4. Performance
4.1 Comparison With Other Parsers
5. Reference

1. What is RapidXml?

RapidXml is an attempt to create the fastest XML DOM parser possible, while retaining useability, portability and reasonable W3C compatibility. It is an in-situ parser written in C++, with parsing speed approaching that of strlen() function executed on the same data.

- Entire parser is contained in a single header file, so no building or linking is neccesary. To use it you just need to copy rapidxml.hpp file to a convenient place (such as your project directory), and include it where needed. You may also want to use printing functions contained in header rapidxml_print.hpp.

1.1 Dependencies And Compatibility

RapidXml has no dependencies other than a very small subset of standard C++ library (<cassert>, <cstdlib>, <new> and <exception>, unless exceptions are disabled). It should compile on any reasonably conformant compiler, and was tested on Visual C++ 2003, Visual C++ 2005, Visual C++ 2008, gcc 3, gcc 4, and Comeau 4.3.3. Care was taken that no warnings are produced on these compilers, even with highest warning levels enabled.

1.2 Character Types And Encodings

RapidXml is character type agnostic, and can work both with narrow and wide characters. Current version does not fully support UTF-16 or UTF-32, so use of wide characters is somewhat incapacitated. However, it should succesfully parse wchar_t strings containing UTF-16 or UTF-32 if endianness of the data matches that of the machine. UTF-8 is fully supported, including all numeric character references, which are expanded into appropriate UTF-8 byte sequences (unless you enable parse_no_utf8 flag).

- Note that RapidXml performs no decoding - strings returned by name() and value() functions will contain text encoded using the same encoding as source file. Rapidxml understands and expands the following character references: &apos; &amp; &quot; &lt; &gt; &#...; Other character references are not expanded.

1.3 Error Handling

By default, RapidXml uses C++ exceptions to report errors. If this behaviour is undesirable, RAPIDXML_NO_EXCEPTIONS can be defined to suppress exception code. See parse_error class and parse_error_handler() function for more information.

1.4 Memory Allocation

RapidXml uses a special memory pool object to allocate nodes and attributes, because direct allocation using new operator would be far too slow. Underlying memory allocations performed by the pool can be customized by use of memory_pool::set_allocator() function. See class memory_pool for more information.

1.5 W3C Compliance

RapidXml is not a W3C compliant parser, primarily because it ignores DOCTYPE declarations. There is a number of other, minor incompatibilities as well. Still, it can successfully parse and produce complete trees of all valid XML files in W3C conformance suite (over 1000 files specially designed to find flaws in XML processors). In destructive mode it performs whitespace normalization and character entity substitution for a small set of built-in entities.

1.6 API Design

RapidXml API is minimalistic, to reduce code size as much as possible, and facilitate use in embedded environments. Additional convenience functions are provided in separate headers: rapidxml_utils.hpp and rapidxml_print.hpp. Contents of these headers is not an essential part of the library, and is currently not documented (otherwise than with comments in code).

1.7 Reliability

RapidXml is very robust and comes with a large harness of unit tests. Special care has been taken to ensure stability of the parser no matter what source text is thrown at it. One of the unit tests produces 100,000 randomly corrupted variants of XML document, which (when uncorrupted) contains all constructs recognized by RapidXml. RapidXml passes this test when it correctly recognizes that errors have been introduced, and does not crash or loop indefinitely.

- Another unit test puts RapidXml head-to-head with another, well estabilished XML parser, and verifies that their outputs match across a wide variety of small and large documents.

- Yet another test feeds RapidXml with over 1000 test files from W3C compliance suite, and verifies that correct results are obtained. There are also additional tests that verify each API function separately, and test that various parsing modes work as expected.

1.8 Acknowledgements

I would like to thank Arseny Kapoulkine for his work on pugixml, which was an inspiration for this project. Additional thanks go to Kristen Wegner for creating pugxml, from which pugixml was derived. Janusz Wohlfeil kindly ran RapidXml speed tests on hardware that I did not have access to, allowing me to expand performance comparison table.

2. Two Minute Tutorial

2.1 Parsing

The following code causes RapidXml to parse a zero-terminated string named text:
using namespace rapidxml;
-xml_document<> doc;    // character type defaults to char
-doc.parse<0>(text);    // 0 means default parse flags
-
doc object is now a root of DOM tree containing representation of the parsed XML. Because all RapidXml interface is contained inside namespace rapidxml, users must either bring contents of this namespace into scope, or fully qualify all the names. Class xml_document represents a root of the DOM hierarchy. By means of public inheritance, it is also an xml_node and a memory_pool. Template parameter of xml_document::parse() function is used to specify parsing flags, with which you can fine-tune behaviour of the parser. Note that flags must be a compile-time constant.

2.2 Accessing The DOM Tree

To access the DOM tree, use methods of xml_node and xml_attribute classes:
cout << "Name of my first node is: " << doc.first_node()->name() << "\n";
-xml_node<> *node = doc.first_node("foobar");
-cout << "Node foobar has value " << node->value() << "\n";
-for (xml_attribute<> *attr = node->first_attribute();
-     attr; attr = attr->next_attribute())
-{
-    cout << "Node foobar has attribute " << attr->name() << " ";
-    cout << "with value " << attr->value() << "\n";
-}
-

2.3 Modifying The DOM Tree

DOM tree produced by the parser is fully modifiable. Nodes and attributes can be added/removed, and their contents changed. The below example creates a HTML document, whose sole contents is a link to google.com website:
xml_document<> doc;
-xml_node<> *node = doc.allocate_node(node_element, "a", "Google");
-doc.append_node(node);
-xml_attribute<> *attr = doc.allocate_attribute("href", "google.com");
-node->append_attribute(attr);
-
One quirk is that nodes and attributes do not own the text of their names and values. This is because normally they only store pointers to the source text. So, when assigning a new name or value to the node, care must be taken to ensure proper lifetime of the string. The easiest way to achieve it is to allocate the string from the xml_document memory pool. In the above example this is not necessary, because we are only assigning character constants. But the code below uses memory_pool::allocate_string() function to allocate node name (which will have the same lifetime as the document), and assigns it to a new node:
xml_document<> doc;
-char *node_name = doc.allocate_string(name);        // Allocate string and copy name into it
-xml_node<> *node = doc.allocate_node(node_element, node_name);  // Set node name to node_name
-
Check Reference section for description of the entire interface.

2.4 Printing XML

You can print xml_document and xml_node objects into an XML string. Use print() function or operator <<, which are defined in rapidxml_print.hpp header.
using namespace rapidxml;
-xml_document<> doc;    // character type defaults to char
-// ... some code to fill the document
-
-// Print to stream using operator <<
-std::cout << doc;   
-
-// Print to stream using print function, specifying printing flags
-print(std::cout, doc, 0);   // 0 means default printing flags
-
-// Print to string using output iterator
-std::string s;
-print(std::back_inserter(s), doc, 0);
-
-// Print to memory buffer using output iterator
-char buffer[4096];                      // You are responsible for making the buffer large enough!
-char *end = print(buffer, doc, 0);      // end contains pointer to character after last printed character
-*end = 0;                               // Add string terminator after XML
-

3. Differences From Regular XML Parsers

RapidXml is an in-situ parser, which allows it to achieve very high parsing speed. In-situ means that parser does not make copies of strings. Instead, it places pointers to the source text in the DOM hierarchy.

3.1 Lifetime Of Source Text

In-situ parsing requires that source text lives at least as long as the document object. If source text is destroyed, names and values of nodes in DOM tree will become destroyed as well. Additionally, whitespace processing, character entity translation, and zero-termination of strings require that source text be modified during parsing (but see non-destructive mode). This makes the text useless for further processing once it was parsed by RapidXml.

- In many cases however, these are not serious issues.

3.2 Ownership Of Strings

Nodes and attributes produced by RapidXml do not own their name and value strings. They merely hold the pointers to them. This means you have to be careful when setting these values manually, by using xml_base::name(const Ch *) or xml_base::value(const Ch *) functions. Care must be taken to ensure that lifetime of the string passed is at least as long as lifetime of the node/attribute. The easiest way to achieve it is to allocate the string from memory_pool owned by the document. Use memory_pool::allocate_string() function for this purpose.

3.3 Destructive Vs Non-Destructive Mode

By default, the parser modifies source text during the parsing process. This is required to achieve character entity translation, whitespace normalization, and zero-termination of strings.

- In some cases this behaviour may be undesirable, for example if source text resides in read only memory, or is mapped to memory directly from file. By using appropriate parser flags (parse_non_destructive), source text modifications can be disabled. However, because RapidXml does in-situ parsing, it obviously has the following side-effects:

4. Performance

RapidXml achieves its speed through use of several techniques:
  • In-situ parsing. When building DOM tree, RapidXml does not make copies of string data, such as node names and values. Instead, it stores pointers to interior of the source text.
  • Use of template metaprogramming techniques. This allows it to move much of the work to compile time. Through magic of the templates, C++ compiler generates a separate copy of parsing code for any combination of parser flags you use. In each copy, all possible decisions are made at compile time and all unused code is omitted.
  • Extensive use of lookup tables for parsing.
  • Hand-tuned C++ with profiling done on several most popular CPUs.
This results in a very small and fast code: a parser which is custom tailored to exact needs with each invocation.

4.1 Comparison With Other Parsers

The table below compares speed of RapidXml to some other parsers, and to strlen() function executed on the same data. On a modern CPU (as of 2007), you can expect parsing throughput to be close to 1 GB/s. As a rule of thumb, parsing speed is about 50-100x faster than Xerces DOM, 30-60x faster than TinyXml, 3-12x faster than pugxml, and about 5% - 30% faster than pugixml, the fastest XML parser I know of.
  • The test file is a real-world, 50kB large, moderately dense XML file.
  • All timing is done by using RDTSC instruction present in Pentium-compatible CPUs.
  • No profile-guided optimizations are used.
  • All parsers are running in their fastest modes.
  • The results are given in CPU cycles per character, so frequency of CPUs is irrelevant.
  • The results are minimum values from a large number of runs, to minimize effects of operating system activity, task switching, interrupt handling etc.
  • A single parse of the test file takes about 1/10th of a millisecond, so with large number of runs there is a good chance of hitting at least one no-interrupt streak, and obtaining undisturbed results.
Platform
Compiler
strlen() RapidXml pugixml 0.3 pugxml TinyXml
Pentium 4
MSVC 8.0
2.5
5.4
7.0
61.7
298.8
Pentium 4
gcc 4.1.1
0.8
6.1
9.5
67.0
413.2
Core 2
MSVC 8.0
1.0
4.5
5.0
24.6
154.8
Core 2
gcc 4.1.1
0.6
4.6
5.4
28.3
229.3
Athlon XP
MSVC 8.0
3.1
7.7
8.0
25.5
182.6
Athlon XP
gcc 4.1.1
0.9
8.2
9.2
33.7
265.2
Pentium 3
MSVC 8.0
2.0
6.3
7.0
30.9
211.9
Pentium 3
gcc 4.1.1
1.0
6.7
8.9
35.3
316.0
(*) All results are in CPU cycles per character of source text

5. Reference

This section lists all classes, functions, constants etc. and describes them in detail.
class - template - rapidxml::memory_pool
- constructor - memory_pool()
- destructor - ~memory_pool()
function allocate_node(node_type type, const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0)
function allocate_attribute(const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0)
function allocate_string(const Ch *source=0, std::size_t size=0)
function clone_node(const xml_node< Ch > *source, xml_node< Ch > *result=0)
function clear()
function set_allocator(alloc_func *af, free_func *ff)

class rapidxml::parse_error
- constructor - parse_error(const char *what, void *where)
function what() const
function where() const

class - template - rapidxml::xml_attribute
- constructor - xml_attribute()
function document() const
function previous_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
function next_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const

class - template - rapidxml::xml_base
- constructor - xml_base()
function name() const
function name_size() const
function value() const
function value_size() const
function name(const Ch *name, std::size_t size)
function name(const Ch *name)
function value(const Ch *value, std::size_t size)
function value(const Ch *value)
function parent() const

class - template - rapidxml::xml_document
- constructor - xml_document()
function parse(Ch *text)
function clear()

class - template - rapidxml::xml_node
- constructor - xml_node(node_type type)
function type() const
function document() const
function first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
function last_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
function previous_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
function next_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
function first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
function last_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
function type(node_type type)
function prepend_node(xml_node< Ch > *child)
function append_node(xml_node< Ch > *child)
function insert_node(xml_node< Ch > *where, xml_node< Ch > *child)
function remove_first_node()
function remove_last_node()
function remove_node(xml_node< Ch > *where)
function remove_all_nodes()
function prepend_attribute(xml_attribute< Ch > *attribute)
function append_attribute(xml_attribute< Ch > *attribute)
function insert_attribute(xml_attribute< Ch > *where, xml_attribute< Ch > *attribute)
function remove_first_attribute()
function remove_last_attribute()
function remove_attribute(xml_attribute< Ch > *where)
function remove_all_attributes()

namespace rapidxml
enum node_type
function parse_error_handler(const char *what, void *where)
function print(OutIt out, const xml_node< Ch > &node, int flags=0)
function print(std::basic_ostream< Ch > &out, const xml_node< Ch > &node, int flags=0)
function operator<<(std::basic_ostream< Ch > &out, const xml_node< Ch > &node)
- constant - parse_no_data_nodes
- constant - parse_no_element_values
- constant - parse_no_string_terminators
- constant - parse_no_entity_translation
- constant - parse_no_utf8
- constant - parse_declaration_node
- constant - parse_comment_nodes
- constant - parse_doctype_node
- constant - parse_pi_nodes
- constant - parse_validate_closing_tags
- constant - parse_trim_whitespace
- constant - parse_normalize_whitespace
- constant - parse_default
- constant - parse_non_destructive
- constant - parse_fastest
- constant - parse_full
- constant - print_no_indenting


class - template - rapidxml::memory_pool

- - Defined in rapidxml.hpp
- Base class for - xml_document

Description

This class is used by the parser to create new nodes and attributes, without overheads of dynamic memory allocation. In most cases, you will not need to use this class directly. However, if you need to create nodes manually or modify names/values of nodes, you are encouraged to use memory_pool of relevant xml_document to allocate the memory. Not only is this faster than allocating them by using new operator, but also their lifetime will be tied to the lifetime of document, possibly simplyfing memory management.

- Call allocate_node() or allocate_attribute() functions to obtain new nodes or attributes from the pool. You can also call allocate_string() function to allocate strings. Such strings can then be used as names or values of nodes without worrying about their lifetime. Note that there is no free() function -- all allocations are freed at once when clear() function is called, or when the pool is destroyed.

- It is also possible to create a standalone memory_pool, and use it to allocate nodes, whose lifetime will not be tied to any document.

- Pool maintains RAPIDXML_STATIC_POOL_SIZE bytes of statically allocated memory. Until static memory is exhausted, no dynamic memory allocations are done. When static memory is exhausted, pool allocates additional blocks of memory of size RAPIDXML_DYNAMIC_POOL_SIZE each, by using global new[] and delete[] operators. This behaviour can be changed by setting custom allocation routines. Use set_allocator() function to set them.

- Allocations for nodes, attributes and strings are aligned at RAPIDXML_ALIGNMENT bytes. This value defaults to the size of pointer on target architecture.

- To obtain absolutely top performance from the parser, it is important that all nodes are allocated from a single, contiguous block of memory. Otherwise, cache misses when jumping between two (or more) disjoint blocks of memory can slow down parsing quite considerably. If required, you can tweak RAPIDXML_STATIC_POOL_SIZE, RAPIDXML_DYNAMIC_POOL_SIZE and RAPIDXML_ALIGNMENT to obtain best wasted memory to performance compromise. To do it, define their values before rapidxml.hpp file is included.

Parameters

Ch
Character type of created nodes.

- constructor - memory_pool::memory_pool

Synopsis

memory_pool(); -

Description

Constructs empty pool with default allocator functions.

- destructor - memory_pool::~memory_pool

Synopsis

~memory_pool(); -

Description

Destroys pool and frees all the memory. This causes memory occupied by nodes allocated by the pool to be freed. Nodes allocated from the pool are no longer valid.

function memory_pool::allocate_node

Synopsis

xml_node<Ch>* allocate_node(node_type type, const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0); -

Description

Allocates a new node from the pool, and optionally assigns name and value to it. If the allocation request cannot be accomodated, this function will throw std::bad_alloc. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function.

Parameters

type
Type of node to create.
name
Name to assign to the node, or 0 to assign no name.
value
Value to assign to the node, or 0 to assign no value.
name_size
Size of name to assign, or 0 to automatically calculate size from name string.
value_size
Size of value to assign, or 0 to automatically calculate size from value string.

Returns

Pointer to allocated node. This pointer will never be NULL.

function memory_pool::allocate_attribute

Synopsis

xml_attribute<Ch>* allocate_attribute(const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0); -

Description

Allocates a new attribute from the pool, and optionally assigns name and value to it. If the allocation request cannot be accomodated, this function will throw std::bad_alloc. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function.

Parameters

name
Name to assign to the attribute, or 0 to assign no name.
value
Value to assign to the attribute, or 0 to assign no value.
name_size
Size of name to assign, or 0 to automatically calculate size from name string.
value_size
Size of value to assign, or 0 to automatically calculate size from value string.

Returns

Pointer to allocated attribute. This pointer will never be NULL.

function memory_pool::allocate_string

Synopsis

Ch* allocate_string(const Ch *source=0, std::size_t size=0); -

Description

Allocates a char array of given size from the pool, and optionally copies a given string to it. If the allocation request cannot be accomodated, this function will throw std::bad_alloc. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function.

Parameters

source
String to initialize the allocated memory with, or 0 to not initialize it.
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.

Returns

Pointer to allocated char array. This pointer will never be NULL.

function memory_pool::clone_node

Synopsis

xml_node<Ch>* clone_node(const xml_node< Ch > *source, xml_node< Ch > *result=0); -

Description

Clones an xml_node and its hierarchy of child nodes and attributes. Nodes and attributes are allocated from this memory pool. Names and values are not cloned, they are shared between the clone and the source. Result node can be optionally specified as a second parameter, in which case its contents will be replaced with cloned source node. This is useful when you want to clone entire document.

Parameters

source
Node to clone.
result
Node to put results in, or 0 to automatically allocate result node

Returns

Pointer to cloned node. This pointer will never be NULL.

function memory_pool::clear

Synopsis

void clear(); -

Description

Clears the pool. This causes memory occupied by nodes allocated by the pool to be freed. Any nodes or strings allocated from the pool will no longer be valid.

function memory_pool::set_allocator

Synopsis

void set_allocator(alloc_func *af, free_func *ff); -

Description

Sets or resets the user-defined memory allocation functions for the pool. This can only be called when no memory is allocated from the pool yet, otherwise results are undefined. Allocation function must not return invalid pointer on failure. It should either throw, stop the program, or use longjmp() function to pass control to other place of program. If it returns invalid pointer, results are undefined.

- User defined allocation functions must have the following forms:

-void *allocate(std::size_t size);
-void free(void *pointer);

Parameters

af
Allocation function, or 0 to restore default function
ff
Free function, or 0 to restore default function

class rapidxml::parse_error

- - Defined in rapidxml.hpp

Description

Parse error exception. This exception is thrown by the parser when an error occurs. Use what() function to get human-readable error message. Use where() function to get a pointer to position within source text where error was detected.

- If throwing exceptions by the parser is undesirable, it can be disabled by defining RAPIDXML_NO_EXCEPTIONS macro before rapidxml.hpp is included. This will cause the parser to call rapidxml::parse_error_handler() function instead of throwing an exception. This function must be defined by the user.

- This class derives from std::exception class.

- constructor - parse_error::parse_error

Synopsis

parse_error(const char *what, void *where); -

Description

Constructs parse error.

function parse_error::what

Synopsis

virtual const char* what() const; -

Description

Gets human readable description of error.

Returns

Pointer to null terminated description of the error.

function parse_error::where

Synopsis

Ch* where() const; -

Description

Gets pointer to character data where error happened. Ch should be the same as char type of xml_document that produced the error.

Returns

Pointer to location within the parsed string where error occured.

class - template - rapidxml::xml_attribute

- - Defined in rapidxml.hpp
- Inherits from - xml_base

Description

Class representing attribute node of XML document. Each attribute has name and value strings, which are available through name() and value() functions (inherited from xml_base). Note that after parse, both name and value of attribute will point to interior of source text used for parsing. Thus, this text must persist in memory for the lifetime of attribute.

Parameters

Ch
Character type to use.

- constructor - xml_attribute::xml_attribute

Synopsis

xml_attribute(); -

Description

Constructs an empty attribute with the specified type. Consider using memory_pool of appropriate xml_document if allocating attributes manually.

function xml_attribute::document

Synopsis

xml_document<Ch>* document() const; -

Description

Gets document of which attribute is a child.

Returns

Pointer to document that contains this attribute, or 0 if there is no parent document.

function xml_attribute::previous_attribute

Synopsis

xml_attribute<Ch>* previous_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; -

Description

Gets previous attribute, optionally matching attribute name.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found attribute, or 0 if not found.

function xml_attribute::next_attribute

Synopsis

xml_attribute<Ch>* next_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; -

Description

Gets next attribute, optionally matching attribute name.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found attribute, or 0 if not found.

class - template - rapidxml::xml_base

- - Defined in rapidxml.hpp
- Base class for - xml_attribute xml_node

Description

Base class for xml_node and xml_attribute implementing common functions: name(), name_size(), value(), value_size() and parent().

Parameters

Ch
Character type to use

- constructor - xml_base::xml_base

Synopsis

xml_base(); -

function xml_base::name

Synopsis

Ch* name() const; -

Description

Gets name of the node. Interpretation of name depends on type of node. Note that name will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse.

- Use name_size() function to determine length of the name.

Returns

Name of node, or empty string if node has no name.

function xml_base::name_size

Synopsis

std::size_t name_size() const; -

Description

Gets size of node name, not including terminator character. This function works correctly irrespective of whether name is or is not zero terminated.

Returns

Size of node name, in characters.

function xml_base::value

Synopsis

Ch* value() const; -

Description

Gets value of node. Interpretation of value depends on type of node. Note that value will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse.

- Use value_size() function to determine length of the value.

Returns

Value of node, or empty string if node has no value.

function xml_base::value_size

Synopsis

std::size_t value_size() const; -

Description

Gets size of node value, not including terminator character. This function works correctly irrespective of whether value is or is not zero terminated.

Returns

Size of node value, in characters.

function xml_base::name

Synopsis

void name(const Ch *name, std::size_t size); -

Description

Sets name of node to a non zero-terminated string. See Ownership Of Strings .

- Note that node does not own its name or value, it only stores a pointer to it. It will not delete or otherwise free the pointer on destruction. It is reponsibility of the user to properly manage lifetime of the string. The easiest way to achieve it is to use memory_pool of the document to allocate the string - on destruction of the document the string will be automatically freed.

- Size of name must be specified separately, because name does not have to be zero terminated. Use name(const Ch *) function to have the length automatically calculated (string must be zero terminated).

Parameters

name
Name of node to set. Does not have to be zero terminated.
size
Size of name, in characters. This does not include zero terminator, if one is present.

function xml_base::name

Synopsis

void name(const Ch *name); -

Description

Sets name of node to a zero-terminated string. See also Ownership Of Strings and xml_node::name(const Ch *, std::size_t).

Parameters

name
Name of node to set. Must be zero terminated.

function xml_base::value

Synopsis

void value(const Ch *value, std::size_t size); -

Description

Sets value of node to a non zero-terminated string. See Ownership Of Strings .

- Note that node does not own its name or value, it only stores a pointer to it. It will not delete or otherwise free the pointer on destruction. It is reponsibility of the user to properly manage lifetime of the string. The easiest way to achieve it is to use memory_pool of the document to allocate the string - on destruction of the document the string will be automatically freed.

- Size of value must be specified separately, because it does not have to be zero terminated. Use value(const Ch *) function to have the length automatically calculated (string must be zero terminated).

- If an element has a child node of type node_data, it will take precedence over element value when printing. 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.

Parameters

value
value of node to set. Does not have to be zero terminated.
size
Size of value, in characters. This does not include zero terminator, if one is present.

function xml_base::value

Synopsis

void value(const Ch *value); -

Description

Sets value of node to a zero-terminated string. See also Ownership Of Strings and xml_node::value(const Ch *, std::size_t).

Parameters

value
Vame of node to set. Must be zero terminated.

function xml_base::parent

Synopsis

xml_node<Ch>* parent() const; -

Description

Gets node parent.

Returns

Pointer to parent node, or 0 if there is no parent.

class - template - rapidxml::xml_document

- - Defined in rapidxml.hpp
- Inherits from - xml_node memory_pool

Description

This class represents root of the DOM hierarchy. It is also an xml_node and a memory_pool through public inheritance. Use parse() function to build a DOM tree from a zero-terminated XML text string. parse() function allocates memory for nodes and attributes by using functions of xml_document, which are inherited from memory_pool. To access root node of the document, use the document itself, as if it was an xml_node.

Parameters

Ch
Character type to use.

- constructor - xml_document::xml_document

Synopsis

xml_document(); -

Description

Constructs empty XML document.

function xml_document::parse

Synopsis

void parse(Ch *text); -

Description

Parses zero-terminated XML string according to given flags. Passed string will be modified by the parser, unless rapidxml::parse_non_destructive flag is used. The string must persist for the lifetime of the document. In case of error, rapidxml::parse_error exception will be thrown.

- If you want to parse contents of a file, you must first load the file into the memory, and pass pointer to its beginning. Make sure that data is zero-terminated.

- Document can be parsed into multiple times. Each new call to parse removes previous nodes and attributes (if any), but does not clear memory pool.

Parameters

text
XML data to parse; pointer is non-const to denote fact that this data may be modified by the parser.

function xml_document::clear

Synopsis

void clear(); -

Description

Clears the document by deleting all nodes and clearing the memory pool. All nodes owned by document pool are destroyed.

class - template - rapidxml::xml_node

- - Defined in rapidxml.hpp
- Inherits from - xml_base
- Base class for - xml_document

Description

Class representing a node of XML document. Each node may have associated name and value strings, which are available through name() and value() functions. Interpretation of name and value depends on type of the node. Type of node can be determined by using type() function.

- Note that after parse, both name and value of node, if any, will point interior of source text used for parsing. Thus, this text must persist in the memory for the lifetime of node.

Parameters

Ch
Character type to use.

- constructor - xml_node::xml_node

Synopsis

xml_node(node_type type); -

Description

Constructs an empty node with the specified type. Consider using memory_pool of appropriate document to allocate nodes manually.

Parameters

type
Type of node to construct.

function xml_node::type

Synopsis

node_type type() const; -

Description

Gets type of node.

Returns

Type of node.

function xml_node::document

Synopsis

xml_document<Ch>* document() const; -

Description

Gets document of which node is a child.

Returns

Pointer to document that contains this node, or 0 if there is no parent document.

function xml_node::first_node

Synopsis

xml_node<Ch>* first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; -

Description

Gets first child node, optionally matching node name.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found child, or 0 if not found.

function xml_node::last_node

Synopsis

xml_node<Ch>* last_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; -

Description

Gets last child node, optionally matching node name. Behaviour is undefined if node has no children. Use first_node() to test if node has children.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found child, or 0 if not found.

function xml_node::previous_sibling

Synopsis

xml_node<Ch>* previous_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; -

Description

Gets previous sibling node, optionally matching node name. Behaviour is undefined if node has no parent. Use parent() to test if node has a parent.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found sibling, or 0 if not found.

function xml_node::next_sibling

Synopsis

xml_node<Ch>* next_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; -

Description

Gets next sibling node, optionally matching node name. Behaviour is undefined if node has no parent. Use parent() to test if node has a parent.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found sibling, or 0 if not found.

function xml_node::first_attribute

Synopsis

xml_attribute<Ch>* first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; -

Description

Gets first attribute of node, optionally matching attribute name.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found attribute, or 0 if not found.

function xml_node::last_attribute

Synopsis

xml_attribute<Ch>* last_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; -

Description

Gets last attribute of node, optionally matching attribute name.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found attribute, or 0 if not found.

function xml_node::type

Synopsis

void type(node_type type); -

Description

Sets type of node.

Parameters

type
Type of node to set.

function xml_node::prepend_node

Synopsis

void prepend_node(xml_node< Ch > *child); -

Description

Prepends a new child node. The prepended child becomes the first child, and all existing children are moved one position back.

Parameters

child
Node to prepend.

function xml_node::append_node

Synopsis

void append_node(xml_node< Ch > *child); -

Description

Appends a new child node. The appended child becomes the last child.

Parameters

child
Node to append.

function xml_node::insert_node

Synopsis

void insert_node(xml_node< Ch > *where, xml_node< Ch > *child); -

Description

Inserts a new child node at specified place inside the node. All children after and including the specified node are moved one position back.

Parameters

where
Place where to insert the child, or 0 to insert at the back.
child
Node to insert.

function xml_node::remove_first_node

Synopsis

void remove_first_node(); -

Description

Removes first child node. If node has no children, behaviour is undefined. Use first_node() to test if node has children.

function xml_node::remove_last_node

Synopsis

void remove_last_node(); -

Description

Removes last child of the node. If node has no children, behaviour is undefined. Use first_node() to test if node has children.

function xml_node::remove_node

Synopsis

void remove_node(xml_node< Ch > *where); -

Description

Removes specified child from the node.

function xml_node::remove_all_nodes

Synopsis

void remove_all_nodes(); -

Description

Removes all child nodes (but not attributes).

function xml_node::prepend_attribute

Synopsis

void prepend_attribute(xml_attribute< Ch > *attribute); -

Description

Prepends a new attribute to the node.

Parameters

attribute
Attribute to prepend.

function xml_node::append_attribute

Synopsis

void append_attribute(xml_attribute< Ch > *attribute); -

Description

Appends a new attribute to the node.

Parameters

attribute
Attribute to append.

function xml_node::insert_attribute

Synopsis

void insert_attribute(xml_attribute< Ch > *where, xml_attribute< Ch > *attribute); -

Description

Inserts a new attribute at specified place inside the node. All attributes after and including the specified attribute are moved one position back.

Parameters

where
Place where to insert the attribute, or 0 to insert at the back.
attribute
Attribute to insert.

function xml_node::remove_first_attribute

Synopsis

void remove_first_attribute(); -

Description

Removes first attribute of the node. If node has no attributes, behaviour is undefined. Use first_attribute() to test if node has attributes.

function xml_node::remove_last_attribute

Synopsis

void remove_last_attribute(); -

Description

Removes last attribute of the node. If node has no attributes, behaviour is undefined. Use first_attribute() to test if node has attributes.

function xml_node::remove_attribute

Synopsis

void remove_attribute(xml_attribute< Ch > *where); -

Description

Removes specified attribute from node.

Parameters

where
Pointer to attribute to be removed.

function xml_node::remove_all_attributes

Synopsis

void remove_all_attributes(); -

Description

Removes all attributes of node.

enum node_type

Description

Enumeration listing all node types produced by the parser. Use xml_node::type() function to query node type.

Values

node_document
A document node. Name and value are empty.
node_element
An element node. Name contains element name. Value contains text of first data node.
node_data
A data node. Name is empty. Value contains data text.
node_cdata
A CDATA node. Name is empty. Value contains data text.
node_comment
A comment node. Name is empty. Value contains comment text.
node_declaration
A declaration node. Name and value are empty. Declaration parameters (version, encoding and standalone) are in node attributes.
node_doctype
A DOCTYPE node. Name is empty. Value contains DOCTYPE text.
node_pi
A PI node. Name contains target. Value contains instructions.

function parse_error_handler

Synopsis

void rapidxml::parse_error_handler(const char *what, void *where); -

Description

When exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function is called to notify user about the error. It must be defined by the user.

- This function cannot return. If it does, the results are undefined.

- A very simple definition might look like that: - void rapidxml::parse_error_handler(const char *what, void *where) - { - std::cout << "Parse error: " << what << "\n"; - std::abort(); - } -

Parameters

what
Human readable description of the error.
where
Pointer to character data where error was detected.

function print

Synopsis

OutIt rapidxml::print(OutIt out, const xml_node< Ch > &node, int flags=0); -

Description

Prints XML to given output iterator.

Parameters

out
Output iterator to print to.
node
Node to be printed. Pass xml_document to print entire document.
flags
Flags controlling how XML is printed.

Returns

Output iterator pointing to position immediately after last character of printed text.

function print

Synopsis

std::basic_ostream<Ch>& rapidxml::print(std::basic_ostream< Ch > &out, const xml_node< Ch > &node, int flags=0); -

Description

Prints XML to given output stream.

Parameters

out
Output stream to print to.
node
Node to be printed. Pass xml_document to print entire document.
flags
Flags controlling how XML is printed.

Returns

Output stream.

function operator<<

Synopsis

std::basic_ostream<Ch>& rapidxml::operator<<(std::basic_ostream< Ch > &out, const xml_node< Ch > &node); -

Description

Prints formatted XML to given output stream. Uses default printing flags. Use print() function to customize printing process.

Parameters

out
Output stream to print to.
node
Node to be printed.

Returns

Output stream.

- constant - parse_no_data_nodes

Synopsis

const int parse_no_data_nodes - = 0x1; -

Description

Parse flag instructing the parser to not create data nodes. Text of first data node will still be placed in value of parent element, unless rapidxml::parse_no_element_values flag is also specified. Can be combined with other flags by use of | operator.

- See xml_document::parse() function.

- constant - parse_no_element_values

Synopsis

const int parse_no_element_values - = 0x2; -

Description

Parse flag instructing the parser to not use text of first data node as a value of parent element. Can be combined with other flags by use of | operator. Note that child data nodes of element node take precendence over its value when printing. That is, if element has one or more child data nodes and a value, the value will be ignored. Use rapidxml::parse_no_data_nodes flag to prevent creation of data nodes if you want to manipulate data using values of elements.

- See xml_document::parse() function.

- constant - parse_no_string_terminators

Synopsis

const int parse_no_string_terminators - = 0x4; -

Description

Parse flag instructing the parser to not place zero terminators after strings in the source text. By default zero terminators are placed, modifying source text. Can be combined with other flags by use of | operator.

- See xml_document::parse() function.

- constant - parse_no_entity_translation

Synopsis

const int parse_no_entity_translation - = 0x8; -

Description

Parse flag instructing the parser to not translate entities in the source text. By default entities are translated, modifying source text. Can be combined with other flags by use of | operator.

- See xml_document::parse() function.

- constant - parse_no_utf8

Synopsis

const int parse_no_utf8 - = 0x10; -

Description

Parse flag instructing the parser to disable UTF-8 handling and assume plain 8 bit characters. By default, UTF-8 handling is enabled. Can be combined with other flags by use of | operator.

- See xml_document::parse() function.

- constant - parse_declaration_node

Synopsis

const int parse_declaration_node - = 0x20; -

Description

Parse flag instructing the parser to create XML declaration node. By default, declaration node is not created. Can be combined with other flags by use of | operator.

- See xml_document::parse() function.

- constant - parse_comment_nodes

Synopsis

const int parse_comment_nodes - = 0x40; -

Description

Parse flag instructing the parser to create comments nodes. By default, comment nodes are not created. Can be combined with other flags by use of | operator.

- See xml_document::parse() function.

- constant - parse_doctype_node

Synopsis

const int parse_doctype_node - = 0x80; -

Description

Parse flag instructing the parser to create DOCTYPE node. By default, doctype node is not created. Although W3C specification allows at most one DOCTYPE node, RapidXml will silently accept documents with more than one. Can be combined with other flags by use of | operator.

- See xml_document::parse() function.

- constant - parse_pi_nodes

Synopsis

const int parse_pi_nodes - = 0x100; -

Description

Parse flag instructing the parser to create PI nodes. By default, PI nodes are not created. Can be combined with other flags by use of | operator.

- See xml_document::parse() function.

- constant - parse_validate_closing_tags

Synopsis

const int parse_validate_closing_tags - = 0x200; -

Description

Parse flag instructing the parser to validate closing tag names. If not set, name inside closing tag is irrelevant to the parser. By default, closing tags are not validated. Can be combined with other flags by use of | operator.

- See xml_document::parse() function.

- constant - parse_trim_whitespace

Synopsis

const int parse_trim_whitespace - = 0x400; -

Description

Parse flag instructing the parser to trim all leading and trailing whitespace of data nodes. By default, whitespace is not trimmed. This flag does not cause the parser to modify source text. Can be combined with other flags by use of | operator.

- See xml_document::parse() function.

- constant - parse_normalize_whitespace

Synopsis

const int parse_normalize_whitespace - = 0x800; -

Description

Parse flag instructing the parser to condense all whitespace runs of data nodes to a single space character. Trimming of leading and trailing whitespace of data is controlled by rapidxml::parse_trim_whitespace flag. By default, whitespace is not normalized. If this flag is specified, source text will be modified. Can be combined with other flags by use of | operator.

- See xml_document::parse() function.

- constant - parse_default

Synopsis

const int parse_default - = 0; -

Description

Parse flags which represent default behaviour of the parser. This is always equal to 0, so that all other flags can be simply ored together. Normally there is no need to inconveniently disable flags by anding with their negated (~) values. This also means that meaning of each flag is a negation of the default setting. For example, if flag name is rapidxml::parse_no_utf8, it means that utf-8 is enabled by default, and using the flag will disable it.

- See xml_document::parse() function.

- constant - parse_non_destructive

Synopsis

const int parse_non_destructive - = parse_no_string_terminators | parse_no_entity_translation; -

Description

A combination of parse flags that forbids any modifications of the source text. This also results in faster parsing. However, note that the following will occur: -See xml_document::parse() function.

- constant - parse_fastest

Synopsis

const int parse_fastest - = parse_non_destructive | parse_no_data_nodes; -

Description

A combination of parse flags resulting in fastest possible parsing, without sacrificing important data.

- See xml_document::parse() function.

- constant - parse_full

Synopsis

const int parse_full - = parse_declaration_node | parse_comment_nodes | parse_doctype_node | parse_pi_nodes | parse_validate_closing_tags; -

Description

A combination of parse flags resulting in largest amount of data being extracted. This usually results in slowest parsing.

- See xml_document::parse() function.

- constant - print_no_indenting

Synopsis

const int print_no_indenting - = 0x1; +

RAPIDXML Manual

Version 1.13

Copyright (C) 2006, 2009 Marcin Kalicinski
See accompanying file license.txt for license information.

Table of Contents

1. What is RapidXml?
1.1 Dependencies And Compatibility
1.2 Character Types And Encodings
1.3 Error Handling
1.4 Memory Allocation
1.5 W3C Compliance
1.6 API Design
1.7 Reliability
1.8 Acknowledgements
2. Two Minute Tutorial
2.1 Parsing
2.2 Accessing The DOM Tree
2.3 Modifying The DOM Tree
2.4 Printing XML
3. Differences From Regular XML Parsers
3.1 Lifetime Of Source Text
3.2 Ownership Of Strings
3.3 Destructive Vs Non-Destructive Mode
4. Performance
4.1 Comparison With Other Parsers
5. Reference

1. What is RapidXml?

RapidXml is an attempt to create the fastest XML DOM parser possible, while retaining useability, portability and reasonable W3C compatibility. It is an in-situ parser written in C++, with parsing speed approaching that of strlen() function executed on the same data.

+ Entire parser is contained in a single header file, so no building or linking is neccesary. To use it you just need to copy rapidxml.hpp file to a convenient place (such as your project directory), and include it where needed. You may also want to use printing functions contained in header rapidxml_print.hpp.

1.1 Dependencies And Compatibility

RapidXml has no dependencies other than a very small subset of standard C++ library (<cassert>, <cstdlib>, <new> and <exception>, unless exceptions are disabled). It should compile on any reasonably conformant compiler, and was tested on Visual C++ 2003, Visual C++ 2005, Visual C++ 2008, gcc 3, gcc 4, and Comeau 4.3.3. Care was taken that no warnings are produced on these compilers, even with highest warning levels enabled.

1.2 Character Types And Encodings

RapidXml is character type agnostic, and can work both with narrow and wide characters. Current version does not fully support UTF-16 or UTF-32, so use of wide characters is somewhat incapacitated. However, it should succesfully parse wchar_t strings containing UTF-16 or UTF-32 if endianness of the data matches that of the machine. UTF-8 is fully supported, including all numeric character references, which are expanded into appropriate UTF-8 byte sequences (unless you enable parse_no_utf8 flag).

+ Note that RapidXml performs no decoding - strings returned by name() and value() functions will contain text encoded using the same encoding as source file. Rapidxml understands and expands the following character references: &apos; &amp; &quot; &lt; &gt; &#...; Other character references are not expanded.

1.3 Error Handling

By default, RapidXml uses C++ exceptions to report errors. If this behaviour is undesirable, RAPIDXML_NO_EXCEPTIONS can be defined to suppress exception code. See parse_error class and parse_error_handler() function for more information.

1.4 Memory Allocation

RapidXml uses a special memory pool object to allocate nodes and attributes, because direct allocation using new operator would be far too slow. Underlying memory allocations performed by the pool can be customized by use of memory_pool::set_allocator() function. See class memory_pool for more information.

1.5 W3C Compliance

RapidXml is not a W3C compliant parser, primarily because it ignores DOCTYPE declarations. There is a number of other, minor incompatibilities as well. Still, it can successfully parse and produce complete trees of all valid XML files in W3C conformance suite (over 1000 files specially designed to find flaws in XML processors). In destructive mode it performs whitespace normalization and character entity substitution for a small set of built-in entities.

1.6 API Design

RapidXml API is minimalistic, to reduce code size as much as possible, and facilitate use in embedded environments. Additional convenience functions are provided in separate headers: rapidxml_utils.hpp and rapidxml_print.hpp. Contents of these headers is not an essential part of the library, and is currently not documented (otherwise than with comments in code).

1.7 Reliability

RapidXml is very robust and comes with a large harness of unit tests. Special care has been taken to ensure stability of the parser no matter what source text is thrown at it. One of the unit tests produces 100,000 randomly corrupted variants of XML document, which (when uncorrupted) contains all constructs recognized by RapidXml. RapidXml passes this test when it correctly recognizes that errors have been introduced, and does not crash or loop indefinitely.

+ Another unit test puts RapidXml head-to-head with another, well estabilished XML parser, and verifies that their outputs match across a wide variety of small and large documents.

+ Yet another test feeds RapidXml with over 1000 test files from W3C compliance suite, and verifies that correct results are obtained. There are also additional tests that verify each API function separately, and test that various parsing modes work as expected.

1.8 Acknowledgements

I would like to thank Arseny Kapoulkine for his work on pugixml, which was an inspiration for this project. Additional thanks go to Kristen Wegner for creating pugxml, from which pugixml was derived. Janusz Wohlfeil kindly ran RapidXml speed tests on hardware that I did not have access to, allowing me to expand performance comparison table.

2. Two Minute Tutorial

2.1 Parsing

The following code causes RapidXml to parse a zero-terminated string named text:
using namespace rapidxml;
+xml_document<> doc;    // character type defaults to char
+doc.parse<0>(text);    // 0 means default parse flags
+
doc object is now a root of DOM tree containing representation of the parsed XML. Because all RapidXml interface is contained inside namespace rapidxml, users must either bring contents of this namespace into scope, or fully qualify all the names. Class xml_document represents a root of the DOM hierarchy. By means of public inheritance, it is also an xml_node and a memory_pool. Template parameter of xml_document::parse() function is used to specify parsing flags, with which you can fine-tune behaviour of the parser. Note that flags must be a compile-time constant.

2.2 Accessing The DOM Tree

To access the DOM tree, use methods of xml_node and xml_attribute classes:
cout << "Name of my first node is: " << doc.first_node()->name() << "\n";
+xml_node<> *node = doc.first_node("foobar");
+cout << "Node foobar has value " << node->value() << "\n";
+for (xml_attribute<> *attr = node->first_attribute();
+     attr; attr = attr->next_attribute())
+{
+    cout << "Node foobar has attribute " << attr->name() << " ";
+    cout << "with value " << attr->value() << "\n";
+}
+

2.3 Modifying The DOM Tree

DOM tree produced by the parser is fully modifiable. Nodes and attributes can be added/removed, and their contents changed. The below example creates a HTML document, whose sole contents is a link to google.com website:
xml_document<> doc;
+xml_node<> *node = doc.allocate_node(node_element, "a", "Google");
+doc.append_node(node);
+xml_attribute<> *attr = doc.allocate_attribute("href", "google.com");
+node->append_attribute(attr);
+
One quirk is that nodes and attributes do not own the text of their names and values. This is because normally they only store pointers to the source text. So, when assigning a new name or value to the node, care must be taken to ensure proper lifetime of the string. The easiest way to achieve it is to allocate the string from the xml_document memory pool. In the above example this is not necessary, because we are only assigning character constants. But the code below uses memory_pool::allocate_string() function to allocate node name (which will have the same lifetime as the document), and assigns it to a new node:
xml_document<> doc;
+char *node_name = doc.allocate_string(name);        // Allocate string and copy name into it
+xml_node<> *node = doc.allocate_node(node_element, node_name);  // Set node name to node_name
+
Check Reference section for description of the entire interface.

2.4 Printing XML

You can print xml_document and xml_node objects into an XML string. Use print() function or operator <<, which are defined in rapidxml_print.hpp header.
using namespace rapidxml;
+xml_document<> doc;    // character type defaults to char
+// ... some code to fill the document
+
+// Print to stream using operator <<
+std::cout << doc;   
+
+// Print to stream using print function, specifying printing flags
+print(std::cout, doc, 0);   // 0 means default printing flags
+
+// Print to string using output iterator
+std::string s;
+print(std::back_inserter(s), doc, 0);
+
+// Print to memory buffer using output iterator
+char buffer[4096];                      // You are responsible for making the buffer large enough!
+char *end = print(buffer, doc, 0);      // end contains pointer to character after last printed character
+*end = 0;                               // Add string terminator after XML
+

3. Differences From Regular XML Parsers

RapidXml is an in-situ parser, which allows it to achieve very high parsing speed. In-situ means that parser does not make copies of strings. Instead, it places pointers to the source text in the DOM hierarchy.

3.1 Lifetime Of Source Text

In-situ parsing requires that source text lives at least as long as the document object. If source text is destroyed, names and values of nodes in DOM tree will become destroyed as well. Additionally, whitespace processing, character entity translation, and zero-termination of strings require that source text be modified during parsing (but see non-destructive mode). This makes the text useless for further processing once it was parsed by RapidXml.

+ In many cases however, these are not serious issues.

3.2 Ownership Of Strings

Nodes and attributes produced by RapidXml do not own their name and value strings. They merely hold the pointers to them. This means you have to be careful when setting these values manually, by using xml_base::name(const Ch *) or xml_base::value(const Ch *) functions. Care must be taken to ensure that lifetime of the string passed is at least as long as lifetime of the node/attribute. The easiest way to achieve it is to allocate the string from memory_pool owned by the document. Use memory_pool::allocate_string() function for this purpose.

3.3 Destructive Vs Non-Destructive Mode

By default, the parser modifies source text during the parsing process. This is required to achieve character entity translation, whitespace normalization, and zero-termination of strings.

+ In some cases this behaviour may be undesirable, for example if source text resides in read only memory, or is mapped to memory directly from file. By using appropriate parser flags (parse_non_destructive), source text modifications can be disabled. However, because RapidXml does in-situ parsing, it obviously has the following side-effects:

4. Performance

RapidXml achieves its speed through use of several techniques:
  • In-situ parsing. When building DOM tree, RapidXml does not make copies of string data, such as node names and values. Instead, it stores pointers to interior of the source text.
  • Use of template metaprogramming techniques. This allows it to move much of the work to compile time. Through magic of the templates, C++ compiler generates a separate copy of parsing code for any combination of parser flags you use. In each copy, all possible decisions are made at compile time and all unused code is omitted.
  • Extensive use of lookup tables for parsing.
  • Hand-tuned C++ with profiling done on several most popular CPUs.
This results in a very small and fast code: a parser which is custom tailored to exact needs with each invocation.

4.1 Comparison With Other Parsers

The table below compares speed of RapidXml to some other parsers, and to strlen() function executed on the same data. On a modern CPU (as of 2007), you can expect parsing throughput to be close to 1 GB/s. As a rule of thumb, parsing speed is about 50-100x faster than Xerces DOM, 30-60x faster than TinyXml, 3-12x faster than pugxml, and about 5% - 30% faster than pugixml, the fastest XML parser I know of.
  • The test file is a real-world, 50kB large, moderately dense XML file.
  • All timing is done by using RDTSC instruction present in Pentium-compatible CPUs.
  • No profile-guided optimizations are used.
  • All parsers are running in their fastest modes.
  • The results are given in CPU cycles per character, so frequency of CPUs is irrelevant.
  • The results are minimum values from a large number of runs, to minimize effects of operating system activity, task switching, interrupt handling etc.
  • A single parse of the test file takes about 1/10th of a millisecond, so with large number of runs there is a good chance of hitting at least one no-interrupt streak, and obtaining undisturbed results.
Platform
Compiler
strlen() RapidXml pugixml 0.3 pugxml TinyXml
Pentium 4
MSVC 8.0
2.5
5.4
7.0
61.7
298.8
Pentium 4
gcc 4.1.1
0.8
6.1
9.5
67.0
413.2
Core 2
MSVC 8.0
1.0
4.5
5.0
24.6
154.8
Core 2
gcc 4.1.1
0.6
4.6
5.4
28.3
229.3
Athlon XP
MSVC 8.0
3.1
7.7
8.0
25.5
182.6
Athlon XP
gcc 4.1.1
0.9
8.2
9.2
33.7
265.2
Pentium 3
MSVC 8.0
2.0
6.3
7.0
30.9
211.9
Pentium 3
gcc 4.1.1
1.0
6.7
8.9
35.3
316.0
(*) All results are in CPU cycles per character of source text

5. Reference

This section lists all classes, functions, constants etc. and describes them in detail.
class + template + rapidxml::memory_pool
+ constructor + memory_pool()
+ destructor + ~memory_pool()
function allocate_node(node_type type, const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0)
function allocate_attribute(const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0)
function allocate_string(const Ch *source=0, std::size_t size=0)
function clone_node(const xml_node< Ch > *source, xml_node< Ch > *result=0)
function clear()
function set_allocator(alloc_func *af, free_func *ff)

class rapidxml::parse_error
+ constructor + parse_error(const char *what, void *where)
function what() const
function where() const

class + template + rapidxml::xml_attribute
+ constructor + xml_attribute()
function document() const
function previous_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
function next_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const

class + template + rapidxml::xml_base
+ constructor + xml_base()
function name() const
function name_size() const
function value() const
function value_size() const
function name(const Ch *name, std::size_t size)
function name(const Ch *name)
function value(const Ch *value, std::size_t size)
function value(const Ch *value)
function parent() const

class + template + rapidxml::xml_document
+ constructor + xml_document()
function parse(Ch *text)
function clear()

class + template + rapidxml::xml_node
+ constructor + xml_node(node_type type)
function type() const
function document() const
function first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
function last_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
function previous_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
function next_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
function first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
function last_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
function type(node_type type)
function prepend_node(xml_node< Ch > *child)
function append_node(xml_node< Ch > *child)
function insert_node(xml_node< Ch > *where, xml_node< Ch > *child)
function remove_first_node()
function remove_last_node()
function remove_node(xml_node< Ch > *where)
function remove_all_nodes()
function prepend_attribute(xml_attribute< Ch > *attribute)
function append_attribute(xml_attribute< Ch > *attribute)
function insert_attribute(xml_attribute< Ch > *where, xml_attribute< Ch > *attribute)
function remove_first_attribute()
function remove_last_attribute()
function remove_attribute(xml_attribute< Ch > *where)
function remove_all_attributes()

namespace rapidxml
enum node_type
function parse_error_handler(const char *what, void *where)
function print(OutIt out, const xml_node< Ch > &node, int flags=0)
function print(std::basic_ostream< Ch > &out, const xml_node< Ch > &node, int flags=0)
function operator<<(std::basic_ostream< Ch > &out, const xml_node< Ch > &node)
+ constant + parse_no_data_nodes
+ constant + parse_no_element_values
+ constant + parse_no_string_terminators
+ constant + parse_no_entity_translation
+ constant + parse_no_utf8
+ constant + parse_declaration_node
+ constant + parse_comment_nodes
+ constant + parse_doctype_node
+ constant + parse_pi_nodes
+ constant + parse_validate_closing_tags
+ constant + parse_trim_whitespace
+ constant + parse_normalize_whitespace
+ constant + parse_default
+ constant + parse_non_destructive
+ constant + parse_fastest
+ constant + parse_full
+ constant + print_no_indenting


class + template + rapidxml::memory_pool

+ + Defined in rapidxml.hpp
+ Base class for + xml_document

Description

This class is used by the parser to create new nodes and attributes, without overheads of dynamic memory allocation. In most cases, you will not need to use this class directly. However, if you need to create nodes manually or modify names/values of nodes, you are encouraged to use memory_pool of relevant xml_document to allocate the memory. Not only is this faster than allocating them by using new operator, but also their lifetime will be tied to the lifetime of document, possibly simplyfing memory management.

+ Call allocate_node() or allocate_attribute() functions to obtain new nodes or attributes from the pool. You can also call allocate_string() function to allocate strings. Such strings can then be used as names or values of nodes without worrying about their lifetime. Note that there is no free() function -- all allocations are freed at once when clear() function is called, or when the pool is destroyed.

+ It is also possible to create a standalone memory_pool, and use it to allocate nodes, whose lifetime will not be tied to any document.

+ Pool maintains RAPIDXML_STATIC_POOL_SIZE bytes of statically allocated memory. Until static memory is exhausted, no dynamic memory allocations are done. When static memory is exhausted, pool allocates additional blocks of memory of size RAPIDXML_DYNAMIC_POOL_SIZE each, by using global new[] and delete[] operators. This behaviour can be changed by setting custom allocation routines. Use set_allocator() function to set them.

+ Allocations for nodes, attributes and strings are aligned at RAPIDXML_ALIGNMENT bytes. This value defaults to the size of pointer on target architecture.

+ To obtain absolutely top performance from the parser, it is important that all nodes are allocated from a single, contiguous block of memory. Otherwise, cache misses when jumping between two (or more) disjoint blocks of memory can slow down parsing quite considerably. If required, you can tweak RAPIDXML_STATIC_POOL_SIZE, RAPIDXML_DYNAMIC_POOL_SIZE and RAPIDXML_ALIGNMENT to obtain best wasted memory to performance compromise. To do it, define their values before rapidxml.hpp file is included.

Parameters

Ch
Character type of created nodes.

+ constructor + memory_pool::memory_pool

Synopsis

memory_pool(); +

Description

Constructs empty pool with default allocator functions.

+ destructor + memory_pool::~memory_pool

Synopsis

~memory_pool(); +

Description

Destroys pool and frees all the memory. This causes memory occupied by nodes allocated by the pool to be freed. Nodes allocated from the pool are no longer valid.

function memory_pool::allocate_node

Synopsis

xml_node<Ch>* allocate_node(node_type type, const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0); +

Description

Allocates a new node from the pool, and optionally assigns name and value to it. If the allocation request cannot be accomodated, this function will throw std::bad_alloc. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function.

Parameters

type
Type of node to create.
name
Name to assign to the node, or 0 to assign no name.
value
Value to assign to the node, or 0 to assign no value.
name_size
Size of name to assign, or 0 to automatically calculate size from name string.
value_size
Size of value to assign, or 0 to automatically calculate size from value string.

Returns

Pointer to allocated node. This pointer will never be NULL.

function memory_pool::allocate_attribute

Synopsis

xml_attribute<Ch>* allocate_attribute(const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0); +

Description

Allocates a new attribute from the pool, and optionally assigns name and value to it. If the allocation request cannot be accomodated, this function will throw std::bad_alloc. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function.

Parameters

name
Name to assign to the attribute, or 0 to assign no name.
value
Value to assign to the attribute, or 0 to assign no value.
name_size
Size of name to assign, or 0 to automatically calculate size from name string.
value_size
Size of value to assign, or 0 to automatically calculate size from value string.

Returns

Pointer to allocated attribute. This pointer will never be NULL.

function memory_pool::allocate_string

Synopsis

Ch* allocate_string(const Ch *source=0, std::size_t size=0); +

Description

Allocates a char array of given size from the pool, and optionally copies a given string to it. If the allocation request cannot be accomodated, this function will throw std::bad_alloc. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function.

Parameters

source
String to initialize the allocated memory with, or 0 to not initialize it.
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.

Returns

Pointer to allocated char array. This pointer will never be NULL.

function memory_pool::clone_node

Synopsis

xml_node<Ch>* clone_node(const xml_node< Ch > *source, xml_node< Ch > *result=0); +

Description

Clones an xml_node and its hierarchy of child nodes and attributes. Nodes and attributes are allocated from this memory pool. Names and values are not cloned, they are shared between the clone and the source. Result node can be optionally specified as a second parameter, in which case its contents will be replaced with cloned source node. This is useful when you want to clone entire document.

Parameters

source
Node to clone.
result
Node to put results in, or 0 to automatically allocate result node

Returns

Pointer to cloned node. This pointer will never be NULL.

function memory_pool::clear

Synopsis

void clear(); +

Description

Clears the pool. This causes memory occupied by nodes allocated by the pool to be freed. Any nodes or strings allocated from the pool will no longer be valid.

function memory_pool::set_allocator

Synopsis

void set_allocator(alloc_func *af, free_func *ff); +

Description

Sets or resets the user-defined memory allocation functions for the pool. This can only be called when no memory is allocated from the pool yet, otherwise results are undefined. Allocation function must not return invalid pointer on failure. It should either throw, stop the program, or use longjmp() function to pass control to other place of program. If it returns invalid pointer, results are undefined.

+ User defined allocation functions must have the following forms:

+void *allocate(std::size_t size);
+void free(void *pointer);

Parameters

af
Allocation function, or 0 to restore default function
ff
Free function, or 0 to restore default function

class rapidxml::parse_error

+ + Defined in rapidxml.hpp

Description

Parse error exception. This exception is thrown by the parser when an error occurs. Use what() function to get human-readable error message. Use where() function to get a pointer to position within source text where error was detected.

+ If throwing exceptions by the parser is undesirable, it can be disabled by defining RAPIDXML_NO_EXCEPTIONS macro before rapidxml.hpp is included. This will cause the parser to call rapidxml::parse_error_handler() function instead of throwing an exception. This function must be defined by the user.

+ This class derives from std::exception class.

+ constructor + parse_error::parse_error

Synopsis

parse_error(const char *what, void *where); +

Description

Constructs parse error.

function parse_error::what

Synopsis

virtual const char* what() const; +

Description

Gets human readable description of error.

Returns

Pointer to null terminated description of the error.

function parse_error::where

Synopsis

Ch* where() const; +

Description

Gets pointer to character data where error happened. Ch should be the same as char type of xml_document that produced the error.

Returns

Pointer to location within the parsed string where error occured.

class + template + rapidxml::xml_attribute

+ + Defined in rapidxml.hpp
+ Inherits from + xml_base

Description

Class representing attribute node of XML document. Each attribute has name and value strings, which are available through name() and value() functions (inherited from xml_base). Note that after parse, both name and value of attribute will point to interior of source text used for parsing. Thus, this text must persist in memory for the lifetime of attribute.

Parameters

Ch
Character type to use.

+ constructor + xml_attribute::xml_attribute

Synopsis

xml_attribute(); +

Description

Constructs an empty attribute with the specified type. Consider using memory_pool of appropriate xml_document if allocating attributes manually.

function xml_attribute::document

Synopsis

xml_document<Ch>* document() const; +

Description

Gets document of which attribute is a child.

Returns

Pointer to document that contains this attribute, or 0 if there is no parent document.

function xml_attribute::previous_attribute

Synopsis

xml_attribute<Ch>* previous_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

Description

Gets previous attribute, optionally matching attribute name.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found attribute, or 0 if not found.

function xml_attribute::next_attribute

Synopsis

xml_attribute<Ch>* next_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

Description

Gets next attribute, optionally matching attribute name.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found attribute, or 0 if not found.

class + template + rapidxml::xml_base

+ + Defined in rapidxml.hpp
+ Base class for + xml_attribute xml_node

Description

Base class for xml_node and xml_attribute implementing common functions: name(), name_size(), value(), value_size() and parent().

Parameters

Ch
Character type to use

+ constructor + xml_base::xml_base

Synopsis

xml_base(); +

function xml_base::name

Synopsis

Ch* name() const; +

Description

Gets name of the node. Interpretation of name depends on type of node. Note that name will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse.

+ Use name_size() function to determine length of the name.

Returns

Name of node, or empty string if node has no name.

function xml_base::name_size

Synopsis

std::size_t name_size() const; +

Description

Gets size of node name, not including terminator character. This function works correctly irrespective of whether name is or is not zero terminated.

Returns

Size of node name, in characters.

function xml_base::value

Synopsis

Ch* value() const; +

Description

Gets value of node. Interpretation of value depends on type of node. Note that value will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse.

+ Use value_size() function to determine length of the value.

Returns

Value of node, or empty string if node has no value.

function xml_base::value_size

Synopsis

std::size_t value_size() const; +

Description

Gets size of node value, not including terminator character. This function works correctly irrespective of whether value is or is not zero terminated.

Returns

Size of node value, in characters.

function xml_base::name

Synopsis

void name(const Ch *name, std::size_t size); +

Description

Sets name of node to a non zero-terminated string. See Ownership Of Strings .

+ Note that node does not own its name or value, it only stores a pointer to it. It will not delete or otherwise free the pointer on destruction. It is reponsibility of the user to properly manage lifetime of the string. The easiest way to achieve it is to use memory_pool of the document to allocate the string - on destruction of the document the string will be automatically freed.

+ Size of name must be specified separately, because name does not have to be zero terminated. Use name(const Ch *) function to have the length automatically calculated (string must be zero terminated).

Parameters

name
Name of node to set. Does not have to be zero terminated.
size
Size of name, in characters. This does not include zero terminator, if one is present.

function xml_base::name

Synopsis

void name(const Ch *name); +

Description

Sets name of node to a zero-terminated string. See also Ownership Of Strings and xml_node::name(const Ch *, std::size_t).

Parameters

name
Name of node to set. Must be zero terminated.

function xml_base::value

Synopsis

void value(const Ch *value, std::size_t size); +

Description

Sets value of node to a non zero-terminated string. See Ownership Of Strings .

+ Note that node does not own its name or value, it only stores a pointer to it. It will not delete or otherwise free the pointer on destruction. It is reponsibility of the user to properly manage lifetime of the string. The easiest way to achieve it is to use memory_pool of the document to allocate the string - on destruction of the document the string will be automatically freed.

+ Size of value must be specified separately, because it does not have to be zero terminated. Use value(const Ch *) function to have the length automatically calculated (string must be zero terminated).

+ If an element has a child node of type node_data, it will take precedence over element value when printing. 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.

Parameters

value
value of node to set. Does not have to be zero terminated.
size
Size of value, in characters. This does not include zero terminator, if one is present.

function xml_base::value

Synopsis

void value(const Ch *value); +

Description

Sets value of node to a zero-terminated string. See also Ownership Of Strings and xml_node::value(const Ch *, std::size_t).

Parameters

value
Vame of node to set. Must be zero terminated.

function xml_base::parent

Synopsis

xml_node<Ch>* parent() const; +

Description

Gets node parent.

Returns

Pointer to parent node, or 0 if there is no parent.

class + template + rapidxml::xml_document

+ + Defined in rapidxml.hpp
+ Inherits from + xml_node memory_pool

Description

This class represents root of the DOM hierarchy. It is also an xml_node and a memory_pool through public inheritance. Use parse() function to build a DOM tree from a zero-terminated XML text string. parse() function allocates memory for nodes and attributes by using functions of xml_document, which are inherited from memory_pool. To access root node of the document, use the document itself, as if it was an xml_node.

Parameters

Ch
Character type to use.

+ constructor + xml_document::xml_document

Synopsis

xml_document(); +

Description

Constructs empty XML document.

function xml_document::parse

Synopsis

void parse(Ch *text); +

Description

Parses zero-terminated XML string according to given flags. Passed string will be modified by the parser, unless rapidxml::parse_non_destructive flag is used. The string must persist for the lifetime of the document. In case of error, rapidxml::parse_error exception will be thrown.

+ If you want to parse contents of a file, you must first load the file into the memory, and pass pointer to its beginning. Make sure that data is zero-terminated.

+ Document can be parsed into multiple times. Each new call to parse removes previous nodes and attributes (if any), but does not clear memory pool.

Parameters

text
XML data to parse; pointer is non-const to denote fact that this data may be modified by the parser.

function xml_document::clear

Synopsis

void clear(); +

Description

Clears the document by deleting all nodes and clearing the memory pool. All nodes owned by document pool are destroyed.

class + template + rapidxml::xml_node

+ + Defined in rapidxml.hpp
+ Inherits from + xml_base
+ Base class for + xml_document

Description

Class representing a node of XML document. Each node may have associated name and value strings, which are available through name() and value() functions. Interpretation of name and value depends on type of the node. Type of node can be determined by using type() function.

+ Note that after parse, both name and value of node, if any, will point interior of source text used for parsing. Thus, this text must persist in the memory for the lifetime of node.

Parameters

Ch
Character type to use.

+ constructor + xml_node::xml_node

Synopsis

xml_node(node_type type); +

Description

Constructs an empty node with the specified type. Consider using memory_pool of appropriate document to allocate nodes manually.

Parameters

type
Type of node to construct.

function xml_node::type

Synopsis

node_type type() const; +

Description

Gets type of node.

Returns

Type of node.

function xml_node::document

Synopsis

xml_document<Ch>* document() const; +

Description

Gets document of which node is a child.

Returns

Pointer to document that contains this node, or 0 if there is no parent document.

function xml_node::first_node

Synopsis

xml_node<Ch>* first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

Description

Gets first child node, optionally matching node name.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found child, or 0 if not found.

function xml_node::last_node

Synopsis

xml_node<Ch>* last_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

Description

Gets last child node, optionally matching node name. Behaviour is undefined if node has no children. Use first_node() to test if node has children.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found child, or 0 if not found.

function xml_node::previous_sibling

Synopsis

xml_node<Ch>* previous_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

Description

Gets previous sibling node, optionally matching node name. Behaviour is undefined if node has no parent. Use parent() to test if node has a parent.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found sibling, or 0 if not found.

function xml_node::next_sibling

Synopsis

xml_node<Ch>* next_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

Description

Gets next sibling node, optionally matching node name. Behaviour is undefined if node has no parent. Use parent() to test if node has a parent.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found sibling, or 0 if not found.

function xml_node::first_attribute

Synopsis

xml_attribute<Ch>* first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

Description

Gets first attribute of node, optionally matching attribute name.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found attribute, or 0 if not found.

function xml_node::last_attribute

Synopsis

xml_attribute<Ch>* last_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const; +

Description

Gets last attribute of node, optionally matching attribute name.

Parameters

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
name_size
Size of name, in characters, or 0 to have size calculated automatically from string
case_sensitive
Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters

Returns

Pointer to found attribute, or 0 if not found.

function xml_node::type

Synopsis

void type(node_type type); +

Description

Sets type of node.

Parameters

type
Type of node to set.

function xml_node::prepend_node

Synopsis

void prepend_node(xml_node< Ch > *child); +

Description

Prepends a new child node. The prepended child becomes the first child, and all existing children are moved one position back.

Parameters

child
Node to prepend.

function xml_node::append_node

Synopsis

void append_node(xml_node< Ch > *child); +

Description

Appends a new child node. The appended child becomes the last child.

Parameters

child
Node to append.

function xml_node::insert_node

Synopsis

void insert_node(xml_node< Ch > *where, xml_node< Ch > *child); +

Description

Inserts a new child node at specified place inside the node. All children after and including the specified node are moved one position back.

Parameters

where
Place where to insert the child, or 0 to insert at the back.
child
Node to insert.

function xml_node::remove_first_node

Synopsis

void remove_first_node(); +

Description

Removes first child node. If node has no children, behaviour is undefined. Use first_node() to test if node has children.

function xml_node::remove_last_node

Synopsis

void remove_last_node(); +

Description

Removes last child of the node. If node has no children, behaviour is undefined. Use first_node() to test if node has children.

function xml_node::remove_node

Synopsis

void remove_node(xml_node< Ch > *where); +

Description

Removes specified child from the node.

function xml_node::remove_all_nodes

Synopsis

void remove_all_nodes(); +

Description

Removes all child nodes (but not attributes).

function xml_node::prepend_attribute

Synopsis

void prepend_attribute(xml_attribute< Ch > *attribute); +

Description

Prepends a new attribute to the node.

Parameters

attribute
Attribute to prepend.

function xml_node::append_attribute

Synopsis

void append_attribute(xml_attribute< Ch > *attribute); +

Description

Appends a new attribute to the node.

Parameters

attribute
Attribute to append.

function xml_node::insert_attribute

Synopsis

void insert_attribute(xml_attribute< Ch > *where, xml_attribute< Ch > *attribute); +

Description

Inserts a new attribute at specified place inside the node. All attributes after and including the specified attribute are moved one position back.

Parameters

where
Place where to insert the attribute, or 0 to insert at the back.
attribute
Attribute to insert.

function xml_node::remove_first_attribute

Synopsis

void remove_first_attribute(); +

Description

Removes first attribute of the node. If node has no attributes, behaviour is undefined. Use first_attribute() to test if node has attributes.

function xml_node::remove_last_attribute

Synopsis

void remove_last_attribute(); +

Description

Removes last attribute of the node. If node has no attributes, behaviour is undefined. Use first_attribute() to test if node has attributes.

function xml_node::remove_attribute

Synopsis

void remove_attribute(xml_attribute< Ch > *where); +

Description

Removes specified attribute from node.

Parameters

where
Pointer to attribute to be removed.

function xml_node::remove_all_attributes

Synopsis

void remove_all_attributes(); +

Description

Removes all attributes of node.

enum node_type

Description

Enumeration listing all node types produced by the parser. Use xml_node::type() function to query node type.

Values

node_document
A document node. Name and value are empty.
node_element
An element node. Name contains element name. Value contains text of first data node.
node_data
A data node. Name is empty. Value contains data text.
node_cdata
A CDATA node. Name is empty. Value contains data text.
node_comment
A comment node. Name is empty. Value contains comment text.
node_declaration
A declaration node. Name and value are empty. Declaration parameters (version, encoding and standalone) are in node attributes.
node_doctype
A DOCTYPE node. Name is empty. Value contains DOCTYPE text.
node_pi
A PI node. Name contains target. Value contains instructions.

function parse_error_handler

Synopsis

void rapidxml::parse_error_handler(const char *what, void *where); +

Description

When exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function is called to notify user about the error. It must be defined by the user.

+ This function cannot return. If it does, the results are undefined.

+ A very simple definition might look like that: + void rapidxml::parse_error_handler(const char *what, void *where) + { + std::cout << "Parse error: " << what << "\n"; + std::abort(); + } +

Parameters

what
Human readable description of the error.
where
Pointer to character data where error was detected.

function print

Synopsis

OutIt rapidxml::print(OutIt out, const xml_node< Ch > &node, int flags=0); +

Description

Prints XML to given output iterator.

Parameters

out
Output iterator to print to.
node
Node to be printed. Pass xml_document to print entire document.
flags
Flags controlling how XML is printed.

Returns

Output iterator pointing to position immediately after last character of printed text.

function print

Synopsis

std::basic_ostream<Ch>& rapidxml::print(std::basic_ostream< Ch > &out, const xml_node< Ch > &node, int flags=0); +

Description

Prints XML to given output stream.

Parameters

out
Output stream to print to.
node
Node to be printed. Pass xml_document to print entire document.
flags
Flags controlling how XML is printed.

Returns

Output stream.

function operator<<

Synopsis

std::basic_ostream<Ch>& rapidxml::operator<<(std::basic_ostream< Ch > &out, const xml_node< Ch > &node); +

Description

Prints formatted XML to given output stream. Uses default printing flags. Use print() function to customize printing process.

Parameters

out
Output stream to print to.
node
Node to be printed.

Returns

Output stream.

+ constant + parse_no_data_nodes

Synopsis

const int parse_no_data_nodes + = 0x1; +

Description

Parse flag instructing the parser to not create data nodes. Text of first data node will still be placed in value of parent element, unless rapidxml::parse_no_element_values flag is also specified. Can be combined with other flags by use of | operator.

+ See xml_document::parse() function.

+ constant + parse_no_element_values

Synopsis

const int parse_no_element_values + = 0x2; +

Description

Parse flag instructing the parser to not use text of first data node as a value of parent element. Can be combined with other flags by use of | operator. Note that child data nodes of element node take precendence over its value when printing. That is, if element has one or more child data nodes and a value, the value will be ignored. Use rapidxml::parse_no_data_nodes flag to prevent creation of data nodes if you want to manipulate data using values of elements.

+ See xml_document::parse() function.

+ constant + parse_no_string_terminators

Synopsis

const int parse_no_string_terminators + = 0x4; +

Description

Parse flag instructing the parser to not place zero terminators after strings in the source text. By default zero terminators are placed, modifying source text. Can be combined with other flags by use of | operator.

+ See xml_document::parse() function.

+ constant + parse_no_entity_translation

Synopsis

const int parse_no_entity_translation + = 0x8; +

Description

Parse flag instructing the parser to not translate entities in the source text. By default entities are translated, modifying source text. Can be combined with other flags by use of | operator.

+ See xml_document::parse() function.

+ constant + parse_no_utf8

Synopsis

const int parse_no_utf8 + = 0x10; +

Description

Parse flag instructing the parser to disable UTF-8 handling and assume plain 8 bit characters. By default, UTF-8 handling is enabled. Can be combined with other flags by use of | operator.

+ See xml_document::parse() function.

+ constant + parse_declaration_node

Synopsis

const int parse_declaration_node + = 0x20; +

Description

Parse flag instructing the parser to create XML declaration node. By default, declaration node is not created. Can be combined with other flags by use of | operator.

+ See xml_document::parse() function.

+ constant + parse_comment_nodes

Synopsis

const int parse_comment_nodes + = 0x40; +

Description

Parse flag instructing the parser to create comments nodes. By default, comment nodes are not created. Can be combined with other flags by use of | operator.

+ See xml_document::parse() function.

+ constant + parse_doctype_node

Synopsis

const int parse_doctype_node + = 0x80; +

Description

Parse flag instructing the parser to create DOCTYPE node. By default, doctype node is not created. Although W3C specification allows at most one DOCTYPE node, RapidXml will silently accept documents with more than one. Can be combined with other flags by use of | operator.

+ See xml_document::parse() function.

+ constant + parse_pi_nodes

Synopsis

const int parse_pi_nodes + = 0x100; +

Description

Parse flag instructing the parser to create PI nodes. By default, PI nodes are not created. Can be combined with other flags by use of | operator.

+ See xml_document::parse() function.

+ constant + parse_validate_closing_tags

Synopsis

const int parse_validate_closing_tags + = 0x200; +

Description

Parse flag instructing the parser to validate closing tag names. If not set, name inside closing tag is irrelevant to the parser. By default, closing tags are not validated. Can be combined with other flags by use of | operator.

+ See xml_document::parse() function.

+ constant + parse_trim_whitespace

Synopsis

const int parse_trim_whitespace + = 0x400; +

Description

Parse flag instructing the parser to trim all leading and trailing whitespace of data nodes. By default, whitespace is not trimmed. This flag does not cause the parser to modify source text. Can be combined with other flags by use of | operator.

+ See xml_document::parse() function.

+ constant + parse_normalize_whitespace

Synopsis

const int parse_normalize_whitespace + = 0x800; +

Description

Parse flag instructing the parser to condense all whitespace runs of data nodes to a single space character. Trimming of leading and trailing whitespace of data is controlled by rapidxml::parse_trim_whitespace flag. By default, whitespace is not normalized. If this flag is specified, source text will be modified. Can be combined with other flags by use of | operator.

+ See xml_document::parse() function.

+ constant + parse_default

Synopsis

const int parse_default + = 0; +

Description

Parse flags which represent default behaviour of the parser. This is always equal to 0, so that all other flags can be simply ored together. Normally there is no need to inconveniently disable flags by anding with their negated (~) values. This also means that meaning of each flag is a negation of the default setting. For example, if flag name is rapidxml::parse_no_utf8, it means that utf-8 is enabled by default, and using the flag will disable it.

+ See xml_document::parse() function.

+ constant + parse_non_destructive

Synopsis

const int parse_non_destructive + = parse_no_string_terminators | parse_no_entity_translation; +

Description

A combination of parse flags that forbids any modifications of the source text. This also results in faster parsing. However, note that the following will occur: +See xml_document::parse() function.

+ constant + parse_fastest

Synopsis

const int parse_fastest + = parse_non_destructive | parse_no_data_nodes; +

Description

A combination of parse flags resulting in fastest possible parsing, without sacrificing important data.

+ See xml_document::parse() function.

+ constant + parse_full

Synopsis

const int parse_full + = parse_declaration_node | parse_comment_nodes | parse_doctype_node | parse_pi_nodes | parse_validate_closing_tags; +

Description

A combination of parse flags resulting in largest amount of data being extracted. This usually results in slowest parsing.

+ See xml_document::parse() function.

+ constant + print_no_indenting

Synopsis

const int print_no_indenting + = 0x1;

Description

Printer flag instructing the printer to suppress indenting of XML. See print() function.

\ No newline at end of file diff --git a/cereal/include/cereal/external/rapidxml/rapidxml.hpp b/3rdparty/cereal/include/cereal/external/rapidxml/rapidxml.hpp similarity index 100% rename from cereal/include/cereal/external/rapidxml/rapidxml.hpp rename to 3rdparty/cereal/include/cereal/external/rapidxml/rapidxml.hpp diff --git a/cereal/include/cereal/external/rapidxml/rapidxml_iterators.hpp b/3rdparty/cereal/include/cereal/external/rapidxml/rapidxml_iterators.hpp similarity index 100% rename from cereal/include/cereal/external/rapidxml/rapidxml_iterators.hpp rename to 3rdparty/cereal/include/cereal/external/rapidxml/rapidxml_iterators.hpp diff --git a/cereal/include/cereal/external/rapidxml/rapidxml_print.hpp b/3rdparty/cereal/include/cereal/external/rapidxml/rapidxml_print.hpp similarity index 100% rename from cereal/include/cereal/external/rapidxml/rapidxml_print.hpp rename to 3rdparty/cereal/include/cereal/external/rapidxml/rapidxml_print.hpp diff --git a/cereal/include/cereal/external/rapidxml/rapidxml_utils.hpp b/3rdparty/cereal/include/cereal/external/rapidxml/rapidxml_utils.hpp similarity index 100% rename from cereal/include/cereal/external/rapidxml/rapidxml_utils.hpp rename to 3rdparty/cereal/include/cereal/external/rapidxml/rapidxml_utils.hpp diff --git a/cereal/include/cereal/macros.hpp b/3rdparty/cereal/include/cereal/macros.hpp similarity index 100% rename from cereal/include/cereal/macros.hpp rename to 3rdparty/cereal/include/cereal/macros.hpp diff --git a/cereal/include/cereal/specialize.hpp b/3rdparty/cereal/include/cereal/specialize.hpp similarity index 100% rename from cereal/include/cereal/specialize.hpp rename to 3rdparty/cereal/include/cereal/specialize.hpp diff --git a/cereal/include/cereal/types/array.hpp b/3rdparty/cereal/include/cereal/types/array.hpp similarity index 100% rename from cereal/include/cereal/types/array.hpp rename to 3rdparty/cereal/include/cereal/types/array.hpp diff --git a/cereal/include/cereal/types/atomic.hpp b/3rdparty/cereal/include/cereal/types/atomic.hpp similarity index 100% rename from cereal/include/cereal/types/atomic.hpp rename to 3rdparty/cereal/include/cereal/types/atomic.hpp diff --git a/cereal/include/cereal/types/base_class.hpp b/3rdparty/cereal/include/cereal/types/base_class.hpp similarity index 100% rename from cereal/include/cereal/types/base_class.hpp rename to 3rdparty/cereal/include/cereal/types/base_class.hpp diff --git a/cereal/include/cereal/types/bitset.hpp b/3rdparty/cereal/include/cereal/types/bitset.hpp similarity index 100% rename from cereal/include/cereal/types/bitset.hpp rename to 3rdparty/cereal/include/cereal/types/bitset.hpp diff --git a/cereal/include/cereal/types/boost_variant.hpp b/3rdparty/cereal/include/cereal/types/boost_variant.hpp similarity index 100% rename from cereal/include/cereal/types/boost_variant.hpp rename to 3rdparty/cereal/include/cereal/types/boost_variant.hpp diff --git a/cereal/include/cereal/types/chrono.hpp b/3rdparty/cereal/include/cereal/types/chrono.hpp similarity index 100% rename from cereal/include/cereal/types/chrono.hpp rename to 3rdparty/cereal/include/cereal/types/chrono.hpp diff --git a/cereal/include/cereal/types/common.hpp b/3rdparty/cereal/include/cereal/types/common.hpp similarity index 100% rename from cereal/include/cereal/types/common.hpp rename to 3rdparty/cereal/include/cereal/types/common.hpp diff --git a/cereal/include/cereal/types/complex.hpp b/3rdparty/cereal/include/cereal/types/complex.hpp similarity index 100% rename from cereal/include/cereal/types/complex.hpp rename to 3rdparty/cereal/include/cereal/types/complex.hpp diff --git a/cereal/include/cereal/types/concepts/pair_associative_container.hpp b/3rdparty/cereal/include/cereal/types/concepts/pair_associative_container.hpp similarity index 100% rename from cereal/include/cereal/types/concepts/pair_associative_container.hpp rename to 3rdparty/cereal/include/cereal/types/concepts/pair_associative_container.hpp diff --git a/cereal/include/cereal/types/deque.hpp b/3rdparty/cereal/include/cereal/types/deque.hpp similarity index 100% rename from cereal/include/cereal/types/deque.hpp rename to 3rdparty/cereal/include/cereal/types/deque.hpp diff --git a/cereal/include/cereal/types/forward_list.hpp b/3rdparty/cereal/include/cereal/types/forward_list.hpp similarity index 100% rename from cereal/include/cereal/types/forward_list.hpp rename to 3rdparty/cereal/include/cereal/types/forward_list.hpp diff --git a/cereal/include/cereal/types/functional.hpp b/3rdparty/cereal/include/cereal/types/functional.hpp similarity index 100% rename from cereal/include/cereal/types/functional.hpp rename to 3rdparty/cereal/include/cereal/types/functional.hpp diff --git a/cereal/include/cereal/types/list.hpp b/3rdparty/cereal/include/cereal/types/list.hpp similarity index 100% rename from cereal/include/cereal/types/list.hpp rename to 3rdparty/cereal/include/cereal/types/list.hpp diff --git a/cereal/include/cereal/types/map.hpp b/3rdparty/cereal/include/cereal/types/map.hpp similarity index 100% rename from cereal/include/cereal/types/map.hpp rename to 3rdparty/cereal/include/cereal/types/map.hpp diff --git a/cereal/include/cereal/types/memory.hpp b/3rdparty/cereal/include/cereal/types/memory.hpp similarity index 100% rename from cereal/include/cereal/types/memory.hpp rename to 3rdparty/cereal/include/cereal/types/memory.hpp diff --git a/cereal/include/cereal/types/optional.hpp b/3rdparty/cereal/include/cereal/types/optional.hpp similarity index 100% rename from cereal/include/cereal/types/optional.hpp rename to 3rdparty/cereal/include/cereal/types/optional.hpp diff --git a/cereal/include/cereal/types/polymorphic.hpp b/3rdparty/cereal/include/cereal/types/polymorphic.hpp similarity index 100% rename from cereal/include/cereal/types/polymorphic.hpp rename to 3rdparty/cereal/include/cereal/types/polymorphic.hpp diff --git a/cereal/include/cereal/types/queue.hpp b/3rdparty/cereal/include/cereal/types/queue.hpp similarity index 100% rename from cereal/include/cereal/types/queue.hpp rename to 3rdparty/cereal/include/cereal/types/queue.hpp diff --git a/cereal/include/cereal/types/set.hpp b/3rdparty/cereal/include/cereal/types/set.hpp similarity index 100% rename from cereal/include/cereal/types/set.hpp rename to 3rdparty/cereal/include/cereal/types/set.hpp diff --git a/cereal/include/cereal/types/stack.hpp b/3rdparty/cereal/include/cereal/types/stack.hpp similarity index 100% rename from cereal/include/cereal/types/stack.hpp rename to 3rdparty/cereal/include/cereal/types/stack.hpp diff --git a/cereal/include/cereal/types/string.hpp b/3rdparty/cereal/include/cereal/types/string.hpp similarity index 100% rename from cereal/include/cereal/types/string.hpp rename to 3rdparty/cereal/include/cereal/types/string.hpp diff --git a/cereal/include/cereal/types/tuple.hpp b/3rdparty/cereal/include/cereal/types/tuple.hpp similarity index 100% rename from cereal/include/cereal/types/tuple.hpp rename to 3rdparty/cereal/include/cereal/types/tuple.hpp diff --git a/cereal/include/cereal/types/unordered_map.hpp b/3rdparty/cereal/include/cereal/types/unordered_map.hpp similarity index 100% rename from cereal/include/cereal/types/unordered_map.hpp rename to 3rdparty/cereal/include/cereal/types/unordered_map.hpp diff --git a/cereal/include/cereal/types/unordered_set.hpp b/3rdparty/cereal/include/cereal/types/unordered_set.hpp similarity index 100% rename from cereal/include/cereal/types/unordered_set.hpp rename to 3rdparty/cereal/include/cereal/types/unordered_set.hpp diff --git a/cereal/include/cereal/types/utility.hpp b/3rdparty/cereal/include/cereal/types/utility.hpp similarity index 100% rename from cereal/include/cereal/types/utility.hpp rename to 3rdparty/cereal/include/cereal/types/utility.hpp diff --git a/cereal/include/cereal/types/valarray.hpp b/3rdparty/cereal/include/cereal/types/valarray.hpp similarity index 100% rename from cereal/include/cereal/types/valarray.hpp rename to 3rdparty/cereal/include/cereal/types/valarray.hpp diff --git a/cereal/include/cereal/types/variant.hpp b/3rdparty/cereal/include/cereal/types/variant.hpp similarity index 100% rename from cereal/include/cereal/types/variant.hpp rename to 3rdparty/cereal/include/cereal/types/variant.hpp diff --git a/cereal/include/cereal/types/vector.hpp b/3rdparty/cereal/include/cereal/types/vector.hpp similarity index 100% rename from cereal/include/cereal/types/vector.hpp rename to 3rdparty/cereal/include/cereal/types/vector.hpp diff --git a/cereal/include/cereal/version.hpp b/3rdparty/cereal/include/cereal/version.hpp similarity index 100% rename from cereal/include/cereal/version.hpp rename to 3rdparty/cereal/include/cereal/version.hpp diff --git a/cereal/sandbox/CMakeLists.txt b/3rdparty/cereal/sandbox/CMakeLists.txt similarity index 100% rename from cereal/sandbox/CMakeLists.txt rename to 3rdparty/cereal/sandbox/CMakeLists.txt diff --git a/cereal/sandbox/performance.cpp b/3rdparty/cereal/sandbox/performance.cpp similarity index 100% rename from cereal/sandbox/performance.cpp rename to 3rdparty/cereal/sandbox/performance.cpp diff --git a/cereal/sandbox/sandbox.cpp b/3rdparty/cereal/sandbox/sandbox.cpp similarity index 100% rename from cereal/sandbox/sandbox.cpp rename to 3rdparty/cereal/sandbox/sandbox.cpp diff --git a/cereal/sandbox/sandbox_json.cpp b/3rdparty/cereal/sandbox/sandbox_json.cpp similarity index 100% rename from cereal/sandbox/sandbox_json.cpp rename to 3rdparty/cereal/sandbox/sandbox_json.cpp diff --git a/cereal/sandbox/sandbox_rtti.cpp b/3rdparty/cereal/sandbox/sandbox_rtti.cpp similarity index 100% rename from cereal/sandbox/sandbox_rtti.cpp rename to 3rdparty/cereal/sandbox/sandbox_rtti.cpp diff --git a/cereal/sandbox/sandbox_shared_lib/CMakeLists.txt b/3rdparty/cereal/sandbox/sandbox_shared_lib/CMakeLists.txt similarity index 100% rename from cereal/sandbox/sandbox_shared_lib/CMakeLists.txt rename to 3rdparty/cereal/sandbox/sandbox_shared_lib/CMakeLists.txt diff --git a/cereal/sandbox/sandbox_shared_lib/base.cpp b/3rdparty/cereal/sandbox/sandbox_shared_lib/base.cpp similarity index 100% rename from cereal/sandbox/sandbox_shared_lib/base.cpp rename to 3rdparty/cereal/sandbox/sandbox_shared_lib/base.cpp diff --git a/cereal/sandbox/sandbox_shared_lib/base.hpp b/3rdparty/cereal/sandbox/sandbox_shared_lib/base.hpp similarity index 100% rename from cereal/sandbox/sandbox_shared_lib/base.hpp rename to 3rdparty/cereal/sandbox/sandbox_shared_lib/base.hpp diff --git a/cereal/sandbox/sandbox_shared_lib/derived.cpp b/3rdparty/cereal/sandbox/sandbox_shared_lib/derived.cpp similarity index 100% rename from cereal/sandbox/sandbox_shared_lib/derived.cpp rename to 3rdparty/cereal/sandbox/sandbox_shared_lib/derived.cpp diff --git a/cereal/sandbox/sandbox_shared_lib/derived.hpp b/3rdparty/cereal/sandbox/sandbox_shared_lib/derived.hpp similarity index 100% rename from cereal/sandbox/sandbox_shared_lib/derived.hpp rename to 3rdparty/cereal/sandbox/sandbox_shared_lib/derived.hpp diff --git a/cereal/sandbox/sandbox_vs.cpp b/3rdparty/cereal/sandbox/sandbox_vs.cpp similarity index 100% rename from cereal/sandbox/sandbox_vs.cpp rename to 3rdparty/cereal/sandbox/sandbox_vs.cpp diff --git a/cereal/scripts/add_rapidjson_prefix.sh b/3rdparty/cereal/scripts/add_rapidjson_prefix.sh similarity index 100% rename from cereal/scripts/add_rapidjson_prefix.sh rename to 3rdparty/cereal/scripts/add_rapidjson_prefix.sh diff --git a/cereal/scripts/appveyor.bat b/3rdparty/cereal/scripts/appveyor.bat similarity index 100% rename from cereal/scripts/appveyor.bat rename to 3rdparty/cereal/scripts/appveyor.bat diff --git a/cereal/scripts/renameincludes.sh b/3rdparty/cereal/scripts/renameincludes.sh similarity index 100% rename from cereal/scripts/renameincludes.sh rename to 3rdparty/cereal/scripts/renameincludes.sh diff --git a/cereal/scripts/updatecoverage.sh b/3rdparty/cereal/scripts/updatecoverage.sh similarity index 100% rename from cereal/scripts/updatecoverage.sh rename to 3rdparty/cereal/scripts/updatecoverage.sh diff --git a/cereal/scripts/updatedoc.in b/3rdparty/cereal/scripts/updatedoc.in similarity index 100% rename from cereal/scripts/updatedoc.in rename to 3rdparty/cereal/scripts/updatedoc.in diff --git a/cereal/unittests/CMakeLists.txt b/3rdparty/cereal/unittests/CMakeLists.txt similarity index 100% rename from cereal/unittests/CMakeLists.txt rename to 3rdparty/cereal/unittests/CMakeLists.txt diff --git a/cereal/unittests/array.cpp b/3rdparty/cereal/unittests/array.cpp similarity index 100% rename from cereal/unittests/array.cpp rename to 3rdparty/cereal/unittests/array.cpp diff --git a/cereal/unittests/array.hpp b/3rdparty/cereal/unittests/array.hpp similarity index 100% rename from cereal/unittests/array.hpp rename to 3rdparty/cereal/unittests/array.hpp diff --git a/cereal/unittests/atomic.cpp b/3rdparty/cereal/unittests/atomic.cpp similarity index 100% rename from cereal/unittests/atomic.cpp rename to 3rdparty/cereal/unittests/atomic.cpp diff --git a/cereal/unittests/atomic.hpp b/3rdparty/cereal/unittests/atomic.hpp similarity index 100% rename from cereal/unittests/atomic.hpp rename to 3rdparty/cereal/unittests/atomic.hpp diff --git a/cereal/unittests/basic_string.cpp b/3rdparty/cereal/unittests/basic_string.cpp similarity index 100% rename from cereal/unittests/basic_string.cpp rename to 3rdparty/cereal/unittests/basic_string.cpp diff --git a/cereal/unittests/basic_string.hpp b/3rdparty/cereal/unittests/basic_string.hpp similarity index 100% rename from cereal/unittests/basic_string.hpp rename to 3rdparty/cereal/unittests/basic_string.hpp diff --git a/cereal/unittests/bitset.cpp b/3rdparty/cereal/unittests/bitset.cpp similarity index 100% rename from cereal/unittests/bitset.cpp rename to 3rdparty/cereal/unittests/bitset.cpp diff --git a/cereal/unittests/bitset.hpp b/3rdparty/cereal/unittests/bitset.hpp similarity index 100% rename from cereal/unittests/bitset.hpp rename to 3rdparty/cereal/unittests/bitset.hpp diff --git a/cereal/unittests/boost/CMakeLists.txt b/3rdparty/cereal/unittests/boost/CMakeLists.txt similarity index 100% rename from cereal/unittests/boost/CMakeLists.txt rename to 3rdparty/cereal/unittests/boost/CMakeLists.txt diff --git a/cereal/unittests/boost/boost_variant.cpp b/3rdparty/cereal/unittests/boost/boost_variant.cpp similarity index 100% rename from cereal/unittests/boost/boost_variant.cpp rename to 3rdparty/cereal/unittests/boost/boost_variant.cpp diff --git a/cereal/unittests/boost/boost_variant.hpp b/3rdparty/cereal/unittests/boost/boost_variant.hpp similarity index 100% rename from cereal/unittests/boost/boost_variant.hpp rename to 3rdparty/cereal/unittests/boost/boost_variant.hpp diff --git a/cereal/unittests/chrono.cpp b/3rdparty/cereal/unittests/chrono.cpp similarity index 100% rename from cereal/unittests/chrono.cpp rename to 3rdparty/cereal/unittests/chrono.cpp diff --git a/cereal/unittests/chrono.hpp b/3rdparty/cereal/unittests/chrono.hpp similarity index 100% rename from cereal/unittests/chrono.hpp rename to 3rdparty/cereal/unittests/chrono.hpp diff --git a/cereal/unittests/cmake-config-module.cmake b/3rdparty/cereal/unittests/cmake-config-module.cmake similarity index 100% rename from cereal/unittests/cmake-config-module.cmake rename to 3rdparty/cereal/unittests/cmake-config-module.cmake diff --git a/cereal/unittests/common.hpp b/3rdparty/cereal/unittests/common.hpp similarity index 100% rename from cereal/unittests/common.hpp rename to 3rdparty/cereal/unittests/common.hpp diff --git a/cereal/unittests/complex.cpp b/3rdparty/cereal/unittests/complex.cpp similarity index 100% rename from cereal/unittests/complex.cpp rename to 3rdparty/cereal/unittests/complex.cpp diff --git a/cereal/unittests/complex.hpp b/3rdparty/cereal/unittests/complex.hpp similarity index 100% rename from cereal/unittests/complex.hpp rename to 3rdparty/cereal/unittests/complex.hpp diff --git a/cereal/unittests/cpp17/CMakeLists.txt b/3rdparty/cereal/unittests/cpp17/CMakeLists.txt similarity index 100% rename from cereal/unittests/cpp17/CMakeLists.txt rename to 3rdparty/cereal/unittests/cpp17/CMakeLists.txt diff --git a/cereal/unittests/cpp17/optional.cpp b/3rdparty/cereal/unittests/cpp17/optional.cpp similarity index 100% rename from cereal/unittests/cpp17/optional.cpp rename to 3rdparty/cereal/unittests/cpp17/optional.cpp diff --git a/cereal/unittests/cpp17/optional.hpp b/3rdparty/cereal/unittests/cpp17/optional.hpp similarity index 100% rename from cereal/unittests/cpp17/optional.hpp rename to 3rdparty/cereal/unittests/cpp17/optional.hpp diff --git a/cereal/unittests/cpp17/variant.cpp b/3rdparty/cereal/unittests/cpp17/variant.cpp similarity index 100% rename from cereal/unittests/cpp17/variant.cpp rename to 3rdparty/cereal/unittests/cpp17/variant.cpp diff --git a/cereal/unittests/cpp17/variant.hpp b/3rdparty/cereal/unittests/cpp17/variant.hpp similarity index 100% rename from cereal/unittests/cpp17/variant.hpp rename to 3rdparty/cereal/unittests/cpp17/variant.hpp diff --git a/cereal/unittests/defer.cpp b/3rdparty/cereal/unittests/defer.cpp similarity index 100% rename from cereal/unittests/defer.cpp rename to 3rdparty/cereal/unittests/defer.cpp diff --git a/cereal/unittests/defer.hpp b/3rdparty/cereal/unittests/defer.hpp similarity index 100% rename from cereal/unittests/defer.hpp rename to 3rdparty/cereal/unittests/defer.hpp diff --git a/cereal/unittests/deque.cpp b/3rdparty/cereal/unittests/deque.cpp similarity index 100% rename from cereal/unittests/deque.cpp rename to 3rdparty/cereal/unittests/deque.cpp diff --git a/cereal/unittests/deque.hpp b/3rdparty/cereal/unittests/deque.hpp similarity index 100% rename from cereal/unittests/deque.hpp rename to 3rdparty/cereal/unittests/deque.hpp diff --git a/cereal/unittests/doctest.h b/3rdparty/cereal/unittests/doctest.h similarity index 100% rename from cereal/unittests/doctest.h rename to 3rdparty/cereal/unittests/doctest.h diff --git a/cereal/unittests/forward_list.cpp b/3rdparty/cereal/unittests/forward_list.cpp similarity index 100% rename from cereal/unittests/forward_list.cpp rename to 3rdparty/cereal/unittests/forward_list.cpp diff --git a/cereal/unittests/forward_list.hpp b/3rdparty/cereal/unittests/forward_list.hpp similarity index 100% rename from cereal/unittests/forward_list.hpp rename to 3rdparty/cereal/unittests/forward_list.hpp diff --git a/cereal/unittests/list.cpp b/3rdparty/cereal/unittests/list.cpp similarity index 100% rename from cereal/unittests/list.cpp rename to 3rdparty/cereal/unittests/list.cpp diff --git a/cereal/unittests/list.hpp b/3rdparty/cereal/unittests/list.hpp similarity index 100% rename from cereal/unittests/list.hpp rename to 3rdparty/cereal/unittests/list.hpp diff --git a/cereal/unittests/load_construct.cpp b/3rdparty/cereal/unittests/load_construct.cpp similarity index 100% rename from cereal/unittests/load_construct.cpp rename to 3rdparty/cereal/unittests/load_construct.cpp diff --git a/cereal/unittests/load_construct.hpp b/3rdparty/cereal/unittests/load_construct.hpp similarity index 100% rename from cereal/unittests/load_construct.hpp rename to 3rdparty/cereal/unittests/load_construct.hpp diff --git a/cereal/unittests/map.cpp b/3rdparty/cereal/unittests/map.cpp similarity index 100% rename from cereal/unittests/map.cpp rename to 3rdparty/cereal/unittests/map.cpp diff --git a/cereal/unittests/map.hpp b/3rdparty/cereal/unittests/map.hpp similarity index 100% rename from cereal/unittests/map.hpp rename to 3rdparty/cereal/unittests/map.hpp diff --git a/cereal/unittests/memory.cpp b/3rdparty/cereal/unittests/memory.cpp similarity index 100% rename from cereal/unittests/memory.cpp rename to 3rdparty/cereal/unittests/memory.cpp diff --git a/cereal/unittests/memory.hpp b/3rdparty/cereal/unittests/memory.hpp similarity index 100% rename from cereal/unittests/memory.hpp rename to 3rdparty/cereal/unittests/memory.hpp diff --git a/cereal/unittests/memory_cycles.cpp b/3rdparty/cereal/unittests/memory_cycles.cpp similarity index 100% rename from cereal/unittests/memory_cycles.cpp rename to 3rdparty/cereal/unittests/memory_cycles.cpp diff --git a/cereal/unittests/memory_cycles.hpp b/3rdparty/cereal/unittests/memory_cycles.hpp similarity index 100% rename from cereal/unittests/memory_cycles.hpp rename to 3rdparty/cereal/unittests/memory_cycles.hpp diff --git a/cereal/unittests/multimap.cpp b/3rdparty/cereal/unittests/multimap.cpp similarity index 100% rename from cereal/unittests/multimap.cpp rename to 3rdparty/cereal/unittests/multimap.cpp diff --git a/cereal/unittests/multimap.hpp b/3rdparty/cereal/unittests/multimap.hpp similarity index 100% rename from cereal/unittests/multimap.hpp rename to 3rdparty/cereal/unittests/multimap.hpp diff --git a/cereal/unittests/multiset.cpp b/3rdparty/cereal/unittests/multiset.cpp similarity index 100% rename from cereal/unittests/multiset.cpp rename to 3rdparty/cereal/unittests/multiset.cpp diff --git a/cereal/unittests/multiset.hpp b/3rdparty/cereal/unittests/multiset.hpp similarity index 100% rename from cereal/unittests/multiset.hpp rename to 3rdparty/cereal/unittests/multiset.hpp diff --git a/cereal/unittests/pair.cpp b/3rdparty/cereal/unittests/pair.cpp similarity index 100% rename from cereal/unittests/pair.cpp rename to 3rdparty/cereal/unittests/pair.cpp diff --git a/cereal/unittests/pair.hpp b/3rdparty/cereal/unittests/pair.hpp similarity index 100% rename from cereal/unittests/pair.hpp rename to 3rdparty/cereal/unittests/pair.hpp diff --git a/cereal/unittests/pod.cpp b/3rdparty/cereal/unittests/pod.cpp similarity index 100% rename from cereal/unittests/pod.cpp rename to 3rdparty/cereal/unittests/pod.cpp diff --git a/cereal/unittests/pod.hpp b/3rdparty/cereal/unittests/pod.hpp similarity index 100% rename from cereal/unittests/pod.hpp rename to 3rdparty/cereal/unittests/pod.hpp diff --git a/cereal/unittests/polymorphic.cpp b/3rdparty/cereal/unittests/polymorphic.cpp similarity index 100% rename from cereal/unittests/polymorphic.cpp rename to 3rdparty/cereal/unittests/polymorphic.cpp diff --git a/cereal/unittests/polymorphic.hpp b/3rdparty/cereal/unittests/polymorphic.hpp similarity index 100% rename from cereal/unittests/polymorphic.hpp rename to 3rdparty/cereal/unittests/polymorphic.hpp diff --git a/cereal/unittests/portability_test.cpp b/3rdparty/cereal/unittests/portability_test.cpp similarity index 100% rename from cereal/unittests/portability_test.cpp rename to 3rdparty/cereal/unittests/portability_test.cpp diff --git a/cereal/unittests/portable_binary_archive.cpp b/3rdparty/cereal/unittests/portable_binary_archive.cpp similarity index 100% rename from cereal/unittests/portable_binary_archive.cpp rename to 3rdparty/cereal/unittests/portable_binary_archive.cpp diff --git a/cereal/unittests/portable_binary_archive.hpp b/3rdparty/cereal/unittests/portable_binary_archive.hpp similarity index 100% rename from cereal/unittests/portable_binary_archive.hpp rename to 3rdparty/cereal/unittests/portable_binary_archive.hpp diff --git a/cereal/unittests/priority_queue.cpp b/3rdparty/cereal/unittests/priority_queue.cpp similarity index 100% rename from cereal/unittests/priority_queue.cpp rename to 3rdparty/cereal/unittests/priority_queue.cpp diff --git a/cereal/unittests/priority_queue.hpp b/3rdparty/cereal/unittests/priority_queue.hpp similarity index 100% rename from cereal/unittests/priority_queue.hpp rename to 3rdparty/cereal/unittests/priority_queue.hpp diff --git a/cereal/unittests/queue.cpp b/3rdparty/cereal/unittests/queue.cpp similarity index 100% rename from cereal/unittests/queue.cpp rename to 3rdparty/cereal/unittests/queue.cpp diff --git a/cereal/unittests/queue.hpp b/3rdparty/cereal/unittests/queue.hpp similarity index 100% rename from cereal/unittests/queue.hpp rename to 3rdparty/cereal/unittests/queue.hpp diff --git a/cereal/unittests/run_portability_test.cmake b/3rdparty/cereal/unittests/run_portability_test.cmake similarity index 100% rename from cereal/unittests/run_portability_test.cmake rename to 3rdparty/cereal/unittests/run_portability_test.cmake diff --git a/cereal/unittests/run_valgrind.sh b/3rdparty/cereal/unittests/run_valgrind.sh similarity index 100% rename from cereal/unittests/run_valgrind.sh rename to 3rdparty/cereal/unittests/run_valgrind.sh diff --git a/cereal/unittests/set.cpp b/3rdparty/cereal/unittests/set.cpp similarity index 100% rename from cereal/unittests/set.cpp rename to 3rdparty/cereal/unittests/set.cpp diff --git a/cereal/unittests/set.hpp b/3rdparty/cereal/unittests/set.hpp similarity index 100% rename from cereal/unittests/set.hpp rename to 3rdparty/cereal/unittests/set.hpp diff --git a/cereal/unittests/stack.cpp b/3rdparty/cereal/unittests/stack.cpp similarity index 100% rename from cereal/unittests/stack.cpp rename to 3rdparty/cereal/unittests/stack.cpp diff --git a/cereal/unittests/stack.hpp b/3rdparty/cereal/unittests/stack.hpp similarity index 100% rename from cereal/unittests/stack.hpp rename to 3rdparty/cereal/unittests/stack.hpp diff --git a/cereal/unittests/structs.cpp b/3rdparty/cereal/unittests/structs.cpp similarity index 100% rename from cereal/unittests/structs.cpp rename to 3rdparty/cereal/unittests/structs.cpp diff --git a/cereal/unittests/structs.hpp b/3rdparty/cereal/unittests/structs.hpp similarity index 100% rename from cereal/unittests/structs.hpp rename to 3rdparty/cereal/unittests/structs.hpp diff --git a/cereal/unittests/structs_minimal.cpp b/3rdparty/cereal/unittests/structs_minimal.cpp similarity index 100% rename from cereal/unittests/structs_minimal.cpp rename to 3rdparty/cereal/unittests/structs_minimal.cpp diff --git a/cereal/unittests/structs_minimal.hpp b/3rdparty/cereal/unittests/structs_minimal.hpp similarity index 100% rename from cereal/unittests/structs_minimal.hpp rename to 3rdparty/cereal/unittests/structs_minimal.hpp diff --git a/cereal/unittests/structs_specialized.cpp b/3rdparty/cereal/unittests/structs_specialized.cpp similarity index 100% rename from cereal/unittests/structs_specialized.cpp rename to 3rdparty/cereal/unittests/structs_specialized.cpp diff --git a/cereal/unittests/structs_specialized.hpp b/3rdparty/cereal/unittests/structs_specialized.hpp similarity index 100% rename from cereal/unittests/structs_specialized.hpp rename to 3rdparty/cereal/unittests/structs_specialized.hpp diff --git a/cereal/unittests/tuple.cpp b/3rdparty/cereal/unittests/tuple.cpp similarity index 100% rename from cereal/unittests/tuple.cpp rename to 3rdparty/cereal/unittests/tuple.cpp diff --git a/cereal/unittests/tuple.hpp b/3rdparty/cereal/unittests/tuple.hpp similarity index 100% rename from cereal/unittests/tuple.hpp rename to 3rdparty/cereal/unittests/tuple.hpp diff --git a/cereal/unittests/unordered_loads.cpp b/3rdparty/cereal/unittests/unordered_loads.cpp similarity index 100% rename from cereal/unittests/unordered_loads.cpp rename to 3rdparty/cereal/unittests/unordered_loads.cpp diff --git a/cereal/unittests/unordered_loads.hpp b/3rdparty/cereal/unittests/unordered_loads.hpp similarity index 100% rename from cereal/unittests/unordered_loads.hpp rename to 3rdparty/cereal/unittests/unordered_loads.hpp diff --git a/cereal/unittests/unordered_map.cpp b/3rdparty/cereal/unittests/unordered_map.cpp similarity index 100% rename from cereal/unittests/unordered_map.cpp rename to 3rdparty/cereal/unittests/unordered_map.cpp diff --git a/cereal/unittests/unordered_map.hpp b/3rdparty/cereal/unittests/unordered_map.hpp similarity index 100% rename from cereal/unittests/unordered_map.hpp rename to 3rdparty/cereal/unittests/unordered_map.hpp diff --git a/cereal/unittests/unordered_multimap.cpp b/3rdparty/cereal/unittests/unordered_multimap.cpp similarity index 100% rename from cereal/unittests/unordered_multimap.cpp rename to 3rdparty/cereal/unittests/unordered_multimap.cpp diff --git a/cereal/unittests/unordered_multimap.hpp b/3rdparty/cereal/unittests/unordered_multimap.hpp similarity index 100% rename from cereal/unittests/unordered_multimap.hpp rename to 3rdparty/cereal/unittests/unordered_multimap.hpp diff --git a/cereal/unittests/unordered_multiset.cpp b/3rdparty/cereal/unittests/unordered_multiset.cpp similarity index 100% rename from cereal/unittests/unordered_multiset.cpp rename to 3rdparty/cereal/unittests/unordered_multiset.cpp diff --git a/cereal/unittests/unordered_multiset.hpp b/3rdparty/cereal/unittests/unordered_multiset.hpp similarity index 100% rename from cereal/unittests/unordered_multiset.hpp rename to 3rdparty/cereal/unittests/unordered_multiset.hpp diff --git a/cereal/unittests/unordered_set.cpp b/3rdparty/cereal/unittests/unordered_set.cpp similarity index 100% rename from cereal/unittests/unordered_set.cpp rename to 3rdparty/cereal/unittests/unordered_set.cpp diff --git a/cereal/unittests/unordered_set.hpp b/3rdparty/cereal/unittests/unordered_set.hpp similarity index 100% rename from cereal/unittests/unordered_set.hpp rename to 3rdparty/cereal/unittests/unordered_set.hpp diff --git a/cereal/unittests/user_data_adapters.cpp b/3rdparty/cereal/unittests/user_data_adapters.cpp similarity index 100% rename from cereal/unittests/user_data_adapters.cpp rename to 3rdparty/cereal/unittests/user_data_adapters.cpp diff --git a/cereal/unittests/user_data_adapters.hpp b/3rdparty/cereal/unittests/user_data_adapters.hpp similarity index 100% rename from cereal/unittests/user_data_adapters.hpp rename to 3rdparty/cereal/unittests/user_data_adapters.hpp diff --git a/cereal/unittests/valarray.cpp b/3rdparty/cereal/unittests/valarray.cpp similarity index 100% rename from cereal/unittests/valarray.cpp rename to 3rdparty/cereal/unittests/valarray.cpp diff --git a/cereal/unittests/valarray.hpp b/3rdparty/cereal/unittests/valarray.hpp similarity index 100% rename from cereal/unittests/valarray.hpp rename to 3rdparty/cereal/unittests/valarray.hpp diff --git a/cereal/unittests/vector.cpp b/3rdparty/cereal/unittests/vector.cpp similarity index 100% rename from cereal/unittests/vector.cpp rename to 3rdparty/cereal/unittests/vector.cpp diff --git a/cereal/unittests/vector.hpp b/3rdparty/cereal/unittests/vector.hpp similarity index 100% rename from cereal/unittests/vector.hpp rename to 3rdparty/cereal/unittests/vector.hpp diff --git a/cereal/unittests/versioning.cpp b/3rdparty/cereal/unittests/versioning.cpp similarity index 100% rename from cereal/unittests/versioning.cpp rename to 3rdparty/cereal/unittests/versioning.cpp diff --git a/cereal/unittests/versioning.hpp b/3rdparty/cereal/unittests/versioning.hpp similarity index 100% rename from cereal/unittests/versioning.hpp rename to 3rdparty/cereal/unittests/versioning.hpp diff --git a/cpp-httplib/LICENSE b/3rdparty/cpp-httplib/LICENSE similarity index 100% rename from cpp-httplib/LICENSE rename to 3rdparty/cpp-httplib/LICENSE diff --git a/cpp-httplib/README.md b/3rdparty/cpp-httplib/README.md similarity index 100% rename from cpp-httplib/README.md rename to 3rdparty/cpp-httplib/README.md diff --git a/cpp-httplib/httplib.h b/3rdparty/cpp-httplib/include/httplib.h similarity index 100% rename from cpp-httplib/httplib.h rename to 3rdparty/cpp-httplib/include/httplib.h diff --git a/json/LICENSE.MIT b/3rdparty/json/LICENSE.MIT similarity index 100% rename from json/LICENSE.MIT rename to 3rdparty/json/LICENSE.MIT diff --git a/json/README.md b/3rdparty/json/README.md similarity index 100% rename from json/README.md rename to 3rdparty/json/README.md diff --git a/json/nlohmann/json.hpp b/3rdparty/json/include/nlohmann/json.hpp similarity index 100% rename from json/nlohmann/json.hpp rename to 3rdparty/json/include/nlohmann/json.hpp diff --git a/ACore/CMakeLists.txt b/ACore/CMakeLists.txt index 345de1204..758dd9797 100644 --- a/ACore/CMakeLists.txt +++ b/ACore/CMakeLists.txt @@ -103,6 +103,7 @@ ecbuild_add_library( src ${CMAKE_BINARY_DIR}/generated PUBLIC_LIBS + cereal::cereal # this needs to be public as it appears in public header files used downstream $<$:Boost::system> Boost::filesystem Boost::date_time diff --git a/ANattr/CMakeLists.txt b/ANattr/CMakeLists.txt index c006fe922..c56a4796c 100644 --- a/ANattr/CMakeLists.txt +++ b/ANattr/CMakeLists.txt @@ -1,31 +1,99 @@ -# Note: -# If new src or test cpp files are added make sure you touch this file # +# Copyright 2023- ECMWF. +# +# This software is licensed under the terms of the Apache Licence version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. +# + file( GLOB srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp" "src/*.hpp" ) -ecbuild_add_library( TARGET nodeattr - NOINSTALL - TYPE STATIC - SOURCES ${srcs} - ) - -target_link_libraries(nodeattr PRIVATE core) -target_include_directories(nodeattr PUBLIC src - ../ACore/src - ${Boost_INCLUDE_DIRS}) +set(srcs + # Headers + src/AutoArchiveAttr.hpp + src/AutoCancelAttr.hpp + src/ClockAttr.hpp + src/CronAttr.hpp + src/DateAttr.hpp + src/DayAttr.hpp + src/GenericAttr.hpp + src/LateAttr.hpp + src/NodeAttr.hpp + src/QueueAttr.hpp + src/RepeatAttr.hpp + src/TimeAttr.hpp + src/TodayAttr.hpp + src/Variable.hpp + src/VerifyAttr.hpp + src/Zombie.hpp + src/ZombieAttr.hpp + # Sources + src/AutoArchiveAttr.cpp + src/AutoCancelAttr.cpp + src/ClockAttr.cpp + src/CronAttr.cpp + src/DateAttr.cpp + src/DayAttr.cpp + src/GenericAttr.cpp + src/LateAttr.cpp + src/NodeAttr.cpp + src/QueueAttr.cpp + src/RepeatAttr.cpp + src/TimeAttr.cpp + src/TodayAttr.cpp + src/Variable.cpp + src/VerifyAttr.cpp + src/Zombie.cpp + src/ZombieAttr.cpp +) +ecbuild_add_library( + TARGET + nodeattr + NOINSTALL + TYPE STATIC + SOURCES + ${srcs} + PUBLIC_INCLUDES + src + PUBLIC_LIBS + core + Boost::date_time +) target_clangformat(nodeattr) -file( GLOB test_srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "test/*.cpp" ) - -# libboost_unit_test_framework undefined reference to `clock_gettime', ${LIBRT} needed for boost 1.71 -ecbuild_add_test( TARGET u_anattr - SOURCES ${test_srcs} - INCLUDES src ${Boost_INCLUDE_DIRS} - LIBS nodeattr ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_TEST_EXEC_MONITOR_LIBRARY} ${LIBRT} - DEFINITIONS ${BOOST_TEST_DYN_LINK} - TEST_DEPENDS u_acore - ) +set(test_srcs + # Sources + test/TestAttributes_main.cpp + test/TestAttrSerialization.cpp + test/TestCron.cpp + test/TestDateAttr.cpp + test/TestDayAttr.cpp + test/TestLabel.cpp + test/TestLateAttr.cpp + test/TestMigration.cpp + test/TestRepeat.cpp + test/TestSizeOf.cpp + test/TestTimeAttr.cpp + test/TestTodayAttr.cpp + test/TestVariable.cpp + test/TestZombieAttr.cpp +) -target_clangformat(u_anattr CONDITION ENABLE_TESTS) +ecbuild_add_test( + TARGET + u_anattr + SOURCES + ${test_srcs} + LIBS + nodeattr + TEST_DEPENDS + u_acore + Boost::boost # Boost header-only libraries must be available (namely unit_test_framework) +) +target_clangformat(u_anattr + CONDITION ENABLE_TESTS +) diff --git a/ANattr/test/TestAttrSerialization.cpp b/ANattr/test/TestAttrSerialization.cpp index e6adc431d..a008fe0d9 100644 --- a/ANattr/test/TestAttrSerialization.cpp +++ b/ANattr/test/TestAttrSerialization.cpp @@ -1,5 +1,3 @@ -#define BOOST_TEST_MODULE TestANattr - /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // Name : // Author : Avi diff --git a/ANattr/test/TestAttributes_main.cpp b/ANattr/test/TestAttributes_main.cpp new file mode 100644 index 000000000..28ca1f9d4 --- /dev/null +++ b/ANattr/test/TestAttributes_main.cpp @@ -0,0 +1,12 @@ +/* + * Copyright 2023- ECMWF. + * + * This software is licensed under the terms of the Apache Licence version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation + * nor does it submit to any jurisdiction. + */ + +#define BOOST_TEST_MODULE TestAttributes +#include diff --git a/ANode/CMakeLists.txt b/ANode/CMakeLists.txt index cfef82add..240b74c7a 100644 --- a/ANode/CMakeLists.txt +++ b/ANode/CMakeLists.txt @@ -1,101 +1,365 @@ -# Note: -# If new src or test cpp files are added make sure you touch this file +# +# Copyright 2023- ECMWF. +# +# This software is licensed under the terms of the Apache Licence version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. # -file(GLOB srcs - RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - "src/*.cpp" "src/*.hpp" "parser/src/*.cpp" "parser/src/*.hpp") - -ecbuild_add_library( TARGET node - NOINSTALL - TYPE STATIC - SOURCES ${srcs} - ) -target_link_libraries(node PRIVATE nodeattr core) -target_include_directories(node PUBLIC ../ACore/src - ../ANattr/src - src - parser/src) +set(srcs + # Headers + src/Flag.hpp + src/Expression.hpp + src/LimitFwd.hpp + src/ClientSuites.hpp + src/MiscAttrs.hpp + src/InLimit.hpp + src/Family.hpp + src/SuiteChanged.hpp + src/EcfFile.hpp + src/Submittable.hpp + src/DefsDelta.hpp + src/NodeState.hpp + src/ExprAst.hpp + src/Signal.hpp + src/NodeStats.hpp + src/Task.hpp + src/System.hpp + src/InLimitMgr.hpp + src/JobProfiler.hpp + src/Limit.hpp + src/JobCreationCtrl.hpp + src/Memento.hpp + src/Attr.hpp + src/TaskScriptGenerator.hpp + src/Node.hpp + src/NodeTreeVisitor.hpp + src/move_peer.hpp + src/NodeFwd.hpp + src/Aspect.hpp + src/Jobs.hpp + src/AbstractObserver.hpp + src/CmdContext.hpp + src/JobsParam.hpp + src/ClientSuiteMgr.hpp + src/AutoRestoreAttr.hpp + src/Suite.hpp + src/Alias.hpp + src/Defs.hpp + src/ResolveExternsVisitor.hpp + src/NodeContainer.hpp + src/ExprDuplicate.hpp + src/ServerState.hpp + src/ExprParser.hpp + src/ExprAstVisitor.hpp + parser/src/ClockParser.hpp + parser/src/LateParser.hpp + parser/src/DefsStructureParser.hpp + parser/src/AutoCancelParser.hpp + parser/src/DefsStatusParser.hpp + parser/src/Parser.hpp + parser/src/AutoRestoreParser.hpp + parser/src/AutoArchiveParser.hpp + parser/src/VerifyParser.hpp + parser/src/EventParser.hpp + parser/src/DefsParser.hpp + parser/src/DateParser.hpp + parser/src/ExternParser.hpp + parser/src/QueueParser.hpp + parser/src/TriggerParser.hpp + parser/src/CronParser.hpp + parser/src/DefsStateParser.hpp + parser/src/LimitParser.hpp + parser/src/ZombieAttrParser.hpp + parser/src/RepeatParser.hpp + parser/src/MeterParser.hpp + parser/src/DayParser.hpp + parser/src/TimeParser.hpp + parser/src/GenericParser.hpp + parser/src/CalendarParser.hpp + parser/src/LabelParser.hpp + parser/src/TodayParser.hpp + parser/src/InlimitParser.hpp + parser/src/VariableParser.hpp + # Sources + src/Suite.cpp + src/Alias.cpp + src/Defs.cpp + src/ResolveExternsVisitor.cpp + src/NodeContainer.cpp + src/ExprDuplicate.cpp + src/NodeFind.cpp + src/ExprParser.cpp + src/ExprAstVisitor.cpp + src/ServerState.cpp + src/Memento.cpp + src/NodeAdd.cpp + src/NodeChange.cpp + src/Attr.cpp + src/NodeTreeVisitor.cpp + src/TaskScriptGenerator.cpp + src/Node.cpp + src/Jobs.cpp + src/JobsParam.cpp + src/CmdContext.cpp + src/ClientSuiteMgr.cpp + src/AutoRestoreAttr.cpp + src/NodeMemento.cpp + src/Family.cpp + src/SuiteChanged.cpp + src/Submittable.cpp + src/DefsDelta.cpp + src/EcfFile.cpp + src/Signal.cpp + src/ExprAst.cpp + src/NodeTime.cpp + src/NodeStats.cpp + src/NodeDelete.cpp + src/Task.cpp + src/System.cpp + src/InLimitMgr.cpp + src/JobProfiler.cpp + src/JobCreationCtrl.cpp + src/Limit.cpp + src/Flag.cpp + src/Expression.cpp + src/ClientSuites.cpp + src/MiscAttrs.cpp + src/InLimit.cpp + parser/src/RepeatParser.cpp + parser/src/MeterParser.cpp + parser/src/DayParser.cpp + parser/src/GenericParser.cpp + parser/src/CalendarParser.cpp + parser/src/TimeParser.cpp + parser/src/LabelParser.cpp + parser/src/TodayParser.cpp + parser/src/InlimitParser.cpp + parser/src/VariableParser.cpp + parser/src/DateParser.cpp + parser/src/ExternParser.cpp + parser/src/QueueParser.cpp + parser/src/TriggerParser.cpp + parser/src/DefsStateParser.cpp + parser/src/CronParser.cpp + parser/src/LimitParser.cpp + parser/src/ZombieAttrParser.cpp + parser/src/DefsParser.cpp + parser/src/ClockParser.cpp + parser/src/LateParser.cpp + parser/src/DefsStructureParser.cpp + parser/src/DefsStatusParser.cpp + parser/src/AutoCancelParser.cpp + parser/src/Parser.cpp + parser/src/AutoRestoreParser.cpp + parser/src/VerifyParser.cpp + parser/src/AutoArchiveParser.cpp + parser/src/EventParser.cpp +) +ecbuild_add_library( + TARGET + node + NOINSTALL + TYPE STATIC + SOURCES + ${srcs} + PUBLIC_INCLUDES + src + parser/src + PUBLIC_LIBS + nodeattr +) target_clangformat(node) -add_subdirectory( parser ) - -# Use following to populate list: -# cd $WK/ANode -# find test -name \*.cpp | sort - -# no way to exclude file ? -#file( GLOB test_srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "test/*.cpp" ) - -list( APPEND test_srcs -# HEADERS -test/MyDefsFixture.hpp -# SOURCES -test/Test_ECFLOW-195.cpp -test/Test_ECFLOW-247.cpp -test/Test_ECFLOW-417.cpp -test/TestAdd.cpp -test/TestAlias.cpp -test/TestAssignmentOperator.cpp -test/TestChangeMgrSingleton.cpp -test/TestClientSuiteMgr.cpp -test/TestCopyConstructor.cpp -test/TestDefStatus.cpp -test/TestDefs.cpp -test/TestEcfFile.cpp -test/TestEcfFileLocator.cpp -test/TestEnviromentSubstitution.cpp -test/TestExprParser.cpp -test/TestExprRepeatDateArithmetic.cpp -test/TestExprRepeatDateListArithmetic.cpp -test/TestFindAbsNodePath.cpp -test/TestFlag.cpp -test/TestHistoryParser.cpp -test/TestInLimit.cpp -test/TestJobCreator.cpp -test/TestJobProfiler.cpp -test/TestLimit.cpp -test/TestMigration.cpp -test/TestMovePeer.cpp -test/TestMissNextTimeSlot.cpp -test/TestNodeBeginReque.cpp -test/TestNodeState.cpp -test/TestOrder.cpp -test/TestPersistence.cpp -test/TestPreProcessing.cpp -test/TestRepeatWithTimeDependencies.cpp -test/TestReplace.cpp -test/TestSetState.cpp -test/TestSystem.cpp -test/TestTaskScriptGenerator.cpp -test/TestTimeDependencies.cpp -test/TestVariableGeneration.cpp -test/TestVariableInheritance.cpp -test/TestVariableSubstitution.cpp -test/TestVariableSubstitutionDefs.cpp -test/TestZombies.cpp + +set(test_srcs + # Headers + test/MyDefsFixture.hpp + # Sources + test/Test_ECFLOW-195.cpp + test/Test_ECFLOW-247.cpp + test/Test_ECFLOW-417.cpp + test/TestAdd.cpp + test/TestAlias.cpp + test/TestAssignmentOperator.cpp + test/TestChangeMgrSingleton.cpp + test/TestClientSuiteMgr.cpp + test/TestCopyConstructor.cpp + test/TestDefStatus.cpp + test/TestDefs.cpp + test/TestEcfFile.cpp + test/TestEcfFileLocator.cpp + test/TestEnviromentSubstitution.cpp + test/TestExprParser.cpp + test/TestExprRepeatDateArithmetic.cpp + test/TestExprRepeatDateListArithmetic.cpp + test/TestFindAbsNodePath.cpp + test/TestFlag.cpp + test/TestHistoryParser.cpp + test/TestInLimit.cpp + test/TestJobCreator.cpp + test/TestJobProfiler.cpp + test/TestLimit.cpp + test/TestMigration.cpp + test/TestMovePeer.cpp + test/TestNode_main.cpp # test entry point + test/TestMissNextTimeSlot.cpp + test/TestNodeBeginReque.cpp + test/TestNodeState.cpp + test/TestOrder.cpp + test/TestPersistence.cpp + test/TestPreProcessing.cpp + test/TestRepeatWithTimeDependencies.cpp + test/TestReplace.cpp + test/TestSetState.cpp + test/TestSystem.cpp + test/TestTaskScriptGenerator.cpp + test/TestTimeDependencies.cpp + test/TestVariableGeneration.cpp + test/TestVariableInheritance.cpp + test/TestVariableSubstitution.cpp + test/TestVariableSubstitutionDefs.cpp + test/TestZombies.cpp ) -# libboost_unit_test_framework undefined reference to `clock_gettime', ${LIBRT} needed for boost 1.71 -ecbuild_add_test(TARGET u_anode - SOURCES ${test_srcs} - INCLUDES ${Boost_INCLUDE_DIRS} - LIBS node ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_TEST_EXEC_MONITOR_LIBRARY} ${LIBRT} - DEFINITIONS ${BOOST_TEST_DYN_LINK} - TEST_DEPENDS u_anattr - ) +ecbuild_add_test( + TARGET + u_anode + SOURCES + ${test_srcs} + LIBS + node + Boost::boost # Boost header-only libraries must be available (namely unit_test_framework) + TEST_DEPENDS + u_anattr +) +target_clangformat(u_anode + CONDITION ENABLE_TESTS) + -target_clangformat(u_anode CONDITION ENABLE_TESTS) +set(test_srcs + # Headers + parser/test/PersistHelper.hpp + # Sources + parser/test/PersistHelper.cpp + parser/test/TestAutoAddExterns.cpp + parser/test/TestDefsStructurePersistAndReload.cpp + parser/test/TestMementoPersistAndReload.cpp + parser/test/TestMigration.cpp + parser/test/TestParser.cpp + parser/test/TestParser_main.cpp # test entry point + parser/test/TestVariableParsing.cpp +) +ecbuild_add_test( + TARGET + u_aparser + SOURCES + ${test_srcs} + INCLUDES + test + LIBS + node + Boost::boost # Boost header-only libraries must be available (namely unit_test_framework) + TEST_DEPENDS + u_anode +) +target_clangformat(u_aparser + CONDITION ENABLE_TESTS +) if (ENABLE_ALL_TESTS) - list( APPEND stest_srcs test/TestSingleExprParse.cpp ) - ecbuild_add_test( TARGET u_anode_stest - SOURCES ${stest_srcs} - INCLUDES ${Boost_INCLUDE_DIRS} - LIBS node ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_TEST_EXEC_MONITOR_LIBRARY} ${LIBRT} - DEFINITIONS ${BOOST_TEST_DYN_LINK} - TEST_DEPENDS u_anattr - ) - target_clangformat(u_anode_stest CONDITION ENABLE_TESTS) + set(test_srcs + test/TestSingleExprParse.cpp + test/TestSingleExprParse_main.cpp # test entry point + ) + + ecbuild_add_test( + TARGET + u_anode_stest + SOURCES + ${test_srcs} + LIBS + node + Boost::boost # Boost header-only libraries must be available (namely unit_test_framework) + TEST_DEPENDS + u_anattr + ) + target_clangformat(u_anode_stest + CONDITION ENABLE_TESTS + ) + + + set(test_srcs + # Headers + parser/test/PersistHelper.hpp + # Sources + parser/test/PersistHelper.cpp + parser/test/TestParserPerformance_main.cpp # test entry point + parser/test/TestSingleDefsFile.cpp + ) + + ecbuild_add_test( + TARGET + perf_aparser + SOURCES + ${test_srcs} + LIBS + node + Boost::boost # Boost header-only libraries must be available (namely unit_test_framework) + Boost::timer + ) + target_clangformat(perf_aparser + CONDITION ENABLE_TESTS + ) + + + set(test_srcs + # Headers + parser/test/PersistHelper.hpp + # Sources + parser/test/ParseTimer.cpp + parser/test/PersistHelper.cpp + ) + + # The following is not technically a test (as it makes no checks), + # but a tool to measure the time it takes to parse 'mega.def' file + ecbuild_add_test( + TARGET + perf_aparser_timer + ARGS + ${CMAKE_CURRENT_SOURCE_DIR}/test/data/single_defs/mega.def + SOURCES + ${test_srcs} + LIBS + node + Boost::boost # Boost header-only libraries must be available + Boost::timer + ) + target_clangformat(perf_aparser_timer + CONDITION ENABLE_TESTS + ) + + # The following is not technically a test (as it makes no checks), + # but a tool to parse 'mega.def' file + set(test_srcs + parser/test/ParseOnly.cpp + ) + ecbuild_add_test( + TARGET + perf_aparser_only + ARGS + ${CMAKE_CURRENT_SOURCE_DIR}/test/data/single_defs/mega.def + SOURCES + ${test_srcs} + LIBS + node + Boost::boost # Boost header-only libraries must be available (namely unit_test_framework) + ) + target_clangformat(perf_aparser_only + CONDITION ENABLE_TESTS + ) + endif() diff --git a/ANode/parser/CMakeLists.txt b/ANode/parser/CMakeLists.txt deleted file mode 100644 index 5814f9626..000000000 --- a/ANode/parser/CMakeLists.txt +++ /dev/null @@ -1,92 +0,0 @@ -# Note: -# If new src or test cpp files are added make sure you touch this file -# - -# =================================================================== -# Use following to populate list: -# cd $WK/ANode/parser -# find test -name \*.cpp | sort -list( APPEND test_srcs - # HEADERS - test/PersistHelper.hpp - # SOURCES - test/PersistHelper.cpp - test/TestAutoAddExterns.cpp - test/TestDefsStructurePersistAndReload.cpp - test/TestMementoPersistAndReload.cpp - test/TestMigration.cpp - test/TestParser.cpp - test/TestVariableParsing.cpp -) -ecbuild_add_test( TARGET u_aparser - SOURCES ${test_srcs} - LIBS node nodeattr core - ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_TEST_EXEC_MONITOR_LIBRARY} ${LIBRT} - INCLUDES src - ../../ACore/src - ../../ANattr/src - ../test # ANode/test - ../src # ANode/src - ${Boost_INCLUDE_DIRS} - DEFINITIONS ${BOOST_TEST_DYN_LINK} - TEST_DEPENDS u_anode - ) -target_clangformat(u_aparser CONDITION ENABLE_TESTS) - -if (ENABLE_ALL_TESTS) - # - # Tests parser for a single defs file but with a range of tests - # - list( APPEND t2_src test/TestSingleDefsFile.cpp test/PersistHelper.cpp ) - ecbuild_add_test( TARGET perf_aparser - SOURCES ${t2_src} - LIBS node nodeattr core - ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_TEST_EXEC_MONITOR_LIBRARY} - ${Boost_TIMER_LIBRARY} ${Boost_CHRONO_LIBRARY} ${LIBRT} - INCLUDES src - ../../ACore/src - ../../ANattr/src - ../test # ANode/test - ../src # ANode/src - ${Boost_INCLUDE_DIRS} - DEFINITIONS ${BOOST_TEST_DYN_LINK} - ) - target_clangformat(perf_aparser CONDITION ENABLE_TESTS) - - # - # Timer for arbitary defs file, - # - list( APPEND t3_src test/ParseTimer.cpp test/PersistHelper.cpp ) - ecbuild_add_test( TARGET perf_aparser_timer - ARGS ${CMAKE_CURRENT_SOURCE_DIR}/test/data/single_defs/mega.def - SOURCES ${t3_src} - LIBS node nodeattr core - ${Boost_TIMER_LIBRARY} ${Boost_CHRONO_LIBRARY} ${LIBRT} - INCLUDES src - ../../ACore/src - ../../ANattr/src - ../src # ANode/src - ../test # ANode/test - ${Boost_INCLUDE_DIRS} - DEFINITIONS ${BOOST_TEST_DYN_LINK} - ) - target_clangformat(perf_aparser_timer CONDITION ENABLE_TESTS) - # - # Tests parser for a single defs file. - # - list( APPEND t4_src test/ParseOnly.cpp ) - ecbuild_add_test( TARGET perf_aparser_only - ARGS ${CMAKE_CURRENT_SOURCE_DIR}/test/data/single_defs/mega.def - SOURCES ${t4_src} - LIBS node nodeattr core - INCLUDES src - ../../ACore/src - ../../ANattr/src - ../src # ANode/src - ../test # ANode/test - ${Boost_INCLUDE_DIRS} - DEFINITIONS ${BOOST_TEST_DYN_LINK} - ) - target_clangformat(perf_aparser_only CONDITION ENABLE_TESTS) - -endif() diff --git a/ANode/parser/test/TestParser.cpp b/ANode/parser/test/TestParser.cpp index 1b6ac91fa..db7573b16 100644 --- a/ANode/parser/test/TestParser.cpp +++ b/ANode/parser/test/TestParser.cpp @@ -1,4 +1,4 @@ -#define BOOST_TEST_MODULE TestParser + /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // Name : Request // Author : Avi @@ -19,6 +19,7 @@ #include #include + #include #include "Defs.hpp" diff --git a/ANode/parser/test/TestParserPerformance_main.cpp b/ANode/parser/test/TestParserPerformance_main.cpp new file mode 100644 index 000000000..4ed368daa --- /dev/null +++ b/ANode/parser/test/TestParserPerformance_main.cpp @@ -0,0 +1,12 @@ +/* + * Copyright 2023- ECMWF. + * + * This software is licensed under the terms of the Apache Licence version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation + * nor does it submit to any jurisdiction. + */ + +#define BOOST_TEST_MODULE TestParserPerformance +#include diff --git a/ANode/parser/test/TestParser_main.cpp b/ANode/parser/test/TestParser_main.cpp new file mode 100644 index 000000000..83cf59ab9 --- /dev/null +++ b/ANode/parser/test/TestParser_main.cpp @@ -0,0 +1,12 @@ +/* + * Copyright 2023- ECMWF. + * + * This software is licensed under the terms of the Apache Licence version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation + * nor does it submit to any jurisdiction. + */ + +#define BOOST_TEST_MODULE TestParser +#include diff --git a/ANode/parser/test/TestSingleDefsFile.cpp b/ANode/parser/test/TestSingleDefsFile.cpp index 532fe24c9..3e55ef494 100644 --- a/ANode/parser/test/TestSingleDefsFile.cpp +++ b/ANode/parser/test/TestSingleDefsFile.cpp @@ -1,5 +1,3 @@ -#define BOOST_TEST_MODULE TestParser - //============================================================================ // Name : // Author : Avi @@ -23,6 +21,7 @@ #include #include #include + #include #include diff --git a/ANode/test/TestExprParser.cpp b/ANode/test/TestExprParser.cpp index e525ecbf8..44237c03f 100644 --- a/ANode/test/TestExprParser.cpp +++ b/ANode/test/TestExprParser.cpp @@ -1,4 +1,3 @@ -#define BOOST_TEST_MODULE TestNode /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // Name : // Author : Avi diff --git a/ANode/test/TestNode_main.cpp b/ANode/test/TestNode_main.cpp new file mode 100644 index 000000000..f2af1407b --- /dev/null +++ b/ANode/test/TestNode_main.cpp @@ -0,0 +1,12 @@ +/* + * Copyright 2023- ECMWF. + * + * This software is licensed under the terms of the Apache Licence version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation + * nor does it submit to any jurisdiction. + */ + +#define BOOST_TEST_MODULE TestNode +#include diff --git a/ANode/test/TestSingleExprParse.cpp b/ANode/test/TestSingleExprParse.cpp index b5b4d0bb5..e77b94a3f 100644 --- a/ANode/test/TestSingleExprParse.cpp +++ b/ANode/test/TestSingleExprParse.cpp @@ -1,4 +1,3 @@ -#define BOOST_TEST_MODULE TestSingle /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // Name : // Author : Avi @@ -19,6 +18,7 @@ #include #include #include // requires boost date and time lib, for to_simple_string + #include #include "ExprAst.hpp" diff --git a/ANode/test/TestSingleExprParse_main.cpp b/ANode/test/TestSingleExprParse_main.cpp new file mode 100644 index 000000000..9719ea8e7 --- /dev/null +++ b/ANode/test/TestSingleExprParse_main.cpp @@ -0,0 +1,12 @@ +/* + * Copyright 2023- ECMWF. + * + * This software is licensed under the terms of the Apache Licence version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation + * nor does it submit to any jurisdiction. + */ + +#define BOOST_TEST_MODULE TestSingleExpression +#include diff --git a/Base/CMakeLists.txt b/Base/CMakeLists.txt index 68c91afcd..1b9fefc62 100644 --- a/Base/CMakeLists.txt +++ b/Base/CMakeLists.txt @@ -1,189 +1,206 @@ - # ======================================================= - # to list all sources to build use: - # cd $WK/Base - # find src -name \*.cpp >> CMakeLists.txt - # ======================================================= - list( APPEND srcs - # HEADERS - src/AbstractClientEnv.hpp - src/AbstractServer.hpp - src/Client.hpp - src/ClientOptionsParser.hpp - src/ClientToServerRequest.hpp - src/Cmd.hpp - src/Connection.hpp - src/Gnuplot.hpp - src/ServerReply.hpp - src/ServerToClientResponse.hpp - src/Stats.hpp - src/WhyCmd.hpp - src/ZombieCtrl.hpp - src/cts/ClientToServerCmd.hpp - src/cts/CtsApi.hpp - src/cts/CtsCmdRegistry.hpp - src/cts/EditHistoryMgr.hpp - src/cts/TaskApi.hpp - src/stc/BlockClientZombieCmd.hpp - src/stc/DefsCache.hpp - src/stc/DefsCmd.hpp - src/stc/ErrorCmd.hpp - src/stc/GroupSTCCmd.hpp - src/stc/PreAllocatedReply.hpp - src/stc/SClientHandleCmd.hpp - src/stc/SClientHandleSuitesCmd.hpp - src/stc/SNewsCmd.hpp - src/stc/SNodeCmd.hpp - src/stc/SServerLoadCmd.hpp - src/stc/SStatsCmd.hpp - src/stc/SStringCmd.hpp - src/stc/SStringVecCmd.hpp - src/stc/SSuitesCmd.hpp - src/stc/SSyncCmd.hpp - src/stc/ServerToClientCmd.hpp - src/stc/StcCmd.hpp - src/stc/ZombieGetCmd.hpp - # SOURCES - src/ZombieCtrl.cpp - src/Stats.cpp - src/Client.cpp - src/ClientOptionsParser.cpp - src/ServerReply.cpp - src/Connection.cpp - src/stc/BlockClientZombieCmd.cpp - src/stc/DefsCache.cpp - src/stc/DefsCmd.cpp - src/stc/PreAllocatedReply.cpp - src/stc/SStringVecCmd.cpp - src/stc/StcCmd.cpp - src/stc/SSuitesCmd.cpp - src/stc/SClientHandleCmd.cpp - src/stc/SStringCmd.cpp - src/stc/ServerToClientCmd.cpp - src/stc/SClientHandleSuitesCmd.cpp - src/stc/SServerLoadCmd.cpp - src/stc/SNodeCmd.cpp - src/stc/SStatsCmd.cpp - src/stc/SSyncCmd.cpp - src/stc/SNewsCmd.cpp - src/stc/ErrorCmd.cpp - src/stc/GroupSTCCmd.cpp - src/stc/ZombieGetCmd.cpp - src/ClientToServerRequest.cpp - src/Gnuplot.cpp - src/WhyCmd.cpp - src/ServerToClientResponse.cpp - src/cts/CSyncCmd.cpp - src/cts/ZombieCmd.cpp - src/cts/OrderNodeCmd.cpp - src/cts/CheckPtCmd.cpp - src/cts/CtsNodeCmd.cpp - src/cts/GroupCTSCmd.cpp - src/cts/UserCmd.cpp - src/cts/ClientHandleCmd.cpp - src/cts/PlugCmd.cpp - src/cts/QueryCmd.cpp - src/cts/ForceCmd.cpp - src/cts/LoadDefsCmd.cpp - src/cts/CFileCmd.cpp - src/cts/ShowCmd.cpp - src/cts/CtsCmd.cpp - src/cts/TaskApi.cpp - src/cts/EditScriptCmd.cpp - src/cts/FreeDepCmd.cpp - src/cts/PathsCmd.cpp - src/cts/DeleteCmd.cpp - src/cts/EditHistoryMgr.cpp - src/cts/LogMessageCmd.cpp - src/cts/CtsApi.cpp - src/cts/ReplaceNodeCmd.cpp - src/cts/RequeueNodeCmd.cpp - src/cts/BeginCmd.cpp - src/cts/LogCmd.cpp - src/cts/AlterCmd.cpp - src/cts/TaskCmds.cpp - src/cts/CtsCmdRegistry.cpp - src/cts/RunNodeCmd.cpp - src/cts/ClientToServerCmd.cpp - src/cts/ServerVersionCmd.cpp -) - -if(OPENSSL_FOUND) - list( APPEND srcs - # HEADERS - src/Openssl.hpp - src/ssl_connection.hpp - src/SslClient.hpp - # SOURCES - src/Openssl.cpp - src/ssl_connection.cpp - src/SslClient.cpp - ) -endif() +# +# Copyright 2023- ECMWF. +# +# This software is licensed under the terms of the Apache Licence version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. +# -ecbuild_add_library( TARGET base - NOINSTALL - TYPE STATIC - SOURCES ${srcs} - ) - -# This ensures that for debug config, we only link with debug boost libs, for other configs, we link with optimised boost libs -target_link_libraries(base node nodeattr core ${Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE}) -target_include_directories(base PUBLIC src - ../ACore/src - ../ANattr/src - ../ANode/src - ../Base/src - ../Base/src/cts - ../Base/src/stc ) +set(srcs + # Headers + src/AbstractClientEnv.hpp + src/AbstractServer.hpp + src/Client.hpp + src/ClientOptionsParser.hpp + src/ClientToServerRequest.hpp + src/Cmd.hpp + src/Connection.hpp + src/Gnuplot.hpp + src/ServerReply.hpp + src/ServerToClientResponse.hpp + src/Stats.hpp + src/WhyCmd.hpp + src/ZombieCtrl.hpp + src/cts/ClientToServerCmd.hpp + src/cts/CtsApi.hpp + src/cts/CtsCmdRegistry.hpp + src/cts/EditHistoryMgr.hpp + src/cts/TaskApi.hpp + src/stc/BlockClientZombieCmd.hpp + src/stc/DefsCache.hpp + src/stc/DefsCmd.hpp + src/stc/ErrorCmd.hpp + src/stc/GroupSTCCmd.hpp + src/stc/PreAllocatedReply.hpp + src/stc/SClientHandleCmd.hpp + src/stc/SClientHandleSuitesCmd.hpp + src/stc/SNewsCmd.hpp + src/stc/SNodeCmd.hpp + src/stc/SServerLoadCmd.hpp + src/stc/SStatsCmd.hpp + src/stc/SStringCmd.hpp + src/stc/SStringVecCmd.hpp + src/stc/SSuitesCmd.hpp + src/stc/SSyncCmd.hpp + src/stc/ServerToClientCmd.hpp + src/stc/StcCmd.hpp + src/stc/ZombieGetCmd.hpp + $<$:src/Openssl.hpp> + $<$:src/ssl_connection.hpp> + $<$:src/SslClient.hpp> + # Sources + src/ZombieCtrl.cpp + src/Stats.cpp + src/Client.cpp + src/ClientOptionsParser.cpp + src/ServerReply.cpp + src/Connection.cpp + src/stc/BlockClientZombieCmd.cpp + src/stc/DefsCache.cpp + src/stc/DefsCmd.cpp + src/stc/PreAllocatedReply.cpp + src/stc/SStringVecCmd.cpp + src/stc/StcCmd.cpp + src/stc/SSuitesCmd.cpp + src/stc/SClientHandleCmd.cpp + src/stc/SStringCmd.cpp + src/stc/ServerToClientCmd.cpp + src/stc/SClientHandleSuitesCmd.cpp + src/stc/SServerLoadCmd.cpp + src/stc/SNodeCmd.cpp + src/stc/SStatsCmd.cpp + src/stc/SSyncCmd.cpp + src/stc/SNewsCmd.cpp + src/stc/ErrorCmd.cpp + src/stc/GroupSTCCmd.cpp + src/stc/ZombieGetCmd.cpp + src/ClientToServerRequest.cpp + src/Gnuplot.cpp + src/WhyCmd.cpp + src/ServerToClientResponse.cpp + src/cts/CSyncCmd.cpp + src/cts/ZombieCmd.cpp + src/cts/OrderNodeCmd.cpp + src/cts/CheckPtCmd.cpp + src/cts/CtsNodeCmd.cpp + src/cts/GroupCTSCmd.cpp + src/cts/UserCmd.cpp + src/cts/ClientHandleCmd.cpp + src/cts/PlugCmd.cpp + src/cts/QueryCmd.cpp + src/cts/ForceCmd.cpp + src/cts/LoadDefsCmd.cpp + src/cts/CFileCmd.cpp + src/cts/ShowCmd.cpp + src/cts/CtsCmd.cpp + src/cts/TaskApi.cpp + src/cts/EditScriptCmd.cpp + src/cts/FreeDepCmd.cpp + src/cts/PathsCmd.cpp + src/cts/DeleteCmd.cpp + src/cts/EditHistoryMgr.cpp + src/cts/LogMessageCmd.cpp + src/cts/CtsApi.cpp + src/cts/ReplaceNodeCmd.cpp + src/cts/RequeueNodeCmd.cpp + src/cts/BeginCmd.cpp + src/cts/LogCmd.cpp + src/cts/AlterCmd.cpp + src/cts/TaskCmds.cpp + src/cts/CtsCmdRegistry.cpp + src/cts/RunNodeCmd.cpp + src/cts/ClientToServerCmd.cpp + src/cts/ServerVersionCmd.cpp + $<$:src/Openssl.cpp> + $<$:src/ssl_connection.cpp> + $<$:src/SslClient.cpp> +) +ecbuild_add_library( + TARGET + base + NOINSTALL + TYPE STATIC + SOURCES + ${srcs} + PUBLIC_INCLUDES + src + src/cts + src/stc + PUBLIC_LIBS + node + Boost::boost # Boost header-only libraries must be available (namely asio) +) target_clangformat(base) -list( APPEND test_srcs - test/MockServer.hpp - test/TestHelper.hpp - test/TestAlterCmd.cpp - test/TestArchiveAndRestoreCmd.cpp - test/TestClientHandleCmd.cpp - test/TestCmd.cpp - test/TestDeleteNodeCmd.cpp - test/TestECFLOW-189.cpp - test/TestForceCmd.cpp - test/TestFreeDepCmd.cpp - test/TestInLimitAndLimit.cpp - test/TestLogCmd.cpp - test/TestMeterCmd.cpp - test/TestQueryCmd.cpp - test/TestQueueCmd.cpp - test/TestProgramOptions.cpp - test/TestRequest.cpp - test/TestRequeueNodeCmd.cpp - test/TestResolveDependencies.cpp - test/TestSSyncCmd_CH1.cpp - test/TestSSyncCmd.cpp - test/TestSSyncCmdOrder.cpp - test/TestStatsCmd.cpp +set(test_srcs + # Headers + test/MockServer.hpp + test/TestHelper.hpp + # Sources + test/TestAlterCmd.cpp + test/TestArchiveAndRestoreCmd.cpp + test/TestBase_main.cpp # test entry point + test/TestClientHandleCmd.cpp + test/TestCmd.cpp + test/TestDeleteNodeCmd.cpp + test/TestECFLOW-189.cpp + test/TestForceCmd.cpp + test/TestFreeDepCmd.cpp + test/TestInLimitAndLimit.cpp + test/TestLogCmd.cpp + test/TestMeterCmd.cpp + test/TestQueryCmd.cpp + test/TestQueueCmd.cpp + test/TestProgramOptions.cpp + test/TestRequest.cpp + test/TestRequeueNodeCmd.cpp + test/TestResolveDependencies.cpp + test/TestSSyncCmd_CH1.cpp + test/TestSSyncCmd.cpp + test/TestSSyncCmdOrder.cpp + test/TestStatsCmd.cpp ) -# if OpenSSL not enabled ${OPENSSL_LIBRARIES}, is empty -# libboost_unit_test_framework undefined reference to `clock_gettime', ${LIBRT} needed for boost 1.71 -ecbuild_add_test( TARGET u_base - SOURCES ${test_srcs} - LIBS base pthread ${OPENSSL_LIBRARIES} - ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_TEST_EXEC_MONITOR_LIBRARY} ${LIBRT} - INCLUDES ../ANode/test ${Boost_INCLUDE_DIRS} - DEFINITIONS ${BOOST_TEST_DYN_LINK} - TEST_DEPENDS u_aparser - ) +ecbuild_add_test( + TARGET + u_base + SOURCES + ${test_srcs} + INCLUDES + ../ANode/test + LIBS + base + pthread + $<$:OpenSSL::SSL> + TEST_DEPENDS + u_aparser +) +target_clangformat(u_base + CONDITION ENABLE_TESTS +) -target_clangformat(u_base CONDITION ENABLE_TESTS) +# The following is not technically a test (as it makes no checks), +# but a tool to measure the time it takes to generate a job file +if (ENABLE_ALL_TESTS) + set(test_srcs + # Sources + test/TestJobGenPerf.cpp + ) - if (ENABLE_ALL_TESTS) - ecbuild_add_test( TARGET perf_job_gen - SOURCES test/TestJobGenPerf.cpp - LIBS base nodeattr node core pthread - INCLUDES ../ANode/test ${Boost_INCLUDE_DIRS} - DEFINITIONS ${BOOST_TEST_DYN_LINK} - ) - target_clangformat(perf_job_gen CONDITION ENABLE_TESTS) - endif() + ecbuild_add_test( + TARGET + perf_job_gen + SOURCES + ${test_srcs} + LIBS + base + pthread + ) + target_clangformat(perf_job_gen + CONDITION ENABLE_TESTS + ) +endif() diff --git a/Base/test/TestBase_main.cpp b/Base/test/TestBase_main.cpp new file mode 100644 index 000000000..8552d1615 --- /dev/null +++ b/Base/test/TestBase_main.cpp @@ -0,0 +1,12 @@ +/* + * Copyright 2023- ECMWF. + * + * This software is licensed under the terms of the Apache Licence version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation + * nor does it submit to any jurisdiction. + */ + +#define BOOST_TEST_MODULE TestBase +#include diff --git a/Base/test/TestResolveDependencies.cpp b/Base/test/TestResolveDependencies.cpp index 5860755c8..32569643f 100644 --- a/Base/test/TestResolveDependencies.cpp +++ b/Base/test/TestResolveDependencies.cpp @@ -1,4 +1,3 @@ -#define BOOST_TEST_MODULE TestBase //============================================================================ // Name : // Author : Avi diff --git a/CMakeLists.txt b/CMakeLists.txt index 557129014..a9b88de69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,10 +222,9 @@ ecbuild_info("") # ========================================================================================= -# cereal is embedded +# Setup Project-wide dependencies # ========================================================================================= -include_directories( ${CMAKE_SOURCE_DIR}/cereal/include ) - +include(Dependencies) message( STATUS "====================================================================================================================" ) message( STATUS "BOOST" ) diff --git a/Client/CMakeLists.txt b/Client/CMakeLists.txt index 6b5248989..078b34ab2 100644 --- a/Client/CMakeLists.txt +++ b/Client/CMakeLists.txt @@ -1,66 +1,73 @@ - # ======================================================= - # LIB - # to list all sources to build use: - # cd $WK/Client - # find src -name \*.cpp --print - # ======================================================= - -# Excludes src/ClientMain.cpp -list( APPEND srcs - # HEADERS - src/ClientCmdCache.hpp - src/ClientEnvironment.hpp - src/ClientInvoker.hpp - src/ClientOptions.hpp - src/Help.hpp - src/Rtt.hpp - src/UrlCmd.hpp - # SOURCES - src/ClientCmdCache.cpp - src/Rtt.cpp - src/ClientEnvironment.cpp - src/ClientInvoker.cpp - src/Help.cpp - src/Rtt.cpp - src/ClientOptions.cpp - src/UrlCmd.cpp +# +# Copyright 2023- ECMWF. +# +# This software is licensed under the terms of the Apache Licence version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. +# + +set(srcs + # Headers + src/ClientCmdCache.hpp + src/ClientEnvironment.hpp + src/ClientInvoker.hpp + src/ClientOptions.hpp + src/Help.hpp + src/Rtt.hpp + src/UrlCmd.hpp + # Sources + src/ClientCmdCache.cpp + src/Rtt.cpp + src/ClientEnvironment.cpp + src/ClientInvoker.cpp + src/Help.cpp + src/Rtt.cpp + src/ClientOptions.cpp + src/UrlCmd.cpp ) -ecbuild_add_library( TARGET libclient - NOINSTALL - TYPE STATIC - SOURCES ${srcs} - ) - -target_link_libraries(libclient base node nodeattr core pthread) -target_include_directories(libclient PUBLIC src - ../ACore/src - ../ANattr/src - ../ANode/src - ../Base/src - ../Base/src/cts - ../Base/src/stc ) +ecbuild_add_library( + TARGET + libclient + NOINSTALL + TYPE STATIC + SOURCES + ${srcs} + PUBLIC_INCLUDES + src + PUBLIC_LIBS + base + pthread +) target_clangformat(libclient) # ======================================================================== # EXE ecflow_client, if OpenSSL not enabled ${OPENSSL_LIBRARIES}, is empty -ecbuild_add_executable( TARGET ecflow_client - SOURCES src/ClientMain.cpp - LIBS libclient ${OPENSSL_LIBRARIES} - INCLUDES ${Boost_INCLUDE_DIRS} - ) +ecbuild_add_executable( + TARGET + ecflow_client + SOURCES + src/ClientMain.cpp + LIBS + libclient + $<$:OpenSSL::SSL> +) +target_clangformat(ecflow_client) # Override default behaviour that add RPATHS during install # The only thing that seem to work is set INSTALL_RPATH to "" # Using SKIP_BUILD_RPATH,BUILD_WITH_INSTALL_RPATH,INSTALL_RPATH_USE_LINK_PATH # had no effect # -SET_TARGET_PROPERTIES(ecflow_client PROPERTIES - INSTALL_RPATH "" - ) +SET_TARGET_PROPERTIES(ecflow_client + PROPERTIES + INSTALL_RPATH "" +) + -target_clangformat(ecflow_client) # use, i.e. don't skip the full RPATH for the build tree #SET(CMAKE_SKIP_BUILD_RPATH FALSE) @@ -79,96 +86,116 @@ target_clangformat(ecflow_client) # ================================================================================ # TEST -# Use following to populate list: -# cd $WK/Client -# find test -name \*.cpp | sort - -list( APPEND test_srcs - # HEADERS - test/InvokeServer.hpp - # SOURCES - test/TestClientEnvironment.cpp - test/TestClientOptions.cpp - test/TestClientInterface.cpp - test/TestJobGenOnly.cpp - test/TestLifeCycle.cpp - test/TestInitAddVariables.cpp - test/TestRtt.cpp - test/TestUrlCmd.cpp - ) +set(test_srcs + # Headers + test/InvokeServer.hpp + # Sources + test/TestClient_main.cpp # test entry point + test/TestClientEnvironment.cpp + test/TestClientOptions.cpp + test/TestClientInterface.cpp + test/TestJobGenOnly.cpp + test/TestLifeCycle.cpp + test/TestInitAddVariables.cpp + test/TestRtt.cpp + test/TestUrlCmd.cpp +) if (ENABLE_SERVER) - list(APPEND test_srcs - # HEADERS - test/SCPort.hpp - # SOURCES - test/SCPort.cpp - test/TestClientTimeout.cpp - test/TestClientHandleCmd.cpp - test/TestCheckPtDefsCmd.cpp - test/TestCustomUser.cpp - test/TestGroupCmd.cpp - test/TestLoadDefsCmd.cpp - test/TestLogAndCheckptErrors.cpp - test/TestPasswdFile.cpp - test/TestPlugCmd.cpp - test/TestServer.cpp - test/TestServerAndLifeCycle.cpp - test/TestServerLoad.cpp - test/TestSignalSIGTERM.cpp - test/TestWhiteListFile.cpp - ) + list(APPEND test_srcs + # Headers + test/SCPort.hpp + # Sources + test/SCPort.cpp + test/TestClientTimeout.cpp + test/TestClientHandleCmd.cpp + test/TestCheckPtDefsCmd.cpp + test/TestCustomUser.cpp + test/TestGroupCmd.cpp + test/TestLoadDefsCmd.cpp + test/TestLogAndCheckptErrors.cpp + test/TestPasswdFile.cpp + test/TestPlugCmd.cpp + test/TestServer.cpp + test/TestServerAndLifeCycle.cpp + test/TestServerLoad.cpp + test/TestSignalSIGTERM.cpp + test/TestWhiteListFile.cpp + ) endif() - -# if OpenSSL not enabled ${OPENSSL_LIBRARIES}, is empty -# boost_timer -> boost_chrono -> librt -ecbuild_add_test( TARGET s_client - SOURCES ${test_srcs} - LIBS libclient ${OPENSSL_LIBRARIES} - ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_TEST_EXEC_MONITOR_LIBRARY} - ${Boost_TIMER_LIBRARY} ${Boost_CHRONO_LIBRARY} ${LIBRT} - INCLUDES ../ANode/test - ../Base/test - ${Boost_INCLUDE_DIRS} - DEFINITIONS ${BOOST_TEST_DYN_LINK} - TEST_DEPENDS u_base - ) - -target_clangformat(s_client CONDITION ENABLE_TESTS) + +ecbuild_add_test( + TARGET + s_client + SOURCES + ${test_srcs} + INCLUDES + ../Base/test + ../ANode/test + LIBS + libclient + Boost::boost # Boost header-only libraries must be available (namely unit_test_framework) + Boost::timer + $<$:OpenSSL::SSL> + TEST_DEPENDS + u_base +) +target_clangformat(s_client + CONDITION ENABLE_TESTS +) if (ENABLE_ALL_TESTS AND ENABLE_SERVER) - # - # Simple stand alone test - # - # libboost_unit_test_framework undefined reference to `clock_gettime', ${LIBRT} needed for boost 1.71 - ecbuild_add_test( TARGET perf_test_large_defs - SOURCES test/TestSinglePerf.cpp test/SCPort.cpp - LIBS libclient ${OPENSSL_LIBRARIES} - ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_TEST_EXEC_MONITOR_LIBRARY} ${LIBRT} - INCLUDES ../ANode/test - ../Base/test - ${Boost_INCLUDE_DIRS} - DEFINITIONS ${BOOST_TEST_DYN_LINK} - TEST_DEPENDS u_base - ) - - target_clangformat(perf_test_large_defs CONDITION ENABLE_TESTS) - - # - # test migration - # - ecbuild_add_test( TARGET m_test_migration - SOURCES test/TestMigration.cpp test/SCPort.cpp - LIBS libclient ${OPENSSL_LIBRARIES} - ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_TEST_EXEC_MONITOR_LIBRARY} ${LIBRT} - INCLUDES ../ANode/test - ../Base/test - ${Boost_INCLUDE_DIRS} - DEFINITIONS ${BOOST_TEST_DYN_LINK} - TEST_DEPENDS u_base - ) - - target_clangformat(m_test_migration CONDITION ENABLE_TESTS) + # + # Simple stand alone test + # + ecbuild_add_test( + TARGET + perf_test_large_defs + SOURCES + # Headers + test/SCPort.hpp + # Sources + test/SCPort.cpp + test/TestSinglePerf.cpp + test/TestSinglePerf_main.cpp # test entry point + INCLUDES + ../Base/test + LIBS + libclient + Boost::boost # Boost header-only libraries must be available (namely unit_test_framework) + $<$:OpenSSL::SSL> + TEST_DEPENDS + u_base + ) + target_clangformat(perf_test_large_defs + CONDITION ENABLE_TESTS + ) + + # + # test migration + # + ecbuild_add_test( + TARGET + m_test_migration + SOURCES + # Headers + test/SCPort.hpp + # Sources + test/SCPort.cpp + test/TestMigration.cpp + test/TestMigration_main.cpp # test entry point + INCLUDES + ../Base/test + LIBS + libclient + Boost::boost # Boost header-only libraries must be available (namely unit_test_framework) + $<$:OpenSSL::SSL> + TEST_DEPENDS + u_base + ) + target_clangformat(m_test_migration + CONDITION ENABLE_TESTS + ) endif() diff --git a/Client/test/TestClientEnvironment.cpp b/Client/test/TestClientEnvironment.cpp index ba84425f4..226468b32 100644 --- a/Client/test/TestClientEnvironment.cpp +++ b/Client/test/TestClientEnvironment.cpp @@ -1,4 +1,3 @@ -#define BOOST_TEST_MODULE TestClient //============================================================================ // Name : // Author : Avi diff --git a/Client/test/TestClient_main.cpp b/Client/test/TestClient_main.cpp new file mode 100644 index 000000000..b52b51027 --- /dev/null +++ b/Client/test/TestClient_main.cpp @@ -0,0 +1,12 @@ +/* + * Copyright 2023- ECMWF. + * + * This software is licensed under the terms of the Apache Licence version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation + * nor does it submit to any jurisdiction. + */ + +#define BOOST_TEST_MODULE TestClient +#include diff --git a/Client/test/TestMigration.cpp b/Client/test/TestMigration.cpp index 3f90af013..a4439f6e2 100644 --- a/Client/test/TestMigration.cpp +++ b/Client/test/TestMigration.cpp @@ -1,4 +1,3 @@ -#define BOOST_TEST_MODULE TestMigration //============================================================================ // Name : // Author : Avi diff --git a/Client/test/TestMigration_main.cpp b/Client/test/TestMigration_main.cpp new file mode 100644 index 000000000..9b62af188 --- /dev/null +++ b/Client/test/TestMigration_main.cpp @@ -0,0 +1,12 @@ +/* + * Copyright 2023- ECMWF. + * + * This software is licensed under the terms of the Apache Licence version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation + * nor does it submit to any jurisdiction. + */ + +#define BOOST_TEST_MODULE TestMigration +#include diff --git a/Client/test/TestSinglePerf.cpp b/Client/test/TestSinglePerf.cpp index c9c10a23c..cf8152ac9 100644 --- a/Client/test/TestSinglePerf.cpp +++ b/Client/test/TestSinglePerf.cpp @@ -1,4 +1,3 @@ -#define BOOST_TEST_MODULE TestSingle //============================================================================ // Name : // Author : Avi diff --git a/Client/test/TestSinglePerf_main.cpp b/Client/test/TestSinglePerf_main.cpp new file mode 100644 index 000000000..85185f41d --- /dev/null +++ b/Client/test/TestSinglePerf_main.cpp @@ -0,0 +1,12 @@ +/* + * Copyright 2023- ECMWF. + * + * This software is licensed under the terms of the Apache Licence version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation + * nor does it submit to any jurisdiction. + */ + +#define BOOST_TEST_MODULE TestSinglePerf +#include diff --git a/Http/CMakeLists.txt b/Http/CMakeLists.txt index 8fb90def6..743a22a12 100644 --- a/Http/CMakeLists.txt +++ b/Http/CMakeLists.txt @@ -1,86 +1,85 @@ - # ======================================================= - # LIB - # to list all sources to build use: - # cd $WK/Client - # find src -name \*.cpp --print - # ======================================================= - - # Excludes src/HttpMain.cpp -list( APPEND srcs - # HEADERS - src/ApiV1.hpp - src/ApiV1Impl.hpp - src/Base64.hpp - src/BasicAuth.hpp - src/HttpServer.hpp - src/HttpServerException.hpp - src/JSON.hpp - src/Options.hpp - src/TokenStorage.hpp - src/TypeToJson.hpp - # SOURCES - src/HttpServer.cpp - src/ApiV1.cpp - src/ApiV1Impl.cpp - src/BasicAuth.cpp - src/TypeToJson.cpp - src/TokenStorage.cpp -) +# +# Copyright 2023- ECMWF. +# +# This software is licensed under the terms of the Apache Licence version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. +# # cpp-httplib requires at least OpenSSL 1.1.1 for https support # so if we have OpenSSL enabled and the version is less than this, # we should disable SSL capabilities from the HTTP server if (OPENSSL_FOUND) - if (OPENSSL_VERSION VERSION_LESS 1.1.1) - ecbuild_warn("HTTP_SERVER requires at least OpenSSL 1.1.1 for https support (have version ${OPENSSL_VERSION}) - disabling https in HTTP server") - remove_definitions( -DECF_OPENSSL ) - set(DISABLED_SSL_IN_HTTP_SERVER 1) - endif() -endif() - - -ecbuild_add_library( TARGET libhttp - NOINSTALL - TYPE STATIC - SOURCES ${srcs} - ) - -target_link_libraries(libhttp base node nodeattr core pthread) -target_include_directories(libhttp PUBLIC src - ../ACore/src - ../ANattr/src - ../ANode/src - ../Base/src - ../Base/src/cts - ../Base/src/stc - ../Client/src - ../cpp-httplib - ../json + if (OPENSSL_VERSION VERSION_LESS 1.1.1) + ecbuild_warn("HTTP_SERVER requires at least OpenSSL 1.1.1 for https support (have version ${OPENSSL_VERSION}) - disabling https in HTTP server") + remove_definitions(-DECF_OPENSSL) + set(DISABLED_SSL_IN_HTTP_SERVER 1) + endif () +endif () + +set(srcs + # Headers + src/ApiV1.hpp + src/ApiV1Impl.hpp + src/Base64.hpp + src/BasicAuth.hpp + src/HttpServer.hpp + src/HttpServerException.hpp + src/JSON.hpp + src/Options.hpp + src/TokenStorage.hpp + src/TypeToJson.hpp + # Sources + src/HttpServer.cpp + src/ApiV1.cpp + src/ApiV1Impl.cpp + src/BasicAuth.cpp + src/TypeToJson.cpp + src/TokenStorage.cpp ) +ecbuild_add_library( + TARGET libhttp + NOINSTALL + TYPE STATIC + SOURCES + ${srcs} + PUBLIC_INCLUDES + src + PUBLIC_LIBS + base + libclient + nlohmann::json + httplib::httplib +) target_clangformat(libhttp) # ======================================================================== # EXE ecflow_http, if OpenSSL not enabled ${OPENSSL_LIBRARIES}, is empty -ecbuild_add_executable( TARGET ecflow_http - SOURCES - src/HttpMain.cpp - LIBS libhttp libclient ${OPENSSL_LIBRARIES} - INCLUDES ${Boost_INCLUDE_DIRS} ../cpp-httplib - ) +ecbuild_add_executable( + TARGET ecflow_http + SOURCES + src/HttpMain.cpp + LIBS + libhttp + libclient + $<$:OpenSSL::SSL> +) +target_clangformat(ecflow_http) # Override default behaviour that add RPATHS during install # The only thing that seem to work is set INSTALL_RPATH to "" # Using SKIP_BUILD_RPATH,BUILD_WITH_INSTALL_RPATH,INSTALL_RPATH_USE_LINK_PATH # had no effect # -SET_TARGET_PROPERTIES(ecflow_http PROPERTIES - INSTALL_RPATH "" - ) - -target_clangformat(ecflow_http) +SET_TARGET_PROPERTIES(ecflow_http + PROPERTIES + INSTALL_RPATH "" +) # use, i.e. don't skip the full RPATH for the build tree #SET(CMAKE_SKIP_BUILD_RPATH FALSE) @@ -98,39 +97,44 @@ target_clangformat(ecflow_http) if (ENABLE_HTTP AND ENABLE_SERVER) - list(APPEND test_srcs - # HEADERS + if (OPENSSL_FOUND AND NOT DISABLED_SSL_IN_HTTP_SERVER) + + set(test_srcs + # Headers test/Certificate.hpp test/InvokeServer.hpp test/TokenFile.hpp - # SOURCES + # Sources test/TestApiV1.cpp - ) - - if (OPENSSL_FOUND AND NOT DISABLED_SSL_IN_HTTP_SERVER) - - ecbuild_add_test( TARGET s_http - SOURCES ${test_srcs} - LIBS libhttp libclient libserver ${OPENSSL_LIBRARIES} - ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_TEST_EXEC_MONITOR_LIBRARY} - ${Boost_TIMER_LIBRARY} ${Boost_CHRONO_LIBRARY} ${LIBRT} - INCLUDES src - ../ANode/test - ../Base/test - ../Server/src - ${Boost_INCLUDE_DIRS} - DEFINITIONS ${BOOST_TEST_DYN_LINK} - TEST_DEPENDS u_base s_client - ) - - target_clangformat(s_http CONDITION ENABLE_TESTS) - else() + test/TestApiV1_main.cpp # test entry point + ) + + ecbuild_add_test( + TARGET s_http + SOURCES + ${test_srcs} + INCLUDES + ../Base/test + LIBS + libhttp + libclient + libserver + Boost::boost # Boost header-only libraries must be available (namely unit_test_framework) + $<$:OpenSSL::SSL> + TEST_DEPENDS + u_base + s_client + ) + target_clangformat(s_http + CONDITION ENABLE_TESTS + ) + else () message(WARNING "SSL not enabled - will not run HTTP server tests") - endif() + endif () -endif() +endif () # =================================================================== # install # =================================================================== -install (TARGETS ecflow_http DESTINATION bin) +install(TARGETS ecflow_http DESTINATION bin) diff --git a/Http/test/TestApiV1.cpp b/Http/test/TestApiV1.cpp index abb162d3d..b1caae61d 100644 --- a/Http/test/TestApiV1.cpp +++ b/Http/test/TestApiV1.cpp @@ -1,4 +1,12 @@ -#define BOOST_TEST_MODULE TestHttp +/* + * Copyright 2023- ECMWF. + * + * This software is licensed under the terms of the Apache Licence version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation + * nor does it submit to any jurisdiction. + */ #ifdef ECF_OPENSSL #define CPPHTTPLIB_OPENSSL_SUPPORT diff --git a/Http/test/TestApiV1_main.cpp b/Http/test/TestApiV1_main.cpp new file mode 100644 index 000000000..d464cbee5 --- /dev/null +++ b/Http/test/TestApiV1_main.cpp @@ -0,0 +1,12 @@ +/* + * Copyright 2023- ECMWF. + * + * This software is licensed under the terms of the Apache Licence version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation + * nor does it submit to any jurisdiction. + */ + +#define BOOST_TEST_MODULE TestHttp +#include diff --git a/Server/CMakeLists.txt b/Server/CMakeLists.txt index dc5c5eb22..b85c9087e 100644 --- a/Server/CMakeLists.txt +++ b/Server/CMakeLists.txt @@ -1,80 +1,81 @@ - # ======================================================= - # LIB - # to list all sources to build use: - # cd $WK/Server - # find src -name \*.cpp -print | sort - # ======================================================= -list( APPEND srcs - # HEADERS - src/BaseServer.hpp - src/CheckPtSaver.hpp - src/NodeTreeTraverser.hpp - src/Server.hpp - src/ServerEnvironment.hpp - src/ServerOptions.hpp - src/SslServer.hpp - src/SslTcpServer.hpp - src/TcpBaseServer.hpp - src/TcpServer.hpp - # SOURCES - src/BaseServer.cpp - src/CheckPtSaver.cpp - src/NodeTreeTraverser.cpp - src/Server.cpp - src/ServerEnvironment.cpp - src/ServerOptions.cpp - src/TcpBaseServer.cpp - src/TcpServer.cpp -) - -if (OPENSSL_FOUND) - list( APPEND srcs - # HEADERS - src/SslServer.hpp - src/SslTcpServer.hpp - # SOURCES - src/SslServer.cpp - src/SslTcpServer.cpp - ) -endif() - +# +# Copyright 2023- ECMWF. +# +# This software is licensed under the terms of the Apache Licence version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. +# -ecbuild_add_library( TARGET libserver - NOINSTALL - TYPE STATIC - SOURCES ${srcs} - ) -target_link_libraries(libserver base node nodeattr core pthread ) -target_include_directories(libserver PRIVATE src - ../ACore/src - ../ANattr/src - ../ANode/src - ../Base/src - ../Base/src/cts - ../Base/src/stc +set(srcs + # Headers + src/BaseServer.hpp + src/CheckPtSaver.hpp + src/NodeTreeTraverser.hpp + src/Server.hpp + src/ServerEnvironment.hpp + src/ServerOptions.hpp + src/SslServer.hpp + src/SslTcpServer.hpp + src/TcpBaseServer.hpp + src/TcpServer.hpp + $<$:src/SslServer.hpp> + $<$:src/SslTcpServer.hpp> + # Sources + src/BaseServer.cpp + src/CheckPtSaver.cpp + src/NodeTreeTraverser.cpp + src/Server.cpp + src/ServerEnvironment.cpp + src/ServerOptions.cpp + src/TcpBaseServer.cpp + src/TcpServer.cpp + $<$:src/SslServer.cpp> + $<$:src/SslTcpServer.cpp> ) +ecbuild_add_library( + TARGET + libserver + NOINSTALL + TYPE STATIC + SOURCES + ${srcs} + PUBLIC_INCLUDES + src + PUBLIC_LIBS + base + Boost::boost # Boost header-only libraries must be available (namely asio) +) target_clangformat(libserver) +find_package(Threads REQUIRED) + # ======================================================= # EXE ecflow_server, if OpenSSL not enabled ${OPENSSL_LIBRARIES}, is empty -ecbuild_add_executable( TARGET ecflow_server - SOURCES src/ServerMain.cpp - LIBS libserver ${OPENSSL_LIBRARIES} - INCLUDES ${Boost_INCLUDE_DIRS} - ) +ecbuild_add_executable( + TARGET + ecflow_server + SOURCES + src/ServerMain.cpp + LIBS + libserver + $<$:OpenSSL::SSL> + Threads::Threads +) +target_clangformat(ecflow_server) # Override default behaviour that add RPATHS during install # The only thing that seem to work is set INSTALL_RPATH to "" # Using SKIP_BUILD_RPATH,BUILD_WITH_INSTALL_RPATH,INSTALL_RPATH_USE_LINK_PATH # had no effect # -SET_TARGET_PROPERTIES(ecflow_server PROPERTIES - INSTALL_RPATH "" - ) - -target_clangformat(ecflow_server) +SET_TARGET_PROPERTIES(ecflow_server + PROPERTIES + INSTALL_RPATH "" +) # use, i.e. don't skip the full RPATH for the build tree #SET(CMAKE_SKIP_BUILD_RPATH FALSE) @@ -93,7 +94,6 @@ target_clangformat(ecflow_server) # ================================================================================ # TEST -# libboost_unit_test_framework undefined reference to `clock_gettime', ${LIBRT} needed for boost 1.71 ecbuild_add_test( TARGET u_server @@ -101,10 +101,13 @@ ecbuild_add_test( src SOURCES test/TestServerEnvironment.cpp + test/TestServer_main.cpp # test entry point test/TestServer1.cpp LIBS libserver + Boost::boost # Boost header-only libraries must be available (namely unit_test_framework) $<$:OpenSSL::SSL> + Threads::Threads TEST_DEPENDS u_base ) diff --git a/Server/test/TestServerEnvironment.cpp b/Server/test/TestServerEnvironment.cpp index e31c3e4c7..2deb06cbd 100644 --- a/Server/test/TestServerEnvironment.cpp +++ b/Server/test/TestServerEnvironment.cpp @@ -1,4 +1,3 @@ -#define BOOST_TEST_MODULE Server //============================================================================ // Name : // Author : Avi @@ -20,7 +19,7 @@ #include #include -#include +#include #include "CheckPt.hpp" #include "Ecf.hpp" diff --git a/Server/test/TestServer_main.cpp b/Server/test/TestServer_main.cpp new file mode 100644 index 000000000..98ce3ed3d --- /dev/null +++ b/Server/test/TestServer_main.cpp @@ -0,0 +1,12 @@ +/* + * Copyright 2023- ECMWF. + * + * This software is licensed under the terms of the Apache Licence version 2.0 + * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. + * In applying this licence, ECMWF does not waive the privileges and immunities + * granted to it by virtue of its status as an intergovernmental organisation + * nor does it submit to any jurisdiction. + */ + +#define BOOST_TEST_MODULE TestServer +#include diff --git a/Udp/CMakeLists.txt b/Udp/CMakeLists.txt index d31bda9a6..fb4f7970c 100644 --- a/Udp/CMakeLists.txt +++ b/Udp/CMakeLists.txt @@ -1,3 +1,12 @@ +# +# Copyright 2023- ECMWF. +# +# This software is licensed under the terms of the Apache Licence version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. +# # ============================================================================== # ECFLOW UDP library @@ -5,14 +14,14 @@ set(LIB_TARGET libecflow_udp) set(${LIB_TARGET}_srcs - # HEADERS + # Headers src/ClientAPI.hpp src/RequestHandler.hpp src/Trace.hpp src/UDPServer.hpp src/UDPServerEnvironment.hpp src/UDPServerOptions.hpp - # SOURCES + # Sources src/ClientAPI.cpp src/RequestHandler.cpp src/Trace.cpp @@ -21,19 +30,20 @@ set(${LIB_TARGET}_srcs ) ecbuild_add_library( - TARGET ${LIB_TARGET} + TARGET + ${LIB_TARGET} TYPE STATIC NOINSTALL - SOURCES ${${LIB_TARGET}_srcs} + SOURCES + ${${LIB_TARGET}_srcs} PRIVATE_INCLUDES src - ../Client/src - ../json PUBLIC_LIBS libclient pthread - $<$:OpenSSL::SSL> + nlohmann::json Boost::boost + $<$:OpenSSL::SSL> ) target_clangformat(${LIB_TARGET}) @@ -43,7 +53,7 @@ target_clangformat(${LIB_TARGET}) set(SERVER_TARGET ecflow_udp) set(${SERVER_TARGET}_srcs - # SOURCES + # Sources src/UDPServerMain.cpp ) @@ -52,9 +62,9 @@ ecbuild_add_executable( SOURCES ${${SERVER_TARGET}_srcs} INCLUDES src - ../ACore/src # Needed only to #include "ecflow_version.h" LIBS ${LIB_TARGET} + core # Needed only to #include "ecflow_version.h" ) set_target_properties(${SERVER_TARGET} PROPERTIES INSTALL_RPATH "" @@ -118,7 +128,6 @@ ecbuild_add_test( ${BOOST_TEST_DYN_LINK} INCLUDES src - ../json WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/test_sandbox ENVIRONMENT diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake new file mode 100644 index 000000000..04e7d6c77 --- /dev/null +++ b/cmake/Dependencies.cmake @@ -0,0 +1,28 @@ +# +# Copyright 2023- ECMWF. +# This software is licensed under the terms of the Apache Licence version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. +# + +set(DEPENDENCIES_DIR "${CMAKE_SOURCE_DIR}/3rdparty") + +# ========================================================================================= +# Cereal +# ========================================================================================= +set(CEREAL_DIR "${DEPENDENCIES_DIR}/cereal") +find_package(Cereal REQUIRED) + +# ========================================================================================= +# Json +# ========================================================================================= +set(JSON_DIR "${DEPENDENCIES_DIR}/json") +find_package(Json REQUIRED) + +# ========================================================================================= +# Httplib +# ========================================================================================= +set(HTTPLIB_DIR "${DEPENDENCIES_DIR}/cpp-httplib") +find_package(Httplib REQUIRED) diff --git a/cmake/FindCereal.cmake b/cmake/FindCereal.cmake new file mode 100644 index 000000000..e3a005399 --- /dev/null +++ b/cmake/FindCereal.cmake @@ -0,0 +1,73 @@ +# +# Copyright 2023- ECMWF. +# This software is licensed under the terms of the Apache Licence version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. +# + +# FindCereal +# ---------- +# + +# +# Find Cereal library include dirs +# +# Use this module by invoking find_package with the form: +# +# find_package(Cereal +# [REQUIRED] # Fail with error if library is not found +# ) +# +# This module finds headers and libraries, specifying the following variables: +# +# Cereal_FOUND - True if library is found +# Cereal_INCLUDE_DIRS - Include directories to be used +# Cereal_DEFINITIONS - Compiler flags to be used +# +# The following `IMPORTED` targets are also defined: +# +# cereal::cereal - Generic target for the libraryCereal +# +# + +if (CEREAL_DIR) + message(STATUS "Locating Cereal at ${CEREAL_DIR}") +else () + message(FATAL_ERROR "Unable to find Cereal. Please provide CEREAL_DIR property.") +endif () + +# +# ----------------------------------------------------------------------------- +# Search for include DIRs +# ----------------------------------------------------------------------------- + +find_path(CEREAL_INCLUDE_DIRS + NAMES cereal/cereal.hpp + PATHS ${CEREAL_DIR}/include) + +# +# ----------------------------------------------------------------------------- +# Handle find_package() REQUIRED and QUIET parameters +# ----------------------------------------------------------------------------- + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Cereal + REQUIRED_VARS + CEREAL_INCLUDE_DIRS) + +# +# ----------------------------------------------------------------------------- +# Define library as exported targets +# ----------------------------------------------------------------------------- + +set(NAME "cereal") + +add_library(${NAME} INTERFACE IMPORTED GLOBAL) + +set_target_properties(${NAME} + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CEREAL_INCLUDE_DIRS}") + +add_library(cereal::cereal ALIAS cereal) diff --git a/cmake/FindHttplib.cmake b/cmake/FindHttplib.cmake new file mode 100644 index 000000000..a648cf07c --- /dev/null +++ b/cmake/FindHttplib.cmake @@ -0,0 +1,72 @@ +# +# Copyright 2023- ECMWF. +# This software is licensed under the terms of the Apache Licence version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. +# + +# FindHttplib +# ----------- +# + +# +# Find HTTP library include dirs +# +# Use this module by invoking find_package with the form: +# +# find_package(Httplib +# [REQUIRED] # Fail with error if library is not found +# ) +# +# This module finds headers and libraries, specifying the following variables: +# +# HTTPLIB_FOUND - True if library is found +# HTTPLIB_INCLUDE_DIRS - Include directories to be used +# +# The following `IMPORTED` targets are also defined: +# +# httplib::httplib - Generic target for the library +# +# + +if (HTTPLIB_DIR) + message(STATUS "Locating Httplib at ${HTTPLIB_DIR}") +else () + message(FATAL_ERROR "Unable to find Httplib. Please provide HTTPLIB_LIB property.") +endif () + +# +# ----------------------------------------------------------------------------- +# Search for include DIRs +# ----------------------------------------------------------------------------- + +find_path(HTTPLIB_INCLUDE_DIRS + NAMES httplib.h + PATHS ${HTTPLIB_DIR}/include) + +# +# ----------------------------------------------------------------------------- +# Handle find_package() REQUIRED and QUIET parameters +# ----------------------------------------------------------------------------- + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Httplib + REQUIRED_VARS + HTTPLIB_INCLUDE_DIRS) + +# +# ----------------------------------------------------------------------------- +# Define library as exported targets +# ----------------------------------------------------------------------------- + +set(NAME "httplib") + +add_library(${NAME} INTERFACE IMPORTED GLOBAL) + +set_target_properties(${NAME} + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${HTTPLIB_INCLUDE_DIRS}") + +add_library(httplib::httplib ALIAS httplib) diff --git a/cmake/FindJson.cmake b/cmake/FindJson.cmake new file mode 100644 index 000000000..2f36b83a4 --- /dev/null +++ b/cmake/FindJson.cmake @@ -0,0 +1,72 @@ +# +# Copyright 2023- ECMWF. +# This software is licensed under the terms of the Apache Licence version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation +# nor does it submit to any jurisdiction. +# + +# FindJson +# ---------- +# + +# +# Find JSON library include dirs +# +# Use this module by invoking find_package with the form: +# +# find_package(Json +# [REQUIRED] # Fail with error if library is not found +# ) +# +# This module finds headers and libraries, specifying the following variables: +# +# JSON_FOUND - True if library is found +# JSON_INCLUDE_DIRS - Include directories to be used +# +# The following `IMPORTED` targets are also defined: +# +# nlohmann::json - Generic target for the library +# +# + +if (JSON_DIR) + message(STATUS "Locating JSON at ${JSON_DIR}") +else () + message(FATAL_ERROR "Unable to find JSON. Please provide JSON_DIR property.") +endif () + +# +# ----------------------------------------------------------------------------- +# Search for include DIRs +# ----------------------------------------------------------------------------- + +find_path(JSON_INCLUDE_DIRS + NAMES nlohmann/json.hpp + PATHS ${JSON_DIR}/include) + +# +# ----------------------------------------------------------------------------- +# Handle find_package() REQUIRED and QUIET parameters +# ----------------------------------------------------------------------------- + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Json + REQUIRED_VARS + JSON_INCLUDE_DIRS) + +# +# ----------------------------------------------------------------------------- +# Define library as exported targets +# ----------------------------------------------------------------------------- + +set(NAME "nlohmann_json") + +add_library(${NAME} INTERFACE IMPORTED GLOBAL) + +set_target_properties(${NAME} + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${JSON_INCLUDE_DIRS}") + +add_library(nlohmann::json ALIAS nlohmann_json)