react-native-nitro-xlsx 0.1.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (428) hide show
  1. package/NitroXlsx.podspec +27 -27
  2. package/Package.swift +35 -10
  3. package/README.md +220 -58
  4. package/android/CMakeLists.txt +24 -27
  5. package/android/cpp-adapter.cpp +12 -0
  6. package/android/src/main/java/com/margelo/nitro/xlsx/NitroXlsxPackage.kt +9 -0
  7. package/cpp/HybridNitroXlsx.cpp +25 -179
  8. package/cpp/HybridNitroXlsx.hpp +2 -2
  9. package/cpp/HybridXlsxConditionalFormat.cpp +252 -0
  10. package/cpp/HybridXlsxConditionalFormat.hpp +62 -0
  11. package/cpp/HybridXlsxConditionalFormats.cpp +46 -0
  12. package/cpp/HybridXlsxConditionalFormats.hpp +28 -0
  13. package/cpp/HybridXlsxWorkbook.cpp +159 -196
  14. package/cpp/HybridXlsxWorkbook.hpp +7 -2
  15. package/cpp/HybridXlsxWorksheet.cpp +433 -62
  16. package/cpp/HybridXlsxWorksheet.hpp +73 -26
  17. package/cpp/XlsxCacheDir.cpp +76 -0
  18. package/cpp/XlsxCacheDir.hpp +27 -0
  19. package/cpp/XlsxError.hpp +68 -0
  20. package/cpp/XlsxJson.cpp +185 -0
  21. package/cpp/XlsxJson.hpp +36 -0
  22. package/ios/XlsxCacheDir.mm +60 -0
  23. package/nitrogen/generated/android/NitroXlsx+autolinking.cmake +2 -0
  24. package/nitrogen/generated/shared/c++/HybridNitroXlsxSpec.hpp +5 -3
  25. package/nitrogen/generated/shared/c++/HybridXlsxConditionalFormatSpec.cpp +54 -0
  26. package/nitrogen/generated/shared/c++/HybridXlsxConditionalFormatSpec.hpp +95 -0
  27. package/nitrogen/generated/shared/c++/HybridXlsxConditionalFormatsSpec.cpp +24 -0
  28. package/nitrogen/generated/shared/c++/HybridXlsxConditionalFormatsSpec.hpp +68 -0
  29. package/nitrogen/generated/shared/c++/HybridXlsxWorkbookSpec.cpp +3 -0
  30. package/nitrogen/generated/shared/c++/HybridXlsxWorkbookSpec.hpp +6 -1
  31. package/nitrogen/generated/shared/c++/HybridXlsxWorksheetSpec.cpp +47 -19
  32. package/nitrogen/generated/shared/c++/HybridXlsxWorksheetSpec.hpp +52 -20
  33. package/package.json +3 -3
  34. package/scripts/run-cpp-tests.sh +14 -0
  35. package/src/__mocks__/react-native-nitro-modules.ts +1 -0
  36. package/src/__tests__/index.test.ts +76 -7
  37. package/src/index.ts +107 -18
  38. package/src/specs/NitroXlsx.nitro.ts +141 -44
  39. package/thirdparty/OpenXLSX/.clang-format +118 -0
  40. package/thirdparty/OpenXLSX/.clang-tidy +28 -0
  41. package/thirdparty/OpenXLSX/.gitignore +130 -0
  42. package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_before_XMLNode_wrappers +46 -0
  43. package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_and_stripping +49 -0
  44. package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_char_support +49 -0
  45. package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_support +49 -0
  46. package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespaced_name_disabled +49 -0
  47. package/thirdparty/OpenXLSX/Benchmarks/2024-08-11-benchmarks_post-XLCellIterator-Rework +46 -0
  48. package/thirdparty/OpenXLSX/Benchmarks/2024-08-14-benchmarks_post-default-row-column-style-support +46 -0
  49. package/thirdparty/OpenXLSX/Benchmarks/2024-09-02-benchmarks +46 -0
  50. package/thirdparty/OpenXLSX/Benchmarks/2024-12-19-benchmarks +46 -0
  51. package/thirdparty/OpenXLSX/Benchmarks/2024-12-30-benchmarks-post-XLSharedStrings-by-ref +46 -0
  52. package/thirdparty/OpenXLSX/Benchmarks/2025-01-09-benchmarks-post-conditionalFormatsAndSheetProtection +46 -0
  53. package/thirdparty/OpenXLSX/Benchmarks/2025-01-10-benchmarks-post-XLCellValue-bugfix +46 -0
  54. package/thirdparty/OpenXLSX/Benchmarks/2025-01-31-benchmarks-post-XLComments-implementation +46 -0
  55. package/thirdparty/OpenXLSX/Benchmarks/2025-02-02-benchmarks-post-XLRowIterator-Rework +46 -0
  56. package/thirdparty/OpenXLSX/Benchmarks/2025-07-20-benchmarks-after-hiding-pugixml-internals +46 -0
  57. package/thirdparty/OpenXLSX/Benchmarks/2025-08-29-benchmarks-after-code-review-with-libzip +46 -0
  58. package/thirdparty/OpenXLSX/Benchmarks/Benchmark.cpp +249 -0
  59. package/thirdparty/OpenXLSX/Benchmarks/CMakeLists.txt +19 -0
  60. package/thirdparty/OpenXLSX/CMakeLists.txt +466 -0
  61. package/thirdparty/OpenXLSX/Documentation/CMakeLists.txt +31 -0
  62. package/thirdparty/OpenXLSX/Documentation/Doxyfile.in +2471 -0
  63. package/thirdparty/OpenXLSX/Documentation/DoxygenLayout.xml +194 -0
  64. package/thirdparty/OpenXLSX/Documentation/customdoxygen.css +1355 -0
  65. package/thirdparty/OpenXLSX/Examples/CMakeLists.txt +103 -0
  66. package/thirdparty/OpenXLSX/Examples/Demo1.cpp +279 -0
  67. package/thirdparty/OpenXLSX/Examples/Demo10.cpp +545 -0
  68. package/thirdparty/OpenXLSX/Examples/Demo1A.cpp +137 -0
  69. package/thirdparty/OpenXLSX/Examples/Demo2.cpp +65 -0
  70. package/thirdparty/OpenXLSX/Examples/Demo3.cpp +89 -0
  71. package/thirdparty/OpenXLSX/Examples/Demo4.cpp +86 -0
  72. package/thirdparty/OpenXLSX/Examples/Demo5.cpp +77 -0
  73. package/thirdparty/OpenXLSX/Examples/Demo6.cpp +103 -0
  74. package/thirdparty/OpenXLSX/Examples/Demo7.cpp +79 -0
  75. package/thirdparty/OpenXLSX/Examples/Demo8.cpp +117 -0
  76. package/thirdparty/OpenXLSX/Examples/Demo9.cpp +363 -0
  77. package/thirdparty/OpenXLSX/Examples/cmake/FindLIBZIP.cmake +61 -0
  78. package/thirdparty/OpenXLSX/Examples/external/CustomZip/CustomZip.hpp +256 -0
  79. package/thirdparty/OpenXLSX/LICENSE.md +29 -0
  80. package/thirdparty/OpenXLSX/Makefile.GNU +530 -0
  81. package/thirdparty/OpenXLSX/Notes/TBDs.txt +16 -0
  82. package/thirdparty/OpenXLSX/Notes/confirmed-TBCs.txt +8 -0
  83. package/thirdparty/OpenXLSX/Notes/styles-missing-support.xml +12 -0
  84. package/thirdparty/OpenXLSX/Notes/todo-list.txt +108 -0
  85. package/thirdparty/OpenXLSX/OpenXLSX/CMakeLists.txt +631 -0
  86. package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSX.hpp +63 -0
  87. package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSXConfig.cmake +11 -0
  88. package/thirdparty/OpenXLSX/OpenXLSX/cmake/bundle_static_library.cmake +198 -0
  89. package/thirdparty/OpenXLSX/OpenXLSX/cmake/patch_pkg_config.cmake +69 -0
  90. package/thirdparty/OpenXLSX/OpenXLSX/headers/IZipArchive.hpp +361 -0
  91. package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX-Exports.hpp +12 -0
  92. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCell.hpp +367 -0
  93. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellIterator.hpp +252 -0
  94. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellRange.hpp +223 -0
  95. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellReference.hpp +317 -0
  96. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellValue.hpp +793 -0
  97. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColor.hpp +232 -0
  98. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColumn.hpp +159 -0
  99. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCommandQuery.hpp +228 -0
  100. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLComments.hpp +270 -0
  101. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLConstants.hpp +18 -0
  102. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLContentTypes.hpp +264 -0
  103. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDateTime.hpp +175 -0
  104. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDocument.hpp +505 -0
  105. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDrawing.hpp +452 -0
  106. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLException.hpp +161 -0
  107. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLFormula.hpp +375 -0
  108. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLIterator.hpp +40 -0
  109. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLMergeCells.hpp +216 -0
  110. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLProperties.hpp +348 -0
  111. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRelationships.hpp +348 -0
  112. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRow.hpp +721 -0
  113. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRowData.hpp +488 -0
  114. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSharedStrings.hpp +204 -0
  115. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSheet.hpp +1640 -0
  116. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLStyles.hpp +2390 -0
  117. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLTables.hpp +132 -0
  118. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLWorkbook.hpp +404 -0
  119. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlData.hpp +283 -0
  120. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlFile.hpp +194 -0
  121. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParser.hpp +282 -0
  122. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParserForwardDeclarations.hpp +85 -0
  123. package/thirdparty/OpenXLSX/OpenXLSX/headers/XLZipArchive.hpp +232 -0
  124. package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/LibZip.hpp +447 -0
  125. package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/OpenXLSXFileSystemTools.hpp +207 -0
  126. package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/Zippy.hpp +1375 -0
  127. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCell.cpp +340 -0
  128. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellIterator.cpp +427 -0
  129. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellRange.cpp +221 -0
  130. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellReference.cpp +408 -0
  131. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellValue.cpp +519 -0
  132. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColor.cpp +202 -0
  133. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColumn.cpp +141 -0
  134. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLComments.cpp +637 -0
  135. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLContentTypes.cpp +329 -0
  136. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDateTime.cpp +269 -0
  137. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDocument.cpp +1678 -0
  138. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDrawing.cpp +784 -0
  139. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLFormula.cpp +201 -0
  140. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLMergeCells.cpp +357 -0
  141. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLProperties.cpp +810 -0
  142. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRelationships.cpp +529 -0
  143. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRow.cpp +918 -0
  144. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRowData.cpp +508 -0
  145. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSharedStrings.cpp +220 -0
  146. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSheet.cpp +1970 -0
  147. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLStyles.cpp +3014 -0
  148. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLTables.cpp +125 -0
  149. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLWorkbook.cpp +784 -0
  150. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlData.cpp +247 -0
  151. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlFile.cpp +160 -0
  152. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlParser.cpp +261 -0
  153. package/thirdparty/OpenXLSX/OpenXLSX/sources/XLZipArchive.cpp +266 -0
  154. package/thirdparty/OpenXLSX/OpenXLSX/sources/utilities/XLUtilities.hpp +478 -0
  155. package/thirdparty/OpenXLSX/README.md +1279 -0
  156. package/thirdparty/OpenXLSX/Scripts/cmake-cleanup.sh +102 -0
  157. package/thirdparty/OpenXLSX/Scripts/compile.sh +23 -0
  158. package/thirdparty/OpenXLSX/Scripts/demos-cleanup.sh +25 -0
  159. package/thirdparty/OpenXLSX/Scripts/demos-run-all.sh +60 -0
  160. package/thirdparty/OpenXLSX/Scripts/guarded-xml-format.sh +47 -0
  161. package/thirdparty/OpenXLSX/Scripts/make-gnu.sh +11 -0
  162. package/thirdparty/OpenXLSX/Scripts/uninstall-manifest.sh +48 -0
  163. package/thirdparty/OpenXLSX/Scripts/xml-format-all.sh +19 -0
  164. package/thirdparty/OpenXLSX/Scripts/xml-format.sh +38 -0
  165. package/thirdparty/OpenXLSX/Tests/CMakeLists.txt +37 -0
  166. package/thirdparty/OpenXLSX/Tests/catch/catch.hpp +17799 -0
  167. package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_automake.hpp +68 -0
  168. package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_sonarqube.hpp +182 -0
  169. package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_tap.hpp +278 -0
  170. package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_teamcity.hpp +212 -0
  171. package/thirdparty/OpenXLSX/Tests/main.cpp +55 -0
  172. package/thirdparty/OpenXLSX/Tests/testXLCell.cpp +176 -0
  173. package/thirdparty/OpenXLSX/Tests/testXLCellRange.cpp +180 -0
  174. package/thirdparty/OpenXLSX/Tests/testXLCellReference.cpp +160 -0
  175. package/thirdparty/OpenXLSX/Tests/testXLCellValue.cpp +366 -0
  176. package/thirdparty/OpenXLSX/Tests/testXLCellValueProxy.cpp +255 -0
  177. package/thirdparty/OpenXLSX/Tests/testXLColor.cpp +75 -0
  178. package/thirdparty/OpenXLSX/Tests/testXLDateTime.cpp +229 -0
  179. package/thirdparty/OpenXLSX/Tests/testXLDocument.cpp +197 -0
  180. package/thirdparty/OpenXLSX/Tests/testXLFormula.cpp +131 -0
  181. package/thirdparty/OpenXLSX/Tests/testXLRow.cpp +597 -0
  182. package/thirdparty/OpenXLSX/Tests/testXLSheet.cpp +77 -0
  183. package/thirdparty/OpenXLSX/Tests/ziptest-with-libs.cpp +88 -0
  184. package/thirdparty/OpenXLSX/Tests/ziptest.cpp +735 -0
  185. package/thirdparty/OpenXLSX/cmake/get-git-HEAD-ID.cmake +45 -0
  186. package/thirdparty/OpenXLSX/cmake/libopenxlsxCPackOptions.cmake.in +20 -0
  187. package/thirdparty/OpenXLSX/cmake/manage_dependency.cmake +813 -0
  188. package/thirdparty/OpenXLSX/cmake/recursive_library_type_test.cmake +52 -0
  189. package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-shared.hpp +42 -0
  190. package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-static.hpp +42 -0
  191. package/thirdparty/OpenXLSX/vcpkg.json +24 -0
  192. package/thirdparty/README.md +42 -0
  193. package/thirdparty/miniz/.clang-format +47 -0
  194. package/thirdparty/miniz/.travis.yml +2 -0
  195. package/thirdparty/miniz/CMakeLists.txt +333 -0
  196. package/thirdparty/miniz/CMakePresets.json +31 -0
  197. package/thirdparty/miniz/ChangeLog.md +272 -0
  198. package/thirdparty/miniz/Config.cmake.in +1 -0
  199. package/thirdparty/miniz/LICENSE +22 -0
  200. package/thirdparty/miniz/amalgamate.sh +57 -0
  201. package/thirdparty/miniz/examples/example1.c +105 -0
  202. package/thirdparty/miniz/examples/example2.c +164 -0
  203. package/thirdparty/miniz/examples/example3.c +269 -0
  204. package/thirdparty/miniz/examples/example4.c +102 -0
  205. package/thirdparty/miniz/examples/example5.c +327 -0
  206. package/thirdparty/miniz/examples/example6.c +189 -0
  207. package/thirdparty/miniz/meson.build +21 -0
  208. package/thirdparty/miniz/miniz.c +646 -0
  209. package/thirdparty/miniz/miniz.h +615 -0
  210. package/thirdparty/miniz/miniz.pc.in +13 -0
  211. package/thirdparty/miniz/miniz_common.h +89 -0
  212. package/thirdparty/miniz/miniz_export.h +20 -0
  213. package/thirdparty/miniz/miniz_tdef.c +1602 -0
  214. package/thirdparty/miniz/miniz_tdef.h +199 -0
  215. package/thirdparty/miniz/miniz_tinfl.c +778 -0
  216. package/thirdparty/miniz/miniz_tinfl.h +150 -0
  217. package/thirdparty/miniz/miniz_zip.c +4895 -0
  218. package/thirdparty/miniz/miniz_zip.h +454 -0
  219. package/thirdparty/miniz/readme.md +46 -0
  220. package/thirdparty/miniz/test.sh +36 -0
  221. package/thirdparty/miniz/tests/add_in_place_fuzzer.c +87 -0
  222. package/thirdparty/miniz/tests/catch_amalgamated.cpp +10795 -0
  223. package/thirdparty/miniz/tests/catch_amalgamated.hpp +13143 -0
  224. package/thirdparty/miniz/tests/checksum_fuzzer.c +26 -0
  225. package/thirdparty/miniz/tests/compress_fuzzer.c +91 -0
  226. package/thirdparty/miniz/tests/flush_fuzzer.c +88 -0
  227. package/thirdparty/miniz/tests/fuzz_main.c +55 -0
  228. package/thirdparty/miniz/tests/large_fuzzer.c +133 -0
  229. package/thirdparty/miniz/tests/main.cpp +185 -0
  230. package/thirdparty/miniz/tests/miniz_tdefl_fuzzer.cc +115 -0
  231. package/thirdparty/miniz/tests/miniz_tester.cpp +1881 -0
  232. package/thirdparty/miniz/tests/miniz_zip_validate_fuzzer.cc +71 -0
  233. package/thirdparty/miniz/tests/miniz_zip_writer_fuzzer.cc +96 -0
  234. package/thirdparty/miniz/tests/ossfuzz.sh +48 -0
  235. package/thirdparty/miniz/tests/small_fuzzer.c +126 -0
  236. package/thirdparty/miniz/tests/timer.cpp +152 -0
  237. package/thirdparty/miniz/tests/timer.h +40 -0
  238. package/thirdparty/miniz/tests/uncompress2_fuzzer.c +21 -0
  239. package/thirdparty/miniz/tests/uncompress_fuzzer.c +30 -0
  240. package/thirdparty/miniz/tests/zip.dict +9 -0
  241. package/thirdparty/miniz/tests/zip_fuzzer.c +63 -0
  242. package/thirdparty/pugixml/.codecov.yml +7 -0
  243. package/thirdparty/pugixml/.gitattributes +1 -0
  244. package/thirdparty/pugixml/CMakeLists.txt +330 -0
  245. package/thirdparty/pugixml/LICENSE.md +24 -0
  246. package/thirdparty/pugixml/Makefile +98 -0
  247. package/thirdparty/pugixml/README.md +81 -0
  248. package/thirdparty/pugixml/SECURITY.md +9 -0
  249. package/thirdparty/pugixml/appveyor.yml +50 -0
  250. package/thirdparty/pugixml/docs/config.adoc +7 -0
  251. package/thirdparty/pugixml/docs/images/dom_tree.png +0 -0
  252. package/thirdparty/pugixml/docs/images/vs2005_link1.png +0 -0
  253. package/thirdparty/pugixml/docs/images/vs2005_link2.png +0 -0
  254. package/thirdparty/pugixml/docs/images/vs2005_pch1.png +0 -0
  255. package/thirdparty/pugixml/docs/images/vs2005_pch2.png +0 -0
  256. package/thirdparty/pugixml/docs/images/vs2005_pch3.png +0 -0
  257. package/thirdparty/pugixml/docs/images/vs2005_pch4.png +0 -0
  258. package/thirdparty/pugixml/docs/images/vs2010_link1.png +0 -0
  259. package/thirdparty/pugixml/docs/images/vs2010_link2.png +0 -0
  260. package/thirdparty/pugixml/docs/manual.adoc +3326 -0
  261. package/thirdparty/pugixml/docs/manual.html +6395 -0
  262. package/thirdparty/pugixml/docs/quickstart.adoc +287 -0
  263. package/thirdparty/pugixml/docs/quickstart.html +1107 -0
  264. package/thirdparty/pugixml/docs/samples/character.xml +8 -0
  265. package/thirdparty/pugixml/docs/samples/custom_memory_management.cpp +27 -0
  266. package/thirdparty/pugixml/docs/samples/include.cpp +64 -0
  267. package/thirdparty/pugixml/docs/samples/load_error_handling.cpp +33 -0
  268. package/thirdparty/pugixml/docs/samples/load_file.cpp +16 -0
  269. package/thirdparty/pugixml/docs/samples/load_memory.cpp +66 -0
  270. package/thirdparty/pugixml/docs/samples/load_options.cpp +30 -0
  271. package/thirdparty/pugixml/docs/samples/load_stream.cpp +97 -0
  272. package/thirdparty/pugixml/docs/samples/modify_add.cpp +29 -0
  273. package/thirdparty/pugixml/docs/samples/modify_base.cpp +43 -0
  274. package/thirdparty/pugixml/docs/samples/modify_remove.cpp +27 -0
  275. package/thirdparty/pugixml/docs/samples/save_custom_writer.cpp +116 -0
  276. package/thirdparty/pugixml/docs/samples/save_declaration.cpp +27 -0
  277. package/thirdparty/pugixml/docs/samples/save_file.cpp +17 -0
  278. package/thirdparty/pugixml/docs/samples/save_options.cpp +48 -0
  279. package/thirdparty/pugixml/docs/samples/save_stream.cpp +18 -0
  280. package/thirdparty/pugixml/docs/samples/save_subtree.cpp +26 -0
  281. package/thirdparty/pugixml/docs/samples/text.cpp +35 -0
  282. package/thirdparty/pugixml/docs/samples/transitions.xml +7 -0
  283. package/thirdparty/pugixml/docs/samples/traverse_base.cpp +51 -0
  284. package/thirdparty/pugixml/docs/samples/traverse_iter.cpp +27 -0
  285. package/thirdparty/pugixml/docs/samples/traverse_predicate.cpp +48 -0
  286. package/thirdparty/pugixml/docs/samples/traverse_rangefor.cpp +32 -0
  287. package/thirdparty/pugixml/docs/samples/traverse_walker.cpp +35 -0
  288. package/thirdparty/pugixml/docs/samples/tree.xml +12 -0
  289. package/thirdparty/pugixml/docs/samples/weekly-shift_jis.xml +78 -0
  290. package/thirdparty/pugixml/docs/samples/weekly-utf-16.xml +0 -0
  291. package/thirdparty/pugixml/docs/samples/weekly-utf-8.xml +78 -0
  292. package/thirdparty/pugixml/docs/samples/xgconsole.xml +12 -0
  293. package/thirdparty/pugixml/docs/samples/xpath_error.cpp +43 -0
  294. package/thirdparty/pugixml/docs/samples/xpath_query.cpp +36 -0
  295. package/thirdparty/pugixml/docs/samples/xpath_select.cpp +28 -0
  296. package/thirdparty/pugixml/docs/samples/xpath_variables.cpp +38 -0
  297. package/thirdparty/pugixml/readme.txt +50 -0
  298. package/thirdparty/pugixml/scripts/archive.py +54 -0
  299. package/thirdparty/pugixml/scripts/cocoapods_push.sh +4 -0
  300. package/thirdparty/pugixml/scripts/natvis/pugixml.natvis +77 -0
  301. package/thirdparty/pugixml/scripts/natvis/pugixml_compact.natvis +506 -0
  302. package/thirdparty/pugixml/scripts/nuget/build/native/pugixml-propertiesui.xml +17 -0
  303. package/thirdparty/pugixml/scripts/nuget/build/native/pugixml.targets +28 -0
  304. package/thirdparty/pugixml/scripts/nuget/pugixml.nuspec +20 -0
  305. package/thirdparty/pugixml/scripts/nuget_build.ps1 +60 -0
  306. package/thirdparty/pugixml/scripts/premake4.lua +92 -0
  307. package/thirdparty/pugixml/scripts/pugixml-config.cmake.in +12 -0
  308. package/thirdparty/pugixml/scripts/pugixml.pc.in +11 -0
  309. package/thirdparty/pugixml/scripts/pugixml.podspec +14 -0
  310. package/thirdparty/pugixml/scripts/pugixml.xcodeproj/project.pbxproj +212 -0
  311. package/thirdparty/pugixml/scripts/pugixml_airplay.mkf +13 -0
  312. package/thirdparty/pugixml/scripts/pugixml_codeblocks.cbp +44 -0
  313. package/thirdparty/pugixml/scripts/pugixml_codelite.project +56 -0
  314. package/thirdparty/pugixml/scripts/pugixml_dll.rc +45 -0
  315. package/thirdparty/pugixml/scripts/pugixml_vs2005.vcproj +343 -0
  316. package/thirdparty/pugixml/scripts/pugixml_vs2005_static.vcproj +343 -0
  317. package/thirdparty/pugixml/scripts/pugixml_vs2008.vcproj +339 -0
  318. package/thirdparty/pugixml/scripts/pugixml_vs2008_static.vcproj +339 -0
  319. package/thirdparty/pugixml/scripts/pugixml_vs2010.vcxproj +191 -0
  320. package/thirdparty/pugixml/scripts/pugixml_vs2010_static.vcxproj +191 -0
  321. package/thirdparty/pugixml/scripts/pugixml_vs2013.vcxproj +199 -0
  322. package/thirdparty/pugixml/scripts/pugixml_vs2013_static.vcxproj +199 -0
  323. package/thirdparty/pugixml/scripts/pugixml_vs2015.vcxproj +172 -0
  324. package/thirdparty/pugixml/scripts/pugixml_vs2015_static.vcxproj +176 -0
  325. package/thirdparty/pugixml/scripts/pugixml_vs2017.vcxproj +172 -0
  326. package/thirdparty/pugixml/scripts/pugixml_vs2017_static.vcxproj +176 -0
  327. package/thirdparty/pugixml/scripts/pugixml_vs2019.vcxproj +176 -0
  328. package/thirdparty/pugixml/scripts/pugixml_vs2019_static.vcxproj +180 -0
  329. package/thirdparty/pugixml/scripts/pugixml_vs2022.vcxproj +176 -0
  330. package/thirdparty/pugixml/scripts/pugixml_vs2022_static.vcxproj +180 -0
  331. package/thirdparty/pugixml/scripts/pugixml_vs2026.vcxproj +176 -0
  332. package/thirdparty/pugixml/scripts/pugixml_vs2026_static.vcxproj +180 -0
  333. package/thirdparty/pugixml/scripts/sbom.cdx.json +47 -0
  334. package/thirdparty/pugixml/src/pugiconfig.hpp +81 -0
  335. package/thirdparty/pugixml/src/pugixml.cpp +13776 -0
  336. package/thirdparty/pugixml/src/pugixml.hpp +1604 -0
  337. package/thirdparty/pugixml/tests/allocator.cpp +175 -0
  338. package/thirdparty/pugixml/tests/allocator.hpp +10 -0
  339. package/thirdparty/pugixml/tests/autotest-appveyor.ps1 +93 -0
  340. package/thirdparty/pugixml/tests/cmake-appveyor.ps1 +57 -0
  341. package/thirdparty/pugixml/tests/data/empty.xml +0 -0
  342. package/thirdparty/pugixml/tests/data/large.xml +1 -0
  343. package/thirdparty/pugixml/tests/data/latintest_latin1.xml +1 -0
  344. package/thirdparty/pugixml/tests/data/latintest_utf8.xml +1 -0
  345. package/thirdparty/pugixml/tests/data/multiline.xml +3 -0
  346. package/thirdparty/pugixml/tests/data/small.xml +1 -0
  347. package/thirdparty/pugixml/tests/data/truncation.xml +19 -0
  348. package/thirdparty/pugixml/tests/data/utftest_utf16_be.xml +0 -0
  349. package/thirdparty/pugixml/tests/data/utftest_utf16_be_bom.xml +0 -0
  350. package/thirdparty/pugixml/tests/data/utftest_utf16_be_clean.xml +0 -0
  351. package/thirdparty/pugixml/tests/data/utftest_utf16_be_nodecl.xml +0 -0
  352. package/thirdparty/pugixml/tests/data/utftest_utf16_le.xml +0 -0
  353. package/thirdparty/pugixml/tests/data/utftest_utf16_le_bom.xml +0 -0
  354. package/thirdparty/pugixml/tests/data/utftest_utf16_le_clean.xml +0 -0
  355. package/thirdparty/pugixml/tests/data/utftest_utf16_le_nodecl.xml +0 -0
  356. package/thirdparty/pugixml/tests/data/utftest_utf32_be.xml +0 -0
  357. package/thirdparty/pugixml/tests/data/utftest_utf32_be_bom.xml +0 -0
  358. package/thirdparty/pugixml/tests/data/utftest_utf32_be_clean.xml +0 -0
  359. package/thirdparty/pugixml/tests/data/utftest_utf32_be_nodecl.xml +0 -0
  360. package/thirdparty/pugixml/tests/data/utftest_utf32_le.xml +0 -0
  361. package/thirdparty/pugixml/tests/data/utftest_utf32_le_bom.xml +0 -0
  362. package/thirdparty/pugixml/tests/data/utftest_utf32_le_clean.xml +0 -0
  363. package/thirdparty/pugixml/tests/data/utftest_utf32_le_nodecl.xml +0 -0
  364. package/thirdparty/pugixml/tests/data/utftest_utf8.xml +87 -0
  365. package/thirdparty/pugixml/tests/data/utftest_utf8_bom.xml +87 -0
  366. package/thirdparty/pugixml/tests/data/utftest_utf8_clean.xml +84 -0
  367. package/thirdparty/pugixml/tests/data/utftest_utf8_nodecl.xml +86 -0
  368. package/thirdparty/pugixml/tests/data//321/202/320/265/321/201/321/202.xml +1 -0
  369. package/thirdparty/pugixml/tests/data_fuzz_parse/basic.xml +1 -0
  370. package/thirdparty/pugixml/tests/data_fuzz_parse/doctype.xml +1 -0
  371. package/thirdparty/pugixml/tests/data_fuzz_parse/refs.xml +1 -0
  372. package/thirdparty/pugixml/tests/data_fuzz_parse/types.xml +1 -0
  373. package/thirdparty/pugixml/tests/data_fuzz_parse/utf16.xml +0 -0
  374. package/thirdparty/pugixml/tests/data_fuzz_parse/utf32.xml +0 -0
  375. package/thirdparty/pugixml/tests/data_fuzz_xpath/basic.xpath +1 -0
  376. package/thirdparty/pugixml/tests/data_fuzz_xpath/functions.xpath +1 -0
  377. package/thirdparty/pugixml/tests/data_fuzz_xpath/math.xpath +1 -0
  378. package/thirdparty/pugixml/tests/data_fuzz_xpath/path.xpath +1 -0
  379. package/thirdparty/pugixml/tests/data_fuzz_xpath/predicate.xpath +1 -0
  380. package/thirdparty/pugixml/tests/fuzz_parse.cpp +14 -0
  381. package/thirdparty/pugixml/tests/fuzz_parse.dict +72 -0
  382. package/thirdparty/pugixml/tests/fuzz_setup.sh +11 -0
  383. package/thirdparty/pugixml/tests/fuzz_xpath.cpp +46 -0
  384. package/thirdparty/pugixml/tests/fuzz_xpath.dict +72 -0
  385. package/thirdparty/pugixml/tests/helpers.hpp +114 -0
  386. package/thirdparty/pugixml/tests/main.cpp +218 -0
  387. package/thirdparty/pugixml/tests/test.cpp +220 -0
  388. package/thirdparty/pugixml/tests/test.hpp +175 -0
  389. package/thirdparty/pugixml/tests/test_compact.cpp +150 -0
  390. package/thirdparty/pugixml/tests/test_deprecated.cpp +25 -0
  391. package/thirdparty/pugixml/tests/test_document.cpp +1910 -0
  392. package/thirdparty/pugixml/tests/test_dom_modify.cpp +2122 -0
  393. package/thirdparty/pugixml/tests/test_dom_text.cpp +601 -0
  394. package/thirdparty/pugixml/tests/test_dom_traverse.cpp +1481 -0
  395. package/thirdparty/pugixml/tests/test_header_guard.cpp +3 -0
  396. package/thirdparty/pugixml/tests/test_header_iosfwd_1.cpp +3 -0
  397. package/thirdparty/pugixml/tests/test_header_iosfwd_2.cpp +3 -0
  398. package/thirdparty/pugixml/tests/test_header_iostream_1.cpp +3 -0
  399. package/thirdparty/pugixml/tests/test_header_iostream_2.cpp +3 -0
  400. package/thirdparty/pugixml/tests/test_header_only_1.cpp +21 -0
  401. package/thirdparty/pugixml/tests/test_header_only_2.cpp +21 -0
  402. package/thirdparty/pugixml/tests/test_header_string_1.cpp +3 -0
  403. package/thirdparty/pugixml/tests/test_header_string_2.cpp +3 -0
  404. package/thirdparty/pugixml/tests/test_header_string_iostream.cpp +5 -0
  405. package/thirdparty/pugixml/tests/test_memory.cpp +303 -0
  406. package/thirdparty/pugixml/tests/test_parse.cpp +1463 -0
  407. package/thirdparty/pugixml/tests/test_parse_doctype.cpp +366 -0
  408. package/thirdparty/pugixml/tests/test_unicode.cpp +152 -0
  409. package/thirdparty/pugixml/tests/test_version.cpp +5 -0
  410. package/thirdparty/pugixml/tests/test_write.cpp +757 -0
  411. package/thirdparty/pugixml/tests/test_xpath.cpp +833 -0
  412. package/thirdparty/pugixml/tests/test_xpath_api.cpp +646 -0
  413. package/thirdparty/pugixml/tests/test_xpath_functions.cpp +844 -0
  414. package/thirdparty/pugixml/tests/test_xpath_operators.cpp +566 -0
  415. package/thirdparty/pugixml/tests/test_xpath_parse.cpp +428 -0
  416. package/thirdparty/pugixml/tests/test_xpath_paths.cpp +787 -0
  417. package/thirdparty/pugixml/tests/test_xpath_paths_abbrev_w3c.cpp +219 -0
  418. package/thirdparty/pugixml/tests/test_xpath_paths_w3c.cpp +312 -0
  419. package/thirdparty/pugixml/tests/test_xpath_variables.cpp +683 -0
  420. package/thirdparty/pugixml/tests/test_xpath_xalan_1.cpp +411 -0
  421. package/thirdparty/pugixml/tests/test_xpath_xalan_2.cpp +417 -0
  422. package/thirdparty/pugixml/tests/test_xpath_xalan_3.cpp +321 -0
  423. package/thirdparty/pugixml/tests/test_xpath_xalan_4.cpp +300 -0
  424. package/thirdparty/pugixml/tests/test_xpath_xalan_5.cpp +295 -0
  425. package/thirdparty/pugixml/tests/writer_string.cpp +79 -0
  426. package/thirdparty/pugixml/tests/writer_string.hpp +27 -0
  427. package/ios/dummy.swift +0 -2
  428. package/scripts/prepare-openxlsx.js +0 -109
@@ -0,0 +1,1604 @@
1
+ /**
2
+ * pugixml parser - version 1.16
3
+ * --------------------------------------------------------
4
+ * Report bugs and download new versions at https://pugixml.org/
5
+ *
6
+ * SPDX-FileCopyrightText: Copyright (C) 2006-2026, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
7
+ * SPDX-License-Identifier: MIT
8
+ *
9
+ * See LICENSE.md or notice at the end of this file.
10
+ */
11
+
12
+ // Define version macro; evaluates to major * 1000 + minor * 10 + patch so that it's safe to use in less-than comparisons
13
+ // Note: pugixml used major * 100 + minor * 10 + patch format up until 1.9 (which had version identifier 190); starting from pugixml 1.10, the minor version number is two digits
14
+ #ifndef PUGIXML_VERSION
15
+ # define PUGIXML_VERSION 1160 // 1.16
16
+ #endif
17
+
18
+ // Include user configuration file (this can define various configuration macros)
19
+ #include "pugiconfig.hpp"
20
+
21
+ #ifndef HEADER_PUGIXML_HPP
22
+ #define HEADER_PUGIXML_HPP
23
+
24
+ // Include stddef.h for size_t and ptrdiff_t
25
+ #include <stddef.h>
26
+
27
+ // Include exception header for XPath
28
+ #if !defined(PUGIXML_NO_XPATH) && !defined(PUGIXML_NO_EXCEPTIONS)
29
+ # include <exception>
30
+ #endif
31
+
32
+ // Include STL headers
33
+ #ifndef PUGIXML_NO_STL
34
+ # include <iterator>
35
+ # include <iosfwd>
36
+ # include <string>
37
+ #endif
38
+
39
+ // Check if std::string_view is available
40
+ #if !defined(PUGIXML_HAS_STRING_VIEW) && !defined(PUGIXML_NO_STL)
41
+ # if __cplusplus >= 201703L
42
+ # define PUGIXML_HAS_STRING_VIEW
43
+ # elif defined(_MSVC_LANG) && _MSVC_LANG >= 201703L
44
+ # define PUGIXML_HAS_STRING_VIEW
45
+ # endif
46
+ #endif
47
+
48
+ // Include string_view if appropriate
49
+ #ifdef PUGIXML_HAS_STRING_VIEW
50
+ # include <string_view>
51
+ #endif
52
+
53
+ // Macro for deprecated features
54
+ #ifndef PUGIXML_DEPRECATED
55
+ # if defined(__GNUC__)
56
+ # define PUGIXML_DEPRECATED __attribute__((deprecated))
57
+ # elif defined(_MSC_VER) && _MSC_VER >= 1300
58
+ # define PUGIXML_DEPRECATED __declspec(deprecated)
59
+ # else
60
+ # define PUGIXML_DEPRECATED
61
+ # endif
62
+ #endif
63
+
64
+ // If no API is defined, assume default
65
+ #ifndef PUGIXML_API
66
+ # define PUGIXML_API
67
+ #endif
68
+
69
+ // If no API for classes is defined, assume default
70
+ #ifndef PUGIXML_CLASS
71
+ # define PUGIXML_CLASS PUGIXML_API
72
+ #endif
73
+
74
+ // If no API for functions is defined, assume default
75
+ #ifndef PUGIXML_FUNCTION
76
+ # define PUGIXML_FUNCTION PUGIXML_API
77
+ #endif
78
+
79
+ // If the platform is known to have long long support, enable long long functions
80
+ #ifndef PUGIXML_HAS_LONG_LONG
81
+ # if __cplusplus >= 201103
82
+ # define PUGIXML_HAS_LONG_LONG
83
+ # elif defined(_MSC_VER) && _MSC_VER >= 1400
84
+ # define PUGIXML_HAS_LONG_LONG
85
+ # endif
86
+ #endif
87
+
88
+ // If the platform is known to have move semantics support, compile move ctor/operator implementation
89
+ #ifndef PUGIXML_HAS_MOVE
90
+ # if __cplusplus >= 201103
91
+ # define PUGIXML_HAS_MOVE
92
+ # elif defined(_MSC_VER) && _MSC_VER >= 1600
93
+ # define PUGIXML_HAS_MOVE
94
+ # endif
95
+ #endif
96
+
97
+ // If C++ is 2011 or higher, use 'noexcept' specifiers
98
+ #ifndef PUGIXML_NOEXCEPT
99
+ # if __cplusplus >= 201103
100
+ # define PUGIXML_NOEXCEPT noexcept
101
+ # elif defined(_MSC_VER) && _MSC_VER >= 1900
102
+ # define PUGIXML_NOEXCEPT noexcept
103
+ # else
104
+ # define PUGIXML_NOEXCEPT throw()
105
+ # endif
106
+ #endif
107
+
108
+ // Some functions can not be noexcept in compact mode
109
+ #ifdef PUGIXML_COMPACT
110
+ # define PUGIXML_NOEXCEPT_IF_NOT_COMPACT
111
+ #else
112
+ # define PUGIXML_NOEXCEPT_IF_NOT_COMPACT PUGIXML_NOEXCEPT
113
+ #endif
114
+
115
+ // If C++ is 2011 or higher, add 'override' qualifiers
116
+ #ifndef PUGIXML_OVERRIDE
117
+ # if __cplusplus >= 201103
118
+ # define PUGIXML_OVERRIDE override
119
+ # elif defined(_MSC_VER) && _MSC_VER >= 1700
120
+ # define PUGIXML_OVERRIDE override
121
+ # else
122
+ # define PUGIXML_OVERRIDE
123
+ # endif
124
+ #endif
125
+
126
+ // If C++ is 2011 or higher, use 'nullptr'
127
+ #ifndef PUGIXML_NULL
128
+ # if __cplusplus >= 201103
129
+ # define PUGIXML_NULL nullptr
130
+ # elif defined(_MSC_VER) && _MSC_VER >= 1600
131
+ # define PUGIXML_NULL nullptr
132
+ # else
133
+ # define PUGIXML_NULL 0
134
+ # endif
135
+ #endif
136
+
137
+ // If C++ is 2017 or higher, add 'inline' variables
138
+ #ifndef PUGIXML_INLINE_VAR
139
+ # ifdef __cpp_inline_variables
140
+ # define PUGIXML_INLINE_VAR inline
141
+ # else
142
+ # define PUGIXML_INLINE_VAR
143
+ # endif
144
+ #endif
145
+
146
+ // Character interface macros
147
+ #ifdef PUGIXML_WCHAR_MODE
148
+ # define PUGIXML_TEXT(t) L ## t
149
+ # define PUGIXML_CHAR wchar_t
150
+ #else
151
+ # define PUGIXML_TEXT(t) t
152
+ # define PUGIXML_CHAR char
153
+ #endif
154
+
155
+ namespace pugi
156
+ {
157
+ // Character type used for all internal storage and operations; depends on PUGIXML_WCHAR_MODE
158
+ typedef PUGIXML_CHAR char_t;
159
+
160
+ #ifndef PUGIXML_NO_STL
161
+ // String type used for operations that work with STL string; depends on PUGIXML_WCHAR_MODE
162
+ typedef std::basic_string<PUGIXML_CHAR> string_t;
163
+ #endif
164
+
165
+ #ifdef PUGIXML_HAS_STRING_VIEW
166
+ // String view type used for operations that can work with a length delimited string; depends on PUGIXML_WCHAR_MODE
167
+ typedef std::basic_string_view<PUGIXML_CHAR> string_view_t;
168
+ #endif
169
+ }
170
+
171
+ // The PugiXML namespace
172
+ namespace pugi
173
+ {
174
+ // Tree node types
175
+ enum xml_node_type
176
+ {
177
+ node_null, // Empty (null) node handle
178
+ node_document, // A document tree's absolute root
179
+ node_element, // Element tag, i.e. '<node/>'
180
+ node_pcdata, // Plain character data, i.e. 'text'
181
+ node_cdata, // Character data, i.e. '<![CDATA[text]]>'
182
+ node_comment, // Comment tag, i.e. '<!-- text -->'
183
+ node_pi, // Processing instruction, i.e. '<?name?>'
184
+ node_declaration, // Document declaration, i.e. '<?xml version="1.0"?>'
185
+ node_doctype // Document type declaration, i.e. '<!DOCTYPE doc>'
186
+ };
187
+
188
+ // Parsing options
189
+
190
+ // Minimal parsing mode (equivalent to turning all other flags off).
191
+ // Only elements and PCDATA sections are added to the DOM tree, no text conversions are performed.
192
+ PUGIXML_INLINE_VAR const unsigned int parse_minimal = 0x0000;
193
+
194
+ // This flag determines if processing instructions (node_pi) are added to the DOM tree. This flag is off by default.
195
+ PUGIXML_INLINE_VAR const unsigned int parse_pi = 0x0001;
196
+
197
+ // This flag determines if comments (node_comment) are added to the DOM tree. This flag is off by default.
198
+ PUGIXML_INLINE_VAR const unsigned int parse_comments = 0x0002;
199
+
200
+ // This flag determines if CDATA sections (node_cdata) are added to the DOM tree. This flag is on by default.
201
+ PUGIXML_INLINE_VAR const unsigned int parse_cdata = 0x0004;
202
+
203
+ // This flag determines if plain character data (node_pcdata) that consist only of whitespace are added to the DOM tree.
204
+ // This flag is off by default; turning it on usually results in slower parsing and more memory consumption.
205
+ PUGIXML_INLINE_VAR const unsigned int parse_ws_pcdata = 0x0008;
206
+
207
+ // This flag determines if character and entity references are expanded during parsing. This flag is on by default.
208
+ PUGIXML_INLINE_VAR const unsigned int parse_escapes = 0x0010;
209
+
210
+ // This flag determines if EOL characters are normalized (converted to #xA) during parsing. This flag is on by default.
211
+ PUGIXML_INLINE_VAR const unsigned int parse_eol = 0x0020;
212
+
213
+ // This flag determines if attribute values are normalized using CDATA normalization rules during parsing. This flag is on by default.
214
+ PUGIXML_INLINE_VAR const unsigned int parse_wconv_attribute = 0x0040;
215
+
216
+ // This flag determines if attribute values are normalized using NMTOKENS normalization rules during parsing. This flag is off by default.
217
+ PUGIXML_INLINE_VAR const unsigned int parse_wnorm_attribute = 0x0080;
218
+
219
+ // This flag determines if document declaration (node_declaration) is added to the DOM tree. This flag is off by default.
220
+ PUGIXML_INLINE_VAR const unsigned int parse_declaration = 0x0100;
221
+
222
+ // This flag determines if document type declaration (node_doctype) is added to the DOM tree. This flag is off by default.
223
+ PUGIXML_INLINE_VAR const unsigned int parse_doctype = 0x0200;
224
+
225
+ // This flag determines if plain character data (node_pcdata) that is the only child of the parent node and that consists only
226
+ // of whitespace is added to the DOM tree.
227
+ // This flag is off by default; turning it on may result in slower parsing and more memory consumption.
228
+ PUGIXML_INLINE_VAR const unsigned int parse_ws_pcdata_single = 0x0400;
229
+
230
+ // This flag determines if leading and trailing whitespace is to be removed from plain character data. This flag is off by default.
231
+ PUGIXML_INLINE_VAR const unsigned int parse_trim_pcdata = 0x0800;
232
+
233
+ // This flag determines if plain character data that does not have a parent node is added to the DOM tree, and if an empty document
234
+ // is a valid document. This flag is off by default.
235
+ PUGIXML_INLINE_VAR const unsigned int parse_fragment = 0x1000;
236
+
237
+ // This flag determines if plain character data is stored in the parent element's value. This significantly changes the structure of
238
+ // the document; this flag is only recommended for parsing documents with many PCDATA nodes in memory-constrained environments.
239
+ // This flag is off by default.
240
+ PUGIXML_INLINE_VAR const unsigned int parse_embed_pcdata = 0x2000;
241
+
242
+ // This flag determines whether two adjacent pcdata should be merged or not, if no intermediary data are parsed in the document.
243
+ // This flag is off by default.
244
+ PUGIXML_INLINE_VAR const unsigned int parse_merge_pcdata = 0x4000;
245
+
246
+ // The default parsing mode.
247
+ // Elements, PCDATA and CDATA sections are added to the DOM tree, character/reference entities are expanded,
248
+ // End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
249
+ PUGIXML_INLINE_VAR const unsigned int parse_default = parse_cdata | parse_escapes | parse_wconv_attribute | parse_eol;
250
+
251
+ // The full parsing mode.
252
+ // Nodes of all types are added to the DOM tree, character/reference entities are expanded,
253
+ // End-of-Line characters are normalized, attribute values are normalized using CDATA normalization rules.
254
+ PUGIXML_INLINE_VAR const unsigned int parse_full = parse_default | parse_pi | parse_comments | parse_declaration | parse_doctype;
255
+
256
+ // These flags determine the encoding of input data for XML document
257
+ enum xml_encoding
258
+ {
259
+ encoding_auto, // Auto-detect input encoding using BOM or < / <? detection; use UTF8 if BOM is not found
260
+ encoding_utf8, // UTF8 encoding
261
+ encoding_utf16_le, // Little-endian UTF16
262
+ encoding_utf16_be, // Big-endian UTF16
263
+ encoding_utf16, // UTF16 with native endianness
264
+ encoding_utf32_le, // Little-endian UTF32
265
+ encoding_utf32_be, // Big-endian UTF32
266
+ encoding_utf32, // UTF32 with native endianness
267
+ encoding_wchar, // The same encoding wchar_t has (either UTF16 or UTF32)
268
+ encoding_latin1 // Latin1 encoding (ISO-8859-1)
269
+ };
270
+
271
+ // Formatting flags
272
+
273
+ // Indent the nodes that are written to output stream with as many indentation strings as deep the node is in DOM tree. This flag is on by default.
274
+ PUGIXML_INLINE_VAR const unsigned int format_indent = 0x01;
275
+
276
+ // Write encoding-specific BOM to the output stream. This flag is off by default.
277
+ PUGIXML_INLINE_VAR const unsigned int format_write_bom = 0x02;
278
+
279
+ // Use raw output mode (no indentation and no line breaks are written). This flag is off by default.
280
+ PUGIXML_INLINE_VAR const unsigned int format_raw = 0x04;
281
+
282
+ // Omit default XML declaration even if there is no declaration in the document. This flag is off by default.
283
+ PUGIXML_INLINE_VAR const unsigned int format_no_declaration = 0x08;
284
+
285
+ // Don't escape attribute values and PCDATA contents. This flag is off by default.
286
+ PUGIXML_INLINE_VAR const unsigned int format_no_escapes = 0x10;
287
+
288
+ // Open file using text mode in xml_document::save_file. This enables special character (i.e. new-line) conversions on some systems. This flag is off by default.
289
+ PUGIXML_INLINE_VAR const unsigned int format_save_file_text = 0x20;
290
+
291
+ // Write every attribute on a new line with appropriate indentation. This flag is off by default.
292
+ PUGIXML_INLINE_VAR const unsigned int format_indent_attributes = 0x40;
293
+
294
+ // Don't output empty element tags, instead writing an explicit start and end tag even if there are no children. This flag is off by default.
295
+ PUGIXML_INLINE_VAR const unsigned int format_no_empty_element_tags = 0x80;
296
+
297
+ // Skip characters belonging to range [0; 32) instead of "&#xNN;" encoding. This flag is off by default.
298
+ PUGIXML_INLINE_VAR const unsigned int format_skip_control_chars = 0x100;
299
+
300
+ // Use single quotes ' instead of double quotes " for enclosing attribute values. This flag is off by default.
301
+ PUGIXML_INLINE_VAR const unsigned int format_attribute_single_quote = 0x200;
302
+
303
+ // The default set of formatting flags.
304
+ // Nodes are indented depending on their depth in DOM tree, a default declaration is output if document has none.
305
+ PUGIXML_INLINE_VAR const unsigned int format_default = format_indent;
306
+
307
+ PUGIXML_INLINE_VAR const int default_double_precision = 17;
308
+ PUGIXML_INLINE_VAR const int default_float_precision = 9;
309
+
310
+ // Forward declarations
311
+ struct xml_attribute_struct;
312
+ struct xml_node_struct;
313
+
314
+ class xml_node_iterator;
315
+ class xml_attribute_iterator;
316
+ class xml_named_node_iterator;
317
+
318
+ class xml_tree_walker;
319
+
320
+ struct xml_parse_result;
321
+
322
+ class xml_node;
323
+
324
+ class xml_text;
325
+
326
+ #ifndef PUGIXML_NO_XPATH
327
+ class xpath_node;
328
+ class xpath_node_set;
329
+ class xpath_query;
330
+ class xpath_variable_set;
331
+ #endif
332
+
333
+ // Range-based for loop support
334
+ template <typename It> class xml_object_range
335
+ {
336
+ public:
337
+ typedef It const_iterator;
338
+ typedef It iterator;
339
+
340
+ xml_object_range(It b, It e): _begin(b), _end(e)
341
+ {
342
+ }
343
+
344
+ It begin() const { return _begin; }
345
+ It end() const { return _end; }
346
+
347
+ bool empty() const { return _begin == _end; }
348
+
349
+ private:
350
+ It _begin, _end;
351
+ };
352
+
353
+ // Writer interface for node printing (see xml_node::print)
354
+ class PUGIXML_CLASS xml_writer
355
+ {
356
+ public:
357
+ virtual ~xml_writer();
358
+
359
+ // Write memory chunk into stream/file/whatever
360
+ virtual void write(const void* data, size_t size) = 0;
361
+ };
362
+
363
+ // xml_writer implementation for FILE*
364
+ class PUGIXML_CLASS xml_writer_file: public xml_writer
365
+ {
366
+ public:
367
+ // Construct writer from a FILE* object; void* is used to avoid header dependencies on stdio
368
+ xml_writer_file(void* file);
369
+
370
+ virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
371
+
372
+ private:
373
+ void* file;
374
+ };
375
+
376
+ #ifndef PUGIXML_NO_STL
377
+ // xml_writer implementation for streams
378
+ class PUGIXML_CLASS xml_writer_stream: public xml_writer
379
+ {
380
+ public:
381
+ // Construct writer from an output stream object
382
+ xml_writer_stream(std::basic_ostream<char>& stream);
383
+ xml_writer_stream(std::basic_ostream<wchar_t>& stream);
384
+
385
+ virtual void write(const void* data, size_t size) PUGIXML_OVERRIDE;
386
+
387
+ private:
388
+ std::basic_ostream<char>* narrow_stream;
389
+ std::basic_ostream<wchar_t>* wide_stream;
390
+ };
391
+ #endif
392
+
393
+ // A light-weight handle for manipulating attributes in DOM tree
394
+ class PUGIXML_CLASS xml_attribute
395
+ {
396
+ friend class xml_attribute_iterator;
397
+ friend class xml_node;
398
+
399
+ private:
400
+ xml_attribute_struct* _attr;
401
+
402
+ typedef void (*unspecified_bool_type)(xml_attribute***);
403
+
404
+ public:
405
+ // Default constructor. Constructs an empty attribute.
406
+ xml_attribute();
407
+
408
+ // Constructs attribute from internal pointer
409
+ explicit xml_attribute(xml_attribute_struct* attr);
410
+
411
+ // Safe bool conversion operator
412
+ operator unspecified_bool_type() const;
413
+
414
+ // Borland C++ workaround
415
+ bool operator!() const;
416
+
417
+ // Comparison operators (compares wrapped attribute pointers)
418
+ bool operator==(const xml_attribute& r) const;
419
+ bool operator!=(const xml_attribute& r) const;
420
+ bool operator<(const xml_attribute& r) const;
421
+ bool operator>(const xml_attribute& r) const;
422
+ bool operator<=(const xml_attribute& r) const;
423
+ bool operator>=(const xml_attribute& r) const;
424
+
425
+ // Check if attribute is empty (null)
426
+ bool empty() const;
427
+
428
+ // Get attribute name/value, or "" if attribute is empty
429
+ const char_t* name() const;
430
+ const char_t* value() const;
431
+
432
+ // Get attribute value, or the default value if attribute is empty
433
+ const char_t* as_string(const char_t* def = PUGIXML_TEXT("")) const;
434
+
435
+ // Get attribute value as a number, or the default value if conversion did not succeed or attribute is empty
436
+ int as_int(int def = 0) const;
437
+ unsigned int as_uint(unsigned int def = 0) const;
438
+ double as_double(double def = 0) const;
439
+ float as_float(float def = 0) const;
440
+
441
+ #ifdef PUGIXML_HAS_LONG_LONG
442
+ long long as_llong(long long def = 0) const;
443
+ unsigned long long as_ullong(unsigned long long def = 0) const;
444
+ #endif
445
+
446
+ // Get attribute value as bool (returns true if first character is in '1tTyY' set), or the default value if attribute is empty
447
+ bool as_bool(bool def = false) const;
448
+
449
+ // Set attribute name/value (returns false if attribute is empty or there is not enough memory)
450
+ bool set_name(const char_t* rhs);
451
+ bool set_name(const char_t* rhs, size_t size);
452
+ #ifdef PUGIXML_HAS_STRING_VIEW
453
+ bool set_name(string_view_t rhs);
454
+ #endif
455
+ bool set_value(const char_t* rhs);
456
+ bool set_value(const char_t* rhs, size_t size);
457
+ #ifdef PUGIXML_HAS_STRING_VIEW
458
+ bool set_value(string_view_t rhs);
459
+ #endif
460
+
461
+ // Set attribute value with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
462
+ bool set_value(int rhs);
463
+ bool set_value(unsigned int rhs);
464
+ bool set_value(long rhs);
465
+ bool set_value(unsigned long rhs);
466
+ bool set_value(double rhs);
467
+ bool set_value(double rhs, int precision);
468
+ bool set_value(float rhs);
469
+ bool set_value(float rhs, int precision);
470
+ bool set_value(bool rhs);
471
+
472
+ #ifdef PUGIXML_HAS_LONG_LONG
473
+ bool set_value(long long rhs);
474
+ bool set_value(unsigned long long rhs);
475
+ #endif
476
+
477
+ // Set attribute value (equivalent to set_value without error checking)
478
+ xml_attribute& operator=(const char_t* rhs);
479
+ xml_attribute& operator=(int rhs);
480
+ xml_attribute& operator=(unsigned int rhs);
481
+ xml_attribute& operator=(long rhs);
482
+ xml_attribute& operator=(unsigned long rhs);
483
+ xml_attribute& operator=(double rhs);
484
+ xml_attribute& operator=(float rhs);
485
+ xml_attribute& operator=(bool rhs);
486
+
487
+ #ifdef PUGIXML_HAS_STRING_VIEW
488
+ xml_attribute& operator=(string_view_t rhs);
489
+ #endif
490
+
491
+ #ifdef PUGIXML_HAS_LONG_LONG
492
+ xml_attribute& operator=(long long rhs);
493
+ xml_attribute& operator=(unsigned long long rhs);
494
+ #endif
495
+
496
+ // Get next/previous attribute in the attribute list of the parent node
497
+ xml_attribute next_attribute() const;
498
+ xml_attribute previous_attribute() const;
499
+
500
+ // Get hash value (unique for handles to the same object)
501
+ size_t hash_value() const;
502
+
503
+ // Get internal pointer
504
+ xml_attribute_struct* internal_object() const;
505
+ };
506
+
507
+ #ifdef __BORLANDC__
508
+ // Borland C++ workaround
509
+ bool PUGIXML_FUNCTION operator&&(const xml_attribute& lhs, bool rhs);
510
+ bool PUGIXML_FUNCTION operator||(const xml_attribute& lhs, bool rhs);
511
+ #endif
512
+
513
+ // A light-weight handle for manipulating nodes in DOM tree
514
+ class PUGIXML_CLASS xml_node
515
+ {
516
+ friend class xml_attribute_iterator;
517
+ friend class xml_node_iterator;
518
+ friend class xml_named_node_iterator;
519
+
520
+ protected:
521
+ xml_node_struct* _root;
522
+
523
+ typedef void (*unspecified_bool_type)(xml_node***);
524
+
525
+ public:
526
+ // Default constructor. Constructs an empty node.
527
+ xml_node();
528
+
529
+ // Constructs node from internal pointer
530
+ explicit xml_node(xml_node_struct* p);
531
+
532
+ // Safe bool conversion operator
533
+ operator unspecified_bool_type() const;
534
+
535
+ // Borland C++ workaround
536
+ bool operator!() const;
537
+
538
+ // Comparison operators (compares wrapped node pointers)
539
+ bool operator==(const xml_node& r) const;
540
+ bool operator!=(const xml_node& r) const;
541
+ bool operator<(const xml_node& r) const;
542
+ bool operator>(const xml_node& r) const;
543
+ bool operator<=(const xml_node& r) const;
544
+ bool operator>=(const xml_node& r) const;
545
+
546
+ // Check if node is empty (null)
547
+ bool empty() const;
548
+
549
+ // Get node type
550
+ xml_node_type type() const;
551
+
552
+ // Get node name, or "" if node is empty or it has no name
553
+ const char_t* name() const;
554
+
555
+ // Get node value, or "" if node is empty or it has no value
556
+ // Note: For <node>text</node> node.value() does not return "text"! Use child_value() or text() methods to access text inside nodes.
557
+ const char_t* value() const;
558
+
559
+ // Get attribute list
560
+ xml_attribute first_attribute() const;
561
+ xml_attribute last_attribute() const;
562
+
563
+ // Get children list
564
+ xml_node first_child() const;
565
+ xml_node last_child() const;
566
+
567
+ // Get next/previous sibling in the children list of the parent node
568
+ xml_node next_sibling() const;
569
+ xml_node previous_sibling() const;
570
+
571
+ // Get parent node
572
+ xml_node parent() const;
573
+
574
+ // Get root of DOM tree this node belongs to
575
+ xml_node root() const;
576
+
577
+ // Get text object for the current node
578
+ xml_text text() const;
579
+
580
+ // Get child, attribute or next/previous sibling with the specified name
581
+ xml_node child(const char_t* name) const;
582
+ xml_attribute attribute(const char_t* name) const;
583
+ xml_node next_sibling(const char_t* name) const;
584
+ xml_node previous_sibling(const char_t* name) const;
585
+ #ifdef PUGIXML_HAS_STRING_VIEW
586
+ xml_node child(string_view_t name) const;
587
+ xml_attribute attribute(string_view_t name) const;
588
+ xml_node next_sibling(string_view_t name) const;
589
+ xml_node previous_sibling(string_view_t name) const;
590
+ #endif
591
+
592
+ // Get attribute, starting the search from a hint (and updating hint so that searching for a sequence of attributes is fast)
593
+ xml_attribute attribute(const char_t* name, xml_attribute& hint) const;
594
+ #ifdef PUGIXML_HAS_STRING_VIEW
595
+ xml_attribute attribute(string_view_t name, xml_attribute& hint) const;
596
+ #endif
597
+
598
+ // Get child value of current node; that is, value of the first child node of type PCDATA/CDATA
599
+ const char_t* child_value() const;
600
+
601
+ // Get child value of child with specified name. Equivalent to child(name).child_value().
602
+ const char_t* child_value(const char_t* name) const;
603
+
604
+ // Set node name/value (returns false if node is empty, there is not enough memory, or node can not have name/value)
605
+ bool set_name(const char_t* rhs);
606
+ bool set_name(const char_t* rhs, size_t size);
607
+ #ifdef PUGIXML_HAS_STRING_VIEW
608
+ bool set_name(string_view_t rhs);
609
+ #endif
610
+ bool set_value(const char_t* rhs);
611
+ bool set_value(const char_t* rhs, size_t size);
612
+ #ifdef PUGIXML_HAS_STRING_VIEW
613
+ bool set_value(string_view_t rhs);
614
+ #endif
615
+
616
+ // Add attribute with specified name. Returns added attribute, or empty attribute on errors.
617
+ xml_attribute append_attribute(const char_t* name);
618
+ xml_attribute prepend_attribute(const char_t* name);
619
+ xml_attribute insert_attribute_after(const char_t* name, const xml_attribute& attr);
620
+ xml_attribute insert_attribute_before(const char_t* name, const xml_attribute& attr);
621
+ #ifdef PUGIXML_HAS_STRING_VIEW
622
+ xml_attribute append_attribute(string_view_t name);
623
+ xml_attribute prepend_attribute(string_view_t name);
624
+ xml_attribute insert_attribute_after(string_view_t name, const xml_attribute& attr);
625
+ xml_attribute insert_attribute_before(string_view_t name, const xml_attribute& attr);
626
+ #endif
627
+
628
+ // Get attribute with specified name, adding one if it does not exist. Returns the existing or added attribute, or empty attribute on errors.
629
+ xml_attribute ensure_attribute(const char_t* name);
630
+ #ifdef PUGIXML_HAS_STRING_VIEW
631
+ xml_attribute ensure_attribute(string_view_t name);
632
+ #endif
633
+
634
+ // Add a copy of the specified attribute. Returns added attribute, or empty attribute on errors.
635
+ xml_attribute append_copy(const xml_attribute& proto);
636
+ xml_attribute prepend_copy(const xml_attribute& proto);
637
+ xml_attribute insert_copy_after(const xml_attribute& proto, const xml_attribute& attr);
638
+ xml_attribute insert_copy_before(const xml_attribute& proto, const xml_attribute& attr);
639
+
640
+ // Add child node with specified type. Returns added node, or empty node on errors.
641
+ xml_node append_child(xml_node_type type = node_element);
642
+ xml_node prepend_child(xml_node_type type = node_element);
643
+ xml_node insert_child_after(xml_node_type type, const xml_node& node);
644
+ xml_node insert_child_before(xml_node_type type, const xml_node& node);
645
+
646
+ // Add child element with specified name. Returns added node, or empty node on errors.
647
+ xml_node append_child(const char_t* name);
648
+ xml_node prepend_child(const char_t* name);
649
+ xml_node insert_child_after(const char_t* name, const xml_node& node);
650
+ xml_node insert_child_before(const char_t* name, const xml_node& node);
651
+ #ifdef PUGIXML_HAS_STRING_VIEW
652
+ xml_node append_child(string_view_t name);
653
+ xml_node prepend_child(string_view_t name);
654
+ xml_node insert_child_after(string_view_t name, const xml_node& node);
655
+ xml_node insert_child_before(string_view_t name, const xml_node& node);
656
+ #endif
657
+
658
+ // Get child with specified name, adding one if it does not exist. Returns the existing or added node, or empty node on errors.
659
+ xml_node ensure_child(const char_t* name);
660
+ #ifdef PUGIXML_HAS_STRING_VIEW
661
+ xml_node ensure_child(string_view_t name);
662
+ #endif
663
+
664
+ // Add a copy of the specified node as a child. Returns added node, or empty node on errors.
665
+ xml_node append_copy(const xml_node& proto);
666
+ xml_node prepend_copy(const xml_node& proto);
667
+ xml_node insert_copy_after(const xml_node& proto, const xml_node& node);
668
+ xml_node insert_copy_before(const xml_node& proto, const xml_node& node);
669
+
670
+ // Move the specified node to become a child of this node. Returns moved node, or empty node on errors.
671
+ xml_node append_move(const xml_node& moved);
672
+ xml_node prepend_move(const xml_node& moved);
673
+ xml_node insert_move_after(const xml_node& moved, const xml_node& node);
674
+ xml_node insert_move_before(const xml_node& moved, const xml_node& node);
675
+
676
+ // Remove specified attribute
677
+ bool remove_attribute(const xml_attribute& a);
678
+ bool remove_attribute(const char_t* name);
679
+ #ifdef PUGIXML_HAS_STRING_VIEW
680
+ bool remove_attribute(string_view_t name);
681
+ #endif
682
+
683
+ // Remove all attributes
684
+ bool remove_attributes();
685
+
686
+ // Remove specified child
687
+ bool remove_child(const xml_node& n);
688
+ bool remove_child(const char_t* name);
689
+ #ifdef PUGIXML_HAS_STRING_VIEW
690
+ bool remove_child(string_view_t name);
691
+ #endif
692
+
693
+ // Remove all children
694
+ bool remove_children();
695
+
696
+ // Parses buffer as an XML document fragment and appends all nodes as children of the current node.
697
+ // Copies/converts the buffer, so it may be deleted or changed after the function returns.
698
+ // Note: append_buffer allocates memory that has the lifetime of the owning document; removing the appended nodes does not immediately reclaim that memory.
699
+ xml_parse_result append_buffer(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
700
+
701
+ // Find attribute using predicate. Returns first attribute for which predicate returned true.
702
+ template <typename Predicate> xml_attribute find_attribute(Predicate pred) const
703
+ {
704
+ if (!_root) return xml_attribute();
705
+
706
+ for (xml_attribute attrib = first_attribute(); attrib; attrib = attrib.next_attribute())
707
+ if (pred(attrib))
708
+ return attrib;
709
+
710
+ return xml_attribute();
711
+ }
712
+
713
+ // Find child node using predicate. Returns first child for which predicate returned true.
714
+ template <typename Predicate> xml_node find_child(Predicate pred) const
715
+ {
716
+ if (!_root) return xml_node();
717
+
718
+ for (xml_node node = first_child(); node; node = node.next_sibling())
719
+ if (pred(node))
720
+ return node;
721
+
722
+ return xml_node();
723
+ }
724
+
725
+ // Find node from subtree using predicate. Returns first node from subtree (depth-first), for which predicate returned true.
726
+ template <typename Predicate> xml_node find_node(Predicate pred) const
727
+ {
728
+ if (!_root) return xml_node();
729
+
730
+ xml_node cur = first_child();
731
+
732
+ while (cur._root && cur._root != _root)
733
+ {
734
+ if (pred(cur)) return cur;
735
+
736
+ if (cur.first_child()) cur = cur.first_child();
737
+ else if (cur.next_sibling()) cur = cur.next_sibling();
738
+ else
739
+ {
740
+ while (!cur.next_sibling() && cur._root != _root) cur = cur.parent();
741
+
742
+ if (cur._root != _root) cur = cur.next_sibling();
743
+ }
744
+ }
745
+
746
+ return xml_node();
747
+ }
748
+
749
+ // Find child node by attribute name/value
750
+ xml_node find_child_by_attribute(const char_t* name, const char_t* attr_name, const char_t* attr_value) const;
751
+ xml_node find_child_by_attribute(const char_t* attr_name, const char_t* attr_value) const;
752
+
753
+ #ifndef PUGIXML_NO_STL
754
+ // Get the absolute node path from root as a text string.
755
+ string_t path(char_t delimiter = '/') const;
756
+ #endif
757
+
758
+ // Search for a node by path consisting of node names and . or .. elements.
759
+ xml_node first_element_by_path(const char_t* path, char_t delimiter = '/') const;
760
+
761
+ // Recursively traverse subtree with xml_tree_walker
762
+ bool traverse(xml_tree_walker& walker);
763
+
764
+ #ifndef PUGIXML_NO_XPATH
765
+ // Select single node by evaluating XPath query. Returns first node from the resulting node set.
766
+ xpath_node select_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
767
+ xpath_node select_node(const xpath_query& query) const;
768
+
769
+ // Select node set by evaluating XPath query
770
+ xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
771
+ xpath_node_set select_nodes(const xpath_query& query) const;
772
+
773
+ // (deprecated: use select_node instead) Select single node by evaluating XPath query.
774
+ PUGIXML_DEPRECATED xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
775
+ PUGIXML_DEPRECATED xpath_node select_single_node(const xpath_query& query) const;
776
+
777
+ #endif
778
+
779
+ // Print subtree using a writer object
780
+ void print(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
781
+
782
+ #ifndef PUGIXML_NO_STL
783
+ // Print subtree to stream
784
+ void print(std::basic_ostream<char>& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const;
785
+ void print(std::basic_ostream<wchar_t>& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, unsigned int depth = 0) const;
786
+ #endif
787
+
788
+ // Child nodes iterators
789
+ typedef xml_node_iterator iterator;
790
+
791
+ iterator begin() const;
792
+ iterator end() const;
793
+
794
+ // Attribute iterators
795
+ typedef xml_attribute_iterator attribute_iterator;
796
+
797
+ attribute_iterator attributes_begin() const;
798
+ attribute_iterator attributes_end() const;
799
+
800
+ // Range-based for support
801
+ xml_object_range<xml_node_iterator> children() const;
802
+ xml_object_range<xml_attribute_iterator> attributes() const;
803
+
804
+ // Range-based for support for all children with the specified name
805
+ // Note: name pointer must have a longer lifetime than the returned object; be careful with passing temporaries!
806
+ xml_object_range<xml_named_node_iterator> children(const char_t* name) const;
807
+
808
+ // Get node offset in parsed file/string (in char_t units) for debugging purposes
809
+ ptrdiff_t offset_debug() const;
810
+
811
+ // Get hash value (unique for handles to the same object)
812
+ size_t hash_value() const;
813
+
814
+ // Get internal pointer
815
+ xml_node_struct* internal_object() const;
816
+ };
817
+
818
+ #ifdef __BORLANDC__
819
+ // Borland C++ workaround
820
+ bool PUGIXML_FUNCTION operator&&(const xml_node& lhs, bool rhs);
821
+ bool PUGIXML_FUNCTION operator||(const xml_node& lhs, bool rhs);
822
+ #endif
823
+
824
+ // A helper for working with text inside PCDATA nodes
825
+ class PUGIXML_CLASS xml_text
826
+ {
827
+ friend class xml_node;
828
+
829
+ xml_node_struct* _root;
830
+
831
+ typedef void (*unspecified_bool_type)(xml_text***);
832
+
833
+ explicit xml_text(xml_node_struct* root);
834
+
835
+ xml_node_struct* _data_new();
836
+ xml_node_struct* _data() const;
837
+
838
+ public:
839
+ // Default constructor. Constructs an empty object.
840
+ xml_text();
841
+
842
+ // Safe bool conversion operator
843
+ operator unspecified_bool_type() const;
844
+
845
+ // Borland C++ workaround
846
+ bool operator!() const;
847
+
848
+ // Check if text object is empty (null)
849
+ bool empty() const;
850
+
851
+ // Get text, or "" if object is empty
852
+ const char_t* get() const;
853
+
854
+ // Get text, or the default value if object is empty
855
+ const char_t* as_string(const char_t* def = PUGIXML_TEXT("")) const;
856
+
857
+ // Get text as a number, or the default value if conversion did not succeed or object is empty
858
+ int as_int(int def = 0) const;
859
+ unsigned int as_uint(unsigned int def = 0) const;
860
+ double as_double(double def = 0) const;
861
+ float as_float(float def = 0) const;
862
+
863
+ #ifdef PUGIXML_HAS_LONG_LONG
864
+ long long as_llong(long long def = 0) const;
865
+ unsigned long long as_ullong(unsigned long long def = 0) const;
866
+ #endif
867
+
868
+ // Get text as bool (returns true if first character is in '1tTyY' set), or the default value if object is empty
869
+ bool as_bool(bool def = false) const;
870
+
871
+ // Set text (returns false if object is empty or there is not enough memory)
872
+ bool set(const char_t* rhs);
873
+ bool set(const char_t* rhs, size_t size);
874
+ #ifdef PUGIXML_HAS_STRING_VIEW
875
+ bool set(string_view_t rhs);
876
+ #endif
877
+
878
+ // Set text with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
879
+ bool set(int rhs);
880
+ bool set(unsigned int rhs);
881
+ bool set(long rhs);
882
+ bool set(unsigned long rhs);
883
+ bool set(double rhs);
884
+ bool set(double rhs, int precision);
885
+ bool set(float rhs);
886
+ bool set(float rhs, int precision);
887
+ bool set(bool rhs);
888
+
889
+ #ifdef PUGIXML_HAS_LONG_LONG
890
+ bool set(long long rhs);
891
+ bool set(unsigned long long rhs);
892
+ #endif
893
+
894
+ // Set text (equivalent to set without error checking)
895
+ xml_text& operator=(const char_t* rhs);
896
+ xml_text& operator=(int rhs);
897
+ xml_text& operator=(unsigned int rhs);
898
+ xml_text& operator=(long rhs);
899
+ xml_text& operator=(unsigned long rhs);
900
+ xml_text& operator=(double rhs);
901
+ xml_text& operator=(float rhs);
902
+ xml_text& operator=(bool rhs);
903
+
904
+ #ifdef PUGIXML_HAS_STRING_VIEW
905
+ xml_text& operator=(string_view_t rhs);
906
+ #endif
907
+
908
+ #ifdef PUGIXML_HAS_LONG_LONG
909
+ xml_text& operator=(long long rhs);
910
+ xml_text& operator=(unsigned long long rhs);
911
+ #endif
912
+
913
+ // Get the data node (node_pcdata or node_cdata) for this object
914
+ xml_node data() const;
915
+ };
916
+
917
+ #ifdef __BORLANDC__
918
+ // Borland C++ workaround
919
+ bool PUGIXML_FUNCTION operator&&(const xml_text& lhs, bool rhs);
920
+ bool PUGIXML_FUNCTION operator||(const xml_text& lhs, bool rhs);
921
+ #endif
922
+
923
+ // Child node iterator (a bidirectional iterator over a collection of xml_node)
924
+ class PUGIXML_CLASS xml_node_iterator
925
+ {
926
+ friend class xml_node;
927
+
928
+ private:
929
+ mutable xml_node _wrap;
930
+ xml_node _parent;
931
+
932
+ xml_node_iterator(xml_node_struct* ref, xml_node_struct* parent);
933
+
934
+ public:
935
+ // Iterator traits
936
+ typedef ptrdiff_t difference_type;
937
+ typedef xml_node value_type;
938
+ typedef xml_node* pointer;
939
+ typedef xml_node& reference;
940
+
941
+ #ifndef PUGIXML_NO_STL
942
+ typedef std::bidirectional_iterator_tag iterator_category;
943
+ #endif
944
+
945
+ // Default constructor
946
+ xml_node_iterator();
947
+
948
+ // Construct an iterator which points to the specified node
949
+ xml_node_iterator(const xml_node& node);
950
+
951
+ // Iterator operators
952
+ bool operator==(const xml_node_iterator& rhs) const;
953
+ bool operator!=(const xml_node_iterator& rhs) const;
954
+
955
+ xml_node& operator*() const;
956
+ xml_node* operator->() const;
957
+
958
+ xml_node_iterator& operator++();
959
+ xml_node_iterator operator++(int);
960
+
961
+ xml_node_iterator& operator--();
962
+ xml_node_iterator operator--(int);
963
+ };
964
+
965
+ // Attribute iterator (a bidirectional iterator over a collection of xml_attribute)
966
+ class PUGIXML_CLASS xml_attribute_iterator
967
+ {
968
+ friend class xml_node;
969
+
970
+ private:
971
+ mutable xml_attribute _wrap;
972
+ xml_node _parent;
973
+
974
+ xml_attribute_iterator(xml_attribute_struct* ref, xml_node_struct* parent);
975
+
976
+ public:
977
+ // Iterator traits
978
+ typedef ptrdiff_t difference_type;
979
+ typedef xml_attribute value_type;
980
+ typedef xml_attribute* pointer;
981
+ typedef xml_attribute& reference;
982
+
983
+ #ifndef PUGIXML_NO_STL
984
+ typedef std::bidirectional_iterator_tag iterator_category;
985
+ #endif
986
+
987
+ // Default constructor
988
+ xml_attribute_iterator();
989
+
990
+ // Construct an iterator which points to the specified attribute
991
+ xml_attribute_iterator(const xml_attribute& attr, const xml_node& parent);
992
+
993
+ // Iterator operators
994
+ bool operator==(const xml_attribute_iterator& rhs) const;
995
+ bool operator!=(const xml_attribute_iterator& rhs) const;
996
+
997
+ xml_attribute& operator*() const;
998
+ xml_attribute* operator->() const;
999
+
1000
+ xml_attribute_iterator& operator++();
1001
+ xml_attribute_iterator operator++(int);
1002
+
1003
+ xml_attribute_iterator& operator--();
1004
+ xml_attribute_iterator operator--(int);
1005
+ };
1006
+
1007
+ // Named node range helper
1008
+ class PUGIXML_CLASS xml_named_node_iterator
1009
+ {
1010
+ friend class xml_node;
1011
+
1012
+ public:
1013
+ // Iterator traits
1014
+ typedef ptrdiff_t difference_type;
1015
+ typedef xml_node value_type;
1016
+ typedef xml_node* pointer;
1017
+ typedef xml_node& reference;
1018
+
1019
+ #ifndef PUGIXML_NO_STL
1020
+ typedef std::bidirectional_iterator_tag iterator_category;
1021
+ #endif
1022
+
1023
+ // Default constructor
1024
+ xml_named_node_iterator();
1025
+
1026
+ // Construct an iterator which points to the specified node
1027
+ // Note: name pointer is stored in the iterator and must have a longer lifetime than iterator itself
1028
+ xml_named_node_iterator(const xml_node& node, const char_t* name);
1029
+
1030
+ // Iterator operators
1031
+ bool operator==(const xml_named_node_iterator& rhs) const;
1032
+ bool operator!=(const xml_named_node_iterator& rhs) const;
1033
+
1034
+ xml_node& operator*() const;
1035
+ xml_node* operator->() const;
1036
+
1037
+ xml_named_node_iterator& operator++();
1038
+ xml_named_node_iterator operator++(int);
1039
+
1040
+ xml_named_node_iterator& operator--();
1041
+ xml_named_node_iterator operator--(int);
1042
+
1043
+ private:
1044
+ mutable xml_node _wrap;
1045
+ xml_node _parent;
1046
+ const char_t* _name;
1047
+
1048
+ xml_named_node_iterator(xml_node_struct* ref, xml_node_struct* parent, const char_t* name);
1049
+ };
1050
+
1051
+ // Abstract tree walker class (see xml_node::traverse)
1052
+ class PUGIXML_CLASS xml_tree_walker
1053
+ {
1054
+ friend class xml_node;
1055
+
1056
+ private:
1057
+ int _depth;
1058
+
1059
+ protected:
1060
+ // Get current traversal depth
1061
+ int depth() const;
1062
+
1063
+ public:
1064
+ xml_tree_walker();
1065
+ virtual ~xml_tree_walker();
1066
+
1067
+ // Callback that is called when traversal begins
1068
+ virtual bool begin(xml_node& node);
1069
+
1070
+ // Callback that is called for each node traversed
1071
+ virtual bool for_each(xml_node& node) = 0;
1072
+
1073
+ // Callback that is called when traversal ends
1074
+ virtual bool end(xml_node& node);
1075
+ };
1076
+
1077
+ // Parsing status, returned as part of xml_parse_result object
1078
+ enum xml_parse_status
1079
+ {
1080
+ status_ok = 0, // No error
1081
+
1082
+ status_file_not_found, // File was not found during load_file()
1083
+ status_io_error, // Error reading from file/stream
1084
+ status_out_of_memory, // Could not allocate memory
1085
+ status_internal_error, // Internal error occurred
1086
+
1087
+ status_unrecognized_tag, // Parser could not determine tag type
1088
+
1089
+ status_bad_pi, // Parsing error occurred while parsing document declaration/processing instruction
1090
+ status_bad_comment, // Parsing error occurred while parsing comment
1091
+ status_bad_cdata, // Parsing error occurred while parsing CDATA section
1092
+ status_bad_doctype, // Parsing error occurred while parsing document type declaration
1093
+ status_bad_pcdata, // Parsing error occurred while parsing PCDATA section
1094
+ status_bad_start_element, // Parsing error occurred while parsing start element tag
1095
+ status_bad_attribute, // Parsing error occurred while parsing element attribute
1096
+ status_bad_end_element, // Parsing error occurred while parsing end element tag
1097
+ status_end_element_mismatch,// There was a mismatch of start-end tags (closing tag had incorrect name, some tag was not closed or there was an excessive closing tag)
1098
+
1099
+ status_append_invalid_root, // Unable to append nodes since root type is not node_element or node_document (exclusive to xml_node::append_buffer)
1100
+
1101
+ status_no_document_element // Parsing resulted in a document without element nodes
1102
+ };
1103
+
1104
+ // Parsing result
1105
+ struct PUGIXML_CLASS xml_parse_result
1106
+ {
1107
+ // Parsing status (see xml_parse_status)
1108
+ xml_parse_status status;
1109
+
1110
+ // Last parsed offset (in char_t units from start of input data)
1111
+ ptrdiff_t offset;
1112
+
1113
+ // Source document encoding
1114
+ xml_encoding encoding;
1115
+
1116
+ // Default constructor, initializes object to failed state
1117
+ xml_parse_result();
1118
+
1119
+ // Cast to bool operator
1120
+ operator bool() const;
1121
+
1122
+ // Get error description
1123
+ const char* description() const;
1124
+ };
1125
+
1126
+ // Document class (DOM tree root)
1127
+ class PUGIXML_CLASS xml_document: public xml_node
1128
+ {
1129
+ private:
1130
+ char_t* _buffer;
1131
+
1132
+ char _memory[192];
1133
+
1134
+ // Non-copyable semantics
1135
+ xml_document(const xml_document&);
1136
+ xml_document& operator=(const xml_document&);
1137
+
1138
+ void _create();
1139
+ void _destroy();
1140
+ void _move(xml_document& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
1141
+
1142
+ public:
1143
+ // Default constructor, makes empty document
1144
+ xml_document();
1145
+
1146
+ // Destructor, invalidates all node/attribute handles to this document
1147
+ ~xml_document();
1148
+
1149
+ #ifdef PUGIXML_HAS_MOVE
1150
+ // Move semantics support
1151
+ xml_document(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
1152
+ xml_document& operator=(xml_document&& rhs) PUGIXML_NOEXCEPT_IF_NOT_COMPACT;
1153
+ #endif
1154
+
1155
+ // Removes all nodes, leaving the empty document
1156
+ void reset();
1157
+
1158
+ // Removes all nodes, then copies the entire contents of the specified document
1159
+ void reset(const xml_document& proto);
1160
+
1161
+ #ifndef PUGIXML_NO_STL
1162
+ // Load document from stream.
1163
+ xml_parse_result load(std::basic_istream<char>& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1164
+ xml_parse_result load(std::basic_istream<wchar_t>& stream, unsigned int options = parse_default);
1165
+ #endif
1166
+
1167
+ // (deprecated: use load_string instead) Load document from zero-terminated string. No encoding conversions are applied.
1168
+ PUGIXML_DEPRECATED xml_parse_result load(const char_t* contents, unsigned int options = parse_default);
1169
+
1170
+ // Load document from zero-terminated string. No encoding conversions are applied.
1171
+ xml_parse_result load_string(const char_t* contents, unsigned int options = parse_default);
1172
+
1173
+ // Load document from file
1174
+ xml_parse_result load_file(const char* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1175
+ xml_parse_result load_file(const wchar_t* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1176
+
1177
+ // Load document from buffer. Copies/converts the buffer, so it may be deleted or changed after the function returns.
1178
+ xml_parse_result load_buffer(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1179
+
1180
+ // Load document from buffer, using the buffer for in-place parsing (the buffer is modified and used for storage of document data).
1181
+ // You should ensure that buffer data will persist throughout the document's lifetime, and free the buffer memory manually once document is destroyed.
1182
+ xml_parse_result load_buffer_inplace(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1183
+
1184
+ // Load document from buffer, using the buffer for in-place parsing (the buffer is modified and used for storage of document data).
1185
+ // You should allocate the buffer with pugixml allocation function; document will free the buffer when it is no longer needed (you can't use it anymore).
1186
+ xml_parse_result load_buffer_inplace_own(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
1187
+
1188
+ // Save XML document to writer (semantics is slightly different from xml_node::print, see documentation for details).
1189
+ void save(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
1190
+
1191
+ #ifndef PUGIXML_NO_STL
1192
+ // Save XML document to stream (semantics is slightly different from xml_node::print, see documentation for details).
1193
+ void save(std::basic_ostream<char>& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
1194
+ void save(std::basic_ostream<wchar_t>& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default) const;
1195
+ #endif
1196
+
1197
+ // Save XML to file
1198
+ bool save_file(const char* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
1199
+ bool save_file(const wchar_t* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
1200
+
1201
+ // Get document element
1202
+ xml_node document_element() const;
1203
+ };
1204
+
1205
+ #ifndef PUGIXML_NO_XPATH
1206
+ // XPath query return type
1207
+ enum xpath_value_type
1208
+ {
1209
+ xpath_type_none, // Unknown type (query failed to compile)
1210
+ xpath_type_node_set, // Node set (xpath_node_set)
1211
+ xpath_type_number, // Number
1212
+ xpath_type_string, // String
1213
+ xpath_type_boolean // Boolean
1214
+ };
1215
+
1216
+ // XPath parsing result
1217
+ struct PUGIXML_CLASS xpath_parse_result
1218
+ {
1219
+ // Error message (0 if no error)
1220
+ const char* error;
1221
+
1222
+ // Last parsed offset (in char_t units from string start)
1223
+ ptrdiff_t offset;
1224
+
1225
+ // Default constructor, initializes object to failed state
1226
+ xpath_parse_result();
1227
+
1228
+ // Cast to bool operator
1229
+ operator bool() const;
1230
+
1231
+ // Get error description
1232
+ const char* description() const;
1233
+ };
1234
+
1235
+ // A single XPath variable
1236
+ class PUGIXML_CLASS xpath_variable
1237
+ {
1238
+ friend class xpath_variable_set;
1239
+
1240
+ protected:
1241
+ xpath_value_type _type;
1242
+ xpath_variable* _next;
1243
+
1244
+ xpath_variable(xpath_value_type type);
1245
+
1246
+ // Non-copyable semantics
1247
+ xpath_variable(const xpath_variable&);
1248
+ xpath_variable& operator=(const xpath_variable&);
1249
+
1250
+ public:
1251
+ // Get variable name
1252
+ const char_t* name() const;
1253
+
1254
+ // Get variable type
1255
+ xpath_value_type type() const;
1256
+
1257
+ // Get variable value; no type conversion is performed, default value (false, NaN, empty string, empty node set) is returned on type mismatch error
1258
+ bool get_boolean() const;
1259
+ double get_number() const;
1260
+ const char_t* get_string() const;
1261
+ const xpath_node_set& get_node_set() const;
1262
+
1263
+ // Set variable value; no type conversion is performed, false is returned on type mismatch error
1264
+ bool set(bool value);
1265
+ bool set(double value);
1266
+ bool set(const char_t* value);
1267
+ bool set(const xpath_node_set& value);
1268
+ };
1269
+
1270
+ // A set of XPath variables
1271
+ class PUGIXML_CLASS xpath_variable_set
1272
+ {
1273
+ private:
1274
+ xpath_variable* _data[64];
1275
+
1276
+ void _assign(const xpath_variable_set& rhs);
1277
+ void _swap(xpath_variable_set& rhs);
1278
+
1279
+ xpath_variable* _find(const char_t* name) const;
1280
+
1281
+ static bool _clone(xpath_variable* var, xpath_variable** out_result);
1282
+ static void _destroy(xpath_variable* var);
1283
+
1284
+ public:
1285
+ // Default constructor/destructor
1286
+ xpath_variable_set();
1287
+ ~xpath_variable_set();
1288
+
1289
+ // Copy constructor/assignment operator
1290
+ xpath_variable_set(const xpath_variable_set& rhs);
1291
+ xpath_variable_set& operator=(const xpath_variable_set& rhs);
1292
+
1293
+ #ifdef PUGIXML_HAS_MOVE
1294
+ // Move semantics support
1295
+ xpath_variable_set(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
1296
+ xpath_variable_set& operator=(xpath_variable_set&& rhs) PUGIXML_NOEXCEPT;
1297
+ #endif
1298
+
1299
+ // Add a new variable or get the existing one, if the types match
1300
+ xpath_variable* add(const char_t* name, xpath_value_type type);
1301
+
1302
+ // Set value of an existing variable; no type conversion is performed, false is returned if there is no such variable or if types mismatch
1303
+ bool set(const char_t* name, bool value);
1304
+ bool set(const char_t* name, double value);
1305
+ bool set(const char_t* name, const char_t* value);
1306
+ bool set(const char_t* name, const xpath_node_set& value);
1307
+
1308
+ // Get existing variable by name
1309
+ xpath_variable* get(const char_t* name);
1310
+ const xpath_variable* get(const char_t* name) const;
1311
+ };
1312
+
1313
+ // A compiled XPath query object
1314
+ class PUGIXML_CLASS xpath_query
1315
+ {
1316
+ private:
1317
+ void* _impl;
1318
+ xpath_parse_result _result;
1319
+
1320
+ typedef void (*unspecified_bool_type)(xpath_query***);
1321
+
1322
+ // Non-copyable semantics
1323
+ xpath_query(const xpath_query&);
1324
+ xpath_query& operator=(const xpath_query&);
1325
+
1326
+ public:
1327
+ // Construct a compiled object from XPath expression.
1328
+ // If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on compilation errors.
1329
+ explicit xpath_query(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL);
1330
+
1331
+ // Constructor
1332
+ xpath_query();
1333
+
1334
+ // Destructor
1335
+ ~xpath_query();
1336
+
1337
+ #ifdef PUGIXML_HAS_MOVE
1338
+ // Move semantics support
1339
+ xpath_query(xpath_query&& rhs) PUGIXML_NOEXCEPT;
1340
+ xpath_query& operator=(xpath_query&& rhs) PUGIXML_NOEXCEPT;
1341
+ #endif
1342
+
1343
+ // Get query expression return type
1344
+ xpath_value_type return_type() const;
1345
+
1346
+ // Evaluate expression as boolean value in the specified context; performs type conversion if necessary.
1347
+ // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
1348
+ bool evaluate_boolean(const xpath_node& n) const;
1349
+
1350
+ // Evaluate expression as double value in the specified context; performs type conversion if necessary.
1351
+ // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
1352
+ double evaluate_number(const xpath_node& n) const;
1353
+
1354
+ #ifndef PUGIXML_NO_STL
1355
+ // Evaluate expression as string value in the specified context; performs type conversion if necessary.
1356
+ // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
1357
+ string_t evaluate_string(const xpath_node& n) const;
1358
+ #endif
1359
+
1360
+ // Evaluate expression as string value in the specified context; performs type conversion if necessary.
1361
+ // At most capacity characters are written to the destination buffer, full result size is returned (includes terminating zero).
1362
+ // If PUGIXML_NO_EXCEPTIONS is not defined, throws std::bad_alloc on out of memory errors.
1363
+ // If PUGIXML_NO_EXCEPTIONS is defined, returns empty string instead.
1364
+ size_t evaluate_string(char_t* buffer, size_t capacity, const xpath_node& n) const;
1365
+
1366
+ // Evaluate expression as node set in the specified context.
1367
+ // If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on type mismatch and std::bad_alloc on out of memory errors.
1368
+ // If PUGIXML_NO_EXCEPTIONS is defined, returns empty node set instead.
1369
+ xpath_node_set evaluate_node_set(const xpath_node& n) const;
1370
+
1371
+ // Evaluate expression as node set in the specified context.
1372
+ // Return first node in document order, or empty node if node set is empty.
1373
+ // If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on type mismatch and std::bad_alloc on out of memory errors.
1374
+ // If PUGIXML_NO_EXCEPTIONS is defined, returns empty node instead.
1375
+ xpath_node evaluate_node(const xpath_node& n) const;
1376
+
1377
+ // Get parsing result (used to get compilation errors in PUGIXML_NO_EXCEPTIONS mode)
1378
+ const xpath_parse_result& result() const;
1379
+
1380
+ // Safe bool conversion operator
1381
+ operator unspecified_bool_type() const;
1382
+
1383
+ // Borland C++ workaround
1384
+ bool operator!() const;
1385
+ };
1386
+
1387
+ #ifndef PUGIXML_NO_EXCEPTIONS
1388
+ #if defined(_MSC_VER)
1389
+ // C4275 can be ignored in Visual C++ if you are deriving
1390
+ // from a type in the Standard C++ Library
1391
+ #pragma warning(push)
1392
+ #pragma warning(disable: 4275)
1393
+ #endif
1394
+ // XPath exception class
1395
+ class PUGIXML_CLASS xpath_exception: public std::exception
1396
+ {
1397
+ private:
1398
+ xpath_parse_result _result;
1399
+
1400
+ public:
1401
+ // Construct exception from parse result
1402
+ explicit xpath_exception(const xpath_parse_result& result);
1403
+
1404
+ // Get error message
1405
+ virtual const char* what() const PUGIXML_NOEXCEPT PUGIXML_OVERRIDE;
1406
+
1407
+ // Get parse result
1408
+ const xpath_parse_result& result() const;
1409
+ };
1410
+ #if defined(_MSC_VER)
1411
+ #pragma warning(pop)
1412
+ #endif
1413
+ #endif
1414
+
1415
+ // XPath node class (either xml_node or xml_attribute)
1416
+ class PUGIXML_CLASS xpath_node
1417
+ {
1418
+ private:
1419
+ xml_node _node;
1420
+ xml_attribute _attribute;
1421
+
1422
+ typedef void (*unspecified_bool_type)(xpath_node***);
1423
+
1424
+ public:
1425
+ // Default constructor; constructs empty XPath node
1426
+ xpath_node();
1427
+
1428
+ // Construct XPath node from XML node/attribute
1429
+ xpath_node(const xml_node& node);
1430
+ xpath_node(const xml_attribute& attribute, const xml_node& parent);
1431
+
1432
+ // Get node/attribute, if any
1433
+ xml_node node() const;
1434
+ xml_attribute attribute() const;
1435
+
1436
+ // Get parent of contained node/attribute
1437
+ xml_node parent() const;
1438
+
1439
+ // Safe bool conversion operator
1440
+ operator unspecified_bool_type() const;
1441
+
1442
+ // Borland C++ workaround
1443
+ bool operator!() const;
1444
+
1445
+ // Comparison operators
1446
+ bool operator==(const xpath_node& n) const;
1447
+ bool operator!=(const xpath_node& n) const;
1448
+ };
1449
+
1450
+ #ifdef __BORLANDC__
1451
+ // Borland C++ workaround
1452
+ bool PUGIXML_FUNCTION operator&&(const xpath_node& lhs, bool rhs);
1453
+ bool PUGIXML_FUNCTION operator||(const xpath_node& lhs, bool rhs);
1454
+ #endif
1455
+
1456
+ // A fixed-size collection of XPath nodes
1457
+ class PUGIXML_CLASS xpath_node_set
1458
+ {
1459
+ public:
1460
+ // Collection type
1461
+ enum type_t
1462
+ {
1463
+ type_unsorted, // Not ordered
1464
+ type_sorted, // Sorted by document order (ascending)
1465
+ type_sorted_reverse // Sorted by document order (descending)
1466
+ };
1467
+
1468
+ // Constant iterator type
1469
+ typedef const xpath_node* const_iterator;
1470
+
1471
+ // We define non-constant iterator to be the same as constant iterator so that various generic algorithms (i.e. boost foreach) work
1472
+ typedef const xpath_node* iterator;
1473
+
1474
+ // Default constructor. Constructs empty set.
1475
+ xpath_node_set();
1476
+
1477
+ // Constructs a set from iterator range; data is not checked for duplicates and is not sorted according to provided type, so be careful
1478
+ xpath_node_set(const_iterator begin, const_iterator end, type_t type = type_unsorted);
1479
+
1480
+ // Destructor
1481
+ ~xpath_node_set();
1482
+
1483
+ // Copy constructor/assignment operator
1484
+ xpath_node_set(const xpath_node_set& ns);
1485
+ xpath_node_set& operator=(const xpath_node_set& ns);
1486
+
1487
+ #ifdef PUGIXML_HAS_MOVE
1488
+ // Move semantics support
1489
+ xpath_node_set(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
1490
+ xpath_node_set& operator=(xpath_node_set&& rhs) PUGIXML_NOEXCEPT;
1491
+ #endif
1492
+
1493
+ // Get collection type
1494
+ type_t type() const;
1495
+
1496
+ // Get collection size
1497
+ size_t size() const;
1498
+
1499
+ // Indexing operator
1500
+ const xpath_node& operator[](size_t index) const;
1501
+
1502
+ // Collection iterators
1503
+ const_iterator begin() const;
1504
+ const_iterator end() const;
1505
+
1506
+ // Sort the collection in ascending/descending order by document order
1507
+ void sort(bool reverse = false);
1508
+
1509
+ // Get first node in the collection by document order
1510
+ xpath_node first() const;
1511
+
1512
+ // Check if collection is empty
1513
+ bool empty() const;
1514
+
1515
+ private:
1516
+ type_t _type;
1517
+
1518
+ xpath_node _storage[1];
1519
+
1520
+ xpath_node* _begin;
1521
+ xpath_node* _end;
1522
+
1523
+ void _assign(const_iterator begin, const_iterator end, type_t type);
1524
+ void _move(xpath_node_set& rhs) PUGIXML_NOEXCEPT;
1525
+ };
1526
+ #endif
1527
+
1528
+ #ifndef PUGIXML_NO_STL
1529
+ // Convert wide string to UTF8
1530
+ std::basic_string<char> PUGIXML_FUNCTION as_utf8(const wchar_t* str);
1531
+ std::basic_string<char> PUGIXML_FUNCTION as_utf8(const std::basic_string<wchar_t>& str);
1532
+
1533
+ // Convert UTF8 to wide string
1534
+ std::basic_string<wchar_t> PUGIXML_FUNCTION as_wide(const char* str);
1535
+ std::basic_string<wchar_t> PUGIXML_FUNCTION as_wide(const std::basic_string<char>& str);
1536
+ #endif
1537
+
1538
+ // Memory allocation function interface; returns pointer to allocated memory or NULL on failure
1539
+ typedef void* (*allocation_function)(size_t size);
1540
+
1541
+ // Memory deallocation function interface
1542
+ typedef void (*deallocation_function)(void* ptr);
1543
+
1544
+ // Override default memory management functions. All subsequent allocations/deallocations will be performed via supplied functions.
1545
+ void PUGIXML_FUNCTION set_memory_management_functions(allocation_function allocate, deallocation_function deallocate);
1546
+
1547
+ // Get current memory management functions
1548
+ allocation_function PUGIXML_FUNCTION get_memory_allocation_function();
1549
+ deallocation_function PUGIXML_FUNCTION get_memory_deallocation_function();
1550
+ }
1551
+
1552
+ #if !defined(PUGIXML_NO_STL) && (defined(_MSC_VER) || defined(__ICC))
1553
+ namespace std
1554
+ {
1555
+ // Workarounds for (non-standard) iterator category detection for older versions (MSVC7/IC8 and earlier)
1556
+ std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_node_iterator&);
1557
+ std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_attribute_iterator&);
1558
+ std::bidirectional_iterator_tag PUGIXML_FUNCTION _Iter_cat(const pugi::xml_named_node_iterator&);
1559
+ }
1560
+ #endif
1561
+
1562
+ #if !defined(PUGIXML_NO_STL) && defined(__SUNPRO_CC)
1563
+ namespace std
1564
+ {
1565
+ // Workarounds for (non-standard) iterator category detection
1566
+ std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_node_iterator&);
1567
+ std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_attribute_iterator&);
1568
+ std::bidirectional_iterator_tag PUGIXML_FUNCTION __iterator_category(const pugi::xml_named_node_iterator&);
1569
+ }
1570
+ #endif
1571
+
1572
+ #endif
1573
+
1574
+ // Make sure implementation is included in header-only mode
1575
+ // Use macro expansion in #include to work around QMake (QTBUG-11923)
1576
+ #if defined(PUGIXML_HEADER_ONLY) && !defined(PUGIXML_SOURCE)
1577
+ # define PUGIXML_SOURCE "pugixml.cpp"
1578
+ # include PUGIXML_SOURCE
1579
+ #endif
1580
+
1581
+ /**
1582
+ * Copyright (c) 2006-2026 Arseny Kapoulkine
1583
+ *
1584
+ * Permission is hereby granted, free of charge, to any person
1585
+ * obtaining a copy of this software and associated documentation
1586
+ * files (the "Software"), to deal in the Software without
1587
+ * restriction, including without limitation the rights to use,
1588
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
1589
+ * copies of the Software, and to permit persons to whom the
1590
+ * Software is furnished to do so, subject to the following
1591
+ * conditions:
1592
+ *
1593
+ * The above copyright notice and this permission notice shall be
1594
+ * included in all copies or substantial portions of the Software.
1595
+ *
1596
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1597
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
1598
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1599
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
1600
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
1601
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1602
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1603
+ * OTHER DEALINGS IN THE SOFTWARE.
1604
+ */