Compare commits
233 commits
Author | SHA1 | Date | |
---|---|---|---|
|
1dc3266fff | ||
|
cb217f5a85 | ||
|
e11e0c965f | ||
|
b6b747244e | ||
|
8be081fbbe | ||
|
a0e0643363 | ||
|
3bd1f452b5 | ||
|
c5b288d91a | ||
|
0ef3da1e6e | ||
|
76dcd89427 | ||
|
43ef7e25d9 | ||
|
ab8af53059 | ||
|
86c9105154 | ||
|
444963e269 | ||
|
0cb4f02579 | ||
|
c342266fae | ||
|
39e169285c | ||
|
1905284494 | ||
|
d359402311 | ||
|
09e7cc9b1c | ||
|
f327371219 | ||
|
bcf483c3b7 | ||
|
173a263490 | ||
|
521b2cd854 | ||
|
27bc68ab45 | ||
|
f7de324855 | ||
|
3b5c1fb022 | ||
|
ab8453c572 | ||
|
2639dfd053 | ||
|
0401559dde | ||
|
832a4f4914 | ||
|
33a75c734b | ||
|
ec851bb18d | ||
|
6fbf32140b | ||
|
effc46f0ed | ||
|
363ebdde91 | ||
|
c60ca94cdd | ||
|
dd50fa5b45 | ||
|
2fa9158b4f | ||
|
fad2d5e4ef | ||
|
f388c465dd | ||
|
314baf6605 | ||
|
eb918f2078 | ||
|
25c4fb74a8 | ||
|
c9e219c17b | ||
|
9ba92a7fa7 | ||
|
6ce48ec379 | ||
|
428606b3c1 | ||
|
64de196ba9 | ||
|
bd90579718 | ||
|
16a4f382ac | ||
|
bc2448afbb | ||
|
9e382f9807 | ||
|
f1fbd707f1 | ||
|
a5991972ba | ||
|
c624c7a8bd | ||
|
8bd209fb8b | ||
|
657619962f | ||
|
81274bb026 | ||
|
37eddaa0b2 | ||
|
e7eae035ff | ||
|
52a7981b85 | ||
|
92ac6ac1d9 | ||
|
50b103f127 | ||
|
1cd65c7eb8 | ||
|
f1946432ee | ||
|
e2ba4f4014 | ||
|
5f49f2c657 | ||
|
986b7ffd01 | ||
|
06a516c73c | ||
|
a6a63a1b50 | ||
|
5cff00e5ea | ||
|
0de580155d | ||
|
e7b545b288 | ||
|
3097a2c711 | ||
|
8bd9a19a7e | ||
|
0b793a3126 | ||
|
7da44ddc5b | ||
|
7b1b7ee16d | ||
|
fc7928a4b7 | ||
|
0f1e75a902 | ||
|
91fde92fc2 | ||
|
5c4225b5c9 | ||
|
8cece4b9fe | ||
|
56c9afa7c8 | ||
|
791971ee59 | ||
|
e672b1c9f0 | ||
|
5df537f348 | ||
|
c167259e60 | ||
|
5d58e94b6d | ||
|
ef257796db | ||
|
08b3433180 | ||
|
06868c8f57 | ||
|
0e3f1699ff | ||
|
e2bc4f4af2 | ||
|
907955280f | ||
|
4feab60bb7 | ||
|
5a0fd5d85f | ||
|
68a92aa972 | ||
|
d1d415e666 | ||
|
5063e87499 | ||
|
7a9da11d8b | ||
|
a3ae05cc9f | ||
|
fe4bc946b2 | ||
|
632c042a35 | ||
|
70bd6a6b0a | ||
|
8afc1239a3 | ||
|
5f97d5d66f | ||
|
28aebf2b22 | ||
|
df42668e18 | ||
|
30761e48df | ||
|
24e454066d | ||
|
c4bae8d818 | ||
|
8e5b8e0f46 | ||
|
a3fad540a7 | ||
|
20aef1cd4b | ||
|
c7090e6c33 | ||
|
1f84db837b | ||
|
c258fba6f1 | ||
|
22401bafaf | ||
|
8b074b171f | ||
|
d58115e581 | ||
|
45271c9c9c | ||
|
f08768d9bf | ||
|
5fdc78b66b | ||
|
23ca940487 | ||
|
a196b9b7e9 | ||
|
c2d90c49f9 | ||
|
f49d7acdfb | ||
|
285776354d | ||
|
d272f11073 | ||
|
ef9cafa9ce | ||
|
184e6ed916 | ||
|
8c74d8b198 | ||
|
ab86960e48 | ||
|
5e64076af9 | ||
|
76c3914484 | ||
|
6fbe927575 | ||
|
2c24e90c23 | ||
|
546cafefa3 | ||
|
85a39b955d | ||
|
41b6ff21c4 | ||
|
aa2e0909ac | ||
|
53a30c6571 | ||
|
2e8631d2eb | ||
|
cda8623468 | ||
|
51d177e938 | ||
|
78e98c446d | ||
|
fe5460c6dc | ||
|
99ad261611 | ||
|
40be014e48 | ||
|
6949232bbd | ||
|
fdd618f13a | ||
|
3df5036344 | ||
|
ad93a373ab | ||
|
8a0aac18ea | ||
|
1c5a0bb325 | ||
|
195dfe1d8d | ||
|
b9b2aeecaf | ||
|
6934b123d4 | ||
|
6fb765ca9d | ||
|
6202519ca6 | ||
|
fd7326fb91 | ||
|
ccb63a9186 | ||
|
5329ba03b5 | ||
|
3c59df555b | ||
|
c6607740a0 | ||
|
946de603b1 | ||
|
44e4d7e40b | ||
|
84e322738b | ||
|
fdf0295753 | ||
|
a556845555 | ||
|
4f6e7454fd | ||
|
c5752917c7 | ||
|
5a867cb1e3 | ||
|
fcb7c8d3e5 | ||
|
86e0fe1980 | ||
|
1312a46d91 | ||
|
7247a823b7 | ||
|
cdd5d92f26 | ||
|
29f3177d10 | ||
|
434c4a4d41 | ||
|
8bf806c035 | ||
|
b01569918a | ||
|
b9a0d7ff23 | ||
|
138976fd95 | ||
|
66e1b4e03e | ||
|
36e274d949 | ||
|
12e8b699ce | ||
|
c55ea3bc1e | ||
|
930a701f1f | ||
|
93c7bacb29 | ||
|
d902709da2 | ||
|
1d59e4d9d8 | ||
|
160c1c23d9 | ||
|
b67ef29c08 | ||
|
9fcae40bb5 | ||
|
b3db08ffcc | ||
|
ba84465d2e | ||
|
2da1524977 | ||
|
7d0d8ee79f | ||
|
4b57d09882 | ||
|
7664bbf9af | ||
|
1a9c3f66db | ||
|
f9a2a7d19e | ||
|
aac75cd299 | ||
|
7d2436ec2f | ||
|
fa686f004a | ||
|
d3dd79d54d | ||
|
d9fadc7464 | ||
|
273fa0ab26 | ||
|
81c82588bd | ||
|
e3b5e9ce3c | ||
|
1a96777b11 | ||
|
cb4a74d5e5 | ||
|
c51214f21e | ||
|
6b9c07e6ed | ||
|
514478d1f8 | ||
|
f3139f4c04 | ||
|
699143c5d4 | ||
|
c12889f7cc | ||
|
12139f587b | ||
|
e584ea337e | ||
|
51322cffa1 | ||
|
c53fdab93a | ||
|
43b0a6a0a3 | ||
|
24a7064e57 | ||
|
e6dde9cf69 | ||
|
4c791586ee | ||
|
552773269e | ||
|
61f2180d0f | ||
|
daeb8013b2 | ||
|
341cea5a32 |
52 changed files with 5138 additions and 2325 deletions
|
@ -1,2 +1,7 @@
|
|||
comment: false
|
||||
|
||||
coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
informational: true
|
||||
patch: off
|
||||
|
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
tests/data/* -text
|
8
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
8
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
name: Bug report
|
||||
about: Create a report if you believe you've found a bug in this project; please use GitHub Discussions instead if you think the bug may be in your code.
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Help and support
|
||||
url: https://github.com/zeux/pugixml/discussions
|
||||
about: Please use GitHub Discussions if you have questions or need help.
|
8
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
8
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
52
.github/workflows/build.yml
vendored
Normal file
52
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
unix:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu, macos]
|
||||
compiler: [g++, clang++]
|
||||
defines: [standard, PUGIXML_WCHAR_MODE, PUGIXML_COMPACT, PUGIXML_NO_EXCEPTIONS]
|
||||
exclude:
|
||||
- os: macos
|
||||
compiler: g++
|
||||
name: ${{matrix.os}} (${{matrix.compiler}}, ${{matrix.defines}})
|
||||
runs-on: ${{matrix.os}}-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: make test
|
||||
run: |
|
||||
export CXX=${{matrix.compiler}}
|
||||
make test cxxstd=c++11 defines=${{matrix.defines}} config=release -j2
|
||||
make test cxxstd=c++98 defines=${{matrix.defines}} config=debug -j2
|
||||
make test defines=${{matrix.defines}} config=sanitize -j2
|
||||
- name: make coverage
|
||||
if: ${{!(matrix.os == 'ubuntu' && matrix.compiler == 'clang++')}} # linux/clang produces coverage info gcov can't parse
|
||||
run: |
|
||||
export CXX=${{matrix.compiler}}
|
||||
make test defines=${{matrix.defines}} config=coverage -j2
|
||||
bash <(curl -s https://codecov.io/bash) -f pugixml.cpp.gcov -X search -t ${{secrets.CODECOV_TOKEN}} -B ${{github.ref}}
|
||||
|
||||
windows:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [Win32, x64]
|
||||
defines: [standard, PUGIXML_WCHAR_MODE, PUGIXML_COMPACT, PUGIXML_NO_EXCEPTIONS]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: cmake configure
|
||||
run: cmake . -DPUGIXML_BUILD_TESTS=ON -D${{matrix.defines}}=ON -A ${{matrix.arch}}
|
||||
- name: cmake test
|
||||
shell: bash # necessary for fail-fast
|
||||
run: |
|
||||
cmake --build . -- -property:Configuration=Debug -verbosity:minimal
|
||||
Debug/pugixml-check.exe
|
||||
cmake --build . -- -property:Configuration=Release -verbosity:minimal
|
||||
Release/pugixml-check.exe
|
26
.travis.yml
26
.travis.yml
|
@ -1,26 +0,0 @@
|
|||
language: cpp
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
- os: osx
|
||||
compiler: gcc
|
||||
|
||||
env:
|
||||
- DEFINES=standard
|
||||
- DEFINES=PUGIXML_WCHAR_MODE
|
||||
- DEFINES=PUGIXML_COMPACT
|
||||
- DEFINES=PUGIXML_NO_EXCEPTIONS
|
||||
script:
|
||||
- make test cxxstd=c++11 defines=$DEFINES config=coverage -j2
|
||||
- make test cxxstd=c++11 defines=$DEFINES config=release -j2
|
||||
- make test cxxstd=c++98 defines=$DEFINES config=debug -j2
|
||||
|
||||
after_success:
|
||||
- sed -e "s/#####\(.*\)\(\/\/ unreachable.*\)/ 1\1\2/" -i pugixml.cpp.gcov
|
||||
- bash <(curl -s https://codecov.io/bash) -f pugixml.cpp.gcov
|
312
CMakeLists.txt
312
CMakeLists.txt
|
@ -1,87 +1,263 @@
|
|||
cmake_minimum_required(VERSION 2.8.12)
|
||||
cmake_minimum_required(VERSION 3.4)
|
||||
project(pugixml VERSION 1.13 LANGUAGES CXX)
|
||||
|
||||
project(pugixml)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
|
||||
option(BUILD_TESTS "Build tests" OFF)
|
||||
option(BUILD_PKGCONFIG "Build in PKGCONFIG mode" OFF)
|
||||
|
||||
set(BUILD_DEFINES "" CACHE STRING "Build defines")
|
||||
|
||||
if(MSVC)
|
||||
option(STATIC_CRT "Use static CRT libraries" OFF)
|
||||
|
||||
# Rewrite command line flags to use /MT if necessary
|
||||
if(STATIC_CRT)
|
||||
foreach(flag_var
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
if(${flag_var} MATCHES "/MD")
|
||||
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
endif(${flag_var} MATCHES "/MD")
|
||||
endforeach(flag_var)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Pre-defines standard install locations on *nix systems.
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(CMakeDependentOption)
|
||||
include(GNUInstallDirs)
|
||||
mark_as_advanced(CLEAR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR)
|
||||
include(CTest)
|
||||
|
||||
set(HEADERS src/pugixml.hpp src/pugiconfig.hpp)
|
||||
set(SOURCES src/pugixml.cpp)
|
||||
cmake_dependent_option(PUGIXML_USE_VERSIONED_LIBDIR
|
||||
"Use a private subdirectory to install the headers and libraries" OFF
|
||||
"CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
|
||||
|
||||
if(DEFINED BUILD_DEFINES)
|
||||
foreach(DEFINE ${BUILD_DEFINES})
|
||||
add_definitions("-D" ${DEFINE})
|
||||
endforeach()
|
||||
cmake_dependent_option(PUGIXML_USE_POSTFIX
|
||||
"Use separate postfix for each configuration to make sure you can install multiple build outputs" OFF
|
||||
"CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
|
||||
|
||||
cmake_dependent_option(PUGIXML_STATIC_CRT
|
||||
"Use static MSVC RT libraries" OFF
|
||||
"MSVC" OFF)
|
||||
|
||||
cmake_dependent_option(PUGIXML_BUILD_TESTS
|
||||
"Build pugixml tests" OFF
|
||||
"BUILD_TESTING;CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
|
||||
|
||||
# Custom build defines
|
||||
set(PUGIXML_BUILD_DEFINES CACHE STRING "Build defines for custom options")
|
||||
separate_arguments(PUGIXML_BUILD_DEFINES)
|
||||
|
||||
# Technically not needed for this file. This is builtin CMAKE global variable.
|
||||
option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
|
||||
|
||||
# Expose option to build PUGIXML as static as well when the global BUILD_SHARED_LIBS variable is set
|
||||
cmake_dependent_option(PUGIXML_BUILD_SHARED_AND_STATIC_LIBS
|
||||
"Build both shared and static libraries" OFF
|
||||
"BUILD_SHARED_LIBS" OFF)
|
||||
|
||||
# Expose options from the pugiconfig.hpp
|
||||
option(PUGIXML_WCHAR_MODE "Enable wchar_t mode" OFF)
|
||||
option(PUGIXML_COMPACT "Enable compact mode" OFF)
|
||||
|
||||
# Advanced options from pugiconfig.hpp
|
||||
option(PUGIXML_NO_XPATH "Disable XPath" OFF)
|
||||
option(PUGIXML_NO_STL "Disable STL" OFF)
|
||||
option(PUGIXML_NO_EXCEPTIONS "Disable Exceptions" OFF)
|
||||
mark_as_advanced(PUGIXML_NO_XPATH PUGIXML_NO_STL PUGIXML_NO_EXCEPTIONS)
|
||||
|
||||
# Policy configuration
|
||||
if(POLICY CMP0091)
|
||||
cmake_policy(SET CMP0091 NEW) # Enables use of MSVC_RUNTIME_LIBRARY
|
||||
endif()
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_library(pugixml SHARED ${HEADERS} ${SOURCES})
|
||||
set(PUGIXML_PUBLIC_DEFINITIONS
|
||||
$<$<BOOL:${PUGIXML_WCHAR_MODE}>:PUGIXML_WCHAR_MODE>
|
||||
$<$<BOOL:${PUGIXML_COMPACT}>:PUGIXML_COMPACT>
|
||||
$<$<BOOL:${PUGIXML_NO_XPATH}>:PUGIXML_NO_XPATH>
|
||||
$<$<BOOL:${PUGIXML_NO_STL}>:PUGIXML_NO_STL>
|
||||
$<$<BOOL:${PUGIXML_NO_EXCEPTIONS}>:PUGIXML_NO_EXCEPTIONS>)
|
||||
|
||||
# This is used to backport a CMake 3.15 feature, but is also forwards compatible
|
||||
if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY
|
||||
MultiThreaded$<$<CONFIG:Debug>:Debug>$<$<NOT:$<BOOL:${PUGIXML_STATIC_CRT}>>:DLL>)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
|
||||
if (PUGIXML_USE_POSTFIX)
|
||||
set(CMAKE_RELWITHDEBINFO_POSTFIX _r)
|
||||
set(CMAKE_MINSIZEREL_POSTFIX _m)
|
||||
set(CMAKE_DEBUG_POSTFIX _d)
|
||||
endif()
|
||||
|
||||
if (CMAKE_VERSION VERSION_LESS 3.15)
|
||||
set(msvc-rt $<TARGET_PROPERTY:MSVC_RUNTIME_LIBRARY>)
|
||||
|
||||
set(msvc-rt-mtd-shared $<STREQUAL:${msvc-rt},MultiThreadedDebugDLL>)
|
||||
set(msvc-rt-mtd-static $<STREQUAL:${msvc-rt},MultiThreadedDebug>)
|
||||
set(msvc-rt-mt-shared $<STREQUAL:${msvc-rt},MultiThreadedDLL>)
|
||||
set(msvc-rt-mt-static $<STREQUAL:${msvc-rt},MultiThreaded>)
|
||||
unset(msvc-rt)
|
||||
|
||||
set(msvc-rt-mtd-shared $<${msvc-rt-mtd-shared}:-MDd>)
|
||||
set(msvc-rt-mtd-static $<${msvc-rt-mtd-static}:-MTd>)
|
||||
set(msvc-rt-mt-shared $<${msvc-rt-mt-shared}:-MD>)
|
||||
set(msvc-rt-mt-static $<${msvc-rt-mt-static}:-MT>)
|
||||
endif()
|
||||
|
||||
set(versioned-dir $<$<BOOL:${PUGIXML_USE_VERSIONED_LIBDIR}>:/pugixml-${PROJECT_VERSION}>)
|
||||
|
||||
set(libs)
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
add_library(pugixml-shared SHARED
|
||||
${PROJECT_SOURCE_DIR}/scripts/pugixml_dll.rc
|
||||
${PROJECT_SOURCE_DIR}/src/pugixml.cpp)
|
||||
add_library(pugixml::shared ALIAS pugixml-shared)
|
||||
list(APPEND libs pugixml-shared)
|
||||
string(CONCAT pugixml.msvc $<OR:
|
||||
$<STREQUAL:${CMAKE_CXX_COMPILER_FRONTEND_VARIANT},MSVC>,
|
||||
$<CXX_COMPILER_ID:MSVC>
|
||||
>)
|
||||
|
||||
set_property(TARGET pugixml-shared PROPERTY EXPORT_NAME shared)
|
||||
target_include_directories(pugixml-shared
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
|
||||
target_compile_definitions(pugixml-shared
|
||||
PUBLIC
|
||||
${PUGIXML_BUILD_DEFINES}
|
||||
${PUGIXML_PUBLIC_DEFINITIONS}
|
||||
PRIVATE
|
||||
PUGIXML_API=$<IF:${pugixml.msvc},__declspec\(dllexport\),__attribute__\(\(visibility\("default"\)\)\)>
|
||||
)
|
||||
target_compile_options(pugixml-shared
|
||||
PRIVATE
|
||||
${msvc-rt-mtd-shared}
|
||||
${msvc-rt-mtd-static}
|
||||
${msvc-rt-mt-shared}
|
||||
${msvc-rt-mt-static})
|
||||
endif()
|
||||
|
||||
if (NOT BUILD_SHARED_LIBS OR PUGIXML_BUILD_SHARED_AND_STATIC_LIBS)
|
||||
add_library(pugixml-static STATIC
|
||||
${PROJECT_SOURCE_DIR}/src/pugixml.cpp)
|
||||
add_library(pugixml::static ALIAS pugixml-static)
|
||||
list(APPEND libs pugixml-static)
|
||||
|
||||
set_property(TARGET pugixml-static PROPERTY EXPORT_NAME static)
|
||||
target_include_directories(pugixml-static
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>)
|
||||
target_compile_definitions(pugixml-static
|
||||
PUBLIC
|
||||
${PUGIXML_BUILD_DEFINES}
|
||||
${PUGIXML_PUBLIC_DEFINITIONS})
|
||||
target_compile_options(pugixml-static
|
||||
PRIVATE
|
||||
${msvc-rt-mtd-shared}
|
||||
${msvc-rt-mtd-static}
|
||||
${msvc-rt-mt-shared}
|
||||
${msvc-rt-mt-static})
|
||||
endif()
|
||||
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(pugixml-alias pugixml-shared)
|
||||
else()
|
||||
add_library(pugixml STATIC ${HEADERS} ${SOURCES})
|
||||
set(pugixml-alias pugixml-static)
|
||||
endif()
|
||||
add_library(pugixml INTERFACE)
|
||||
target_link_libraries(pugixml INTERFACE ${pugixml-alias})
|
||||
add_library(pugixml::pugixml ALIAS pugixml)
|
||||
|
||||
set_target_properties(${libs}
|
||||
PROPERTIES
|
||||
MSVC_RUNTIME_LIBRARY ${CMAKE_MSVC_RUNTIME_LIBRARY}
|
||||
EXCLUDE_FROM_ALL ON
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
OUTPUT_NAME pugixml)
|
||||
|
||||
set_target_properties(${libs}
|
||||
PROPERTIES
|
||||
EXCLUDE_FROM_ALL OFF)
|
||||
set(install-targets pugixml ${libs})
|
||||
|
||||
configure_package_config_file(
|
||||
"${PROJECT_SOURCE_DIR}/scripts/pugixml-config.cmake.in"
|
||||
"${PROJECT_BINARY_DIR}/pugixml-config.cmake"
|
||||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
||||
NO_SET_AND_CHECK_MACRO)
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${PROJECT_BINARY_DIR}/pugixml-config-version.cmake"
|
||||
COMPATIBILITY SameMajorVersion)
|
||||
|
||||
if (PUGIXML_USE_POSTFIX)
|
||||
if(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
|
||||
set(LIB_POSTFIX ${CMAKE_RELWITHDEBINFO_POSTFIX})
|
||||
elseif(CMAKE_BUILD_TYPE MATCHES MinSizeRel)
|
||||
set(LIB_POSTFIX ${CMAKE_MINSIZEREL_POSTFIX})
|
||||
elseif(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(LIB_POSTFIX ${CMAKE_DEBUG_POSTFIX})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Export symbols for shared library builds
|
||||
if(BUILD_SHARED_LIBS AND MSVC)
|
||||
target_compile_definitions(pugixml PRIVATE "PUGIXML_API=__declspec(dllexport)")
|
||||
configure_file(scripts/pugixml.pc.in pugixml.pc @ONLY)
|
||||
|
||||
if (NOT DEFINED PUGIXML_RUNTIME_COMPONENT)
|
||||
set(PUGIXML_RUNTIME_COMPONENT Runtime)
|
||||
endif()
|
||||
|
||||
# Enable C++11 long long for compilers that are capable of it
|
||||
if(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} STRLESS 3.1 AND ";${CMAKE_CXX_COMPILE_FEATURES};" MATCHES ";cxx_long_long_type;")
|
||||
target_compile_features(pugixml PUBLIC cxx_long_long_type)
|
||||
if (NOT DEFINED PUGIXML_LIBRARY_COMPONENT)
|
||||
set(PUGIXML_LIBRARY_COMPONENT Library)
|
||||
endif()
|
||||
|
||||
set_target_properties(pugixml PROPERTIES VERSION 1.9 SOVERSION 1)
|
||||
get_target_property(PUGIXML_VERSION_STRING pugixml VERSION)
|
||||
|
||||
if(BUILD_PKGCONFIG)
|
||||
# Install library into its own directory under LIBDIR
|
||||
set(INSTALL_SUFFIX /pugixml-${PUGIXML_VERSION_STRING})
|
||||
if (NOT DEFINED PUGIXML_DEVELOPMENT_COMPONENT)
|
||||
set(PUGIXML_DEVELOPMENT_COMPONENT Development)
|
||||
endif()
|
||||
|
||||
target_include_directories(pugixml PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}${INSTALL_SUFFIX}>)
|
||||
|
||||
install(TARGETS pugixml EXPORT pugixml-config
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${INSTALL_SUFFIX}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${INSTALL_SUFFIX}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${INSTALL_SUFFIX})
|
||||
install(EXPORT pugixml-config DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml)
|
||||
|
||||
if(BUILD_PKGCONFIG)
|
||||
configure_file(scripts/pugixml.pc.in ${PROJECT_BINARY_DIR}/pugixml.pc @ONLY)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/pugixml.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
|
||||
set(namelink-component)
|
||||
if (NOT CMAKE_VERSION VERSION_LESS 3.12)
|
||||
set(namelink-component NAMELINK_COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
|
||||
endif()
|
||||
install(TARGETS ${install-targets}
|
||||
EXPORT pugixml-targets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${PUGIXML_RUNTIME_COMPONENT}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${PUGIXML_LIBRARY_COMPONENT} ${namelink-component}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${versioned-dir})
|
||||
|
||||
if(BUILD_TESTS)
|
||||
file(GLOB TEST_SOURCES tests/*.cpp)
|
||||
file(GLOB FUZZ_SOURCES tests/fuzz_*.cpp)
|
||||
list(REMOVE_ITEM TEST_SOURCES ${FUZZ_SOURCES})
|
||||
install(EXPORT pugixml-targets
|
||||
NAMESPACE pugixml::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
|
||||
|
||||
add_executable(check ${TEST_SOURCES})
|
||||
target_link_libraries(check pugixml)
|
||||
add_custom_command(TARGET check POST_BUILD COMMAND check WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
export(EXPORT pugixml-targets
|
||||
NAMESPACE pugixml::)
|
||||
|
||||
install(FILES
|
||||
"${PROJECT_BINARY_DIR}/pugixml-config-version.cmake"
|
||||
"${PROJECT_BINARY_DIR}/pugixml-config.cmake"
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
|
||||
|
||||
install(FILES ${PROJECT_BINARY_DIR}/pugixml.pc
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
|
||||
|
||||
install(
|
||||
FILES
|
||||
"${PROJECT_SOURCE_DIR}/src/pugiconfig.hpp"
|
||||
"${PROJECT_SOURCE_DIR}/src/pugixml.hpp"
|
||||
DESTINATION
|
||||
${CMAKE_INSTALL_INCLUDEDIR}${versioned-dir} COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
|
||||
|
||||
if (PUGIXML_BUILD_TESTS)
|
||||
set(fuzz-pattern "tests/fuzz_*.cpp")
|
||||
set(test-pattern "tests/*.cpp")
|
||||
if (CMAKE_VERSION VERSION_GREATER 3.11)
|
||||
list(INSERT fuzz-pattern 0 CONFIGURE_DEPENDS)
|
||||
list(INSERT test-pattern 0 CONFIGURE_DEPENDS)
|
||||
endif()
|
||||
file(GLOB test-sources ${test-pattern})
|
||||
file(GLOB fuzz-sources ${fuzz-pattern})
|
||||
list(REMOVE_ITEM test-sources ${fuzz-sources})
|
||||
|
||||
add_custom_target(check
|
||||
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
|
||||
|
||||
add_executable(pugixml-check ${test-sources})
|
||||
add_test(NAME pugixml::test
|
||||
COMMAND pugixml-check
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
|
||||
add_dependencies(check pugixml-check)
|
||||
target_link_libraries(pugixml-check
|
||||
PRIVATE
|
||||
pugixml::pugixml)
|
||||
endif()
|
||||
|
|
24
LICENSE.md
Normal file
24
LICENSE.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
9
Makefile
9
Makefile
|
@ -12,9 +12,9 @@ SOURCES=src/pugixml.cpp $(filter-out tests/fuzz_%,$(wildcard tests/*.cpp))
|
|||
EXECUTABLE=$(BUILD)/test
|
||||
|
||||
VERSION=$(shell sed -n 's/.*version \(.*\).*/\1/p' src/pugiconfig.hpp)
|
||||
RELEASE=$(filter-out scripts/archive.py docs/%.adoc,$(shell git ls-files contrib docs scripts src CMakeLists.txt readme.txt))
|
||||
RELEASE=$(filter-out scripts/archive.py docs/%.adoc,$(shell git ls-files docs scripts src CMakeLists.txt LICENSE.md readme.txt))
|
||||
|
||||
CXXFLAGS=-g -Wall -Wextra -Werror -pedantic -Wundef -Wshadow -Wcast-align -Wcast-qual -Wold-style-cast
|
||||
CXXFLAGS=-g -Wall -Wextra -Werror -pedantic -Wundef -Wshadow -Wcast-align -Wcast-qual -Wold-style-cast -Wdouble-promotion
|
||||
LDFLAGS=
|
||||
|
||||
ifeq ($(config),release)
|
||||
|
@ -27,7 +27,7 @@ ifeq ($(config),coverage)
|
|||
endif
|
||||
|
||||
ifeq ($(config),sanitize)
|
||||
CXXFLAGS+=-fsanitize=address,undefined
|
||||
CXXFLAGS+=-fsanitize=address,undefined -fno-sanitize=float-divide-by-zero,float-cast-overflow -fno-sanitize-recover=all
|
||||
LDFLAGS+=-fsanitize=address,undefined
|
||||
endif
|
||||
|
||||
|
@ -58,6 +58,7 @@ test: $(EXECUTABLE)
|
|||
./$(EXECUTABLE)
|
||||
@gcov -b -o $(BUILD)/src/ pugixml.cpp.gcda | sed -e '/./{H;$!d;}' -e 'x;/pugixml.cpp/!d;'
|
||||
@find . -name '*.gcov' -and -not -name 'pugixml.cpp.gcov' -exec rm {} +
|
||||
@sed -i -e "s/#####\(.*\)\(\/\/ unreachable.*\)/ 1\1\2/" pugixml.cpp.gcov
|
||||
else
|
||||
test: $(EXECUTABLE)
|
||||
./$(EXECUTABLE)
|
||||
|
@ -76,7 +77,7 @@ docs: docs/quickstart.html docs/manual.html
|
|||
|
||||
build/pugixml-%: .FORCE | $(RELEASE)
|
||||
@mkdir -p $(BUILD)
|
||||
TIMESTAMP=`git show v$(VERSION) -s --format=%ct` && python scripts/archive.py $@ pugixml-$(VERSION) $$TIMESTAMP $|
|
||||
TIMESTAMP=`git show v$(VERSION) -s --format=%ct` && python3 scripts/archive.py $@ pugixml-$(VERSION) $$TIMESTAMP $|
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS)
|
||||
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
|
|
80
README.md
80
README.md
|
@ -1,4 +1,4 @@
|
|||
pugixml [](https://travis-ci.org/zeux/pugixml) [](https://ci.appveyor.com/project/zeux/pugixml) [](https://codecov.io/github/zeux/pugixml?branch=master) 
|
||||
pugixml [](https://github.com/zeux/pugixml/actions) [](https://ci.appveyor.com/project/zeux/pugixml) [](https://codecov.io/github/zeux/pugixml?branch=master) 
|
||||
=======
|
||||
|
||||
pugixml is a C++ XML processing library, which consists of a DOM-like interface with rich traversal/modification
|
||||
|
@ -12,33 +12,61 @@ pugixml is used by a lot of projects, both open-source and proprietary, for perf
|
|||
|
||||
Documentation for the current release of pugixml is available on-line as two separate documents:
|
||||
|
||||
* [Quick-start guide](http://pugixml.org/docs/quickstart.html), that aims to provide enough information to start using the library;
|
||||
* [Complete reference manual](http://pugixml.org/docs/manual.html), that describes all features of the library in detail.
|
||||
* [Quick-start guide](https://pugixml.org/docs/quickstart.html), that aims to provide enough information to start using the library;
|
||||
* [Complete reference manual](https://pugixml.org/docs/manual.html), that describes all features of the library in detail.
|
||||
|
||||
You’re advised to start with the quick-start guide; however, many important library features are either not described in it at all or only mentioned briefly; if you require more information you should read the complete manual.
|
||||
|
||||
## Example
|
||||
|
||||
Here's an example of how code using pugixml looks; it opens an XML file, goes over all Tool nodes and prints tools that have a Timeout attribute greater than 0:
|
||||
|
||||
```c++
|
||||
#include "pugixml.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
pugi::xml_document doc;
|
||||
pugi::xml_parse_result result = doc.load_file("xgconsole.xml");
|
||||
if (!result)
|
||||
return -1;
|
||||
|
||||
for (pugi::xml_node tool: doc.child("Profile").child("Tools").children("Tool"))
|
||||
{
|
||||
int timeout = tool.attribute("Timeout").as_int();
|
||||
|
||||
if (timeout > 0)
|
||||
std::cout << "Tool " << tool.attribute("Filename").value() << " has timeout " << timeout << "\n";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
And the same example using XPath:
|
||||
|
||||
```c++
|
||||
#include "pugixml.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
pugi::xml_document doc;
|
||||
pugi::xml_parse_result result = doc.load_file("xgconsole.xml");
|
||||
if (!result)
|
||||
return -1;
|
||||
|
||||
pugi::xpath_node_set tools_with_timeout = doc.select_nodes("/Profile/Tools/Tool[@Timeout > 0]");
|
||||
|
||||
for (pugi::xpath_node node: tools_with_timeout)
|
||||
{
|
||||
pugi::xml_node tool = node.node();
|
||||
std::cout << "Tool " << tool.attribute("Filename").value() <<
|
||||
" has timeout " << tool.attribute("Timeout").as_int() << "\n";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
This library is available to anybody free of charge, under the terms of MIT License:
|
||||
|
||||
Copyright (c) 2006-2018 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
This library is available to anybody free of charge, under the terms of MIT License (see LICENSE.md).
|
||||
|
|
9
SECURITY.md
Normal file
9
SECURITY.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Please verify that the vulnerabilities reported can be reproduced on the [latest released version](https://github.com/zeux/pugixml/releases).
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
Vulnerabilities can be reported via e-mail to the [project maintainer](https://github.com/zeux).
|
14
appveyor.yml
14
appveyor.yml
|
@ -1,15 +1,25 @@
|
|||
image:
|
||||
- Visual Studio 2015
|
||||
- Visual Studio 2022
|
||||
- Visual Studio 2019
|
||||
- Visual Studio 2017
|
||||
- Visual Studio 2015
|
||||
|
||||
version: "{branch}-{build}"
|
||||
|
||||
build_script:
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017") { .\scripts\nuget_build.ps1 }
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2013") { .\scripts\nuget_build.ps1 2013}
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { .\scripts\nuget_build.ps1 2015}
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017") { .\scripts\nuget_build.ps1 2017}
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2019") { .\scripts\nuget_build.ps1 2019}
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2022") { .\scripts\nuget_build.ps1 2022}
|
||||
|
||||
test_script:
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { .\tests\autotest-appveyor.ps1 9 10 11 12 14 }
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017") { .\tests\autotest-appveyor.ps1 15 }
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2019") { .\tests\autotest-appveyor.ps1 19 }
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2022") { .\tests\autotest-appveyor.ps1 22 }
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { & C:\cygwin\bin\bash.exe -c "PATH=/usr/bin:/usr/local/bin:$PATH; make config=coverage test && bash <(curl -s https://codecov.io/bash) -f pugixml.cpp.gcov 2>&1" }
|
||||
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { & C:\cygwin\bin\bash.exe -c "PATH=/usr/bin:/usr/local/bin:$PATH; make config=coverage defines=PUGIXML_WCHAR_MODE test && bash <(curl -s https://codecov.io/bash) -f pugixml.cpp.gcov 2>&1" }
|
||||
|
||||
artifacts:
|
||||
- path: .\scripts\*.nupkg
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* Boost.Foreach support for pugixml classes.
|
||||
* This file is provided to the public domain.
|
||||
* Written by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
*/
|
||||
|
||||
#ifndef HEADER_PUGIXML_FOREACH_HPP
|
||||
#define HEADER_PUGIXML_FOREACH_HPP
|
||||
|
||||
#include <boost/range/iterator.hpp>
|
||||
|
||||
#include "pugixml.hpp"
|
||||
|
||||
/*
|
||||
* These types add support for BOOST_FOREACH macro to xml_node and xml_document classes (child iteration only).
|
||||
* Example usage:
|
||||
* BOOST_FOREACH(xml_node n, doc) {}
|
||||
*/
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<> struct range_mutable_iterator<pugi::xml_node>
|
||||
{
|
||||
typedef pugi::xml_node::iterator type;
|
||||
};
|
||||
|
||||
template<> struct range_const_iterator<pugi::xml_node>
|
||||
{
|
||||
typedef pugi::xml_node::iterator type;
|
||||
};
|
||||
|
||||
template<> struct range_mutable_iterator<pugi::xml_document>
|
||||
{
|
||||
typedef pugi::xml_document::iterator type;
|
||||
};
|
||||
|
||||
template<> struct range_const_iterator<pugi::xml_document>
|
||||
{
|
||||
typedef pugi::xml_document::iterator type;
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* These types add support for BOOST_FOREACH macro to xml_node and xml_document classes (child/attribute iteration).
|
||||
* Example usage:
|
||||
* BOOST_FOREACH(xml_node n, children(doc)) {}
|
||||
* BOOST_FOREACH(xml_node n, attributes(doc)) {}
|
||||
*/
|
||||
|
||||
namespace pugi
|
||||
{
|
||||
inline xml_object_range<xml_node_iterator> children(const pugi::xml_node& node)
|
||||
{
|
||||
return node.children();
|
||||
}
|
||||
|
||||
inline xml_object_range<xml_attribute_iterator> attributes(const pugi::xml_node& node)
|
||||
{
|
||||
return node.attributes();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,7 +1,7 @@
|
|||
website <http://pugixml.org>; repository <http://github.com/zeux/pugixml>
|
||||
website <https://pugixml.org>; repository <https://github.com/zeux/pugixml>
|
||||
:toc: right
|
||||
:source-highlighter: pygments
|
||||
:source-language: c++
|
||||
:sectanchors:
|
||||
:sectlinks:
|
||||
:imagesdir: images
|
||||
:imagesdir: images
|
||||
|
|
181
docs/manual.adoc
181
docs/manual.adoc
|
@ -8,7 +8,7 @@ include::config.adoc[]
|
|||
[[overview.introduction]]
|
||||
=== Introduction
|
||||
|
||||
http://pugixml.org/[pugixml] is a light-weight C{plus}{plus} XML processing library. It consists of a DOM-like interface with rich traversal/modification capabilities, an extremely fast XML parser which constructs the DOM tree from an XML file/buffer, and an <<xpath,XPath 1.0 implementation>> for complex data-driven tree queries. Full Unicode support is also available, with <<dom.unicode,two Unicode interface variants>> and conversions between different Unicode encodings (which happen automatically during parsing/saving). The library is <<install.portability,extremely portable>> and easy to integrate and use. pugixml is developed and maintained since 2006 and has many users. All code is distributed under the <<overview.license,MIT license>>, making it completely free to use in both open-source and proprietary applications.
|
||||
https://pugixml.org/[pugixml] is a light-weight C{plus}{plus} XML processing library. It consists of a DOM-like interface with rich traversal/modification capabilities, an extremely fast XML parser which constructs the DOM tree from an XML file/buffer, and an <<xpath,XPath 1.0 implementation>> for complex data-driven tree queries. Full Unicode support is also available, with <<dom.unicode,two Unicode interface variants>> and conversions between different Unicode encodings (which happen automatically during parsing/saving). The library is <<install.portability,extremely portable>> and easy to integrate and use. pugixml is developed and maintained since 2006 and has many users. All code is distributed under the <<overview.license,MIT license>>, making it completely free to use in both open-source and proprietary applications.
|
||||
|
||||
pugixml enables very fast, convenient and memory-efficient XML document processing. However, since pugixml has a DOM parser, it can't process XML documents that do not fit in memory; also the parser is a non-validating one, so if you need DTD or XML Schema validation, the library is not for you.
|
||||
|
||||
|
@ -46,7 +46,7 @@ Thanks to *Vyacheslav Egorov* for documentation proofreading and fuzz testing.
|
|||
The pugixml library is distributed under the MIT license:
|
||||
|
||||
....
|
||||
Copyright (c) 2006-2018 Arseny Kapoulkine
|
||||
Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
@ -73,8 +73,8 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|||
This means that you can freely use pugixml in your applications, both open-source and proprietary. If you use pugixml in a product, it is sufficient to add an acknowledgment like this to the product distribution:
|
||||
|
||||
....
|
||||
This software is based on pugixml library (http://pugixml.org).
|
||||
pugixml is Copyright (C) 2006-2018 Arseny Kapoulkine.
|
||||
This software is based on pugixml library (https://pugixml.org).
|
||||
pugixml is Copyright (C) 2006-2022 Arseny Kapoulkine.
|
||||
....
|
||||
|
||||
[[install]]
|
||||
|
@ -148,7 +148,7 @@ The complete pugixml source consists of three files - one source file, `pugixml.
|
|||
[[install.building.embed]]
|
||||
==== Building pugixml as a part of another static library/executable
|
||||
|
||||
The easiest way to build pugixml is to compile the source file, `pugixml.cpp`, along with the existing library/executable. This process depends on the method of building your application; for example, if you're using Microsoft Visual Studio footnote:[All trademarks used are properties of their respective owners.], Apple Xcode, Code::Blocks or any other IDE, just add `pugixml.cpp` to one of your projects.
|
||||
The easiest way to build pugixml is to compile the source file, `pugixml.cpp`, along with the existing library/executable. This process depends on the method of building your application; for example, if you're using Microsoft Visual Studio footnote:[All trademarks used are properties of their respective owners.], Apple Xcode, Code::Blocks or any other IDE, just *add `pugixml.cpp` to one of your projects*.
|
||||
|
||||
If you're using Microsoft Visual Studio and the project has precompiled headers turned on, you'll see the following error messages:
|
||||
|
||||
|
@ -270,7 +270,7 @@ The XML document is represented with a tree data structure. The root of the tree
|
|||
[[xml_node_type]]
|
||||
The tree nodes can be of one of the following types (which together form the enumeration `xml_node_type`):
|
||||
|
||||
* Document node ([[node_document]]`node_document`) - this is the root of the tree, which consists of several child nodes. This node corresponds to <<xml_document,xml_document>> class; note that <<xml_document,xml_document>> is a sub-class of <<xml_node,xml_node>>, so the entire node interface is also available. However, document node is special in several ways, which are covered below. There can be only one document node in the tree; document node does not have any XML representation.
|
||||
* Document node ([[node_document]]`node_document`) - this is the root of the tree, which consists of several child nodes. This node corresponds to <<xml_document,xml_document>> class; note that <<xml_document,xml_document>> is a sub-class of <<xml_node,xml_node>>, so the entire node interface is also available. However, document node is special in several ways, which are covered below. There can be only one document node in the tree; document node does not have any XML representation. Document generally has one child element node (see [[xml_document::document_element]]`document_element()`), although documents parsed from XML fragments (see [[parse_fragment]]`parse_fragment`) can have more than one.
|
||||
|
||||
* Element/tag node ([[node_element]]`node_element`) - this is the most common type of node, which represents XML elements. Element nodes have a name, a collection of attributes and a collection of child nodes (both of which may be empty). The attribute is a simple name/value pair. The example XML representation of element nodes is as follows:
|
||||
+
|
||||
|
@ -380,7 +380,7 @@ There is a special value of `xml_node` type, known as null node or empty node (s
|
|||
Both `xml_node` and `xml_attribute` have the default constructor which initializes them to null objects.
|
||||
|
||||
[[xml_attribute::comparison]][[xml_node::comparison]]
|
||||
`xml_node` and `xml_attribute` try to behave like pointers, that is, they can be compared with other objects of the same type, making it possible to use them as keys in associative containers. All handles to the same underlying object are equal, and any two handles to different underlying objects are not equal. Null handles only compare as equal to themselves. The result of relational comparison can not be reliably determined from the order of nodes in file or in any other way. Do not use relational comparison operators except for search optimization (i.e. associative container keys).
|
||||
`xml_node` and `xml_attribute` try to behave like pointers, that is, they can be compared with other objects of the same type, making it possible to use them as keys in associative containers. All handles to the same underlying object are equal, and any two handles to different underlying objects are not equal. Null handles only compare as equal to null handles. The result of relational comparison can not be reliably determined from the order of nodes in file or in any other way. Do not use relational comparison operators except for search optimization (i.e. associative container keys).
|
||||
|
||||
[[xml_attribute::hash_value]][[xml_node::hash_value]]
|
||||
If you want to use `xml_node` or `xml_attribute` objects as keys in hash-based associative containers, you can use the `hash_value` member functions. They return the hash values that are guaranteed to be the same for all handles to the same underlying object. The hash value for null handles is 0. Note that hash value does not depend on the content of the node, only on the location of the underlying structure in memory - this means that loading the same document twice will likely produce different hash values, and copying the node will not preserve the hash.
|
||||
|
@ -749,7 +749,7 @@ These flags control the resulting tree contents:
|
|||
* [[parse_embed_pcdata]]`parse_embed_pcdata` determines if PCDATA contents is to be saved as element values. Normally element nodes have names but not values; this flag forces the parser to store the contents as a value if PCDATA is the first child of the element node (otherwise PCDATA node is created as usual). This can significantly reduce the memory required for documents with many PCDATA nodes. To retrieve the data you can use `xml_node::value()` on the element nodes or any of the higher-level functions like `child_value` or `text`. This flag is *off* by default.
|
||||
Since this flag significantly changes the DOM structure it is only recommended for parsing documents with many PCDATA nodes in memory-constrained environments. This flag is *off* by default.
|
||||
|
||||
* [[parse_fragment]]`parse_fragment` determines if document should be treated as a fragment of a valid XML. Parsing document as a fragment leads to top-level PCDATA content (i.e. text that is not located inside a node) to be added to a tree, and additionally treats documents without element nodes as valid. This flag is *off* by default.
|
||||
* [[parse_fragment]]`parse_fragment` determines if document should be treated as a fragment of a valid XML. Parsing document as a fragment leads to top-level PCDATA content (i.e. text that is not located inside a node) to be added to a tree, and additionally treats documents without element nodes as valid and permits multiple top-level element nodes. This flag is *off* by default.
|
||||
|
||||
CAUTION: Using in-place parsing (<<xml_document::load_buffer_inplace,load_buffer_inplace>>) with `parse_fragment` flag may result in the loss of the last character of the buffer if it is a part of PCDATA. Since PCDATA values are null-terminated strings, the only way to resolve this is to provide a null-terminated buffer as an input to `load_buffer_inplace` - i.e. `doc.load_buffer_inplace("test\0", 5, pugi::parse_default | pugi::parse_fragment)`.
|
||||
|
||||
|
@ -818,6 +818,7 @@ As for rejecting invalid XML documents, there are a number of incompatibilities
|
|||
* XML data is not required to begin with document declaration; additionally, document declaration can appear after comments and other nodes.
|
||||
* Invalid document type declarations are silently ignored in some cases.
|
||||
* Unicode validation is not performed so invalid UTF sequences are not rejected.
|
||||
* Document can contain multiple top-level element nodes.
|
||||
|
||||
[[access]]
|
||||
== Accessing document data
|
||||
|
@ -968,6 +969,28 @@ xml_node xml_node::previous_sibling(const char_t* name) const;
|
|||
for (pugi::xml_node tool = tools.child("Tool"); tool; tool = tool.next_sibling("Tool"))
|
||||
----
|
||||
|
||||
[[xml_node::attribute_hinted]]
|
||||
`attribute` function needs to look for the target attribute by name. If a node has many attributes, finding each by name can be time consuming. If you have an idea of how attributes are ordered in the node, you can use a faster function:
|
||||
|
||||
[source]
|
||||
----
|
||||
xml_attribute xml_node::attribute(const char_t* name, xml_attribute& hint) const;
|
||||
----
|
||||
|
||||
The extra `hint` argument is used to guess where the attribute might be, and is updated to the location of the next attribute so that if you search for multiple attributes in the right order, the performance is maximized. Note that `hint` has to be either null or has to belong to the node, otherwise the behavior is undefined.
|
||||
|
||||
You can use this function as follows:
|
||||
|
||||
[source]
|
||||
----
|
||||
xml_attribute hint;
|
||||
xml_attribute id = node.attribute("id", hint);
|
||||
xml_attribute name = node.attribute("name", hint);
|
||||
xml_attribute version = node.attribute("version", hint);
|
||||
----
|
||||
|
||||
This code is correct regardless of the order of the attributes, but it's faster if `"id"`, `"name"` and `"version"` occur in that order.
|
||||
|
||||
[[xml_node::find_child_by_attribute]]
|
||||
Occasionally the needed node is specified not by the unique name but instead by the value of some attribute; for example, it is common to have node collections with each node having a unique id: `<group><item id="1"/> <item id="2"/></group>`. There are two functions for finding child nodes based on the attribute values:
|
||||
|
||||
|
@ -1010,6 +1033,13 @@ This is an example of using these functions (link:samples/traverse_rangefor.cpp[
|
|||
include::samples/traverse_rangefor.cpp[tags=code]
|
||||
----
|
||||
|
||||
While using `children()` makes the intent of the code clear, note that each node can be treated as a container of child nodes, since it provides `begin()`/`end()` member functions described in the next section. Because of this, you can iterate through node's children simply by using the node itself:
|
||||
|
||||
[source]
|
||||
----
|
||||
for (pugi::xml_node child: tool)
|
||||
----
|
||||
|
||||
[[access.iterators]]
|
||||
=== Traversing node/attribute lists via iterators
|
||||
|
||||
|
@ -1246,6 +1276,7 @@ As discussed before, nodes can have name and value, both of which are strings. D
|
|||
----
|
||||
bool xml_node::set_name(const char_t* rhs);
|
||||
bool xml_node::set_value(const char_t* rhs);
|
||||
bool xml_node::set_value(const char_t* rhs, size_t size);
|
||||
----
|
||||
|
||||
Both functions try to set the name/value to the specified string, and return the operation result. The operation fails if the node can not have name or value (for instance, when trying to call `set_name` on a <<node_pcdata,node_pcdata>> node), if the node handle is null, or if there is insufficient memory to handle the request. The provided string is copied into document managed memory and can be destroyed after the function returns (for example, you can safely pass stack-allocated buffers to these functions). The name/value content is not verified, so take care to use only valid XML names, or the document may become malformed.
|
||||
|
@ -1267,6 +1298,7 @@ All attributes have name and value, both of which are strings (value may be empt
|
|||
----
|
||||
bool xml_attribute::set_name(const char_t* rhs);
|
||||
bool xml_attribute::set_value(const char_t* rhs);
|
||||
bool xml_attribute::set_value(const char_t* rhs, size_t size);
|
||||
----
|
||||
|
||||
Both functions try to set the name/value to the specified string, and return the operation result. The operation fails if the attribute handle is null, or if there is insufficient memory to handle the request. The provided string is copied into document managed memory and can be destroyed after the function returns (for example, you can safely pass stack-allocated buffers to these functions). The name/value content is not verified, so take care to use only valid XML names, or the document may become malformed.
|
||||
|
@ -1280,7 +1312,9 @@ bool xml_attribute::set_value(unsigned int rhs);
|
|||
bool xml_attribute::set_value(long rhs);
|
||||
bool xml_attribute::set_value(unsigned long rhs);
|
||||
bool xml_attribute::set_value(double rhs);
|
||||
bool xml_attribute::set_value(double rhs, int precision);
|
||||
bool xml_attribute::set_value(float rhs);
|
||||
bool xml_attribute::set_value(float rhs, int precision);
|
||||
bool xml_attribute::set_value(bool rhs);
|
||||
bool xml_attribute::set_value(long long rhs);
|
||||
bool xml_attribute::set_value(unsigned long long rhs);
|
||||
|
@ -1371,16 +1405,18 @@ include::samples/modify_add.cpp[tags=code]
|
|||
[[modify.remove]]
|
||||
=== Removing nodes/attributes
|
||||
|
||||
[[xml_node::remove_attribute]][[xml_node::remove_child]]
|
||||
[[xml_node::remove_attribute]][[xml_node::remove_attributes]][[xml_node::remove_child]][[xml_node::remove_children]]
|
||||
If you do not want your document to contain some node or attribute, you can remove it with one of the following functions:
|
||||
|
||||
[source]
|
||||
----
|
||||
bool xml_node::remove_attribute(const xml_attribute& a);
|
||||
bool xml_node::remove_attributes();
|
||||
bool xml_node::remove_child(const xml_node& n);
|
||||
bool xml_node::remove_children();
|
||||
----
|
||||
|
||||
`remove_attribute` removes the attribute from the attribute list of the node, and returns the operation result. `remove_child` removes the child node with the entire subtree (including all descendant nodes and attributes) from the document, and returns the operation result. Removing fails if one of the following is true:
|
||||
`remove_attribute` removes the attribute from the attribute list of the node, and returns the operation result. `remove_child` removes the child node with the entire subtree (including all descendant nodes and attributes) from the document, and returns the operation result. `remove_attributes` removes all the attributes of the node, and returns the operation result. `remove_children` removes all the child nodes of the node, and returns the operation result. Removing fails if one of the following is true:
|
||||
|
||||
* The node the function is called on is null;
|
||||
* The attribute/node to be removed is null;
|
||||
|
@ -1416,6 +1452,7 @@ Once you have an `xml_text` object, you can set the text contents using the foll
|
|||
[source]
|
||||
----
|
||||
bool xml_text::set(const char_t* rhs);
|
||||
bool xml_text::set(const char_t* rhs, size_t size);
|
||||
----
|
||||
|
||||
This function tries to set the contents to the specified string, and returns the operation result. The operation fails if the text object was retrieved from a node that can not have a value and is not an element node (i.e. it is a <<node_declaration,node_declaration>> node), if the text object is empty, or if there is insufficient memory to handle the request. The provided string is copied into document managed memory and can be destroyed after the function returns (for example, you can safely pass stack-allocated buffers to this function). Note that if the text object was retrieved from an element node, this function creates the PCDATA child node if necessary (i.e. if the element node does not have a PCDATA/CDATA child already).
|
||||
|
@ -1430,7 +1467,9 @@ bool xml_text::set(unsigned int rhs);
|
|||
bool xml_text::set(long rhs);
|
||||
bool xml_text::set(unsigned long rhs);
|
||||
bool xml_text::set(double rhs);
|
||||
bool xml_text::set(double rhs, int precision);
|
||||
bool xml_text::set(float rhs);
|
||||
bool xml_text::set(float rhs, int precision);
|
||||
bool xml_text::set(bool rhs);
|
||||
bool xml_text::set(long long rhs);
|
||||
bool xml_text::set(unsigned long long rhs);
|
||||
|
@ -1590,12 +1629,12 @@ bool xml_document::save_file(const char* path, const char_t* indent = "\t", unsi
|
|||
bool xml_document::save_file(const wchar_t* path, const char_t* indent = "\t", unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const;
|
||||
----
|
||||
|
||||
These functions accept file path as its first argument, and also three optional arguments, which specify indentation and other output options (see <<saving.options>>) and output data encoding (see <<saving.encoding>>). The path has the target operating system format, so it can be a relative or absolute one, it should have the delimiters of the target system, it should have the exact case if the target file system is case-sensitive, etc.
|
||||
These functions accept file path as its first argument, and also three optional arguments, which specify indentation and other output options (see <<saving.options>>) and output data encoding (see <<saving.encoding>>). The path has the target operating system format, so it can be a relative or absolute one, it should have the delimiters of the target system, it should have the exact case if the target file system is case-sensitive, etc. The functions return `true` on success and `false` if the file could not be opened or written to.
|
||||
|
||||
File path is passed to the system file opening function as is in case of the first function (which accepts `const char* path`); the second function either uses a special file opening function if it is provided by the runtime library or converts the path to UTF-8 and uses the system file opening function.
|
||||
|
||||
[[xml_writer_file]]
|
||||
`save_file` opens the target file for writing, outputs the requested header (by default a document declaration is output, unless the document already has one), and then saves the document contents. If the file could not be opened, the function returns `false`. Calling `save_file` is equivalent to creating an `xml_writer_file` object with `FILE*` handle as the only constructor argument and then calling `save`; see <<saving.writer>> for writer interface details.
|
||||
`save_file` opens the target file for writing, outputs the requested header (by default a document declaration is output, unless the document already has one), and then saves the document contents. Calling `save_file` is equivalent to creating an `xml_writer_file` object with `FILE*` handle as the only constructor argument and then calling `save`; see <<saving.writer>> for writer interface details.
|
||||
|
||||
This is a simple example of saving XML document to file (link:samples/save_file.cpp[]):
|
||||
|
||||
|
@ -1697,6 +1736,10 @@ These flags control the resulting tree contents:
|
|||
|
||||
* [[format_no_empty_element_tags]]`format_no_empty_element_tags` determines if start/end tags should be output instead of empty element tags for empty elements (that is, elements with no children). This flag is *off* by default.
|
||||
|
||||
* [[format_skip_control_chars]]`format_skip_control_chars` enables skipping characters belonging to range [0; 32) instead of "&#xNN;" encoding. This flag is *off* by default.
|
||||
|
||||
* [[format_attribute_single_quote]]`format_attribute_single_quote` enables using single quotes `'` instead of double quotes `"` for enclosing attribute values. This flag is *off* by default.
|
||||
|
||||
These flags control the additional output information:
|
||||
|
||||
* [[format_no_declaration]]`format_no_declaration` disables default node declaration output. By default, if the document is saved via `save` or `save_file` function, and it does not have any document declaration, a default declaration is output before the document contents. Enabling this flag disables this declaration. This flag has no effect in `xml_node::print` functions: they never output the default declaration. This flag is *off* by default.
|
||||
|
@ -2120,6 +2163,90 @@ Because of the differences in document object models, performance considerations
|
|||
|
||||
:!numbered:
|
||||
|
||||
[[v1.13]]
|
||||
=== v1.13 ^2022-11-01^
|
||||
|
||||
Maintenance release. Changes:
|
||||
|
||||
* Improvements:
|
||||
. `xml_attribute::set_value`, `xml_node::set_value` and `xml_text::set` now have overloads that accept pointer to non-null-terminated string and size
|
||||
. Improve performance of tree traversal when using compact mode (`PUGIXML_COMPACT`)
|
||||
|
||||
* Bug fixes:
|
||||
. Fix error handling in `xml_document::save_file` that could result in the function succeeding while running out of disk space
|
||||
. Fix memory leak during error handling of some out-of-memory conditions during `xml_document::load`
|
||||
|
||||
* Compatibility improvements:
|
||||
. Fix exported symbols in CMake DLL builds when using CMake
|
||||
. Fix exported symbols in CMake shared object builds when using -fvisibility=hidden
|
||||
|
||||
[[v1.12]]
|
||||
=== v1.12 ^2022-02-09^
|
||||
|
||||
Maintenance release. Changes:
|
||||
|
||||
* Bug fixes:
|
||||
. Fix a bug in xml_document move construction when the source of the move is empty
|
||||
. Fix const-correctness issues with iterator objects to support C++20 ranges
|
||||
|
||||
* XPath improvements:
|
||||
. Improved detection of overly complex queries that may result in stack overflow during parsing
|
||||
|
||||
* Compatibility improvements:
|
||||
. Fix Cygwin support for DLL builds
|
||||
. Fix Windows CE support
|
||||
. Add NuGet builds and project files for VS2022
|
||||
|
||||
* Build system changes
|
||||
. All CMake options now have the prefix `PUGIXML_`. This may require changing dependent build configurations.
|
||||
. Many build settings are now exposed via CMake settings, most notably `PUGIXML_COMPACT` and `PUGIXML_WCHAR_MODE` can be set without changing `pugiconfig.hpp`
|
||||
|
||||
[[v1.11]]
|
||||
=== v1.11 ^2020-11-26^
|
||||
|
||||
Maintenance release. Changes:
|
||||
|
||||
* New features:
|
||||
. Add xml_node::remove_attributes and xml_node::remove_children
|
||||
. Add a way to customize floating point precision via xml_attribute::set and xml_text::set overloads
|
||||
|
||||
* XPath improvements:
|
||||
. XPath parser now limits recursion depth which prevents stack overflow on malicious queries
|
||||
|
||||
* Compatibility improvements:
|
||||
. Fix Visual Studio warnings when built using clang-cl compiler
|
||||
. Fix Wconversion warnings in gcc
|
||||
. Fix Wzero-as-null-pointer-constant warnings in pugixml.hpp
|
||||
. Work around several static analysis false positives
|
||||
|
||||
* Build system changes
|
||||
. The CMake package for pugixml now provides a `pugixml::pugixml` target rather than a `pugixml` target. A compatibility `pugixml` target is provided if at least version 1.11 is not requested.
|
||||
|
||||
[[v1.10]]
|
||||
=== v1.10 ^2019-09-15^
|
||||
|
||||
Maintenance release. Changes:
|
||||
|
||||
* Behavior changes:
|
||||
. Tab characters (ASCII 9) in attribute values are now encoded as '	' to survive roundtripping
|
||||
. `>` characters are no longer escaped in attribute values
|
||||
|
||||
* New features:
|
||||
. Add Visual Studio .natvis files to improve debugging experience
|
||||
. CMake improvements (USE_POSTFIX and BUILD_SHARED_AND_STATIC_LIBS options for building multiple versions and pkg-config tweaks)
|
||||
. Add format_skip_control_chars formatting flag to skip non-printable ASCII characters that are invalid to use in well-formed XML files
|
||||
. Add format_attribute_single_quote formatting flag to use single quotes for attribute values instead of default double quotes.
|
||||
|
||||
* XPath improvements:
|
||||
. XPath union now results in a stable order that doesn't depend on memory allocations; crucially, this may require sorting the output of XPath query operation if you rely on the document-ordered traversal
|
||||
. Improve performance of XPath union operation, making it ~2x faster
|
||||
|
||||
* Compatibility improvements:
|
||||
. Fix Visual Studio warnings when built in a DLL configuration
|
||||
. Fix static analysis false positives in Coverity and clang
|
||||
. Fix Wdouble-promotion warnings in gcc
|
||||
. Add Visual Studio 2019 support for NuGet packages
|
||||
|
||||
[[v1.9]]
|
||||
=== v1.9 ^2018-04-04^
|
||||
|
||||
|
@ -2127,7 +2254,7 @@ Maintenance release. Changes:
|
|||
|
||||
* Specification changes:
|
||||
. `xml_document::load(const char*)` (deprecated in 1.5) now has `deprecated` attribute; use `xml_document::load_string` instead
|
||||
` `xml_node::select_single_node` (deprecated in 1.5) now has `deprecated` attribute; use `xml_node::select_node` instead
|
||||
. `xml_node::select_single_node` (deprecated in 1.5) now has `deprecated` attribute; use `xml_node::select_node` instead
|
||||
|
||||
* New features:
|
||||
. Add move semantics support for xml_document and improve move semantics support for other objects
|
||||
|
@ -2644,6 +2771,7 @@ enum +++<a href="#xpath_value_type">xpath_value_type</a>+++
|
|||
[source,subs="+macros"]
|
||||
----
|
||||
// Formatting options bit flags:
|
||||
const unsigned int +++<a href="#format_attribute_single_quote">format_attribute_single_quote</a>+++
|
||||
const unsigned int +++<a href="#format_default">format_default</a>+++
|
||||
const unsigned int +++<a href="#format_indent">format_indent</a>+++
|
||||
const unsigned int +++<a href="#format_indent_attributes">format_indent_attributes</a>+++
|
||||
|
@ -2652,6 +2780,7 @@ const unsigned int +++<a href="#format_no_empty_element_tags">format_no_empty_el
|
|||
const unsigned int +++<a href="#format_no_escapes">format_no_escapes</a>+++
|
||||
const unsigned int +++<a href="#format_raw">format_raw</a>+++
|
||||
const unsigned int +++<a href="#format_save_file_text">format_save_file_text</a>+++
|
||||
const unsigned int +++<a href="#format_skip_control_chars">format_skip_control_chars</a>+++
|
||||
const unsigned int +++<a href="#format_write_bom">format_write_bom</a>+++
|
||||
|
||||
// Parsing options bit flags:
|
||||
|
@ -2711,6 +2840,7 @@ const unsigned int +++<a href="#parse_wnorm_attribute">parse_wnorm_attribute</a>
|
|||
|
||||
bool +++<a href="#xml_attribute::set_name">set_name</a>+++(const char_t* rhs);
|
||||
bool +++<a href="#xml_attribute::set_value">set_value</a>+++(const char_t* rhs);
|
||||
bool +++<a href="#xml_attribute::set_value">set_value</a>+++(const char_t* rhs, size_t size);
|
||||
bool +++<a href="#xml_attribute::set_value">set_value</a>+++(int rhs);
|
||||
bool +++<a href="#xml_attribute::set_value">set_value</a>+++(unsigned int rhs);
|
||||
bool +++<a href="#xml_attribute::set_value">set_value</a>+++(long rhs);
|
||||
|
@ -2769,6 +2899,9 @@ const unsigned int +++<a href="#parse_wnorm_attribute">parse_wnorm_attribute</a>
|
|||
xml_attribute +++<a href="#xml_node::attribute">attribute</a>+++(const char_t* name) const;
|
||||
xml_node +++<a href="#xml_node::next_sibling_name">next_sibling</a>+++(const char_t* name) const;
|
||||
xml_node +++<a href="#xml_node::previous_sibling_name">previous_sibling</a>+++(const char_t* name) const;
|
||||
|
||||
xml_attribute +++<a href="#xml_node::attribute_hinted">attribute</a>+++(const char_t* name, xml_attribute& hint) const;
|
||||
|
||||
xml_node +++<a href="#xml_node::find_child_by_attribute">find_child_by_attribute</a>+++(const char_t* name, const char_t* attr_name, const char_t* attr_value) const;
|
||||
xml_node +++<a href="#xml_node::find_child_by_attribute">find_child_by_attribute</a>+++(const char_t* attr_name, const char_t* attr_value) const;
|
||||
|
||||
|
@ -2797,6 +2930,7 @@ const unsigned int +++<a href="#parse_wnorm_attribute">parse_wnorm_attribute</a>
|
|||
|
||||
bool +++<a href="#xml_node::set_name">set_name</a>+++(const char_t* rhs);
|
||||
bool +++<a href="#xml_node::set_value">set_value</a>+++(const char_t* rhs);
|
||||
bool +++<a href="#xml_node::set_value">set_value</a>+++(const char_t* rhs, size_t size);
|
||||
|
||||
xml_attribute +++<a href="#xml_node::append_attribute">append_attribute</a>+++(const char_t* name);
|
||||
xml_attribute +++<a href="#xml_node::prepend_attribute">prepend_attribute</a>+++(const char_t* name);
|
||||
|
@ -2830,8 +2964,10 @@ const unsigned int +++<a href="#parse_wnorm_attribute">parse_wnorm_attribute</a>
|
|||
|
||||
bool +++<a href="#xml_node::remove_attribute">remove_attribute</a>+++(const xml_attribute& a);
|
||||
bool +++<a href="#xml_node::remove_attribute">remove_attribute</a>+++(const char_t* name);
|
||||
bool +++<a href="#xml_node::remove_attributes">remove_attributes</a>+++();
|
||||
bool +++<a href="#xml_node::remove_child">remove_child</a>+++(const xml_node& n);
|
||||
bool +++<a href="#xml_node::remove_child">remove_child</a>+++(const char_t* name);
|
||||
bool +++<a href="#xml_node::remove_children">remove_children</a>+++();
|
||||
|
||||
xml_parse_result +++<a href="#xml_node::append_buffer">append_buffer</a>+++(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto);
|
||||
|
||||
|
@ -2907,16 +3043,17 @@ const unsigned int +++<a href="#parse_wnorm_attribute">parse_wnorm_attribute</a>
|
|||
unsigned long long +++<a href="#xml_text::as_ullong">as_ullong</a>+++(unsigned long long def = 0) const;
|
||||
|
||||
bool +++<a href="#xml_text::set">set</a>+++(const char_t* rhs);
|
||||
bool +++<a href="#xml_text::set">set</a>+++(const char_t* rhs, size_t size);
|
||||
|
||||
bool +++<a href="#xml_text::set">set</a>+++(int rhs);
|
||||
bool +++<a href="#xml_text::set">set</a>+++(unsigned int rhs);
|
||||
bool +++<a href="#xml_text::set">set</a>+++(long rhs);
|
||||
bool +++<a href="#xml_text::set">set</a>+++(unsigned long rhs);
|
||||
bool +++<a href="#xml_text::set">set</a>+++(double rhs);
|
||||
bool +++<a href="#xml_text::set">set</a>+++(float rhs);
|
||||
bool +++<a href="#xml_text::set">set</a>+++(bool rhs);
|
||||
bool +++<a href="#xml_text::set">set</a>+++(long long rhs);
|
||||
bool +++<a href="#xml_text::set">set</a>+++(unsigned long long rhs);
|
||||
bool +++<a href="#xml_text::set_value">set</a>+++(int rhs);
|
||||
bool +++<a href="#xml_text::set_value">set</a>+++(unsigned int rhs);
|
||||
bool +++<a href="#xml_text::set_value">set</a>+++(long rhs);
|
||||
bool +++<a href="#xml_text::set_value">set</a>+++(unsigned long rhs);
|
||||
bool +++<a href="#xml_text::set_value">set</a>+++(double rhs);
|
||||
bool +++<a href="#xml_text::set_value">set</a>+++(float rhs);
|
||||
bool +++<a href="#xml_text::set_value">set</a>+++(bool rhs);
|
||||
bool +++<a href="#xml_text::set_value">set</a>+++(long long rhs);
|
||||
bool +++<a href="#xml_text::set_value">set</a>+++(unsigned long long rhs);
|
||||
|
||||
xml_text& +++<a href="#xml_text::assign">operator=</a>+++(const char_t* rhs);
|
||||
xml_text& +++<a href="#xml_text::assign">operator=</a>+++(int rhs);
|
||||
|
|
2898
docs/manual.html
2898
docs/manual.html
File diff suppressed because it is too large
Load diff
|
@ -4,7 +4,7 @@ include::config.adoc[]
|
|||
[[introduction]]
|
||||
== Introduction
|
||||
|
||||
http://pugixml.org/[pugixml] is a light-weight C{plus}{plus} XML processing library. It consists of a DOM-like interface with rich traversal/modification capabilities, an extremely fast XML parser which constructs the DOM tree from an XML file/buffer, and an XPath 1.0 implementation for complex data-driven tree queries. Full Unicode support is also available, with two Unicode interface variants and conversions between different Unicode encodings (which happen automatically during parsing/saving). The library is extremely portable and easy to integrate and use. pugixml is developed and maintained since 2006 and has many users. All code is distributed under the <<license,MIT license>>, making it completely free to use in both open-source and proprietary applications.
|
||||
https://pugixml.org/[pugixml] is a light-weight C{plus}{plus} XML processing library. It consists of a DOM-like interface with rich traversal/modification capabilities, an extremely fast XML parser which constructs the DOM tree from an XML file/buffer, and an XPath 1.0 implementation for complex data-driven tree queries. Full Unicode support is also available, with two Unicode interface variants and conversions between different Unicode encodings (which happen automatically during parsing/saving). The library is extremely portable and easy to integrate and use. pugixml is developed and maintained since 2006 and has many users. All code is distributed under the <<license,MIT license>>, making it completely free to use in both open-source and proprietary applications.
|
||||
|
||||
pugixml enables very fast, convenient and memory-efficient XML document processing. However, since pugixml has a DOM parser, it can't process XML documents that do not fit in memory; also the parser is a non-validating one, so if you need DTD/Schema validation, the library is not for you.
|
||||
|
||||
|
@ -25,7 +25,7 @@ The distribution contains library source, documentation (the guide you're readin
|
|||
|
||||
The complete pugixml source consists of three files - one source file, `pugixml.cpp`, and two header files, `pugixml.hpp` and `pugiconfig.hpp`. `pugixml.hpp` is the primary header which you need to include in order to use pugixml classes/functions. The rest of this guide assumes that `pugixml.hpp` is either in the current directory or in one of include directories of your projects, so that `#include "pugixml.hpp"` can find the header; however you can also use relative path (i.e. `#include "../libs/pugixml/src/pugixml.hpp"`) or include directory-relative path (i.e. `#include <xml/thirdparty/pugixml/src/pugixml.hpp>`).
|
||||
|
||||
The easiest way to build pugixml is to compile the source file, `pugixml.cpp`, along with the existing library/executable. This process depends on the method of building your application; for example, if you're using Microsoft Visual Studio footnote:[All trademarks used are properties of their respective owners.], Apple Xcode, Code::Blocks or any other IDE, just add `pugixml.cpp` to one of your projects. There are other building methods available, including building pugixml as a standalone static/shared library; link:manual.html#install.building[read the manual] for further information.
|
||||
The easiest way to build pugixml is to compile the source file, `pugixml.cpp`, along with the existing library/executable. This process depends on the method of building your application; for example, if you're using Microsoft Visual Studio footnote:[All trademarks used are properties of their respective owners.], Apple Xcode, Code::Blocks or any other IDE, just *add `pugixml.cpp` to one of your projects*. There are other building methods available, including building pugixml as a standalone static/shared library; link:manual.html#install.building[read the manual] for further information.
|
||||
|
||||
[[dom]]
|
||||
== Document object model
|
||||
|
@ -255,7 +255,7 @@ If filing an issue is not possible due to privacy or other concerns, you can con
|
|||
The pugixml library is distributed under the MIT license:
|
||||
|
||||
....
|
||||
Copyright (c) 2006-2018 Arseny Kapoulkine
|
||||
Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
@ -282,6 +282,6 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|||
This means that you can freely use pugixml in your applications, both open-source and proprietary. If you use pugixml in a product, it is sufficient to add an acknowledgment like this to the product distribution:
|
||||
|
||||
....
|
||||
This software is based on pugixml library (http://pugixml.org).
|
||||
pugixml is Copyright (C) 2006-2018 Arseny Kapoulkine.
|
||||
This software is based on pugixml library (https://pugixml.org).
|
||||
pugixml is Copyright (C) 2006-2022 Arseny Kapoulkine.
|
||||
....
|
||||
|
|
File diff suppressed because it is too large
Load diff
10
readme.txt
10
readme.txt
|
@ -1,7 +1,7 @@
|
|||
pugixml 1.9 - an XML processing library
|
||||
pugixml 1.13 - an XML processing library
|
||||
|
||||
Copyright (C) 2006-2018, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
Report bugs and download new versions at http://pugixml.org/
|
||||
Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
Report bugs and download new versions at https://pugixml.org/
|
||||
|
||||
This is the distribution of pugixml, which is a C++ XML processing library,
|
||||
which consists of a DOM-like interface with rich traversal/modification
|
||||
|
@ -13,8 +13,6 @@ automatically during parsing/saving).
|
|||
|
||||
The distribution contains the following folders:
|
||||
|
||||
contrib/ - various contributions to pugixml
|
||||
|
||||
docs/ - documentation
|
||||
docs/samples - pugixml usage examples
|
||||
docs/quickstart.html - quick start guide
|
||||
|
@ -28,7 +26,7 @@ The distribution contains the following folders:
|
|||
|
||||
This library is distributed under the MIT License:
|
||||
|
||||
Copyright (c) 2006-2018 Arseny Kapoulkine
|
||||
Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import io
|
||||
import os.path
|
||||
import sys
|
||||
import tarfile
|
||||
import time
|
||||
import zipfile
|
||||
import StringIO
|
||||
|
||||
def read_file(path, use_crlf):
|
||||
with open(path, 'rb') as file:
|
||||
data = file.read()
|
||||
|
||||
if '\0' not in data:
|
||||
data = data.replace('\r', '')
|
||||
if b'\0' not in data:
|
||||
data = data.replace(b'\r', b'')
|
||||
if use_crlf:
|
||||
data = data.replace('\n', '\r\n')
|
||||
data = data.replace(b'\n', b'\r\n')
|
||||
|
||||
return data
|
||||
|
||||
|
@ -24,6 +24,7 @@ def write_zip(target, arcprefix, timestamp, sources):
|
|||
info = zipfile.ZipInfo(path)
|
||||
info.date_time = time.localtime(timestamp)
|
||||
info.compress_type = zipfile.ZIP_DEFLATED
|
||||
info.external_attr = 0o644 << 16
|
||||
archive.writestr(info, data)
|
||||
|
||||
def write_tar(target, arcprefix, timestamp, sources, compression):
|
||||
|
@ -34,7 +35,7 @@ def write_tar(target, arcprefix, timestamp, sources, compression):
|
|||
info = tarfile.TarInfo(path)
|
||||
info.size = len(data)
|
||||
info.mtime = timestamp
|
||||
archive.addfile(info, StringIO.StringIO(data))
|
||||
archive.addfile(info, io.BytesIO(data))
|
||||
|
||||
if len(sys.argv) < 5:
|
||||
raise RuntimeError('Usage: python archive.py <target> <archive prefix> <timestamp> <source files>')
|
||||
|
|
77
scripts/natvis/pugixml.natvis
Normal file
77
scripts/natvis/pugixml.natvis
Normal file
|
@ -0,0 +1,77 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||
<Type Name="pugi::xml_node">
|
||||
<DisplayString Condition="_root">{_root}</DisplayString>
|
||||
<DisplayString Condition="!_root">none</DisplayString>
|
||||
<Expand>
|
||||
<ExpandedItem Condition="_root">_root</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xml_node_struct">
|
||||
<DisplayString Condition="name && value">{(pugi::xml_node_type)(header & 0xf),en} name={name,na} value={value,na}</DisplayString>
|
||||
<DisplayString Condition="name">{(pugi::xml_node_type)(header & 0xf),en} name={name,na}</DisplayString>
|
||||
<DisplayString Condition="value">{(pugi::xml_node_type)(header & 0xf),en} value={value,na}</DisplayString>
|
||||
<DisplayString>{(pugi::xml_node_type)(header & 0xf),en}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="value" Condition="value">value,na</Item>
|
||||
<Synthetic Name="attributes" Condition="first_attribute">
|
||||
<Expand>
|
||||
<CustomListItems>
|
||||
<Variable Name="curr" InitialValue="first_attribute" />
|
||||
|
||||
<Loop Condition="curr">
|
||||
<Item Name="{curr->name,na}">curr,view(child)na</Item>
|
||||
<Exec>curr = curr->next_attribute</Exec>
|
||||
</Loop>
|
||||
</CustomListItems>
|
||||
</Expand>
|
||||
</Synthetic>
|
||||
<LinkedListItems>
|
||||
<HeadPointer>first_child</HeadPointer>
|
||||
<NextPointer>next_sibling</NextPointer>
|
||||
<ValueNode>this,na</ValueNode>
|
||||
</LinkedListItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xml_attribute">
|
||||
<DisplayString Condition="_attr">{_attr}</DisplayString>
|
||||
<DisplayString Condition="!_attr">none</DisplayString>
|
||||
<Expand>
|
||||
<ExpandedItem Condition="_attr">_attr</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xml_attribute_struct">
|
||||
<DisplayString ExcludeView="child">{name,na} = {value,na}</DisplayString>
|
||||
<DisplayString>{value,na}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="name">name,na</Item>
|
||||
<Item Name="value">value,na</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xpath_node">
|
||||
<DisplayString Condition="_node._root && _attribute._attr">{_node,na} "{_attribute._attr->name,na}"="{_attribute._attr->value,na}"</DisplayString>
|
||||
<DisplayString Condition="_node._root">{_node,na}</DisplayString>
|
||||
<DisplayString Condition="_attribute._attr">{_attribute}</DisplayString>
|
||||
<DisplayString>empty</DisplayString>
|
||||
<Expand HideRawView="1">
|
||||
<ExpandedItem Condition="_node._root && !_attribute._attr">_node</ExpandedItem>
|
||||
<ExpandedItem Condition="!_node._root && _attribute._attr">_attribute</ExpandedItem>
|
||||
<Item Name="node" Condition="_node._root && _attribute._attr">_node,na</Item>
|
||||
<Item Name="attribute" Condition="_node._root && _attribute._attr">_attribute,na</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xpath_node_set">
|
||||
<Expand>
|
||||
<Item Name="type">_type</Item>
|
||||
<ArrayItems>
|
||||
<Size>_end - _begin</Size>
|
||||
<ValuePointer>_begin</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
</AutoVisualizer>
|
506
scripts/natvis/pugixml_compact.natvis
Normal file
506
scripts/natvis/pugixml_compact.natvis
Normal file
|
@ -0,0 +1,506 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||
<Type Name="pugi::xml_node">
|
||||
<DisplayString Condition="_root">{_root}</DisplayString>
|
||||
<DisplayString Condition="!_root">none</DisplayString>
|
||||
<Expand>
|
||||
<ExpandedItem Condition="_root">_root</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xml_attribute">
|
||||
<DisplayString Condition="_attr">{_attr}</DisplayString>
|
||||
<DisplayString Condition="!_attr">none</DisplayString>
|
||||
<Expand>
|
||||
<ExpandedItem Condition="_attr">_attr</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xml_node_struct">
|
||||
<Expand>
|
||||
<Item Name="type">(pugi::xml_node_type)(header._flags & 15)</Item>
|
||||
<Item Name="name" Condition="name._data">name,na</Item>
|
||||
<Item Name="value" Condition="value._data">value,na</Item>
|
||||
|
||||
<Synthetic Name="attributes" Condition="first_attribute._data">
|
||||
<DisplayString>...</DisplayString>
|
||||
<Expand>
|
||||
<CustomListItems>
|
||||
<Variable Name="attribute_this" InitialValue="(size_t)&first_attribute" />
|
||||
<Variable Name="attribute_data" InitialValue="first_attribute._data" />
|
||||
<Variable Name="attribute_data_copy" InitialValue="attribute_data" />
|
||||
|
||||
<!-- first_attribute struct template arguments -->
|
||||
<Variable Name="attribute_T1" InitialValue="11" />
|
||||
<Variable Name="attribute_T2" InitialValue="0" />
|
||||
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<!-- compact_get_page() -->
|
||||
<Variable Name="_page" InitialValue="*(char*)(attribute_this - attribute_T1)" />
|
||||
<Variable Name="page" InitialValue="((attribute_this - attribute_T1 - (_page << compact_alignment_log2)) - *(unsigned*)(attribute_this - attribute_T1 - (_page << compact_alignment_log2)))" />
|
||||
|
||||
<!-- page->allocator->_hash -->
|
||||
<Variable Name="allocator" InitialValue="*(size_t*)page" />
|
||||
<Variable Name="_hash" InitialValue="*(size_t*)(allocator + 2 * sizeof(size_t))" /><!--2 pointer offsetof(allocator, _hash)-->
|
||||
<Variable Name="_items" InitialValue="*(size_t*)_hash" />
|
||||
<Variable Name="_capacity" InitialValue="*((size_t*)_hash + 1)" /><!--1 pointer offsetof(_hash, _capacity)-->
|
||||
<Variable Name="_count" InitialValue="*((size_t*)_hash + 2)" /><!--2 pointer offsetof(_hash, _count)-->
|
||||
|
||||
<!-- find() prolog -->
|
||||
<Variable Name="hashmod" InitialValue="_capacity - 1" />
|
||||
|
||||
<Variable Name="h" InitialValue="(unsigned)attribute_this" />
|
||||
<Variable Name="bucket" InitialValue="0" />
|
||||
|
||||
<Variable Name="probe" InitialValue="0" />
|
||||
<Variable Name="probe_item" InitialValue="(size_t*)0" />
|
||||
|
||||
<Variable Name="attribute_real" InitialValue="(pugi::xml_attribute_struct*)0" />
|
||||
|
||||
<!-- if _data < 255 -->
|
||||
<Variable Name="attribute_short" InitialValue="(pugi::xml_attribute_struct*)(((size_t)attribute_this & ~(compact_alignment - 1)) + (attribute_data - 1 + attribute_T2) * compact_alignment)" />
|
||||
|
||||
<Variable Name="number" InitialValue="0" />
|
||||
|
||||
<!-- Loop over all attributes -->
|
||||
<Loop Condition="attribute_this && attribute_data">
|
||||
<!-- find() hash -->
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
<Exec>h = h * (0x85ebca6bu)</Exec>
|
||||
<Exec>h = h ^ (h >> 13)</Exec>
|
||||
<Exec>h = h * (0xc2b2ae35u)</Exec>
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
|
||||
<Exec>bucket = h & hashmod</Exec>
|
||||
|
||||
<!-- find() loop -->
|
||||
<Loop Condition="probe <= hashmod &&_capacity">
|
||||
<Exec>probe_item = (size_t*)_items + bucket * 2</Exec><!--2 pointer sizeof(item_t)-->
|
||||
|
||||
<If Condition="*probe_item == attribute_this || *probe_item == 0">
|
||||
<Exec>attribute_real = *(pugi::xml_attribute_struct**)(probe_item + 1)</Exec><!--1 pointer offsetof(item_t, value)-->
|
||||
<Break/>
|
||||
</If>
|
||||
|
||||
<Exec>bucket = (bucket + probe + 1) & hashmod</Exec>
|
||||
<Exec>probe++</Exec>
|
||||
</Loop>
|
||||
|
||||
<Exec>attribute_data_copy = attribute_data</Exec>
|
||||
|
||||
<If Condition="attribute_data_copy >= 255 && attribute_real">
|
||||
<Item Name="[{number}]">*attribute_real,view(child)</Item>
|
||||
<Exec>attribute_this = (size_t)&(*attribute_real).next_attribute</Exec>
|
||||
<Exec>attribute_data = (*attribute_real).next_attribute._data</Exec>
|
||||
</If>
|
||||
<If Condition="attribute_data_copy < 255 && attribute_short">
|
||||
<Item Name="[{number}]">*attribute_short,view(child)</Item>
|
||||
<Exec>attribute_this = (size_t)&(*attribute_short).next_attribute</Exec>
|
||||
<Exec>attribute_data = (*attribute_short).next_attribute._data</Exec>
|
||||
</If>
|
||||
|
||||
<!-- next_attribute struct template arguments -->
|
||||
<Exec>attribute_T1 = 7</Exec>
|
||||
<Exec>attribute_T2 = 0</Exec>
|
||||
|
||||
<!-- find() prolog again -->
|
||||
<Exec>h = (unsigned)attribute_this</Exec>
|
||||
<Exec>bucket = 0</Exec>
|
||||
|
||||
<Exec>probe = 0</Exec>
|
||||
<Exec>probe_item = (size_t*)0</Exec>
|
||||
|
||||
<Exec>attribute_real = (pugi::xml_attribute_struct*)0</Exec>
|
||||
<Exec>attribute_short = (pugi::xml_attribute_struct*)(((size_t)attribute_this & ~(compact_alignment - 1)) + (attribute_data - 1 + attribute_T2) * compact_alignment)</Exec>
|
||||
|
||||
<Exec>number++</Exec>
|
||||
</Loop>
|
||||
</CustomListItems>
|
||||
</Expand>
|
||||
</Synthetic>
|
||||
|
||||
<CustomListItems>
|
||||
<Variable Name="child_this" InitialValue="&first_child" />
|
||||
<Variable Name="child_data" InitialValue="first_child._data" />
|
||||
<Variable Name="child_data_copy" InitialValue="child_data" />
|
||||
|
||||
<!-- first_child struct template arguments -->
|
||||
<Variable Name="child_T1" InitialValue="8" />
|
||||
<Variable Name="child_T2" InitialValue="0" />
|
||||
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<!-- compact_get_page() -->
|
||||
<Variable Name="_page" InitialValue="*(char*)(child_this - child_T1)" />
|
||||
<Variable Name="page" InitialValue="((child_this - child_T1 - (_page << compact_alignment_log2)) - *(unsigned*)(child_this - child_T1 - (_page << compact_alignment_log2)))" />
|
||||
|
||||
<!-- page->allocator->_hash -->
|
||||
<Variable Name="allocator" InitialValue="*(size_t*)page" />
|
||||
<Variable Name="_hash" InitialValue="*(size_t*)(allocator + 2 * sizeof(size_t))" /><!--2 pointer offsetof(allocator, _hash)-->
|
||||
<Variable Name="_items" InitialValue="*(size_t*)_hash" />
|
||||
<Variable Name="_capacity" InitialValue="*((size_t*)_hash + 1)" /><!--1 pointer offsetof(_hash, _capacity)-->
|
||||
<Variable Name="_count" InitialValue="*((size_t*)_hash + 2)" /><!--2 pointer offsetof(_hash, _count)-->
|
||||
|
||||
<!-- find() prolog -->
|
||||
<Variable Name="hashmod" InitialValue="_capacity - 1" />
|
||||
|
||||
<Variable Name="h" InitialValue="(unsigned)child_this" />
|
||||
<Variable Name="bucket" InitialValue="0" />
|
||||
|
||||
<Variable Name="probe" InitialValue="0" />
|
||||
<Variable Name="probe_item" InitialValue="(size_t*)0" />
|
||||
|
||||
<Variable Name="child_real" InitialValue="(pugi::xml_node_struct*)0" />
|
||||
|
||||
<!-- if _data < 255 -->
|
||||
<Variable Name="child_short" InitialValue="(pugi::xml_node_struct*)(((size_t)child_this & ~(compact_alignment - 1)) + (child_data - 1 + child_T2) * compact_alignment)" />
|
||||
|
||||
<Variable Name="number" InitialValue="0" />
|
||||
|
||||
<Loop Condition="child_this && child_data">
|
||||
<!-- find() hash -->
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
<Exec>h = h * (0x85ebca6bu)</Exec>
|
||||
<Exec>h = h ^ (h >> 13)</Exec>
|
||||
<Exec>h = h * (0xc2b2ae35u)</Exec>
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
|
||||
<Exec>bucket = h & hashmod</Exec>
|
||||
|
||||
<!-- find() loop -->
|
||||
<Loop Condition="probe <= hashmod &&_capacity">
|
||||
<Exec>probe_item = (size_t*)_items + bucket * 2</Exec><!--2 pointer sizeof(item_t)-->
|
||||
|
||||
<If Condition="*probe_item == child_this || *probe_item == 0">
|
||||
<Exec>child_real = *(pugi::xml_node_struct**)(probe_item + 1)</Exec><!--1 pointer offsetof(item_t, value)-->
|
||||
<Break/>
|
||||
</If>
|
||||
|
||||
<Exec>bucket = (bucket + probe + 1) & hashmod</Exec>
|
||||
<Exec>probe++</Exec>
|
||||
</Loop>
|
||||
|
||||
<Exec>child_data_copy = child_data</Exec>
|
||||
|
||||
<If Condition="child_data_copy >= 255 && child_real">
|
||||
<Item Name="[{number}]">*child_real,view(child)</Item>
|
||||
<Exec>child_this = (size_t)&(*child_real).next_sibling</Exec>
|
||||
<Exec>child_data = (*child_real).next_sibling._data</Exec>
|
||||
</If>
|
||||
<If Condition="child_data_copy < 255 && child_short">
|
||||
<Item Name="[{number}]">*child_short,view(child)</Item>
|
||||
<Exec>child_this = (size_t)&(*child_short).next_sibling</Exec>
|
||||
<Exec>child_data = (*child_short).next_sibling._data</Exec>
|
||||
</If>
|
||||
|
||||
<!-- next_sibling struct template arguments -->
|
||||
<Exec>child_T1 = 10</Exec>
|
||||
<Exec>child_T2 = 0</Exec>
|
||||
|
||||
<!-- find() prolog again -->
|
||||
<Exec>h = (unsigned)child_this</Exec>
|
||||
<Exec>bucket = 0</Exec>
|
||||
|
||||
<Exec>probe = 0</Exec>
|
||||
<Exec>probe_item = (size_t*)0</Exec>
|
||||
|
||||
<Exec>child_real = (pugi::xml_node_struct*)0</Exec>
|
||||
<Exec>child_short = (pugi::xml_node_struct*)(((size_t)child_this & ~(compact_alignment - 1)) + (child_data - 1 + child_T2) * compact_alignment)</Exec>
|
||||
|
||||
<Exec>number++</Exec>
|
||||
</Loop>
|
||||
</CustomListItems>
|
||||
|
||||
<Item Name="next_sibling" ExcludeView="child">next_sibling</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xml_attribute_struct">
|
||||
<Expand>
|
||||
<Item Name="name">name,na</Item>
|
||||
<Item Name="value">value,na</Item>
|
||||
|
||||
<CustomListItems ExcludeView="child">
|
||||
<Variable Name="attribute_this" InitialValue="&next_attribute" />
|
||||
<Variable Name="attribute_data" InitialValue="next_attribute._data" />
|
||||
|
||||
<!-- next_attribute struct template arguments -->
|
||||
<Variable Name="attribute_T1" InitialValue="7" />
|
||||
<Variable Name="attribute_T2" InitialValue="0" />
|
||||
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<!-- compact_get_page() -->
|
||||
<Variable Name="_page" InitialValue="*(char*)(attribute_this - attribute_T1)" />
|
||||
<Variable Name="page" InitialValue="((attribute_this - attribute_T1 - (_page << compact_alignment_log2)) - *(unsigned*)(attribute_this - attribute_T1 - (_page << compact_alignment_log2)))" />
|
||||
|
||||
<!-- page->allocator->_hash -->
|
||||
<Variable Name="allocator" InitialValue="*(size_t*)page" />
|
||||
<Variable Name="_hash" InitialValue="*(size_t*)(allocator + 2 * sizeof(size_t))" /><!--2 pointer offsetof(allocator, _hash)-->
|
||||
<Variable Name="_items" InitialValue="*(size_t*)_hash" />
|
||||
<Variable Name="_capacity" InitialValue="*((size_t*)_hash + 1)" /><!--1 pointer offsetof(_hash, _capacity)-->
|
||||
<Variable Name="_count" InitialValue="*((size_t*)_hash + 2)" /><!--2 pointer offsetof(_hash, _count)-->
|
||||
|
||||
<!-- find() prolog -->
|
||||
<Variable Name="hashmod" InitialValue="_capacity - 1" />
|
||||
|
||||
<Variable Name="h" InitialValue="(unsigned)attribute_this" />
|
||||
<Variable Name="bucket" InitialValue="0" />
|
||||
|
||||
<Variable Name="probe" InitialValue="0" />
|
||||
<Variable Name="probe_item" InitialValue="(size_t*)0" />
|
||||
|
||||
<Variable Name="attribute_real" InitialValue="(pugi::xml_attribute_struct*)0" />
|
||||
|
||||
<!-- if _data < 255 -->
|
||||
<Variable Name="attribute_short" InitialValue="(pugi::xml_attribute_struct*)(((size_t)attribute_this & ~(compact_alignment - 1)) + (attribute_data - 1 + attribute_T2) * compact_alignment)" />
|
||||
|
||||
<!-- find() hash -->
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
<Exec>h = h * (0x85ebca6bu)</Exec>
|
||||
<Exec>h = h ^ (h >> 13)</Exec>
|
||||
<Exec>h = h * (0xc2b2ae35u)</Exec>
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
|
||||
<Exec>bucket = h & hashmod</Exec>
|
||||
|
||||
<!-- find() loop -->
|
||||
<Loop Condition="probe <= hashmod &&_capacity">
|
||||
<Exec>probe_item = (size_t*)_items + bucket * 2</Exec><!--2 pointer sizeof(item_t)-->
|
||||
|
||||
<If Condition="*probe_item == attribute_this || *probe_item == 0">
|
||||
<Exec>attribute_real = *(pugi::xml_attribute_struct**)(probe_item + 1)</Exec><!--1 pointer offsetof(item_t, value)-->
|
||||
<Break/>
|
||||
</If>
|
||||
|
||||
<Exec>bucket = (bucket + probe + 1) & hashmod</Exec>
|
||||
<Exec>probe++</Exec>
|
||||
</Loop>
|
||||
|
||||
<If Condition="attribute_data >= 255 && attribute_real">
|
||||
<Item Name="next_attribute">*attribute_real</Item>
|
||||
</If>
|
||||
<If Condition="attribute_data != 0 && attribute_data < 255 && attribute_short">
|
||||
<Item Name="next_attribute">*attribute_short</Item>
|
||||
</If>
|
||||
</CustomListItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::impl::`anonymous-namespace'::compact_string<*,*>">
|
||||
<Expand HideRawView="1">
|
||||
<CustomListItems Condition="_data && _data < 255">
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<!-- compact_get_page() -->
|
||||
<Variable Name="_page" InitialValue="*(char*)(this - $T1)" />
|
||||
<Variable Name="page" InitialValue="((this - $T1 - (_page << compact_alignment_log2)) - *(unsigned*)(this - $T1 - (_page << compact_alignment_log2)))" />
|
||||
|
||||
<Variable Name="compact_string_base" InitialValue="*(size_t*)(page + 5 * sizeof(void*))" /><!-- 5 pointer offsetof(page, compact_string_base)-->
|
||||
<Variable Name="base" InitialValue="this - $T2" />
|
||||
<Variable Name="offset" InitialValue="((*(short*)base - 1) << 7) + (_data - 1)" />
|
||||
|
||||
<Item Name="value">(pugi::char_t*)(compact_string_base + offset * sizeof(pugi::char_t)),na</Item>
|
||||
</CustomListItems>
|
||||
|
||||
<CustomListItems Condition="_data && _data >= 255">
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<!-- compact_get_page() -->
|
||||
<Variable Name="_page" InitialValue="*(char*)(this - $T1)" />
|
||||
<Variable Name="page" InitialValue="((this - $T1 - (_page << compact_alignment_log2)) - *(unsigned*)(this - $T1 - (_page << compact_alignment_log2)))" />
|
||||
|
||||
<!-- page->allocator->_hash -->
|
||||
<Variable Name="allocator" InitialValue="*(size_t*)page" />
|
||||
<Variable Name="_hash" InitialValue="*(size_t*)(allocator + 2 * sizeof(size_t))" /><!--2 pointer offsetof(allocator, _hash)-->
|
||||
<Variable Name="_items" InitialValue="*(size_t*)_hash" />
|
||||
<Variable Name="_capacity" InitialValue="*((size_t*)_hash + 1)" /><!--1 pointer offsetof(_hash, _capacity)-->
|
||||
<Variable Name="_count" InitialValue="*((size_t*)_hash + 2)" /><!--2 pointer offsetof(_hash, _count)-->
|
||||
|
||||
<!-- find() prolog -->
|
||||
<Variable Name="hashmod" InitialValue="_capacity - 1" />
|
||||
|
||||
<Variable Name="h" InitialValue="(unsigned)this" />
|
||||
<Variable Name="bucket" InitialValue="0" />
|
||||
|
||||
<Variable Name="probe" InitialValue="0" />
|
||||
<Variable Name="probe_item" InitialValue="(size_t*)0" />
|
||||
|
||||
<!-- find() hash -->
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
<Exec>h = h * (0x85ebca6bu)</Exec>
|
||||
<Exec>h = h ^ (h >> 13)</Exec>
|
||||
<Exec>h = h * (0xc2b2ae35u)</Exec>
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
|
||||
<Exec>bucket = h & hashmod</Exec>
|
||||
|
||||
<!-- find() loop -->
|
||||
<Loop Condition="probe <= hashmod &&_capacity">
|
||||
<Exec>probe_item = (size_t*)_items + bucket * 2</Exec><!--2 pointer sizeof(item_t)-->
|
||||
|
||||
<If Condition="*probe_item == this || *probe_item == 0">
|
||||
<Item Name="value">*(pugi::char_t**)(probe_item + 1)</Item><!--1 pointer offsetof(item_t, value)-->
|
||||
<Break/>
|
||||
</If>
|
||||
|
||||
<Exec>bucket = (bucket + probe + 1) & hashmod</Exec>
|
||||
<Exec>probe++</Exec>
|
||||
</Loop>
|
||||
</CustomListItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::impl::`anonymous-namespace'::compact_pointer<pugi::xml_node_struct,*,*>">
|
||||
<DisplayString Condition="!_data">nullptr</DisplayString>
|
||||
<DisplayString Condition="_data">...</DisplayString>
|
||||
|
||||
<Expand HideRawView="1">
|
||||
<CustomListItems Condition="_data && _data < 255">
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<Item Name="value">*(pugi::xml_node_struct*)(((size_t)this & ~(compact_alignment - 1)) + (_data - 1 + $T2) * compact_alignment)</Item>
|
||||
</CustomListItems>
|
||||
|
||||
<CustomListItems Condition="_data && _data >= 255">
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<!-- compact_get_page() -->
|
||||
<Variable Name="_page" InitialValue="*(char*)(this - $T1)" />
|
||||
<Variable Name="page" InitialValue="((this - $T1 - (_page << compact_alignment_log2)) - *(unsigned*)(this - $T1 - (_page << compact_alignment_log2)))" />
|
||||
|
||||
<!-- page->allocator->_hash -->
|
||||
<Variable Name="allocator" InitialValue="*(size_t*)page" />
|
||||
<Variable Name="_hash" InitialValue="*(size_t*)(allocator + 2 * sizeof(size_t))" /><!--2 pointer offsetof(allocator, _hash)-->
|
||||
<Variable Name="_items" InitialValue="*(size_t*)_hash" />
|
||||
<Variable Name="_capacity" InitialValue="*((size_t*)_hash + 1)" /><!--1 pointer offsetof(_hash, _capacity)-->
|
||||
<Variable Name="_count" InitialValue="*((size_t*)_hash + 2)" /><!--2 pointer offsetof(_hash, _count)-->
|
||||
|
||||
<!-- find() prolog -->
|
||||
<Variable Name="hashmod" InitialValue="_capacity - 1" />
|
||||
|
||||
<Variable Name="h" InitialValue="(unsigned)this" />
|
||||
<Variable Name="bucket" InitialValue="0" />
|
||||
|
||||
<Variable Name="probe" InitialValue="0" />
|
||||
<Variable Name="probe_item" InitialValue="(size_t*)0" />
|
||||
|
||||
<!-- find() hash -->
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
<Exec>h = h * (0x85ebca6bu)</Exec>
|
||||
<Exec>h = h ^ (h >> 13)</Exec>
|
||||
<Exec>h = h * (0xc2b2ae35u)</Exec>
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
|
||||
<Exec>bucket = h & hashmod</Exec>
|
||||
|
||||
<!-- find() loop -->
|
||||
<Loop Condition="probe <= hashmod &&_capacity">
|
||||
<Exec>probe_item = (size_t*)_items + bucket * 2</Exec><!--2 pointer sizeof(item_t)-->
|
||||
|
||||
<If Condition="*probe_item == this || *probe_item == 0">
|
||||
<Item Name="value">**(pugi::xml_node_struct**)(probe_item + 1)</Item><!--1 pointer offsetof(item_t, value)-->
|
||||
<Break/>
|
||||
</If>
|
||||
|
||||
<Exec>bucket = (bucket + probe + 1) & hashmod</Exec>
|
||||
<Exec>probe++</Exec>
|
||||
</Loop>
|
||||
</CustomListItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::impl::`anonymous-namespace'::compact_pointer<pugi::xml_attribute_struct,*,*>">
|
||||
<DisplayString Condition="!_data">nullptr</DisplayString>
|
||||
<DisplayString Condition="_data">...</DisplayString>
|
||||
|
||||
<Expand HideRawView="1">
|
||||
<CustomListItems Condition="_data && _data < 255">
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<Item Name="value">*(pugi::xml_attribute_struct*)(((size_t)this & ~(compact_alignment - 1)) + (_data - 1 + $T2) * compact_alignment)</Item>
|
||||
</CustomListItems>
|
||||
|
||||
<CustomListItems Condition="_data && _data >= 255">
|
||||
<Variable Name="compact_alignment_log2" InitialValue="2" />
|
||||
<Variable Name="compact_alignment" InitialValue="1 << compact_alignment_log2" />
|
||||
|
||||
<!-- compact_get_page() -->
|
||||
<Variable Name="_page" InitialValue="*(char*)(this - $T1)" />
|
||||
<Variable Name="page" InitialValue="((this - $T1 - (_page << compact_alignment_log2)) - *(unsigned*)(this - $T1 - (_page << compact_alignment_log2)))" />
|
||||
|
||||
<!-- page->allocator->_hash -->
|
||||
<Variable Name="allocator" InitialValue="*(size_t*)page" />
|
||||
<Variable Name="_hash" InitialValue="*(size_t*)(allocator + 2 * sizeof(size_t))" /><!--2 pointer offsetof(allocator, _hash)-->
|
||||
<Variable Name="_items" InitialValue="*(size_t*)_hash" />
|
||||
<Variable Name="_capacity" InitialValue="*((size_t*)_hash + 1)" /><!--1 pointer offsetof(_hash, _capacity)-->
|
||||
<Variable Name="_count" InitialValue="*((size_t*)_hash + 2)" /><!--2 pointer offsetof(_hash, _count)-->
|
||||
|
||||
<!-- find() prolog -->
|
||||
<Variable Name="hashmod" InitialValue="_capacity - 1" />
|
||||
|
||||
<Variable Name="h" InitialValue="(unsigned)this" />
|
||||
<Variable Name="bucket" InitialValue="0" />
|
||||
|
||||
<Variable Name="probe" InitialValue="0" />
|
||||
<Variable Name="probe_item" InitialValue="(size_t*)0" />
|
||||
|
||||
<!-- find() hash -->
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
<Exec>h = h * (0x85ebca6bu)</Exec>
|
||||
<Exec>h = h ^ (h >> 13)</Exec>
|
||||
<Exec>h = h * (0xc2b2ae35u)</Exec>
|
||||
<Exec>h = h ^ (h >> 16)</Exec>
|
||||
|
||||
<Exec>bucket = h & hashmod</Exec>
|
||||
|
||||
<!-- find() loop -->
|
||||
<Loop Condition="probe <= hashmod &&_capacity">
|
||||
<Exec>probe_item = (size_t*)_items + bucket * 2</Exec><!--2 pointer sizeof(item_t)-->
|
||||
|
||||
<If Condition="*probe_item == this || *probe_item == 0">
|
||||
<Item Name="value">**(pugi::xml_attribute_struct**)(probe_item + 1)</Item><!--1 pointer offsetof(item_t, value)-->
|
||||
<Break/>
|
||||
</If>
|
||||
|
||||
<Exec>bucket = (bucket + probe + 1) & hashmod</Exec>
|
||||
<Exec>probe++</Exec>
|
||||
</Loop>
|
||||
</CustomListItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xpath_node">
|
||||
<DisplayString Condition="_node._root && _attribute._attr">{_node,na} {_attribute,na}</DisplayString>
|
||||
<DisplayString Condition="_node._root">{_node,na}</DisplayString>
|
||||
<DisplayString Condition="_attribute._attr">{_attribute}</DisplayString>
|
||||
<DisplayString>empty</DisplayString>
|
||||
|
||||
<Expand HideRawView="1">
|
||||
<ExpandedItem Condition="_node._root && !_attribute._attr">_node</ExpandedItem>
|
||||
<ExpandedItem Condition="!_node._root && _attribute._attr">_attribute</ExpandedItem>
|
||||
|
||||
<Item Name="node" Condition="_node._root && _attribute._attr">_node,na</Item>
|
||||
<Item Name="attribute" Condition="_node._root && _attribute._attr">_attribute,na</Item>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="pugi::xpath_node_set">
|
||||
<Expand>
|
||||
<Item Name="type">_type</Item>
|
||||
<ArrayItems>
|
||||
<Size>_end - _begin</Size>
|
||||
<ValuePointer>_begin</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
</AutoVisualizer>
|
|
@ -10,6 +10,8 @@
|
|||
<EnumProperty Name="Linkage-pugixml" DisplayName="Linkage" Description="Which version of the runtime library to use for this library" Category="pugixml">
|
||||
<EnumValue Name="dynamic" DisplayName="Dynamic CRT (/MD, /MDd)" />
|
||||
<EnumValue Name="static" DisplayName="Static CRT (/MT, /MTd)" />
|
||||
<EnumValue Name="source" DisplayName="Include pugixml.cpp" />
|
||||
<EnumValue Name="header" DisplayName="Header Only" />
|
||||
</EnumProperty>
|
||||
</Rule>
|
||||
</ProjectSchemaDefinitions>
|
||||
|
|
|
@ -2,26 +2,27 @@
|
|||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Default initializers for properties">
|
||||
<Linkage-pugixml Condition="'$(Linkage-pugixml)' == ''">dynamic</Linkage-pugixml>
|
||||
<Configuration-pugixml Condition="$(Configuration.ToLower().IndexOf('debug')) != -1">Debug</Configuration-pugixml>
|
||||
<Configuration-pugixml Condition="$(Configuration.ToLower().IndexOf('debug')) == -1">Release</Configuration-pugixml>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)\pugixml-propertiesui.xml" />
|
||||
</ItemGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions Condition="'$(Linkage-pugixml)' == 'header'">PUGIXML_HEADER_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="$(Configuration.ToLower().IndexOf('debug')) != -1">
|
||||
<ItemGroup Condition="'$(Linkage-pugixml)' == 'source'">
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)include\pugixml.cpp"/>
|
||||
</ItemGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Linkage-pugixml)' != 'header' AND '$(Linkage-pugixml)' != 'source'">
|
||||
<Link>
|
||||
<AdditionalDependencies>$(MSBuildThisFileDirectory)lib/$(Platform)\$(PlatformToolset.Split('_')[0])\$(Linkage-pugixml)\Debug\pugixml.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="$(Configuration.ToLower().IndexOf('debug')) == -1">
|
||||
<Link>
|
||||
<AdditionalDependencies>$(MSBuildThisFileDirectory)lib/$(Platform)\$(PlatformToolset.Split('_')[0])\$(Linkage-pugixml)\Release\pugixml.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(MSBuildThisFileDirectory)lib/$(Platform)\$(PlatformToolset.Split('_')[0])\$(Linkage-pugixml)\$(Configuration-pugixml)\pugixml.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
||||
|
|
|
@ -2,20 +2,19 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>pugixml</id>
|
||||
<version>1.9.0-appveyor</version>
|
||||
<version>1.13.0-appveyor</version>
|
||||
<title>pugixml</title>
|
||||
<authors>Arseny Kapoulkine</authors>
|
||||
<owners>Arseny Kapoulkine</owners>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<licenseUrl>http://pugixml.org/license.html</licenseUrl>
|
||||
<projectUrl>http://pugixml.org/</projectUrl>
|
||||
<iconUrl>https://github.com/zeux/pugixml/logo.svg</iconUrl>
|
||||
<license type="expression">MIT</license>
|
||||
<projectUrl>https://pugixml.org/</projectUrl>
|
||||
<description>pugixml is a C++ XML processing library, which consists of a DOM-like interface with rich traversal/modification capabilities, an extremely fast XML parser which constructs the DOM tree from an XML file/buffer, and an XPath 1.0 implementation for complex data-driven tree queries. Full Unicode support is also available, with Unicode interface variants and conversions between different Unicode encodings (which happen automatically during parsing/saving).
|
||||
pugixml is used by a lot of projects, both open-source and proprietary, for performance and easy-to-use interface.
|
||||
This package contains builds for VS2013, VS2015 and VS2017, for both statically linked and DLL CRT; you can switch the CRT linkage in Project -> Properties -> Referenced Packages -> pugixml.</description>
|
||||
This package contains builds for VS2013, VS2015, VS2017, VS2019 and VS2022, for both statically linked and DLL CRT; you can switch the CRT linkage in Project -> Properties -> Referenced Packages -> pugixml.</description>
|
||||
<summary>Light-weight, simple and fast XML parser for C++ with XPath support</summary>
|
||||
<releaseNotes>http://pugixml.org/docs/manual.html#changes</releaseNotes>
|
||||
<copyright>Copyright (c) 2006-2018 Arseny Kapoulkine</copyright>
|
||||
<releaseNotes>https://pugixml.org/docs/manual.html#changes</releaseNotes>
|
||||
<copyright>Copyright (c) 2006-2022 Arseny Kapoulkine</copyright>
|
||||
<tags>native nativepackage</tags>
|
||||
</metadata>
|
||||
</package>
|
||||
|
|
|
@ -33,15 +33,37 @@ cd $scriptdir
|
|||
|
||||
Force-Copy "../src/pugiconfig.hpp" "nuget/build/native/include/pugiconfig.hpp"
|
||||
Force-Copy "../src/pugixml.hpp" "nuget/build/native/include/pugixml.hpp"
|
||||
Force-Copy "../src/pugixml.cpp" "nuget/build/native/include/pugixml.cpp"
|
||||
|
||||
Build-Version "vs2013" "v120" "dynamic"
|
||||
Build-Version "vs2013" "v120" "static"
|
||||
if ($args[0] -eq 2022){
|
||||
Build-Version "vs2022" "v143" "dynamic"
|
||||
Build-Version "vs2022" "v143" "static"
|
||||
|
||||
Build-Version "vs2015" "v140" "dynamic"
|
||||
Build-Version "vs2015" "v140" "static"
|
||||
} elseif ($args[0] -eq 2019){
|
||||
Build-Version "vs2019" "v142" "dynamic"
|
||||
Build-Version "vs2019" "v142" "static"
|
||||
|
||||
Build-Version "vs2017" "v141" "dynamic"
|
||||
Build-Version "vs2017" "v141" "static"
|
||||
} elseif ($args[0] -eq 2017){
|
||||
Build-Version "vs2017" "v141" "dynamic"
|
||||
Build-Version "vs2017" "v141" "static"
|
||||
|
||||
Build-Version "vs2015" "v140" "dynamic"
|
||||
Build-Version "vs2015" "v140" "static"
|
||||
|
||||
Build-Version "vs2013" "v120" "dynamic"
|
||||
Build-Version "vs2013" "v120" "static"
|
||||
|
||||
} elseif($args[0] -eq 2015){
|
||||
Build-Version "vs2015" "v140" "dynamic"
|
||||
Build-Version "vs2015" "v140" "static"
|
||||
|
||||
Build-Version "vs2013" "v120" "dynamic"
|
||||
Build-Version "vs2013" "v120" "static"
|
||||
|
||||
} elseif($args[0] -eq 2013){
|
||||
Build-Version "vs2013" "v120" "dynamic"
|
||||
Build-Version "vs2013" "v120" "static"
|
||||
}
|
||||
|
||||
Run-Command "nuget pack nuget"
|
||||
|
||||
|
|
12
scripts/pugixml-config.cmake.in
Normal file
12
scripts/pugixml-config.cmake.in
Normal file
|
@ -0,0 +1,12 @@
|
|||
@PACKAGE_INIT@
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/pugixml-targets.cmake")
|
||||
|
||||
# If the user is not requiring 1.11 (either by explicitly requesting an older
|
||||
# version or not requesting one at all), provide the old imported target name
|
||||
# for compatibility.
|
||||
if (NOT TARGET pugixml AND (NOT DEFINED PACKAGE_FIND_VERSION OR PACKAGE_FIND_VERSION VERSION_LESS "1.11"))
|
||||
add_library(pugixml INTERFACE IMPORTED)
|
||||
# Equivalent to target_link_libraries INTERFACE, but compatible with CMake 3.10
|
||||
set_target_properties(pugixml PROPERTIES INTERFACE_LINK_LIBRARIES pugixml::pugixml)
|
||||
endif ()
|
|
@ -1,11 +1,11 @@
|
|||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=${prefix}
|
||||
includedir=${prefix}/include/pugixml-@PUGIXML_VERSION_STRING@
|
||||
libdir=${exec_prefix}/lib/pugixml-@PUGIXML_VERSION_STRING@
|
||||
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@@INSTALL_SUFFIX@
|
||||
libdir=@CMAKE_INSTALL_FULL_LIBDIR@@INSTALL_SUFFIX@
|
||||
|
||||
Name: pugixml
|
||||
Description: Light-weight, simple and fast XML parser for C++ with XPath support.
|
||||
URL: http://pugixml.org/
|
||||
Version: @PUGIXML_VERSION_STRING@
|
||||
URL: https://pugixml.org/
|
||||
Version: @pugixml_VERSION@
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} -lpugixml
|
||||
Libs: -L${libdir} -lpugixml@LIB_POSTFIX@
|
||||
|
|
|
@ -1,32 +1,9 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = "pugixml"
|
||||
s.version = "1.9"
|
||||
s.version = "1.13"
|
||||
s.summary = "C++ XML parser library."
|
||||
s.homepage = "http://pugixml.org"
|
||||
s.license = { :type => 'MIT', :text => <<-qwertyuiop
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2006-2018 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
qwertyuiop
|
||||
}
|
||||
s.homepage = "https://pugixml.org"
|
||||
s.license = "MIT"
|
||||
s.author = { "Arseny Kapoulkine" => "arseny.kapoulkine@gmail.com" }
|
||||
s.platform = :ios, "7.0"
|
||||
|
||||
|
|
45
scripts/pugixml_dll.rc
Normal file
45
scripts/pugixml_dll.rc
Normal file
|
@ -0,0 +1,45 @@
|
|||
#include <winver.h>
|
||||
|
||||
#define PUGIXML_VERSION_MAJOR 1
|
||||
#define PUGIXML_VERSION_MINOR 13
|
||||
#define PUGIXML_VERSION_PATCH 0
|
||||
#define PUGIXML_VERSION_NUMBER "1.13.0\0"
|
||||
|
||||
#if defined(GCC_WINDRES) || defined(__MINGW32__) || defined(__CYGWIN__)
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
#else
|
||||
VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE
|
||||
#endif
|
||||
FILEVERSION PUGIXML_VERSION_MAJOR,PUGIXML_VERSION_MINOR,PUGIXML_VERSION_PATCH,0
|
||||
PRODUCTVERSION PUGIXML_VERSION_MAJOR,PUGIXML_VERSION_MINOR,PUGIXML_VERSION_PATCH,0
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 1
|
||||
#else
|
||||
FILEFLAGS 0
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
FILESUBTYPE 0 // not used
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904E4"
|
||||
//language ID = U.S. English, char set = Windows, Multilingual
|
||||
BEGIN
|
||||
VALUE "CompanyName", "zeux/pugixml\0"
|
||||
VALUE "FileDescription", "pugixml library\0"
|
||||
VALUE "FileVersion", PUGIXML_VERSION_NUMBER
|
||||
VALUE "InternalName", "pugixml.dll\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2006-2022, by Arseny Kapoulkine\0"
|
||||
VALUE "OriginalFilename", "pugixml.dll\0"
|
||||
VALUE "ProductName", "pugixml\0"
|
||||
VALUE "ProductVersion", PUGIXML_VERSION_NUMBER
|
||||
VALUE "Comments", "For more information visit https://github.com/zeux/pugixml/\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0409, 1252
|
||||
END
|
||||
END
|
172
scripts/pugixml_vs2019.vcxproj
Normal file
172
scripts/pugixml_vs2019.vcxproj
Normal file
|
@ -0,0 +1,172 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{07CF01C0-B887-499D-AD9C-799CB6A9FE64}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>pugixml</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pugiconfig.hpp" />
|
||||
<ClInclude Include="..\src\pugixml.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\pugixml.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
176
scripts/pugixml_vs2019_static.vcxproj
Normal file
176
scripts/pugixml_vs2019_static.vcxproj
Normal file
|
@ -0,0 +1,176 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{07CF01C0-B887-499D-AD9C-799CB6A9FE64}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>pugixml</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>vs2019\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2019\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pugiconfig.hpp" />
|
||||
<ClInclude Include="..\src\pugixml.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\pugixml.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
172
scripts/pugixml_vs2022.vcxproj
Normal file
172
scripts/pugixml_vs2022.vcxproj
Normal file
|
@ -0,0 +1,172 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{07CF01C0-B887-499D-AD9C-799CB6A9FE64}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>pugixml</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pugiconfig.hpp" />
|
||||
<ClInclude Include="..\src\pugixml.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\pugixml.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
176
scripts/pugixml_vs2022_static.vcxproj
Normal file
176
scripts/pugixml_vs2022_static.vcxproj
Normal file
|
@ -0,0 +1,176 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{07CF01C0-B887-499D-AD9C-799CB6A9FE64}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>pugixml</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>vs2022\$(Platform)_$(Configuration)Static\</OutDir>
|
||||
<IntDir>vs2022\$(Platform)_$(Configuration)Static\</IntDir>
|
||||
<TargetName>pugixml</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\pugiconfig.hpp" />
|
||||
<ClInclude Include="..\src\pugixml.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\pugixml.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* pugixml parser - version 1.9
|
||||
* pugixml parser - version 1.13
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2018, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at http://pugixml.org/
|
||||
* Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
|
@ -40,6 +40,9 @@
|
|||
// #define PUGIXML_MEMORY_OUTPUT_STACK 10240
|
||||
// #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096
|
||||
|
||||
// Tune this constant to adjust max nesting for XPath queries
|
||||
// #define PUGIXML_XPATH_DEPTH_LIMIT 1024
|
||||
|
||||
// Uncomment this to switch to header-only version
|
||||
// #define PUGIXML_HEADER_ONLY
|
||||
|
||||
|
@ -49,7 +52,7 @@
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2018 Arseny Kapoulkine
|
||||
* Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
|
|
974
src/pugixml.cpp
974
src/pugixml.cpp
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* pugixml parser - version 1.9
|
||||
* pugixml parser - version 1.13
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2018, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at http://pugixml.org/
|
||||
* Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
|
@ -11,9 +11,10 @@
|
|||
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
|
||||
*/
|
||||
|
||||
// Define version macro; evaluates to major * 1000 + minor * 10 + patch so that it's safe to use in less-than comparisons
|
||||
// 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
|
||||
#ifndef PUGIXML_VERSION
|
||||
// Define version macro; evaluates to major * 100 + minor so that it's safe to use in less-than comparisons
|
||||
# define PUGIXML_VERSION 190
|
||||
# define PUGIXML_VERSION 1130 // 1.13
|
||||
#endif
|
||||
|
||||
// Include user configuration file (this can define various configuration macros)
|
||||
|
@ -110,6 +111,17 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
// If C++ is 2011 or higher, use 'nullptr'
|
||||
#ifndef PUGIXML_NULL
|
||||
# if __cplusplus >= 201103
|
||||
# define PUGIXML_NULL nullptr
|
||||
# elif defined(_MSC_VER) && _MSC_VER >= 1600
|
||||
# define PUGIXML_NULL nullptr
|
||||
# else
|
||||
# define PUGIXML_NULL 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Character interface macros
|
||||
#ifdef PUGIXML_WCHAR_MODE
|
||||
# define PUGIXML_TEXT(t) L ## t
|
||||
|
@ -252,10 +264,19 @@ namespace pugi
|
|||
// Don't output empty element tags, instead writing an explicit start and end tag even if there are no children. This flag is off by default.
|
||||
const unsigned int format_no_empty_element_tags = 0x80;
|
||||
|
||||
// Skip characters belonging to range [0; 32) instead of "&#xNN;" encoding. This flag is off by default.
|
||||
const unsigned int format_skip_control_chars = 0x100;
|
||||
|
||||
// Use single quotes ' instead of double quotes " for enclosing attribute values. This flag is off by default.
|
||||
const unsigned int format_attribute_single_quote = 0x200;
|
||||
|
||||
// The default set of formatting flags.
|
||||
// Nodes are indented depending on their depth in DOM tree, a default declaration is output if document has none.
|
||||
const unsigned int format_default = format_indent;
|
||||
|
||||
const int default_double_precision = 17;
|
||||
const int default_float_precision = 9;
|
||||
|
||||
// Forward declarations
|
||||
struct xml_attribute_struct;
|
||||
struct xml_node_struct;
|
||||
|
@ -293,6 +314,8 @@ namespace pugi
|
|||
It begin() const { return _begin; }
|
||||
It end() const { return _end; }
|
||||
|
||||
bool empty() const { return _begin == _end; }
|
||||
|
||||
private:
|
||||
It _begin, _end;
|
||||
};
|
||||
|
@ -395,6 +418,7 @@ namespace pugi
|
|||
|
||||
// Set attribute name/value (returns false if attribute is empty or there is not enough memory)
|
||||
bool set_name(const char_t* rhs);
|
||||
bool set_value(const char_t* rhs, size_t sz);
|
||||
bool set_value(const char_t* rhs);
|
||||
|
||||
// Set attribute value with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
|
||||
|
@ -403,7 +427,9 @@ namespace pugi
|
|||
bool set_value(long rhs);
|
||||
bool set_value(unsigned long rhs);
|
||||
bool set_value(double rhs);
|
||||
bool set_value(double rhs, int precision);
|
||||
bool set_value(float rhs);
|
||||
bool set_value(float rhs, int precision);
|
||||
bool set_value(bool rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
|
@ -527,6 +553,7 @@ namespace pugi
|
|||
|
||||
// Set node name/value (returns false if node is empty, there is not enough memory, or node can not have name/value)
|
||||
bool set_name(const char_t* rhs);
|
||||
bool set_value(const char_t* rhs, size_t sz);
|
||||
bool set_value(const char_t* rhs);
|
||||
|
||||
// Add attribute with specified name. Returns added attribute, or empty attribute on errors.
|
||||
|
@ -569,10 +596,16 @@ namespace pugi
|
|||
bool remove_attribute(const xml_attribute& a);
|
||||
bool remove_attribute(const char_t* name);
|
||||
|
||||
// Remove all attributes
|
||||
bool remove_attributes();
|
||||
|
||||
// Remove specified child
|
||||
bool remove_child(const xml_node& n);
|
||||
bool remove_child(const char_t* name);
|
||||
|
||||
// Remove all children
|
||||
bool remove_children();
|
||||
|
||||
// Parses buffer as an XML document fragment and appends all nodes as children of the current node.
|
||||
// Copies/converts the buffer, so it may be deleted or changed after the function returns.
|
||||
// Note: append_buffer allocates memory that has the lifetime of the owning document; removing the appended nodes does not immediately reclaim that memory.
|
||||
|
@ -643,15 +676,15 @@ namespace pugi
|
|||
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
// Select single node by evaluating XPath query. Returns first node from the resulting node set.
|
||||
xpath_node select_node(const char_t* query, xpath_variable_set* variables = 0) const;
|
||||
xpath_node select_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
|
||||
xpath_node select_node(const xpath_query& query) const;
|
||||
|
||||
// Select node set by evaluating XPath query
|
||||
xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = 0) const;
|
||||
xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
|
||||
xpath_node_set select_nodes(const xpath_query& query) const;
|
||||
|
||||
// (deprecated: use select_node instead) Select single node by evaluating XPath query.
|
||||
PUGIXML_DEPRECATED xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = 0) const;
|
||||
PUGIXML_DEPRECATED xpath_node select_single_node(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL) const;
|
||||
PUGIXML_DEPRECATED xpath_node select_single_node(const xpath_query& query) const;
|
||||
|
||||
#endif
|
||||
|
@ -746,6 +779,7 @@ namespace pugi
|
|||
bool as_bool(bool def = false) const;
|
||||
|
||||
// Set text (returns false if object is empty or there is not enough memory)
|
||||
bool set(const char_t* rhs, size_t sz);
|
||||
bool set(const char_t* rhs);
|
||||
|
||||
// Set text with type conversion (numbers are converted to strings, boolean is converted to "true"/"false")
|
||||
|
@ -754,7 +788,9 @@ namespace pugi
|
|||
bool set(long rhs);
|
||||
bool set(unsigned long rhs);
|
||||
bool set(double rhs);
|
||||
bool set(double rhs, int precision);
|
||||
bool set(float rhs);
|
||||
bool set(float rhs, int precision);
|
||||
bool set(bool rhs);
|
||||
|
||||
#ifdef PUGIXML_HAS_LONG_LONG
|
||||
|
@ -822,10 +858,10 @@ namespace pugi
|
|||
xml_node& operator*() const;
|
||||
xml_node* operator->() const;
|
||||
|
||||
const xml_node_iterator& operator++();
|
||||
xml_node_iterator& operator++();
|
||||
xml_node_iterator operator++(int);
|
||||
|
||||
const xml_node_iterator& operator--();
|
||||
xml_node_iterator& operator--();
|
||||
xml_node_iterator operator--(int);
|
||||
};
|
||||
|
||||
|
@ -864,10 +900,10 @@ namespace pugi
|
|||
xml_attribute& operator*() const;
|
||||
xml_attribute* operator->() const;
|
||||
|
||||
const xml_attribute_iterator& operator++();
|
||||
xml_attribute_iterator& operator++();
|
||||
xml_attribute_iterator operator++(int);
|
||||
|
||||
const xml_attribute_iterator& operator--();
|
||||
xml_attribute_iterator& operator--();
|
||||
xml_attribute_iterator operator--(int);
|
||||
};
|
||||
|
||||
|
@ -900,10 +936,10 @@ namespace pugi
|
|||
xml_node& operator*() const;
|
||||
xml_node* operator->() const;
|
||||
|
||||
const xml_named_node_iterator& operator++();
|
||||
xml_named_node_iterator& operator++();
|
||||
xml_named_node_iterator operator++(int);
|
||||
|
||||
const xml_named_node_iterator& operator--();
|
||||
xml_named_node_iterator& operator--();
|
||||
xml_named_node_iterator operator--(int);
|
||||
|
||||
private:
|
||||
|
@ -1192,7 +1228,7 @@ namespace pugi
|
|||
public:
|
||||
// Construct a compiled object from XPath expression.
|
||||
// If PUGIXML_NO_EXCEPTIONS is not defined, throws xpath_exception on compilation errors.
|
||||
explicit xpath_query(const char_t* query, xpath_variable_set* variables = 0);
|
||||
explicit xpath_query(const char_t* query, xpath_variable_set* variables = PUGIXML_NULL);
|
||||
|
||||
// Constructor
|
||||
xpath_query();
|
||||
|
@ -1251,6 +1287,12 @@ namespace pugi
|
|||
};
|
||||
|
||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
||||
#if defined(_MSC_VER)
|
||||
// C4275 can be ignored in Visual C++ if you are deriving
|
||||
// from a type in the Standard C++ Library
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4275)
|
||||
#endif
|
||||
// XPath exception class
|
||||
class PUGIXML_CLASS xpath_exception: public std::exception
|
||||
{
|
||||
|
@ -1267,6 +1309,9 @@ namespace pugi
|
|||
// Get parse result
|
||||
const xpath_parse_result& result() const;
|
||||
};
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// XPath node class (either xml_node or xml_attribute)
|
||||
|
@ -1372,7 +1417,7 @@ namespace pugi
|
|||
private:
|
||||
type_t _type;
|
||||
|
||||
xpath_node _storage;
|
||||
xpath_node _storage[1];
|
||||
|
||||
xpath_node* _begin;
|
||||
xpath_node* _end;
|
||||
|
@ -1436,7 +1481,7 @@ namespace std
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2018 Arseny Kapoulkine
|
||||
* Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
|
|
|
@ -18,11 +18,18 @@ foreach ($vs in $args)
|
|||
{
|
||||
Write-Output "# Setting up VS$vs $arch"
|
||||
|
||||
if ($vs -eq 15)
|
||||
{
|
||||
if ($vs -eq 15) {
|
||||
$vsdevcmdarch = if ($arch -eq "x64") { "amd64" } else { "x86" }
|
||||
Invoke-CmdScript "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" "-arch=$vsdevcmdarch"
|
||||
}
|
||||
elseif ($vs -eq 19) {
|
||||
$vsdevcmdarch = if ($arch -eq "x64") { "amd64" } else { "x86" }
|
||||
Invoke-CmdScript "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" "-arch=$vsdevcmdarch"
|
||||
}
|
||||
elseif ($vs -eq 22) {
|
||||
$vsdevcmdarch = if ($arch -eq "x64") { "amd64" } else { "x86" }
|
||||
Invoke-CmdScript "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" "-arch=$vsdevcmdarch"
|
||||
}
|
||||
else
|
||||
{
|
||||
Invoke-CmdScript "C:\Program Files (x86)\Microsoft Visual Studio $vs.0\VC\vcvarsall.bat" $arch
|
||||
|
|
|
@ -117,7 +117,7 @@ bool test_xpath_number(const pugi::xpath_node& node, const pugi::char_t* query,
|
|||
double value = q.evaluate_number(node);
|
||||
double absolute_error = fabs(value - expected);
|
||||
|
||||
const double tolerance = 1e-15f;
|
||||
const double tolerance = 1e-15;
|
||||
return absolute_error < tolerance || absolute_error < fabs(expected) * tolerance;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,12 +22,11 @@
|
|||
# include <stdexcept>
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
# include <io.h> // for unlink in C++0x mode
|
||||
#endif
|
||||
|
||||
#if defined(__CELLOS_LV2__) || defined(ANDROID) || defined(_GLIBCXX_HAVE_UNISTD_H) || defined(__APPLE__)
|
||||
# include <unistd.h> // for unlink
|
||||
// for unlink
|
||||
#ifdef _WIN32
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
using namespace pugi;
|
||||
|
@ -590,13 +589,12 @@ TEST(document_load_file_wide_out_of_memory)
|
|||
CHECK(result.status == status_out_of_memory || result.status == status_file_not_found);
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(__APPLE__)
|
||||
TEST(document_load_file_special_folder)
|
||||
{
|
||||
xml_document doc;
|
||||
xml_parse_result result = doc.load_file(".");
|
||||
// status_out_of_memory is somewhat counter-intuitive but on Linux ftell returns LONG_MAX for directories
|
||||
CHECK(result.status == status_file_not_found || result.status == status_io_error || result.status == status_out_of_memory);
|
||||
CHECK(result.status == status_io_error);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -738,7 +736,12 @@ struct temp_file
|
|||
temp_file()
|
||||
{
|
||||
static int index = 0;
|
||||
|
||||
#if __cplusplus >= 201103 || defined(__APPLE__) // Xcode 14 warns about use of sprintf in C++98 builds
|
||||
snprintf(path, sizeof(path), "%stempfile%d", test_runner::_temp_path, index++);
|
||||
#else
|
||||
sprintf(path, "%stempfile%d", test_runner::_temp_path, index++);
|
||||
#endif
|
||||
}
|
||||
|
||||
~temp_file()
|
||||
|
@ -1807,4 +1810,51 @@ TEST(document_move_compact_fail)
|
|||
CHECK(!docs[safe_count+1].first_child());
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(document_move_assign_empty)
|
||||
{
|
||||
xml_document doc;
|
||||
doc.append_child(STR("node"));
|
||||
|
||||
doc = xml_document();
|
||||
doc.append_child(STR("node2"));
|
||||
|
||||
CHECK_NODE(doc, STR("<node2/>"));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(document_load_buffer_convert_out_of_memory)
|
||||
{
|
||||
const char* source = "<node>\xe7</node>";
|
||||
size_t size = strlen(source);
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
xml_document doc;
|
||||
|
||||
xml_parse_result result;
|
||||
result.status = status_out_of_memory;
|
||||
CHECK_ALLOC_FAIL(result = doc.load_buffer(source, size, pugi::parse_default, pugi::encoding_latin1));
|
||||
|
||||
CHECK(result.status == status_out_of_memory);
|
||||
}
|
||||
|
||||
TEST(document_load_buffer_own_convert_out_of_memory)
|
||||
{
|
||||
const char* source = "<node>\xe7</node>";
|
||||
size_t size = strlen(source);
|
||||
|
||||
void* buffer = pugi::get_memory_allocation_function()(size);
|
||||
CHECK(buffer);
|
||||
memcpy(buffer, source, size);
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
xml_document doc;
|
||||
|
||||
xml_parse_result result;
|
||||
result.status = status_out_of_memory;
|
||||
CHECK_ALLOC_FAIL(result = doc.load_buffer_inplace_own(buffer, size, pugi::parse_default, pugi::encoding_latin1));
|
||||
|
||||
CHECK(result.status == status_out_of_memory);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,13 @@ TEST_XML(dom_attr_set_value, "<node/>")
|
|||
CHECK(node.append_attribute(STR("attr8")).set_value(true));
|
||||
CHECK(!xml_attribute().set_value(true));
|
||||
|
||||
CHECK_NODE(node, STR("<node attr1=\"v1\" attr2=\"-2147483647\" attr3=\"-2147483648\" attr4=\"4294967295\" attr5=\"4294967294\" attr6=\"0.5\" attr7=\"0.25\" attr8=\"true\"/>"));
|
||||
CHECK(node.append_attribute(STR("attr9")).set_value(STR("v2"), 2));
|
||||
CHECK(!xml_attribute().set_value(STR("v2")));
|
||||
|
||||
CHECK(node.append_attribute(STR("attr10")).set_value(STR("v3foobar"), 2));
|
||||
CHECK(!xml_attribute().set_value(STR("v3")));
|
||||
|
||||
CHECK_NODE(node, STR("<node attr1=\"v1\" attr2=\"-2147483647\" attr3=\"-2147483648\" attr4=\"4294967295\" attr5=\"4294967294\" attr6=\"0.5\" attr7=\"0.25\" attr8=\"true\" attr9=\"v2\" attr10=\"v3\"/>"));
|
||||
}
|
||||
|
||||
#if LONG_MAX > 2147483647
|
||||
|
@ -209,6 +215,24 @@ TEST_XML(dom_node_set_value, "<node>text</node>")
|
|||
CHECK_NODE(doc, STR("<node>no text</node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_node_set_value_partially_with_size, "<node>text</node>")
|
||||
{
|
||||
CHECK(doc.child(STR("node")).first_child().set_value(STR("no text"), 2));
|
||||
CHECK(!doc.child(STR("node")).set_value(STR("no text"), 2));
|
||||
CHECK(!xml_node().set_value(STR("no text"), 2));
|
||||
|
||||
CHECK_NODE(doc, STR("<node>no</node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_node_set_value_with_size, "<node>text</node>")
|
||||
{
|
||||
CHECK(doc.child(STR("node")).first_child().set_value(STR("no text"), 7));
|
||||
CHECK(!doc.child(STR("node")).set_value(STR("no text"), 7));
|
||||
CHECK(!xml_node().set_value(STR("no text"), 7));
|
||||
|
||||
CHECK_NODE(doc, STR("<node>no text</node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_node_set_value_allocated, "<node>text</node>")
|
||||
{
|
||||
CHECK(doc.child(STR("node")).first_child().set_value(STR("no text")));
|
||||
|
@ -492,6 +516,36 @@ TEST_XML(dom_node_remove_attribute, "<node a1='v1' a2='v2' a3='v3'><child a4='v4
|
|||
CHECK_NODE(doc, STR("<node a2=\"v2\"><child/></node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_node_remove_attributes, "<node a1='v1' a2='v2' a3='v3'><child a4='v4'/></node>")
|
||||
{
|
||||
CHECK(!xml_node().remove_attributes());
|
||||
xml_node node = doc.child(STR("node"));
|
||||
xml_node child = node.child(STR("child"));
|
||||
|
||||
CHECK(child.remove_attributes());
|
||||
CHECK_NODE(child, STR("<child/>"));
|
||||
|
||||
CHECK(node.remove_attributes());
|
||||
CHECK_NODE(node, STR("<node><child/></node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_node_remove_attributes_lots, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
// this test makes sure we generate at least 2 pages (64K) worth of attribute data
|
||||
// so that we can trigger page deallocation to make sure code is memory safe
|
||||
for (size_t i = 0; i < 10000; ++i)
|
||||
node.append_attribute(STR("a")) = STR("v");
|
||||
|
||||
CHECK_STRING(node.attribute(STR("a")).value(), STR("v"));
|
||||
|
||||
CHECK(node.remove_attributes());
|
||||
|
||||
CHECK_STRING(node.attribute(STR("a")).value(), STR(""));
|
||||
CHECK_NODE(node, STR("<node/>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_node_prepend_child, "<node>foo<child/></node>")
|
||||
{
|
||||
CHECK(xml_node().prepend_child() == xml_node());
|
||||
|
@ -707,6 +761,36 @@ TEST_XML(dom_node_remove_child, "<node><n1/><n2/><n3/><child><n4/></child></node
|
|||
CHECK_NODE(doc, STR("<node><n2/><child/></node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_node_remove_children, "<node><n1/><n2/><n3/><child><n4/></child></node>")
|
||||
{
|
||||
CHECK(!xml_node().remove_children());
|
||||
xml_node node = doc.child(STR("node"));
|
||||
xml_node child = node.child(STR("child"));
|
||||
|
||||
CHECK(child.remove_children());
|
||||
CHECK_NODE(child, STR("<child/>"));
|
||||
|
||||
CHECK(node.remove_children());
|
||||
CHECK_NODE(node, STR("<node/>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_node_remove_children_lots, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
// this test makes sure we generate at least 2 pages (64K) worth of node data
|
||||
// so that we can trigger page deallocation to make sure code is memory safe
|
||||
for (size_t i = 0; i < 10000; ++i)
|
||||
node.append_child().set_name(STR("n"));
|
||||
|
||||
CHECK(node.child(STR("n")));
|
||||
|
||||
CHECK(node.remove_children());
|
||||
|
||||
CHECK(!node.child(STR("n")));
|
||||
CHECK_NODE(node, STR("<node/>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_node_remove_child_complex, "<node id='1'><n1 id1='1' id2='2'/><n2/><n3/><child><n4/></child></node>")
|
||||
{
|
||||
CHECK(doc.child(STR("node")).remove_child(STR("n1")));
|
||||
|
@ -1702,6 +1786,31 @@ TEST(dom_fp_roundtrip_min_max_double)
|
|||
CHECK(fp_equal(node.text().as_double(), std::numeric_limits<double>::max()));
|
||||
}
|
||||
|
||||
TEST(dom_fp_double_custom_precision)
|
||||
{
|
||||
xml_document doc;
|
||||
xml_node node = doc.append_child(STR("node"));
|
||||
xml_attribute attr = node.append_attribute(STR("attr"));
|
||||
|
||||
attr.set_value(std::numeric_limits<double>::min(), 20);
|
||||
CHECK(fp_equal(attr.as_double(), std::numeric_limits<double>::min()));
|
||||
|
||||
attr.set_value(1.0f, 5);
|
||||
CHECK(fp_equal(attr.as_double(), static_cast<double>(1.0f)));
|
||||
|
||||
attr.set_value(3.1415926f, 3);
|
||||
CHECK(!fp_equal(attr.as_double(), static_cast<double>(3.1415926f)));
|
||||
|
||||
node.text().set(1.0f, 5);
|
||||
CHECK(fp_equal(node.text().as_double(), static_cast<double>(1.0f)));
|
||||
|
||||
node.text().set(3.1415926f, 3);
|
||||
CHECK(!fp_equal(node.text().as_double(), static_cast<double>(3.1415926f)));
|
||||
|
||||
node.text().set(std::numeric_limits<double>::max(), 20);
|
||||
CHECK(fp_equal(node.text().as_double(), std::numeric_limits<double>::max()));
|
||||
}
|
||||
|
||||
const double fp_roundtrip_base[] =
|
||||
{
|
||||
0.31830988618379067154,
|
||||
|
|
|
@ -124,12 +124,12 @@ TEST_XML(dom_text_as_float, "<node><text1>0</text1><text2>1</text2><text3>0.12</
|
|||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_text().as_float() == 0);
|
||||
CHECK_DOUBLE(node.child(STR("text1")).text().as_float(), 0);
|
||||
CHECK_DOUBLE(node.child(STR("text2")).text().as_float(), 1);
|
||||
CHECK_DOUBLE(node.child(STR("text3")).text().as_float(), 0.12);
|
||||
CHECK_DOUBLE(node.child(STR("text4")).text().as_float(), -5.1);
|
||||
CHECK_DOUBLE(node.child(STR("text5")).text().as_float(), 3e-4);
|
||||
CHECK_DOUBLE(node.child(STR("text6")).text().as_float(), 3.14159265358979323846);
|
||||
CHECK_DOUBLE(double(node.child(STR("text1")).text().as_float()), 0);
|
||||
CHECK_DOUBLE(double(node.child(STR("text2")).text().as_float()), 1);
|
||||
CHECK_DOUBLE(double(node.child(STR("text3")).text().as_float()), 0.12);
|
||||
CHECK_DOUBLE(double(node.child(STR("text4")).text().as_float()), -5.1);
|
||||
CHECK_DOUBLE(double(node.child(STR("text5")).text().as_float()), 3e-4);
|
||||
CHECK_DOUBLE(double(node.child(STR("text6")).text().as_float()), 3.14159265358979323846);
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_as_double, "<node><text1>0</text1><text2>1</text2><text3>0.12</text3><text4>-5.1</text4><text5>3e-4</text5><text6>3.14159265358979323846</text6></node>")
|
||||
|
@ -249,6 +249,46 @@ TEST_XML(dom_text_set, "<node/>")
|
|||
CHECK_NODE(node, STR("<node>foobarfoobar</node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_set_with_size, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
xml_text t = node.text();
|
||||
|
||||
t.set(STR(""), 0);
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK_NODE(node, STR("<node></node>"));
|
||||
|
||||
t.set(STR("boo"), 3);
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK(node.first_child() == node.last_child());
|
||||
CHECK_NODE(node, STR("<node>boo</node>"));
|
||||
|
||||
t.set(STR("foobarfoobar"), 12);
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK(node.first_child() == node.last_child());
|
||||
CHECK_NODE(node, STR("<node>foobarfoobar</node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_set_partially_with_size, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
xml_text t = node.text();
|
||||
|
||||
t.set(STR("foo"), 0);
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK_NODE(node, STR("<node></node>"));
|
||||
|
||||
t.set(STR("boofoo"), 3);
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK(node.first_child() == node.last_child());
|
||||
CHECK_NODE(node, STR("<node>boo</node>"));
|
||||
|
||||
t.set(STR("foobarfoobar"), 3);
|
||||
CHECK(node.first_child().type() == node_pcdata);
|
||||
CHECK(node.first_child() == node.last_child());
|
||||
CHECK_NODE(node, STR("<node>foo</node>"));
|
||||
}
|
||||
|
||||
TEST_XML(dom_text_assign, "<node/>")
|
||||
{
|
||||
xml_node node = doc.child(STR("node"));
|
||||
|
|
|
@ -150,12 +150,12 @@ TEST_XML(dom_attr_as_float, "<node attr1='0' attr2='1' attr3='0.12' attr4='-5.1'
|
|||
xml_node node = doc.child(STR("node"));
|
||||
|
||||
CHECK(xml_attribute().as_float() == 0);
|
||||
CHECK_DOUBLE(node.attribute(STR("attr1")).as_float(), 0);
|
||||
CHECK_DOUBLE(node.attribute(STR("attr2")).as_float(), 1);
|
||||
CHECK_DOUBLE(node.attribute(STR("attr3")).as_float(), 0.12);
|
||||
CHECK_DOUBLE(node.attribute(STR("attr4")).as_float(), -5.1);
|
||||
CHECK_DOUBLE(node.attribute(STR("attr5")).as_float(), 3e-4);
|
||||
CHECK_DOUBLE(node.attribute(STR("attr6")).as_float(), 3.14159265358979323846);
|
||||
CHECK_DOUBLE(double(node.attribute(STR("attr1")).as_float()), 0);
|
||||
CHECK_DOUBLE(double(node.attribute(STR("attr2")).as_float()), 1);
|
||||
CHECK_DOUBLE(double(node.attribute(STR("attr3")).as_float()), 0.12);
|
||||
CHECK_DOUBLE(double(node.attribute(STR("attr4")).as_float()), -5.1);
|
||||
CHECK_DOUBLE(double(node.attribute(STR("attr5")).as_float()), 3e-4);
|
||||
CHECK_DOUBLE(double(node.attribute(STR("attr6")).as_float()), 3.14159265358979323846);
|
||||
}
|
||||
|
||||
TEST_XML(dom_attr_as_double, "<node attr1='0' attr2='1' attr3='0.12' attr4='-5.1' attr5='3e-4' attr6='3.14159265358979323846'/>")
|
||||
|
@ -795,7 +795,12 @@ struct test_walker: xml_tree_walker
|
|||
std::basic_string<char_t> depthstr() const
|
||||
{
|
||||
char buf[32];
|
||||
|
||||
#if __cplusplus >= 201103 || defined(__APPLE__) // Xcode 14 warns about use of sprintf in C++98 builds
|
||||
snprintf(buf, sizeof(buf), "%d", depth());
|
||||
#else
|
||||
sprintf(buf, "%d", depth());
|
||||
#endif
|
||||
|
||||
#ifdef PUGIXML_WCHAR_MODE
|
||||
wchar_t wbuf[32];
|
||||
|
|
|
@ -221,7 +221,7 @@ TEST(parse_doctype_xmlconf_ibm_2)
|
|||
TEST_DOCTYPE_NWF("<!DOCTYPE animal [ <!ELEMENT animal ANY> <!ENTITY % parameterE \"A music file ?>\"> <?music %parameterE; ]>");
|
||||
TEST_DOCTYPE_NWF("<!DOCTYPE animal [ <!ELEMENT animal ANY> <!ENTITY % parameterE \"leopard EMPTY>\"> <!ELEMENT %parameterE; ]>");
|
||||
TEST_DOCTYPE_WF("<!DOCTYPE root [ <!ELEMENT root ANY> <!ATTLIST root attr1 CDATA #IMPLIED> <!ATTLIST root attr2 CDATA #IMPLIED> <!ENTITY withlt \"have <lessthan> inside\"> <!ENTITY aIndirect \"&withlt;\"> ]>");
|
||||
TEST_DOCTYPE_WF("<!DOCTYPE root [ <!ELEMENT root (#PCDATA)> <!--* Mising Name S contentspec in elementdecl *--> <!ELEMENT > ]>");
|
||||
TEST_DOCTYPE_WF("<!DOCTYPE root [ <!ELEMENT root (#PCDATA)> <!--* Missing Name S contentspec in elementdecl *--> <!ELEMENT > ]>");
|
||||
TEST_DOCTYPE_WF("<!DOCTYPE root [ <!ELEMENT root (#PCDATA)> <!ELEMENT a ANY> <!ELEMENT b ANY> <!--* extra separator in seq *--> <!ELEMENT aElement ((a|b),,a)? > ]>");
|
||||
TEST_DOCTYPE_WF("<!DOCTYPE root [ <!ELEMENT root (#PCDATA)> <!ELEMENT a ANY> <!--* Missing white space before Name in AttDef *--> <!ATTLIST a attr1 CDATA \"default\"attr2 ID #required> ]>");
|
||||
TEST_DOCTYPE_WF("<!DOCTYPE test [ <!ELEMENT test ANY> <!ELEMENT one EMPTY> <!ELEMENT two EMPTY> <!NOTATION this SYSTEM \"alpha\"> <!ATTLIST three attr NOTATION (\"this\") #IMPLIED> ]>");
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "../src/pugixml.hpp"
|
||||
|
||||
#if PUGIXML_VERSION != 190
|
||||
#if PUGIXML_VERSION != 1130
|
||||
#error Unexpected pugixml version
|
||||
#endif
|
||||
|
|
|
@ -193,7 +193,23 @@ TEST_XML(write_escape, "<node attr=''>text</node>")
|
|||
doc.child(STR("node")).attribute(STR("attr")) = STR("<>'\"&\x04\r\n\t");
|
||||
doc.child(STR("node")).first_child().set_value(STR("<>'\"&\x04\r\n\t"));
|
||||
|
||||
CHECK_NODE(doc, STR("<node attr=\"<>'"& \t\"><>'\"&\r\n\t</node>"));
|
||||
CHECK_NODE(doc, STR("<node attr=\"<>'"& 	\"><>'\"&\r\n\t</node>"));
|
||||
CHECK_NODE_EX(doc, STR("<node attr='<>'\"& 	'><>'\"&\r\n\t</node>"), STR(""), format_raw | format_attribute_single_quote);
|
||||
}
|
||||
|
||||
TEST_XML(write_escape_roundtrip, "<node attr=''>text</node>")
|
||||
{
|
||||
doc.child(STR("node")).attribute(STR("attr")) = STR("<>'\"&\x04\r\n\t");
|
||||
doc.child(STR("node")).first_child().set_value(STR("<>'\"&\x04\r\n\t"));
|
||||
|
||||
std::string contents = write_narrow(doc, format_raw, encoding_utf8);
|
||||
|
||||
CHECK(doc.load_buffer(contents.c_str(), contents.size()));
|
||||
|
||||
// Note: this string is almost identical to the string from write_escape with the exception of \r
|
||||
// \r in PCDATA doesn't roundtrip because it has to go through newline conversion (which could be disabled, but is active by default)
|
||||
CHECK_NODE(doc, STR("<node attr=\"<>'"& 	\"><>'\"&\n\t</node>"));
|
||||
CHECK_NODE_EX(doc, STR("<node attr='<>'\"& 	'><>'\"&\n\t</node>"), STR(""), format_raw | format_attribute_single_quote);
|
||||
}
|
||||
|
||||
TEST_XML(write_escape_unicode, "<node attr='㰀'/>")
|
||||
|
@ -618,7 +634,7 @@ TEST_XML(write_no_empty_element_tags, "<node><child1/><child2>text</child2><chil
|
|||
|
||||
TEST_XML_FLAGS(write_roundtrip, "<node><child1 attr1='value1' attr2='value2'/><child2 attr='value'>pre<![CDATA[data]]>mid<text&escape<!--comment--><test/>post<?pi value?>fin</child2><child3/></node>", parse_full)
|
||||
{
|
||||
const unsigned int flagset[] = { format_indent, format_raw, format_no_declaration, format_indent_attributes, format_no_empty_element_tags };
|
||||
const unsigned int flagset[] = { format_indent, format_raw, format_no_declaration, format_indent_attributes, format_no_empty_element_tags, format_attribute_single_quote };
|
||||
size_t flagcount = sizeof(flagset) / sizeof(flagset[0]);
|
||||
|
||||
for (size_t i = 0; i < (size_t(1) << flagcount); ++i)
|
||||
|
@ -705,3 +721,13 @@ TEST_XML(write_throw_encoding, "<node><child/></node>")
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_XML(write_skip_control_chars, "<a>\f\t\n\x0F\x19</a>")
|
||||
{
|
||||
CHECK_NODE_EX(doc.first_child(), STR("<a>\t\n</a>\n"), STR(""), pugi::format_default | pugi::format_skip_control_chars);
|
||||
}
|
||||
|
||||
TEST_XML(write_keep_control_chars, "<a>\f\t\n\x0F\x19</a>")
|
||||
{
|
||||
CHECK_NODE_EX(doc.first_child(), STR("<a>\t\n</a>\n"), STR(""), pugi::format_default);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,22 @@ static void load_document_copy(xml_document& doc, const char_t* text)
|
|||
doc.append_copy(source.first_child());
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static void random_shuffle(std::vector<T>& v)
|
||||
{
|
||||
size_t rng = 2147483647;
|
||||
|
||||
for (size_t i = v.size() - 1; i > 0; --i)
|
||||
{
|
||||
// Fisher-Yates shuffle
|
||||
size_t j = rng % (i + 1);
|
||||
std::swap(v[j], v[i]);
|
||||
|
||||
// LCG RNG, constants from Numerical Recipes
|
||||
rng = rng * 1664525 + 1013904223;
|
||||
}
|
||||
}
|
||||
|
||||
TEST(xpath_allocator_many_pages)
|
||||
{
|
||||
std::basic_string<char_t> query = STR("0");
|
||||
|
@ -155,7 +171,7 @@ TEST(xpath_sort_random_medium)
|
|||
xpath_node_set ns = doc.select_nodes(STR("//node() | //@*"));
|
||||
|
||||
std::vector<xpath_node> nsv(ns.begin(), ns.end());
|
||||
std::random_shuffle(nsv.begin(), nsv.end());
|
||||
random_shuffle(nsv);
|
||||
|
||||
xpath_node_set copy(&nsv[0], &nsv[0] + nsv.size());
|
||||
copy.sort();
|
||||
|
@ -184,7 +200,7 @@ TEST(xpath_sort_random_large)
|
|||
xpath_node_set ns = doc.select_nodes(STR("//node() | //@*"));
|
||||
|
||||
std::vector<xpath_node> nsv(ns.begin(), ns.end());
|
||||
std::random_shuffle(nsv.begin(), nsv.end());
|
||||
random_shuffle(nsv);
|
||||
|
||||
xpath_node_set copy(&nsv[0], &nsv[0] + nsv.size());
|
||||
copy.sort();
|
||||
|
@ -205,8 +221,8 @@ TEST(xpath_long_numbers_parse)
|
|||
xml_node c;
|
||||
|
||||
// check parsing
|
||||
CHECK_XPATH_NUMBER(c, str_flt_max, std::numeric_limits<float>::max());
|
||||
CHECK_XPATH_NUMBER(c, str_flt_max_dec, std::numeric_limits<float>::max());
|
||||
CHECK_XPATH_NUMBER(c, str_flt_max, double(std::numeric_limits<float>::max()));
|
||||
CHECK_XPATH_NUMBER(c, str_flt_max_dec, double(std::numeric_limits<float>::max()));
|
||||
CHECK_XPATH_NUMBER(c, str_dbl_max, std::numeric_limits<double>::max());
|
||||
CHECK_XPATH_NUMBER(c, str_dbl_max_dec, std::numeric_limits<double>::max());
|
||||
}
|
||||
|
@ -251,7 +267,13 @@ TEST(xpath_denorm_numbers)
|
|||
query += STR("0.001");
|
||||
}
|
||||
|
||||
CHECK_XPATH_STRING(xml_node(), query.c_str(), STR("0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009999987484955998"));
|
||||
// check if current fpu setup supports denormals
|
||||
double denorm = xpath_query(query.c_str()).evaluate_number(xml_node());
|
||||
|
||||
if (denorm != 0.0)
|
||||
{
|
||||
CHECK_XPATH_STRING(xml_node(), query.c_str(), STR("0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009999987484955998"));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_XML(xpath_rexml_1, "<a><b><c id='a'/></b><c id='b'/></a>")
|
||||
|
@ -443,15 +465,42 @@ TEST(xpath_out_of_memory_evaluate_substring)
|
|||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_string(0, 0, xml_node()) == 1));
|
||||
}
|
||||
|
||||
TEST_XML(xpath_out_of_memory_evaluate_union, "<node><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/></node>")
|
||||
TEST_XML(xpath_out_of_memory_evaluate_union, "<node />")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
|
||||
// left hand side: size * sizeof(xpath_node) (8 on 32-bit, 16 on 64-bit)
|
||||
// right hand side: same
|
||||
// to make sure that when we append right hand side to left hand side, we run out of an XPath stack page (4K), we need slightly more than 2K/8 = 256 nodes on 32-bit, 128 nodes on 64-bit
|
||||
size_t count = sizeof(void*) == 4 ? 300 : 150;
|
||||
|
||||
xpath_query q(STR("a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|(a|a)))))))))))))))))))"));
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
doc.first_child().append_child(STR("a"));
|
||||
|
||||
xpath_query q(STR("a|a"));
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node_set(doc.child(STR("node"))).empty()));
|
||||
}
|
||||
|
||||
TEST_XML(xpath_out_of_memory_evaluate_union_hash, "<node />")
|
||||
{
|
||||
// left hand side: size * sizeof(xpath_node) (8 on 32-bit, 16 on 64-bit)
|
||||
// right hand side: same
|
||||
// hash table: size * 1.5 * sizeof(void*)
|
||||
// to make sure that when we append right hand side to left hand side, we do *not* run out of an XPath stack page (4K), we need slightly less than 2K/8 = 256 nodes on 32-bit, 128 nodes on 64-bit
|
||||
size_t count = sizeof(void*) == 4 ? 200 : 100;
|
||||
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
doc.first_child().append_child(STR("a"));
|
||||
|
||||
xpath_query q(STR("a|a"));
|
||||
|
||||
test_runner::_memory_fail_threshold = 1;
|
||||
|
||||
CHECK_ALLOC_FAIL(CHECK(q.evaluate_node_set(doc.child(STR("node"))).empty()));
|
||||
}
|
||||
|
||||
|
||||
TEST_XML(xpath_out_of_memory_evaluate_predicate, "<node><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/><a/></node>")
|
||||
{
|
||||
test_runner::_memory_fail_threshold = 32768 + 4096 * 2;
|
||||
|
|
|
@ -123,7 +123,7 @@ TEST_XML(xpath_api_nodeset_copy, "<node><foo/><foo/></node>")
|
|||
|
||||
xpath_node_set copy3;
|
||||
copy3 = set;
|
||||
copy3 = copy3;
|
||||
copy3 = xpath_node_set(copy3);
|
||||
CHECK(copy3.size() == 2);
|
||||
CHECK_STRING(copy3[0].node().name(), STR("foo"));
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ TEST_XML(xpath_operators_equality_node_set_node_set, "<node><c1><v>a</v><v>b</v>
|
|||
CHECK_XPATH_BOOLEAN(n, STR("c1/v != c3/v"), true);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c2/v != c3/v"), true);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v != c4/v"), true);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v != c5/v"), true); // (a, b) != (a, b), since a != b, as per XPath spec (comparison operators are so not intutive)
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v != c5/v"), true); // (a, b) != (a, b), since a != b, as per XPath spec (comparison operators are so not intuitive)
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c3/v != c6/v"), false);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("c1/v != x"), false);
|
||||
CHECK_XPATH_BOOLEAN(n, STR("x != c1/v"), false);
|
||||
|
@ -435,6 +435,24 @@ TEST_XML(xpath_operators_union, "<node><employee/><employee secretary=''/><emplo
|
|||
CHECK_XPATH_NODESET(n, STR(". | tail/preceding-sibling::employee | .")) % 2 % 3 % 4 % 6 % 8 % 11;
|
||||
}
|
||||
|
||||
TEST_XML(xpath_operators_union_order, "<node />")
|
||||
{
|
||||
xml_node n = doc.child(STR("node"));
|
||||
|
||||
n.append_child(STR("c"));
|
||||
n.prepend_child(STR("b"));
|
||||
n.append_child(STR("d"));
|
||||
n.prepend_child(STR("a"));
|
||||
|
||||
xpath_node_set ns = n.select_nodes(STR("d | d | b | c | b | a | c | d | b"));
|
||||
|
||||
CHECK(ns.size() == 4);
|
||||
CHECK_STRING(ns[0].node().name(), STR("d"));
|
||||
CHECK_STRING(ns[1].node().name(), STR("b"));
|
||||
CHECK_STRING(ns[2].node().name(), STR("c"));
|
||||
CHECK_STRING(ns[3].node().name(), STR("a"));
|
||||
}
|
||||
|
||||
TEST(xpath_operators_union_error)
|
||||
{
|
||||
CHECK_XPATH_FAIL(STR(". | true()"));
|
||||
|
|
|
@ -381,6 +381,30 @@ TEST(xpath_parse_oom_propagation)
|
|||
}
|
||||
}
|
||||
|
||||
static std::basic_string<char_t> rep(const std::basic_string<char_t>& base, size_t count)
|
||||
{
|
||||
std::basic_string<char_t> result;
|
||||
result.reserve(base.size() * count);
|
||||
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
result += base;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
TEST(xpath_parse_depth_limit)
|
||||
{
|
||||
const size_t limit = 1500;
|
||||
|
||||
CHECK_XPATH_FAIL((rep(STR("("), limit) + STR("1") + rep(STR(")"), limit)).c_str());
|
||||
CHECK_XPATH_FAIL((STR("(id('a'))") + rep(STR("[1]"), limit)).c_str());
|
||||
CHECK_XPATH_FAIL((STR("/foo") + rep(STR("[1]"), limit)).c_str());
|
||||
CHECK_XPATH_FAIL((STR("/foo") + rep(STR("/x"), limit)).c_str());
|
||||
CHECK_XPATH_FAIL((STR("1") + rep(STR("+1"), limit)).c_str());
|
||||
CHECK_XPATH_FAIL((STR("concat(") + rep(STR("1,"), limit) + STR("1)")).c_str());
|
||||
CHECK_XPATH_FAIL((STR("/foo") + rep(STR("//x"), limit / 2)).c_str());
|
||||
}
|
||||
|
||||
TEST_XML(xpath_parse_location_path, "<node><child/></node>")
|
||||
{
|
||||
CHECK_XPATH_NODESET(doc, STR("/node")) % 2;
|
||||
|
|
|
@ -454,7 +454,7 @@ TEST_XML(xpath_variables_copy, "<node />")
|
|||
|
||||
CHECK_XPATH_STRING_VAR(xml_node(), STR("substring($c, count($d[$a]) + $b)"), &set2, STR("ring"));
|
||||
|
||||
set3 = set3;
|
||||
set3 = xpath_variable_set(set3);
|
||||
|
||||
CHECK_XPATH_STRING_VAR(xml_node(), STR("substring($c, count($d[$a]) + $b)"), &set2, STR("ring"));
|
||||
|
||||
|
@ -642,4 +642,32 @@ TEST_XML(xpath_variables_evaluate_node_set_out_of_memory, "<node />")
|
|||
|
||||
CHECK_ALLOC_FAIL(q.evaluate_node_set(xml_node()).empty());
|
||||
}
|
||||
|
||||
TEST_XML(xpath_variables_type_conversion, "<node>15</node>")
|
||||
{
|
||||
xpath_variable_set set;
|
||||
|
||||
set.set(STR("a"), true);
|
||||
set.set(STR("b"), 42.0);
|
||||
set.set(STR("c"), STR("test"));
|
||||
set.set(STR("d"), doc.select_nodes(STR("node")));
|
||||
|
||||
CHECK_XPATH_BOOLEAN_VAR(xml_node(), STR("boolean($a) = true()"), &set, true);
|
||||
CHECK_XPATH_BOOLEAN_VAR(xml_node(), STR("number($a) = 1"), &set, true);
|
||||
CHECK_XPATH_BOOLEAN_VAR(xml_node(), STR("string($a) = 'true'"), &set, true);
|
||||
|
||||
CHECK_XPATH_BOOLEAN_VAR(xml_node(), STR("boolean($b) = true()"), &set, true);
|
||||
CHECK_XPATH_BOOLEAN_VAR(xml_node(), STR("number($b) = 42"), &set, true);
|
||||
CHECK_XPATH_BOOLEAN_VAR(xml_node(), STR("string($b) = '42'"), &set, true);
|
||||
|
||||
CHECK_XPATH_BOOLEAN_VAR(xml_node(), STR("boolean($c) = true()"), &set, true);
|
||||
#ifndef MSVC6_NAN_BUG
|
||||
CHECK_XPATH_BOOLEAN_VAR(xml_node(), STR("number($c) = 0"), &set, false);
|
||||
#endif
|
||||
CHECK_XPATH_BOOLEAN_VAR(xml_node(), STR("string($c) = 'test'"), &set, true);
|
||||
|
||||
CHECK_XPATH_BOOLEAN_VAR(xml_node(), STR("boolean($d) = true()"), &set, true);
|
||||
CHECK_XPATH_BOOLEAN_VAR(xml_node(), STR("number($d) = 15"), &set, true);
|
||||
CHECK_XPATH_BOOLEAN_VAR(xml_node(), STR("string($d) = '15'"), &set, true);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue