Compare commits
No commits in common. "master" and "v1.10" have entirely different histories.
40 changed files with 1868 additions and 3405 deletions
|
@ -1,7 +1,2 @@
|
|||
comment: false
|
||||
coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
informational: true
|
||||
patch: off
|
||||
|
||||
|
|
8
.github/ISSUE_TEMPLATE/bug_report.md
vendored
8
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
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
5
.github/ISSUE_TEMPLATE/config.yml
vendored
|
@ -1,5 +0,0 @@
|
|||
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
8
.github/ISSUE_TEMPLATE/feature_request.md
vendored
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
52
.github/workflows/build.yml
vendored
52
.github/workflows/build.yml
vendored
|
@ -1,52 +0,0 @@
|
|||
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
|
27
.travis.yml
Normal file
27
.travis.yml
Normal file
|
@ -0,0 +1,27 @@
|
|||
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:
|
||||
- if [[ ! ( "$CXX" == "clang++" && "$TRAVIS_OS_NAME" == "linux" ) ]]; then make test cxxstd=c++11 defines=$DEFINES config=coverage -j2; fi
|
||||
- if [[ "$CXX" == "clang++" ]]; then make test cxxstd=c++11 defines=$DEFINES config=sanitize -j2; fi
|
||||
- make test cxxstd=c++11 defines=$DEFINES config=release -j2
|
||||
- make test cxxstd=c++98 defines=$DEFINES config=debug -j2
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash) -f pugixml.cpp.gcov
|
337
CMakeLists.txt
337
CMakeLists.txt
|
@ -1,263 +1,112 @@
|
|||
cmake_minimum_required(VERSION 3.4)
|
||||
project(pugixml VERSION 1.13 LANGUAGES CXX)
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(CMakeDependentOption)
|
||||
project(pugixml VERSION 1.10)
|
||||
|
||||
option(BUILD_SHARED_AND_STATIC_LIBS "Build both shared and static libraries" OFF)
|
||||
option(BUILD_SHARED_LIBS "Build shared instead of static library" OFF)
|
||||
option(BUILD_TESTS "Build tests" OFF)
|
||||
option(USE_VERSIONED_LIBDIR "Use a private subdirectory to install the headers and libs" OFF)
|
||||
option(USE_POSTFIX "Use separate postfix for each configuration to make sure you can install multiple build outputs" 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(GNUInstallDirs)
|
||||
include(CTest)
|
||||
mark_as_advanced(CLEAR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR)
|
||||
|
||||
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)
|
||||
set(HEADERS src/pugixml.hpp src/pugiconfig.hpp)
|
||||
set(SOURCES src/pugixml.cpp)
|
||||
|
||||
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
|
||||
if(DEFINED BUILD_DEFINES)
|
||||
foreach(DEFINE ${BUILD_DEFINES})
|
||||
add_definitions("-D" ${DEFINE})
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
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)
|
||||
if(BUILD_SHARED_AND_STATIC_LIBS)
|
||||
set(LIBRARY pugixml-static pugixml-shared)
|
||||
else()
|
||||
set(pugixml-alias pugixml-static)
|
||||
set(LIBRARY pugixml)
|
||||
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})
|
||||
if(BUILD_SHARED_AND_STATIC_LIBS)
|
||||
add_library(pugixml-static STATIC ${HEADERS} ${SOURCES})
|
||||
add_library(pugixml-shared SHARED ${HEADERS} ${SOURCES})
|
||||
else()
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_library(pugixml SHARED ${HEADERS} ${SOURCES})
|
||||
else()
|
||||
add_library(pugixml STATIC ${HEADERS} ${SOURCES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
configure_file(scripts/pugixml.pc.in pugixml.pc @ONLY)
|
||||
|
||||
if (NOT DEFINED PUGIXML_RUNTIME_COMPONENT)
|
||||
set(PUGIXML_RUNTIME_COMPONENT Runtime)
|
||||
# Export symbols for shared library builds
|
||||
if(BUILD_SHARED_AND_STATIC_LIBS AND MSVC)
|
||||
target_compile_definitions(pugixml-shared PRIVATE "PUGIXML_API=__declspec(dllexport)")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED PUGIXML_LIBRARY_COMPONENT)
|
||||
set(PUGIXML_LIBRARY_COMPONENT Library)
|
||||
if(BUILD_SHARED_LIBS AND MSVC)
|
||||
target_compile_definitions(pugixml PRIVATE "PUGIXML_API=__declspec(dllexport)")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED PUGIXML_DEVELOPMENT_COMPONENT)
|
||||
set(PUGIXML_DEVELOPMENT_COMPONENT Development)
|
||||
if(USE_VERSIONED_LIBDIR)
|
||||
# Install library into its own directory under LIBDIR
|
||||
set(INSTALL_SUFFIX /pugixml-${pugixml_VERSION})
|
||||
endif()
|
||||
|
||||
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})
|
||||
|
||||
install(EXPORT pugixml-targets
|
||||
NAMESPACE pugixml::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pugixml COMPONENT ${PUGIXML_DEVELOPMENT_COMPONENT})
|
||||
|
||||
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)
|
||||
foreach(TARGET ${LIBRARY})
|
||||
# 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(${TARGET} PUBLIC cxx_long_long_type)
|
||||
endif()
|
||||
|
||||
set_target_properties(${TARGET} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||
|
||||
target_include_directories(${TARGET} PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}${INSTALL_SUFFIX}>)
|
||||
|
||||
if(USE_POSTFIX)
|
||||
set_target_properties(${TARGET} PROPERTIES DEBUG_POSTFIX "_d" MINSIZEREL_POSTFIX "_m" RELWITHDEBINFO_POSTFIX "_r")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
install(TARGETS ${LIBRARY} 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)
|
||||
|
||||
configure_file(scripts/pugixml.pc.in ${PROJECT_BINARY_DIR}/pugixml.pc @ONLY)
|
||||
install(FILES ${PROJECT_BINARY_DIR}/pugixml.pc DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig)
|
||||
|
||||
if(BUILD_TESTS)
|
||||
file(GLOB TEST_SOURCES tests/*.cpp)
|
||||
file(GLOB FUZZ_SOURCES tests/fuzz_*.cpp)
|
||||
list(REMOVE_ITEM TEST_SOURCES ${FUZZ_SOURCES})
|
||||
|
||||
add_executable(check ${TEST_SOURCES})
|
||||
if(BUILD_SHARED_AND_STATIC_LIBS)
|
||||
target_link_libraries(check pugixml-static)
|
||||
else()
|
||||
target_link_libraries(check pugixml)
|
||||
endif()
|
||||
add_custom_command(TARGET check POST_BUILD COMMAND check WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
Copyright (c) 2006-2019 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
|
4
Makefile
4
Makefile
|
@ -12,7 +12,7 @@ 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 docs scripts src CMakeLists.txt LICENSE.md readme.txt))
|
||||
RELEASE=$(filter-out scripts/archive.py docs/%.adoc,$(shell git ls-files docs scripts src CMakeLists.txt readme.txt))
|
||||
|
||||
CXXFLAGS=-g -Wall -Wextra -Werror -pedantic -Wundef -Wshadow -Wcast-align -Wcast-qual -Wold-style-cast -Wdouble-promotion
|
||||
LDFLAGS=
|
||||
|
@ -77,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` && python3 scripts/archive.py $@ pugixml-$(VERSION) $$TIMESTAMP $|
|
||||
TIMESTAMP=`git show v$(VERSION) -s --format=%ct` && python scripts/archive.py $@ pugixml-$(VERSION) $$TIMESTAMP $|
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS)
|
||||
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pugixml [](https://github.com/zeux/pugixml/actions) [](https://ci.appveyor.com/project/zeux/pugixml) [](https://codecov.io/github/zeux/pugixml?branch=master) 
|
||||
pugixml [](https://travis-ci.org/zeux/pugixml) [](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
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
# 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).
|
|
@ -1,5 +1,4 @@
|
|||
image:
|
||||
- Visual Studio 2022
|
||||
- Visual Studio 2019
|
||||
- Visual Studio 2017
|
||||
- Visual Studio 2015
|
||||
|
@ -11,15 +10,13 @@ build_script:
|
|||
- 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" }
|
||||
- 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" }
|
||||
- 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" }
|
||||
|
||||
artifacts:
|
||||
- path: .\scripts\*.nupkg
|
||||
|
|
133
docs/manual.adoc
133
docs/manual.adoc
|
@ -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-2022 Arseny Kapoulkine
|
||||
Copyright (c) 2006-2019 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
@ -74,7 +74,7 @@ This means that you can freely use pugixml in your applications, both open-sourc
|
|||
|
||||
....
|
||||
This software is based on pugixml library (https://pugixml.org).
|
||||
pugixml is Copyright (C) 2006-2022 Arseny Kapoulkine.
|
||||
pugixml is Copyright (C) 2006-2019 Arseny Kapoulkine.
|
||||
....
|
||||
|
||||
[[install]]
|
||||
|
@ -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 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.
|
||||
* 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.
|
||||
|
||||
* 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:
|
||||
+
|
||||
|
@ -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 and permits multiple top-level element nodes. 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.
|
||||
|
||||
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,7 +818,6 @@ 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
|
||||
|
@ -969,28 +968,6 @@ 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:
|
||||
|
||||
|
@ -1276,7 +1253,6 @@ 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.
|
||||
|
@ -1298,7 +1274,6 @@ 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.
|
||||
|
@ -1312,9 +1287,7 @@ 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);
|
||||
|
@ -1405,18 +1378,16 @@ include::samples/modify_add.cpp[tags=code]
|
|||
[[modify.remove]]
|
||||
=== Removing nodes/attributes
|
||||
|
||||
[[xml_node::remove_attribute]][[xml_node::remove_attributes]][[xml_node::remove_child]][[xml_node::remove_children]]
|
||||
[[xml_node::remove_attribute]][[xml_node::remove_child]]
|
||||
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. `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:
|
||||
`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:
|
||||
|
||||
* The node the function is called on is null;
|
||||
* The attribute/node to be removed is null;
|
||||
|
@ -1452,7 +1423,6 @@ 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).
|
||||
|
@ -1467,9 +1437,7 @@ 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);
|
||||
|
@ -1629,12 +1597,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. The functions return `true` on success and `false` if the file could not be opened or written to.
|
||||
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.
|
||||
|
||||
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. 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. 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.
|
||||
|
||||
This is a simple example of saving XML document to file (link:samples/save_file.cpp[]):
|
||||
|
||||
|
@ -2163,65 +2131,6 @@ 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^
|
||||
|
||||
|
@ -2840,7 +2749,6 @@ 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);
|
||||
|
@ -2899,9 +2807,6 @@ 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;
|
||||
|
||||
|
@ -2930,7 +2835,6 @@ 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);
|
||||
|
@ -2964,10 +2868,8 @@ 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);
|
||||
|
||||
|
@ -3043,17 +2945,16 @@ 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_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);
|
||||
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);
|
||||
|
||||
xml_text& +++<a href="#xml_text::assign">operator=</a>+++(const char_t* rhs);
|
||||
xml_text& +++<a href="#xml_text::assign">operator=</a>+++(int rhs);
|
||||
|
|
2509
docs/manual.html
2509
docs/manual.html
File diff suppressed because it is too large
Load diff
|
@ -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-2022 Arseny Kapoulkine
|
||||
Copyright (c) 2006-2019 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
@ -283,5 +283,5 @@ This means that you can freely use pugixml in your applications, both open-sourc
|
|||
|
||||
....
|
||||
This software is based on pugixml library (https://pugixml.org).
|
||||
pugixml is Copyright (C) 2006-2022 Arseny Kapoulkine.
|
||||
pugixml is Copyright (C) 2006-2019 Arseny Kapoulkine.
|
||||
....
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
pugixml 1.13 - an XML processing library
|
||||
pugixml 1.10 - an XML processing library
|
||||
|
||||
Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
Copyright (C) 2006-2019, 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,
|
||||
|
@ -26,7 +26,7 @@ The distribution contains the following folders:
|
|||
|
||||
This library is distributed under the MIT License:
|
||||
|
||||
Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
Copyright (c) 2006-2019 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 b'\0' not in data:
|
||||
data = data.replace(b'\r', b'')
|
||||
if '\0' not in data:
|
||||
data = data.replace('\r', '')
|
||||
if use_crlf:
|
||||
data = data.replace(b'\n', b'\r\n')
|
||||
data = data.replace('\n', '\r\n')
|
||||
|
||||
return data
|
||||
|
||||
|
@ -24,7 +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
|
||||
info.external_attr = 0644 << 16L
|
||||
archive.writestr(info, data)
|
||||
|
||||
def write_tar(target, arcprefix, timestamp, sources, compression):
|
||||
|
@ -35,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, io.BytesIO(data))
|
||||
archive.addfile(info, StringIO.StringIO(data))
|
||||
|
||||
if len(sys.argv) < 5:
|
||||
raise RuntimeError('Usage: python archive.py <target> <archive prefix> <timestamp> <source files>')
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
<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,27 +2,26 @@
|
|||
<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>
|
||||
<PreprocessorDefinitions Condition="'$(Linkage-pugixml)' == 'header'">PUGIXML_HEADER_ONLY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup Condition="'$(Linkage-pugixml)' == 'source'">
|
||||
<ClCompile Include="$(MSBuildThisFileDirectory)include\pugixml.cpp"/>
|
||||
</ItemGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Linkage-pugixml)' != 'header' AND '$(Linkage-pugixml)' != 'source'">
|
||||
<ItemDefinitionGroup Condition="$(Configuration.ToLower().IndexOf('debug')) != -1">
|
||||
<Link>
|
||||
<AdditionalDependencies>$(MSBuildThisFileDirectory)lib/$(Platform)\$(PlatformToolset.Split('_')[0])\$(Linkage-pugixml)\$(Configuration-pugixml)\pugixml.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<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>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
||||
|
|
|
@ -2,19 +2,20 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/10/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>pugixml</id>
|
||||
<version>1.13.0-appveyor</version>
|
||||
<version>1.10.0-appveyor</version>
|
||||
<title>pugixml</title>
|
||||
<authors>Arseny Kapoulkine</authors>
|
||||
<owners>Arseny Kapoulkine</owners>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<license type="expression">MIT</license>
|
||||
<licenseUrl>https://pugixml.org/license.html</licenseUrl>
|
||||
<projectUrl>https://pugixml.org/</projectUrl>
|
||||
<iconUrl>https://github.com/zeux/pugixml/logo.svg</iconUrl>
|
||||
<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, VS2017, VS2019 and VS2022, 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 and VS2017, VS2019, 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>https://pugixml.org/docs/manual.html#changes</releaseNotes>
|
||||
<copyright>Copyright (c) 2006-2022 Arseny Kapoulkine</copyright>
|
||||
<copyright>Copyright (c) 2006-2019 Arseny Kapoulkine</copyright>
|
||||
<tags>native nativepackage</tags>
|
||||
</metadata>
|
||||
</package>
|
||||
|
|
|
@ -33,13 +33,8 @@ 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"
|
||||
|
||||
if ($args[0] -eq 2022){
|
||||
Build-Version "vs2022" "v143" "dynamic"
|
||||
Build-Version "vs2022" "v143" "static"
|
||||
|
||||
} elseif ($args[0] -eq 2019){
|
||||
if ($args[0] -eq 2019){
|
||||
Build-Version "vs2019" "v142" "dynamic"
|
||||
Build-Version "vs2019" "v142" "static"
|
||||
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
@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 ()
|
|
@ -8,4 +8,4 @@ Description: Light-weight, simple and fast XML parser for C++ with XPath support
|
|||
URL: https://pugixml.org/
|
||||
Version: @pugixml_VERSION@
|
||||
Cflags: -I${includedir}
|
||||
Libs: -L${libdir} -lpugixml@LIB_POSTFIX@
|
||||
Libs: -L${libdir} -lpugixml
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = "pugixml"
|
||||
s.version = "1.13"
|
||||
s.version = "1.10"
|
||||
s.summary = "C++ XML parser library."
|
||||
s.homepage = "https://pugixml.org"
|
||||
s.license = "MIT"
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
#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
|
|
@ -1,172 +0,0 @@
|
|||
<?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>
|
|
@ -1,176 +0,0 @@
|
|||
<?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,7 +1,7 @@
|
|||
/**
|
||||
* pugixml parser - version 1.13
|
||||
* pugixml parser - version 1.10
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Copyright (C) 2006-2019, 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
|
||||
|
@ -40,9 +40,6 @@
|
|||
// #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
|
||||
|
||||
|
@ -52,7 +49,7 @@
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
* Copyright (c) 2006-2019 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
|
|
695
src/pugixml.cpp
695
src/pugixml.cpp
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
* pugixml parser - version 1.13
|
||||
* pugixml parser - version 1.10
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2022, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Copyright (C) 2006-2019, 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
|
||||
|
@ -11,10 +11,10 @@
|
|||
* Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
|
||||
*/
|
||||
|
||||
#ifndef PUGIXML_VERSION
|
||||
// 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 PUGIXML_VERSION 1130 // 1.13
|
||||
# define PUGIXML_VERSION 1100
|
||||
#endif
|
||||
|
||||
// Include user configuration file (this can define various configuration macros)
|
||||
|
@ -111,17 +111,6 @@
|
|||
# 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
|
||||
|
@ -274,9 +263,6 @@ namespace pugi
|
|||
// 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;
|
||||
|
@ -314,8 +300,6 @@ namespace pugi
|
|||
It begin() const { return _begin; }
|
||||
It end() const { return _end; }
|
||||
|
||||
bool empty() const { return _begin == _end; }
|
||||
|
||||
private:
|
||||
It _begin, _end;
|
||||
};
|
||||
|
@ -418,7 +402,6 @@ 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")
|
||||
|
@ -427,9 +410,7 @@ 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
|
||||
|
@ -553,7 +534,6 @@ 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.
|
||||
|
@ -596,16 +576,10 @@ 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.
|
||||
|
@ -676,15 +650,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 = PUGIXML_NULL) const;
|
||||
xpath_node select_node(const char_t* query, xpath_variable_set* variables = 0) 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 = PUGIXML_NULL) const;
|
||||
xpath_node_set select_nodes(const char_t* query, xpath_variable_set* variables = 0) 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 = PUGIXML_NULL) const;
|
||||
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 xpath_query& query) const;
|
||||
|
||||
#endif
|
||||
|
@ -779,7 +753,6 @@ 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")
|
||||
|
@ -788,9 +761,7 @@ 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
|
||||
|
@ -858,10 +829,10 @@ namespace pugi
|
|||
xml_node& operator*() const;
|
||||
xml_node* operator->() const;
|
||||
|
||||
xml_node_iterator& operator++();
|
||||
const xml_node_iterator& operator++();
|
||||
xml_node_iterator operator++(int);
|
||||
|
||||
xml_node_iterator& operator--();
|
||||
const xml_node_iterator& operator--();
|
||||
xml_node_iterator operator--(int);
|
||||
};
|
||||
|
||||
|
@ -900,10 +871,10 @@ namespace pugi
|
|||
xml_attribute& operator*() const;
|
||||
xml_attribute* operator->() const;
|
||||
|
||||
xml_attribute_iterator& operator++();
|
||||
const xml_attribute_iterator& operator++();
|
||||
xml_attribute_iterator operator++(int);
|
||||
|
||||
xml_attribute_iterator& operator--();
|
||||
const xml_attribute_iterator& operator--();
|
||||
xml_attribute_iterator operator--(int);
|
||||
};
|
||||
|
||||
|
@ -936,10 +907,10 @@ namespace pugi
|
|||
xml_node& operator*() const;
|
||||
xml_node* operator->() const;
|
||||
|
||||
xml_named_node_iterator& operator++();
|
||||
const xml_named_node_iterator& operator++();
|
||||
xml_named_node_iterator operator++(int);
|
||||
|
||||
xml_named_node_iterator& operator--();
|
||||
const xml_named_node_iterator& operator--();
|
||||
xml_named_node_iterator operator--(int);
|
||||
|
||||
private:
|
||||
|
@ -1228,7 +1199,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 = PUGIXML_NULL);
|
||||
explicit xpath_query(const char_t* query, xpath_variable_set* variables = 0);
|
||||
|
||||
// Constructor
|
||||
xpath_query();
|
||||
|
@ -1481,7 +1452,7 @@ namespace std
|
|||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2022 Arseny Kapoulkine
|
||||
* Copyright (c) 2006-2019 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
|
|
|
@ -18,18 +18,15 @@ 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) {
|
||||
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
|
||||
|
|
|
@ -22,11 +22,12 @@
|
|||
# include <stdexcept>
|
||||
#endif
|
||||
|
||||
// for unlink
|
||||
#ifdef _WIN32
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#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
|
||||
#endif
|
||||
|
||||
using namespace pugi;
|
||||
|
@ -736,12 +737,7 @@ 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()
|
||||
|
@ -1810,51 +1806,4 @@ 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,13 +70,7 @@ TEST_XML(dom_attr_set_value, "<node/>")
|
|||
CHECK(node.append_attribute(STR("attr8")).set_value(true));
|
||||
CHECK(!xml_attribute().set_value(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\"/>"));
|
||||
CHECK_NODE(node, STR("<node attr1=\"v1\" attr2=\"-2147483647\" attr3=\"-2147483648\" attr4=\"4294967295\" attr5=\"4294967294\" attr6=\"0.5\" attr7=\"0.25\" attr8=\"true\"/>"));
|
||||
}
|
||||
|
||||
#if LONG_MAX > 2147483647
|
||||
|
@ -215,24 +209,6 @@ 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")));
|
||||
|
@ -516,36 +492,6 @@ 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());
|
||||
|
@ -761,36 +707,6 @@ 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")));
|
||||
|
@ -1786,31 +1702,6 @@ 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,
|
||||
|
|
|
@ -249,46 +249,6 @@ 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"));
|
||||
|
|
|
@ -795,12 +795,7 @@ 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];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "../src/pugixml.hpp"
|
||||
|
||||
#if PUGIXML_VERSION != 1130
|
||||
#if PUGIXML_VERSION != 1100
|
||||
#error Unexpected pugixml version
|
||||
#endif
|
||||
|
|
|
@ -10,6 +10,14 @@
|
|||
#include <algorithm>
|
||||
#include <limits>
|
||||
|
||||
// std::random_shuffle is deprecated in c++14, is removed in c++17.
|
||||
#if defined(__cplusplus) && (__cplusplus >= 201402L)
|
||||
# include <random>
|
||||
# define PUGIXML_SHUFFLE(rng) std::shuffle(rng.begin(), rng.end(), std::default_random_engine{std::random_device{}()})
|
||||
#else
|
||||
# define PUGIXML_SHUFFLE(rng) std::random_shuffle(rng.begin(), rng.end())
|
||||
#endif
|
||||
|
||||
using namespace pugi;
|
||||
|
||||
static void load_document_copy(xml_document& doc, const char_t* text)
|
||||
|
@ -20,22 +28,6 @@ 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");
|
||||
|
@ -171,7 +163,7 @@ TEST(xpath_sort_random_medium)
|
|||
xpath_node_set ns = doc.select_nodes(STR("//node() | //@*"));
|
||||
|
||||
std::vector<xpath_node> nsv(ns.begin(), ns.end());
|
||||
random_shuffle(nsv);
|
||||
PUGIXML_SHUFFLE(nsv);
|
||||
|
||||
xpath_node_set copy(&nsv[0], &nsv[0] + nsv.size());
|
||||
copy.sort();
|
||||
|
@ -200,7 +192,7 @@ TEST(xpath_sort_random_large)
|
|||
xpath_node_set ns = doc.select_nodes(STR("//node() | //@*"));
|
||||
|
||||
std::vector<xpath_node> nsv(ns.begin(), ns.end());
|
||||
random_shuffle(nsv);
|
||||
PUGIXML_SHUFFLE(nsv);
|
||||
|
||||
xpath_node_set copy(&nsv[0], &nsv[0] + nsv.size());
|
||||
copy.sort();
|
||||
|
|
|
@ -381,30 +381,6 @@ 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;
|
||||
|
|
|
@ -642,32 +642,4 @@ 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