mirror of
https://github.com/GerbilSoft/rom-properties.git
synced 2025-06-18 11:35:38 -04:00
[tinyxml2] Updated to tinyxml2-8.1.0.
This commit is contained in:
parent
034501bbfb
commit
05aed01ddf
2
extlib/tinyxml2/.gitignore
vendored
2
extlib/tinyxml2/.gitignore
vendored
@ -20,3 +20,5 @@ tinyxml2/temp/
|
||||
*.vc.opendb
|
||||
libtinyxml2.a
|
||||
xmltest
|
||||
vs/debug
|
||||
|
||||
|
284
extlib/tinyxml2/CMakeLists.txt
vendored
284
extlib/tinyxml2/CMakeLists.txt
vendored
@ -1,68 +1,39 @@
|
||||
# rom-properties: Disable CMake version requirement.
|
||||
#cmake_minimum_required(VERSION 3.15)
|
||||
project(tinyxml2 VERSION 8.1.0)
|
||||
|
||||
IF(0) # rom-properties: CMake policies.
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
ENDIF(0) # rom-properties
|
||||
|
||||
IF(0) # rom-properties: Disable tests.
|
||||
include(CTest)
|
||||
option(tinyxml2_BUILD_TESTING "Build tests for tinyxml2" "${BUILD_TESTING}")
|
||||
ENDIF(0)
|
||||
|
||||
# rom-properties:
|
||||
# Unix: Add -fpic/-fPIC in order to use this static library in plugins.
|
||||
IF(UNIX AND NOT APPLE)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpic -fPIC")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -fPIC")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpic -fPIC")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic -fPIC")
|
||||
ENDIF(UNIX AND NOT APPLE)
|
||||
|
||||
IF(BIICODE)
|
||||
ADD_BIICODE_TARGETS()
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/resources)
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/resources DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
ENDIF()
|
||||
RETURN()
|
||||
ENDIF(BIICODE)
|
||||
# rom-properties: Disabled; use the main project policies.
|
||||
IF(0)
|
||||
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
|
||||
cmake_policy(VERSION 2.6)
|
||||
cmake_policy(SET CMP0048 NEW)
|
||||
if(POLICY CMP0063)
|
||||
cmake_policy(SET CMP0063 OLD)
|
||||
endif()
|
||||
ENDIF(0) # rom-properties
|
||||
##
|
||||
## Honor tinyxml2_SHARED_LIBS to match install interface
|
||||
##
|
||||
|
||||
project(tinyxml2)
|
||||
# rom-properties: Disabled.
|
||||
IF(0)
|
||||
include(GNUInstallDirs)
|
||||
include(CTest)
|
||||
#enable_testing()
|
||||
ENDIF(0) # rom-properties
|
||||
if (DEFINED tinyxml2_SHARED_LIBS)
|
||||
set(BUILD_SHARED_LIBS "${tinyxml2_SHARED_LIBS}")
|
||||
endif ()
|
||||
|
||||
#CMAKE_BUILD_TOOL
|
||||
|
||||
################################
|
||||
# set lib version here
|
||||
|
||||
set(GENERIC_LIB_VERSION "8.0.0")
|
||||
set(GENERIC_LIB_SOVERSION "8")
|
||||
|
||||
################################
|
||||
# Add definitions
|
||||
|
||||
################################
|
||||
# Add targets
|
||||
# By Default shared library is being built
|
||||
# To build static libs also - Do cmake . -DBUILD_STATIC_LIBS:BOOL=ON
|
||||
# User can choose not to build shared library by using cmake -DBUILD_SHARED_LIBS:BOOL=OFF
|
||||
# To build only static libs use cmake . -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_STATIC_LIBS:BOOL=ON
|
||||
# To build the tests, use cmake . -DBUILD_TESTS:BOOL=ON
|
||||
# To disable the building of the tests, use cmake . -DBUILD_TESTS:BOOL=OFF
|
||||
|
||||
# rom-properties: Don't use option() here; it's set by extlib.
|
||||
IF(0)
|
||||
option(BUILD_SHARED_LIBS "build as shared library" ON)
|
||||
option(BUILD_TESTS "build xmltest (deprecated: Use BUILD_TESTING)" ON)
|
||||
ENDIF(0) # rom-properties
|
||||
|
||||
# To allow using tinyxml in another shared library
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
##
|
||||
## Main library build
|
||||
##
|
||||
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
|
||||
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
|
||||
|
||||
# to distinguish between debug and release lib
|
||||
# rom-properties: to distinguish between debug and release lib
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
|
||||
# rom-properties: Add the custom .rc file in Windows DLL builds.
|
||||
@ -71,46 +42,62 @@ IF(WIN32 AND BUILD_SHARED_LIBS)
|
||||
SET(TINYXML2_RC "tinyxml2.rc")
|
||||
ENDIF(WIN32 AND BUILD_SHARED_LIBS)
|
||||
add_library(tinyxml2 tinyxml2.cpp tinyxml2.h ${TINYXML2_RC})
|
||||
add_library(tinyxml2::tinyxml2 ALIAS tinyxml2)
|
||||
|
||||
# Uncomment the following line to require C++11 (or greater) to use tinyxml2
|
||||
# target_compile_features(tinyxml2 PUBLIC cxx_std_11)
|
||||
target_include_directories(tinyxml2 PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
|
||||
|
||||
target_compile_definitions(
|
||||
tinyxml2
|
||||
PUBLIC $<$<CONFIG:Debug>:TINYXML2_DEBUG>
|
||||
INTERFACE $<$<BOOL:${BUILD_SHARED_LIBS}>:TINYXML2_IMPORT>
|
||||
# rom-properties: This is already set in the platform configuration.
|
||||
#PRIVATE $<$<CXX_COMPILER_ID:MSVC>:_CRT_SECURE_NO_WARNINGS>
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
tinyxml2
|
||||
PROPERTIES
|
||||
DEFINE_SYMBOL "TINYXML2_EXPORT"
|
||||
VERSION "${tinyxml2_VERSION}"
|
||||
SOVERSION "${tinyxml2_VERSION_MAJOR}"
|
||||
)
|
||||
|
||||
set_target_properties(tinyxml2 PROPERTIES
|
||||
COMPILE_DEFINITIONS "TINYXML2_EXPORT"
|
||||
VERSION "${GENERIC_LIB_VERSION}"
|
||||
SOVERSION "${GENERIC_LIB_SOVERSION}")
|
||||
# rom-properties: Set TINYXML2_IMPORT when linking to TinyXML2.
|
||||
TARGET_COMPILE_DEFINITIONS(tinyxml2
|
||||
PRIVATE "TINYXML2_EXPORT"
|
||||
INTERFACE "TINYXML2_IMPORT")
|
||||
|
||||
target_compile_definitions(tinyxml2 PUBLIC $<$<CONFIG:Debug>:TINYXML2_DEBUG>)
|
||||
if (tinyxml2_BUILD_TESTING)
|
||||
add_executable(xmltest xmltest.cpp)
|
||||
target_link_libraries(xmltest PRIVATE tinyxml2::tinyxml2)
|
||||
|
||||
if(DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
|
||||
target_include_directories(tinyxml2 PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
|
||||
add_test(
|
||||
NAME xmltest
|
||||
COMMAND xmltest
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
)
|
||||
|
||||
# rom-properties: This is already set in the platform configuration.
|
||||
IF(0)
|
||||
if(MSVC)
|
||||
target_compile_definitions(tinyxml2 PUBLIC -D_CRT_SECURE_NO_WARNINGS)
|
||||
endif(MSVC)
|
||||
ENDIF(0) # rom-properties
|
||||
else()
|
||||
include_directories(${PROJECT_SOURCE_DIR})
|
||||
set_tests_properties(xmltest PROPERTIES PASS_REGULAR_EXPRESSION ", Fail 0")
|
||||
endif ()
|
||||
|
||||
# rom-properties: This is already set in the platform configuration.
|
||||
IF(0)
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
endif(MSVC)
|
||||
ENDIF(0) # rom-properties
|
||||
endif()
|
||||
##
|
||||
## Installation
|
||||
##
|
||||
|
||||
# rom-properties: Disable target export.
|
||||
IF(0)
|
||||
# export targets for find_package config mode
|
||||
export(TARGETS tinyxml2
|
||||
FILE ${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Targets.cmake)
|
||||
ENDIF(0) # rom-properties
|
||||
## Standard modules
|
||||
include(GNUInstallDirs)
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
## Custom locations
|
||||
set(tinyxml2_INSTALL_PKGCONFIGDIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
|
||||
CACHE PATH "Directory for pkgconfig files")
|
||||
|
||||
set(tinyxml2_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/tinyxml2"
|
||||
CACHE STRING "Path to tinyxml2 CMake files")
|
||||
|
||||
## CMake targets and export scripts
|
||||
|
||||
# rom-properties:
|
||||
# - Only install on Windows.
|
||||
@ -118,21 +105,16 @@ ENDIF(0) # rom-properties
|
||||
# - Disabled installation of export files and import libraries.
|
||||
# - Use the correct RUNTIME destination.
|
||||
# - Install PDB files.
|
||||
IF(WIN32)
|
||||
install(TARGETS tinyxml2
|
||||
#EXPORT ${CMAKE_PROJECT_NAME}Targets
|
||||
RUNTIME
|
||||
#DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
DESTINATION ${INSTALL_BIN_DIR}
|
||||
COMPONENT tinyxml2_runtime
|
||||
#LIBRARY
|
||||
# DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
# COMPONENT tinyxml2_libraries
|
||||
#ARCHIVE
|
||||
# DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
# COMPONENT tinyxml2_libraries)
|
||||
)
|
||||
ENDIF(WIN32)
|
||||
IF(WIN32) # rom-properties
|
||||
install(
|
||||
TARGETS tinyxml2 EXPORT tinyxml2-targets
|
||||
RUNTIME COMPONENT tinyxml2_runtime
|
||||
#LIBRARY COMPONENT tinyxml2_runtime
|
||||
#NAMELINK_COMPONENT tinyxml2_development
|
||||
#ARCHIVE COMPONENT tinyxml2_development
|
||||
#INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
ENDIF(WIN32) # rom-properties
|
||||
|
||||
# rom-properties: Split debug functionality; Windows subsystem.
|
||||
DO_SPLIT_DEBUG(tinyxml2)
|
||||
@ -154,58 +136,58 @@ IF(WIN32 AND BUILD_SHARED_LIBS AND INSTALL_DEBUG)
|
||||
UNSET(PDB_FILENAME_R)
|
||||
ENDIF(WIN32 AND BUILD_SHARED_LIBS AND INSTALL_DEBUG)
|
||||
|
||||
# rom-properties: Don't build xmltest or install anything else.
|
||||
IF(0)
|
||||
if(BUILD_TESTING AND BUILD_TESTS)
|
||||
add_executable(xmltest xmltest.cpp)
|
||||
add_dependencies(xmltest tinyxml2)
|
||||
target_link_libraries(xmltest tinyxml2)
|
||||
# Type-specific targets
|
||||
|
||||
# Copy test resources and create test output directory
|
||||
add_custom_command(TARGET xmltest POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/resources $<TARGET_FILE_DIR:xmltest>/resources
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:xmltest>/resources/out
|
||||
COMMENT "Configuring xmltest resources directory: ${CMAKE_CURRENT_BINARY_DIR}/resources"
|
||||
)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
set(type shared)
|
||||
else ()
|
||||
set(type static)
|
||||
endif ()
|
||||
|
||||
add_test(NAME xmltest COMMAND xmltest WORKING_DIRECTORY $<TARGET_FILE_DIR:xmltest>)
|
||||
endif()
|
||||
|
||||
install(FILES tinyxml2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT tinyxml2_headers)
|
||||
|
||||
configure_file(tinyxml2.pc.in tinyxml2.pc @ONLY)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT tinyxml2_config)
|
||||
|
||||
# uninstall target
|
||||
if(NOT TARGET uninstall)
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
endif()
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
set(TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
|
||||
configure_package_config_file(
|
||||
"Config.cmake.in"
|
||||
"${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake"
|
||||
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}"
|
||||
IF(0) # rom-properties
|
||||
install(
|
||||
EXPORT tinyxml2-targets
|
||||
DESTINATION "${tinyxml2_INSTALL_CMAKEDIR}"
|
||||
NAMESPACE tinyxml2::
|
||||
FILE tinyxml2-${type}-targets.cmake
|
||||
COMPONENT tinyxml2_development
|
||||
)
|
||||
ENDIF(0) # rom-properties
|
||||
|
||||
# Auto-generated version compatibility file
|
||||
write_basic_package_version_file(
|
||||
tinyxml2-config-version.cmake
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
IF(0) # rom-properties
|
||||
install(
|
||||
FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/tinyxml2-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/tinyxml2-config-version.cmake"
|
||||
DESTINATION "${tinyxml2_INSTALL_CMAKEDIR}"
|
||||
COMPONENT tinyxml2_development
|
||||
)
|
||||
ENDIF(0) # rom-properties
|
||||
|
||||
## Headers
|
||||
|
||||
IF(0) # rom-properties
|
||||
install(
|
||||
FILES tinyxml2.h
|
||||
TYPE INCLUDE
|
||||
COMPONENT tinyxml2_development
|
||||
)
|
||||
ENDIF(0) # rom-properties
|
||||
|
||||
## pkg-config
|
||||
|
||||
IF(0) # rom-properties
|
||||
configure_file(cmake/tinyxml2.pc.in tinyxml2.pc.gen @ONLY)
|
||||
file(GENERATE OUTPUT tinyxml2.pc INPUT "${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc.gen")
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/tinyxml2.pc"
|
||||
DESTINATION "${tinyxml2_INSTALL_PKGCONFIGDIR}"
|
||||
COMPONENT tinyxml2_development
|
||||
)
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake"
|
||||
VERSION ${GENERIC_LIB_VERSION}
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
install(FILES
|
||||
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}Config.cmake
|
||||
${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}
|
||||
COMPONENT tinyxml2_config)
|
||||
|
||||
install(EXPORT ${CMAKE_PROJECT_NAME}Targets NAMESPACE tinyxml2::
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}
|
||||
COMPONENT tinyxml2_config)
|
||||
ENDIF(0) # rom-properties
|
||||
|
4
extlib/tinyxml2/Config.cmake.in
vendored
4
extlib/tinyxml2/Config.cmake.in
vendored
@ -1,4 +0,0 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
|
||||
check_required_components("@PROJECT_NAME@")
|
18
extlib/tinyxml2/LICENSE.txt
vendored
Normal file
18
extlib/tinyxml2/LICENSE.txt
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any
|
||||
damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
10
extlib/tinyxml2/_MODIFIED_TINYXML2.txt
vendored
10
extlib/tinyxml2/_MODIFIED_TINYXML2.txt
vendored
@ -1,9 +1,9 @@
|
||||
This copy of tinyxml2-8.0.0 is a modified version of the original.
|
||||
This copy of tinyxml2-8.1.0 is a modified version of the original.
|
||||
|
||||
commit bf15233ad88390461f6ab0dbcf046cce643c5fcb
|
||||
Setting the version to 8.0.0
|
||||
commit 3291390336141573e51dfa991b4179c8bcd8f306
|
||||
update the docs
|
||||
|
||||
Tag: 8.0.0
|
||||
Tag: 8.1.0
|
||||
|
||||
The following changes have been made to the original:
|
||||
|
||||
@ -17,5 +17,5 @@ The following changes have been made to the original:
|
||||
- cmake_minimum_required() is disabled, since it interfered with
|
||||
policies set by the main build infrastructure.
|
||||
|
||||
To obtain the original tinyxml2-8.0.0, visit:
|
||||
To obtain the original tinyxml2-8.1.0, visit:
|
||||
https://github.com/leethomason/tinyxml2
|
||||
|
7
extlib/tinyxml2/biicode.conf
vendored
7
extlib/tinyxml2/biicode.conf
vendored
@ -1,7 +0,0 @@
|
||||
# Biicode configuration file
|
||||
|
||||
[paths]
|
||||
/
|
||||
|
||||
[dependencies]
|
||||
xmltest.cpp + resources/*.xml
|
57
extlib/tinyxml2/cmake/tinyxml2-config.cmake
vendored
Normal file
57
extlib/tinyxml2/cmake/tinyxml2-config.cmake
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
set(tinyxml2_known_comps static shared)
|
||||
set(tinyxml2_comp_static NO)
|
||||
set(tinyxml2_comp_shared NO)
|
||||
foreach (tinyxml2_comp IN LISTS ${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
|
||||
if (tinyxml2_comp IN_LIST tinyxml2_known_comps)
|
||||
set(tinyxml2_comp_${tinyxml2_comp} YES)
|
||||
else ()
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
|
||||
"tinyxml2 does not recognize component `${tinyxml2_comp}`.")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
return()
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
if (tinyxml2_comp_static AND tinyxml2_comp_shared)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
|
||||
"tinyxml2 `static` and `shared` components are mutually exclusive.")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
return()
|
||||
endif ()
|
||||
|
||||
set(tinyxml2_static_targets "${CMAKE_CURRENT_LIST_DIR}/tinyxml2-static-targets.cmake")
|
||||
set(tinyxml2_shared_targets "${CMAKE_CURRENT_LIST_DIR}/tinyxml2-shared-targets.cmake")
|
||||
|
||||
macro(tinyxml2_load_targets type)
|
||||
if (NOT EXISTS "${tinyxml2_${type}_targets}")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
|
||||
"tinyxml2 `${type}` libraries were requested but not found.")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
|
||||
return()
|
||||
endif ()
|
||||
include("${tinyxml2_${type}_targets}")
|
||||
endmacro()
|
||||
|
||||
if (tinyxml2_comp_static)
|
||||
tinyxml2_load_targets(static)
|
||||
elseif (tinyxml2_comp_shared)
|
||||
tinyxml2_load_targets(shared)
|
||||
elseif (DEFINED tinyxml2_SHARED_LIBS AND tinyxml2_SHARED_LIBS)
|
||||
tinyxml2_load_targets(shared)
|
||||
elseif (DEFINED tinyxml2_SHARED_LIBS AND NOT tinyxml2_SHARED_LIBS)
|
||||
tinyxml2_load_targets(static)
|
||||
elseif (BUILD_SHARED_LIBS)
|
||||
if (EXISTS "${tinyxml2_shared_targets}")
|
||||
tinyxml2_load_targets(shared)
|
||||
else ()
|
||||
tinyxml2_load_targets(static)
|
||||
endif ()
|
||||
else ()
|
||||
if (EXISTS "${tinyxml2_static_targets}")
|
||||
tinyxml2_load_targets(static)
|
||||
else ()
|
||||
tinyxml2_load_targets(shared)
|
||||
endif ()
|
||||
endif ()
|
@ -5,6 +5,6 @@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
|
||||
Name: TinyXML2
|
||||
Description: simple, small, C++ XML parser
|
||||
Version: @GENERIC_LIB_VERSION@
|
||||
Libs: -L${libdir} -ltinyxml2
|
||||
Version: @tinyxml2_VERSION@
|
||||
Libs: -L${libdir} -l$<TARGET_FILE_BASE_NAME:tinyxml2::tinyxml2>
|
||||
Cflags: -I${includedir}
|
2
extlib/tinyxml2/dox
vendored
2
extlib/tinyxml2/dox
vendored
@ -38,7 +38,7 @@ PROJECT_NAME = "TinyXML-2"
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 8.0.0
|
||||
PROJECT_NUMBER = 8.1.0
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
29
extlib/tinyxml2/readme.md
vendored
29
extlib/tinyxml2/readme.md
vendored
@ -1,7 +1,7 @@
|
||||
TinyXML-2
|
||||
=========
|
||||
|
||||
[](https://travis-ci.org/leethomason/tinyxml2) [](https://ci.appveyor.com/project/leethomason/tinyxml2)
|
||||

|
||||
|
||||

|
||||
|
||||
@ -61,18 +61,15 @@ browsers or have more complete XML needs, TinyXML-2 is not the parser for you.
|
||||
TinyXML-1 vs. TinyXML-2
|
||||
-----------------------
|
||||
|
||||
TinyXML-2 is now the focus of all development, well tested, and your
|
||||
best choice between the two APIs. At this point, unless you are maintaining
|
||||
legacy code, you should choose TinyXML-2.
|
||||
TinyXML-2 long been the focus of all development. It is well tested
|
||||
and should be used instead of TinyXML-1.
|
||||
|
||||
TinyXML-2 uses a similar API to TinyXML-1 and the same
|
||||
rich test cases. But the implementation of the parser is completely re-written
|
||||
to make it more appropriate for use in a game. It uses less memory, is faster,
|
||||
and uses far fewer memory allocations.
|
||||
|
||||
TinyXML-2 has no requirement or support for STL. By returning `const char*`
|
||||
TinyXML-2 can be much more efficient with memory usage. (TinyXML-1 did support
|
||||
and use STL, but consumed much more memory for the DOM representation.)
|
||||
TinyXML-2 has no requirement or support for STL.
|
||||
|
||||
Features
|
||||
--------
|
||||
@ -262,10 +259,14 @@ There are 2 files in TinyXML-2:
|
||||
And additionally a test file:
|
||||
* xmltest.cpp
|
||||
|
||||
Simply compile and run. There is a visual studio 2019 project included, a simple Makefile,
|
||||
an Xcode project, a Code::Blocks project, and a cmake CMakeLists.txt included to help you.
|
||||
The top of tinyxml.h even has a simple g++ command line if you are using Unix/Linux/BSD and
|
||||
don't want to use a build system.
|
||||
Generally speaking, the intent is that you simply include the tinyxml2.cpp and
|
||||
tinyxml2.h files in your project and build with your other source code.
|
||||
|
||||
There is also a CMake build included. CMake is the general build for TinyXML-2.
|
||||
Additional build systems are costly to maintain, and tend to bit-rot.
|
||||
|
||||
A Visual Studio project is included, but that is largely for developer convenience,
|
||||
and is not intended to integrate well with other builds.
|
||||
|
||||
Building TinyXML-2 - Using vcpkg
|
||||
--------------------------------
|
||||
@ -288,12 +289,6 @@ TinyXML-2 uses semantic versioning. http://semver.org/ Releases are now tagged i
|
||||
Note that the major version will (probably) change fairly rapidly. API changes are fairly
|
||||
common.
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
The documentation is built with Doxygen, using the 'dox'
|
||||
configuration file.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
|
34
extlib/tinyxml2/setversion.py
vendored
Normal file → Executable file
34
extlib/tinyxml2/setversion.py
vendored
Normal file → Executable file
@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# Python program to set the version.
|
||||
##############################################
|
||||
|
||||
@ -18,14 +19,14 @@ def fileProcess( name, lineFunction ):
|
||||
if not line: break
|
||||
output += lineFunction( line )
|
||||
filestream.close()
|
||||
|
||||
|
||||
if not output: return # basic error checking
|
||||
|
||||
|
||||
print( "Writing file " + name )
|
||||
filestream = open( name, "w" );
|
||||
filestream.write( output );
|
||||
filestream.close()
|
||||
|
||||
|
||||
def echoInput( line ):
|
||||
return line
|
||||
|
||||
@ -108,31 +109,28 @@ fileProcess( "dox", doxRule )
|
||||
|
||||
#### Write the CMakeLists.txt ####
|
||||
|
||||
def cmakeRule1( line ):
|
||||
def cmakeRule( line ):
|
||||
|
||||
matchVersion = "set(GENERIC_LIB_VERSION"
|
||||
matchVersion = "project(tinyxml2 VERSION"
|
||||
|
||||
if line[0:len(matchVersion)] == matchVersion:
|
||||
print( "1)tinyxml2.h Major found" )
|
||||
return matchVersion + " \"" + major + "." + minor + "." + build + "\")" + "\n"
|
||||
return matchVersion + " " + major + "." + minor + "." + build + ")\n"
|
||||
|
||||
else:
|
||||
return line;
|
||||
|
||||
fileProcess( "CMakeLists.txt", cmakeRule1 )
|
||||
fileProcess( "CMakeLists.txt", cmakeRule )
|
||||
|
||||
def cmakeRule2( line ):
|
||||
|
||||
matchSoversion = "set(GENERIC_LIB_SOVERSION"
|
||||
def mesonRule(line):
|
||||
match = re.search(r"(\s*version) : '(\d+.\d+.\d+)',", line)
|
||||
if match:
|
||||
print("1)meson.build version found.")
|
||||
return "{} : '{}.{}.{}',\n".format(match.group(1), major, minor, build)
|
||||
return line
|
||||
|
||||
if line[0:len(matchSoversion)] == matchSoversion:
|
||||
print( "1)tinyxml2.h Major found" )
|
||||
return matchSoversion + " \"" + major + "\")" + "\n"
|
||||
|
||||
else:
|
||||
return line;
|
||||
|
||||
fileProcess( "CMakeLists.txt", cmakeRule2 )
|
||||
fileProcess("meson.build", mesonRule)
|
||||
|
||||
print( "Release note:" )
|
||||
print( '1. Build. g++ -Wall -DTINYXML2_DEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe' )
|
||||
@ -141,5 +139,3 @@ print( '3. Tag. git tag ' + versionStr )
|
||||
print( ' OR git tag -a ' + versionStr + ' -m [tag message]' )
|
||||
print( 'Remember to "git push" both code and tag. For the tag:' )
|
||||
print( 'git push origin [tagname]')
|
||||
|
||||
|
176
extlib/tinyxml2/tinyxml2.cpp
vendored
176
extlib/tinyxml2/tinyxml2.cpp
vendored
@ -100,6 +100,20 @@ distribution.
|
||||
#define TIXML_SSCANF sscanf
|
||||
#endif
|
||||
|
||||
#if defined(_WIN64)
|
||||
#define TIXML_FSEEK _fseeki64
|
||||
#define TIXML_FTELL _ftelli64
|
||||
#elif defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#define TIXML_FSEEK fseeko
|
||||
#define TIXML_FTELL ftello
|
||||
#elif defined(__unix__) && defined(__x86_64__)
|
||||
#define TIXML_FSEEK fseeko64
|
||||
#define TIXML_FTELL ftello64
|
||||
#else
|
||||
#define TIXML_FSEEK fseek
|
||||
#define TIXML_FTELL ftell
|
||||
#endif
|
||||
|
||||
|
||||
static const char LINE_FEED = static_cast<char>(0x0a); // all line endings are normalized to LF
|
||||
static const char LF = LINE_FEED;
|
||||
@ -220,13 +234,13 @@ char* StrPair::ParseName( char* p )
|
||||
if ( !p || !(*p) ) {
|
||||
return 0;
|
||||
}
|
||||
if ( !XMLUtil::IsNameStartChar( *p ) ) {
|
||||
if ( !XMLUtil::IsNameStartChar( (unsigned char) *p ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
char* const start = p;
|
||||
++p;
|
||||
while ( *p && XMLUtil::IsNameChar( *p ) ) {
|
||||
while ( *p && XMLUtil::IsNameChar( (unsigned char) *p ) ) {
|
||||
++p;
|
||||
}
|
||||
|
||||
@ -594,17 +608,26 @@ void XMLUtil::ToStr( uint64_t v, char* buffer, int bufferSize )
|
||||
TIXML_SNPRINTF(buffer, bufferSize, "%llu", (long long)v);
|
||||
}
|
||||
|
||||
bool XMLUtil::ToInt( const char* str, int* value )
|
||||
bool XMLUtil::ToInt(const char* str, int* value)
|
||||
{
|
||||
if ( TIXML_SSCANF( str, "%d", value ) == 1 ) {
|
||||
return true;
|
||||
if (IsPrefixHex(str)) {
|
||||
unsigned v;
|
||||
if (TIXML_SSCANF(str, "%x", &v) == 1) {
|
||||
*value = static_cast<int>(v);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (TIXML_SSCANF(str, "%d", value) == 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool XMLUtil::ToUnsigned( const char* str, unsigned *value )
|
||||
bool XMLUtil::ToUnsigned(const char* str, unsigned* value)
|
||||
{
|
||||
if ( TIXML_SSCANF( str, "%u", value ) == 1 ) {
|
||||
if (TIXML_SSCANF(str, IsPrefixHex(str) ? "%x" : "%u", value) == 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -656,18 +679,27 @@ bool XMLUtil::ToDouble( const char* str, double* value )
|
||||
|
||||
bool XMLUtil::ToInt64(const char* str, int64_t* value)
|
||||
{
|
||||
long long v = 0; // horrible syntax trick to make the compiler happy about %lld
|
||||
if (TIXML_SSCANF(str, "%lld", &v) == 1) {
|
||||
*value = static_cast<int64_t>(v);
|
||||
return true;
|
||||
}
|
||||
if (IsPrefixHex(str)) {
|
||||
unsigned long long v = 0; // horrible syntax trick to make the compiler happy about %llx
|
||||
if (TIXML_SSCANF(str, "%llx", &v) == 1) {
|
||||
*value = static_cast<int64_t>(v);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
long long v = 0; // horrible syntax trick to make the compiler happy about %lld
|
||||
if (TIXML_SSCANF(str, "%lld", &v) == 1) {
|
||||
*value = static_cast<int64_t>(v);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool XMLUtil::ToUnsigned64(const char* str, uint64_t* value) {
|
||||
unsigned long long v = 0; // horrible syntax trick to make the compiler happy about %llu
|
||||
if(TIXML_SSCANF(str, "%llu", &v) == 1) {
|
||||
if(TIXML_SSCANF(str, IsPrefixHex(str) ? "%llx" : "%llu", &v) == 1) {
|
||||
*value = (uint64_t)v;
|
||||
return true;
|
||||
}
|
||||
@ -1623,8 +1655,18 @@ float XMLElement::FloatAttribute(const char* name, float defaultValue) const
|
||||
|
||||
const char* XMLElement::GetText() const
|
||||
{
|
||||
if ( FirstChild() && FirstChild()->ToText() ) {
|
||||
return FirstChild()->Value();
|
||||
/* skip comment node */
|
||||
const XMLNode* node = FirstChild();
|
||||
while (node) {
|
||||
if (node->ToComment()) {
|
||||
node = node->NextSibling();
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ( node && node->ToText() ) {
|
||||
return node->Value();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1895,7 +1937,7 @@ char* XMLElement::ParseAttributes( char* p, int* curLineNumPtr )
|
||||
}
|
||||
|
||||
// attribute.
|
||||
if (XMLUtil::IsNameStartChar( *p ) ) {
|
||||
if (XMLUtil::IsNameStartChar( (unsigned char) *p ) ) {
|
||||
XMLAttribute* attrib = CreateAttribute();
|
||||
TIXMLASSERT( attrib );
|
||||
attrib->_parseLineNum = _document->_parseCurLineNum;
|
||||
@ -2286,49 +2328,34 @@ XMLError XMLDocument::LoadFile( const char* filename )
|
||||
return _errorID;
|
||||
}
|
||||
|
||||
// This is likely overengineered template art to have a check that unsigned long value incremented
|
||||
// by one still fits into size_t. If size_t type is larger than unsigned long type
|
||||
// (x86_64-w64-mingw32 target) then the check is redundant and gcc and clang emit
|
||||
// -Wtype-limits warning. This piece makes the compiler select code with a check when a check
|
||||
// is useful and code with no check when a check is redundant depending on how size_t and unsigned long
|
||||
// types sizes relate to each other.
|
||||
template
|
||||
<bool = (sizeof(unsigned long) >= sizeof(size_t))>
|
||||
struct LongFitsIntoSizeTMinusOne {
|
||||
static bool Fits( unsigned long value )
|
||||
{
|
||||
return value < static_cast<size_t>(-1);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct LongFitsIntoSizeTMinusOne<false> {
|
||||
static bool Fits( unsigned long )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
XMLError XMLDocument::LoadFile( FILE* fp )
|
||||
{
|
||||
Clear();
|
||||
|
||||
fseek( fp, 0, SEEK_SET );
|
||||
TIXML_FSEEK( fp, 0, SEEK_SET );
|
||||
if ( fgetc( fp ) == EOF && ferror( fp ) != 0 ) {
|
||||
SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 );
|
||||
return _errorID;
|
||||
}
|
||||
|
||||
fseek( fp, 0, SEEK_END );
|
||||
const long filelength = ftell( fp );
|
||||
fseek( fp, 0, SEEK_SET );
|
||||
if ( filelength == -1L ) {
|
||||
SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 );
|
||||
return _errorID;
|
||||
}
|
||||
TIXMLASSERT( filelength >= 0 );
|
||||
TIXML_FSEEK( fp, 0, SEEK_END );
|
||||
|
||||
if ( !LongFitsIntoSizeTMinusOne<>::Fits( filelength ) ) {
|
||||
unsigned long long filelength;
|
||||
{
|
||||
const long long fileLengthSigned = TIXML_FTELL( fp );
|
||||
TIXML_FSEEK( fp, 0, SEEK_SET );
|
||||
if ( fileLengthSigned == -1L ) {
|
||||
SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 );
|
||||
return _errorID;
|
||||
}
|
||||
TIXMLASSERT( fileLengthSigned >= 0 );
|
||||
filelength = static_cast<unsigned long long>(fileLengthSigned);
|
||||
}
|
||||
|
||||
const size_t maxSizeT = static_cast<size_t>(-1);
|
||||
// We'll do the comparison as an unsigned long long, because that's guaranteed to be at
|
||||
// least 8 bytes, even on a 32-bit platform.
|
||||
if ( filelength >= static_cast<unsigned long long>(maxSizeT) ) {
|
||||
// Cannot handle files which won't fit in buffer together with null terminator
|
||||
SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 );
|
||||
return _errorID;
|
||||
@ -2339,7 +2366,7 @@ XMLError XMLDocument::LoadFile( FILE* fp )
|
||||
return _errorID;
|
||||
}
|
||||
|
||||
const size_t size = filelength;
|
||||
const size_t size = static_cast<size_t>(filelength);
|
||||
TIXMLASSERT( _charBuffer == 0 );
|
||||
_charBuffer = new char[size+1];
|
||||
const size_t read = fread( _charBuffer, 1, size, fp );
|
||||
@ -2428,6 +2455,13 @@ void XMLDocument::Print( XMLPrinter* streamer ) const
|
||||
}
|
||||
|
||||
|
||||
void XMLDocument::ClearError() {
|
||||
_errorID = XML_SUCCESS;
|
||||
_errorLineNum = 0;
|
||||
_errorStr.Reset();
|
||||
}
|
||||
|
||||
|
||||
void XMLDocument::SetError( XMLError error, int lineNum, const char* format, ... )
|
||||
{
|
||||
TIXMLASSERT( error >= 0 && error < XML_ERROR_COUNT );
|
||||
@ -2660,22 +2694,33 @@ void XMLPrinter::PushHeader( bool writeBOM, bool writeDec )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void XMLPrinter::OpenElement( const char* name, bool compactMode )
|
||||
void XMLPrinter::PrepareForNewNode( bool compactMode )
|
||||
{
|
||||
SealElementIfJustOpened();
|
||||
_stack.Push( name );
|
||||
|
||||
if ( _textDepth < 0 && !_firstElement && !compactMode ) {
|
||||
if ( compactMode ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( _firstElement ) {
|
||||
PrintSpace (_depth);
|
||||
} else if ( _textDepth < 0) {
|
||||
Putc( '\n' );
|
||||
PrintSpace( _depth );
|
||||
}
|
||||
|
||||
_firstElement = false;
|
||||
}
|
||||
|
||||
void XMLPrinter::OpenElement( const char* name, bool compactMode )
|
||||
{
|
||||
PrepareForNewNode( compactMode );
|
||||
_stack.Push( name );
|
||||
|
||||
Write ( "<" );
|
||||
Write ( name );
|
||||
|
||||
_elementJustOpened = true;
|
||||
_firstElement = false;
|
||||
++_depth;
|
||||
}
|
||||
|
||||
@ -2851,12 +2896,7 @@ void XMLPrinter::PushText( double value )
|
||||
|
||||
void XMLPrinter::PushComment( const char* comment )
|
||||
{
|
||||
SealElementIfJustOpened();
|
||||
if ( _textDepth < 0 && !_firstElement && !_compactMode) {
|
||||
Putc( '\n' );
|
||||
PrintSpace( _depth );
|
||||
}
|
||||
_firstElement = false;
|
||||
PrepareForNewNode( _compactMode );
|
||||
|
||||
Write( "<!--" );
|
||||
Write( comment );
|
||||
@ -2866,12 +2906,7 @@ void XMLPrinter::PushComment( const char* comment )
|
||||
|
||||
void XMLPrinter::PushDeclaration( const char* value )
|
||||
{
|
||||
SealElementIfJustOpened();
|
||||
if ( _textDepth < 0 && !_firstElement && !_compactMode) {
|
||||
Putc( '\n' );
|
||||
PrintSpace( _depth );
|
||||
}
|
||||
_firstElement = false;
|
||||
PrepareForNewNode( _compactMode );
|
||||
|
||||
Write( "<?" );
|
||||
Write( value );
|
||||
@ -2881,12 +2916,7 @@ void XMLPrinter::PushDeclaration( const char* value )
|
||||
|
||||
void XMLPrinter::PushUnknown( const char* value )
|
||||
{
|
||||
SealElementIfJustOpened();
|
||||
if ( _textDepth < 0 && !_firstElement && !_compactMode) {
|
||||
Putc( '\n' );
|
||||
PrintSpace( _depth );
|
||||
}
|
||||
_firstElement = false;
|
||||
PrepareForNewNode( _compactMode );
|
||||
|
||||
Write( "<!" );
|
||||
Write( value );
|
||||
|
39
extlib/tinyxml2/tinyxml2.h
vendored
39
extlib/tinyxml2/tinyxml2.h
vendored
@ -79,6 +79,7 @@ distribution.
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(TIXMLASSERT)
|
||||
#if defined(TINYXML2_DEBUG)
|
||||
# if defined(_MSC_VER)
|
||||
# // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like
|
||||
@ -93,17 +94,17 @@ distribution.
|
||||
#else
|
||||
# define TIXMLASSERT( x ) {}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Versioning, past 1.0.14:
|
||||
http://semver.org/
|
||||
*/
|
||||
static const int TIXML2_MAJOR_VERSION = 8;
|
||||
static const int TIXML2_MINOR_VERSION = 0;
|
||||
static const int TIXML2_MINOR_VERSION = 1;
|
||||
static const int TIXML2_PATCH_VERSION = 0;
|
||||
|
||||
#define TINYXML2_MAJOR_VERSION 8
|
||||
#define TINYXML2_MINOR_VERSION 0
|
||||
#define TINYXML2_MINOR_VERSION 1
|
||||
#define TINYXML2_PATCH_VERSION 0
|
||||
|
||||
// A fixed element depth limit is problematic. There needs to be a
|
||||
@ -135,7 +136,7 @@ class XMLPrinter;
|
||||
class TINYXML2_LIB StrPair
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
enum Mode {
|
||||
NEEDS_ENTITY_PROCESSING = 0x01,
|
||||
NEEDS_NEWLINE_NORMALIZATION = 0x02,
|
||||
NEEDS_WHITESPACE_COLLAPSING = 0x04,
|
||||
@ -590,6 +591,11 @@ public:
|
||||
|| ch == '-';
|
||||
}
|
||||
|
||||
inline static bool IsPrefixHex( const char* p) {
|
||||
p = SkipWhiteSpace(p, 0);
|
||||
return p && *p == '0' && ( *(p + 1) == 'x' || *(p + 1) == 'X');
|
||||
}
|
||||
|
||||
inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) {
|
||||
if ( p == q ) {
|
||||
return true;
|
||||
@ -1451,6 +1457,10 @@ public:
|
||||
return QueryFloatAttribute( name, value );
|
||||
}
|
||||
|
||||
XMLError QueryAttribute(const char* name, const char** value) const {
|
||||
return QueryStringAttribute(name, value);
|
||||
}
|
||||
|
||||
/// Sets the named attribute to value.
|
||||
void SetAttribute( const char* name, const char* value ) {
|
||||
XMLAttribute* a = FindOrCreateAttribute( name );
|
||||
@ -1478,7 +1488,7 @@ public:
|
||||
XMLAttribute* a = FindOrCreateAttribute(name);
|
||||
a->SetAttribute(value);
|
||||
}
|
||||
|
||||
|
||||
/// Sets the named attribute to value.
|
||||
void SetAttribute( const char* name, bool value ) {
|
||||
XMLAttribute* a = FindOrCreateAttribute( name );
|
||||
@ -1864,9 +1874,8 @@ public:
|
||||
*/
|
||||
void DeleteNode( XMLNode* node );
|
||||
|
||||
void ClearError() {
|
||||
SetError(XML_SUCCESS, 0, 0);
|
||||
}
|
||||
/// Clears the error flags.
|
||||
void ClearError();
|
||||
|
||||
/// Return true if there was an error parsing the document.
|
||||
bool Error() const {
|
||||
@ -2322,16 +2331,22 @@ protected:
|
||||
the space and tabs used. A PrintSpace() override should call Print().
|
||||
*/
|
||||
virtual void PrintSpace( int depth );
|
||||
void Print( const char* format, ... );
|
||||
void Write( const char* data, size_t size );
|
||||
inline void Write( const char* data ) { Write( data, strlen( data ) ); }
|
||||
void Putc( char ch );
|
||||
virtual void Print( const char* format, ... );
|
||||
virtual void Write( const char* data, size_t size );
|
||||
virtual void Putc( char ch );
|
||||
|
||||
inline void Write(const char* data) { Write(data, strlen(data)); }
|
||||
|
||||
void SealElementIfJustOpened();
|
||||
bool _elementJustOpened;
|
||||
DynArray< const char*, 10 > _stack;
|
||||
|
||||
private:
|
||||
/**
|
||||
Prepares to write a new node. This includes sealing an element that was
|
||||
just opened, and writing any whitespace necessary if not in compact mode.
|
||||
*/
|
||||
void PrepareForNewNode( bool compactMode );
|
||||
void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities.
|
||||
|
||||
bool _firstElement;
|
||||
|
6
extlib/tinyxml2/tinyxml2.rc
vendored
6
extlib/tinyxml2/tinyxml2.rc
vendored
@ -1,7 +1,7 @@
|
||||
#include <windows.h>
|
||||
|
||||
#define TINYXML2_VERSION_NUMERIC 7,0,1,0
|
||||
#define TINYXML2_VERSION_STRING "7.0.1"
|
||||
#define TINYXML2_VERSION_NUMERIC 8,1,0,0
|
||||
#define TINYXML2_VERSION_STRING "8.1.0"
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
@ -29,7 +29,7 @@ BEGIN
|
||||
#else
|
||||
VALUE "InternalName", "tinyxml2.dll\0"
|
||||
#endif
|
||||
VALUE "LegalCopyright", "(C) 2000-2018 Lee Thomason\0"
|
||||
VALUE "LegalCopyright", "(C) 2000-2021 Lee Thomason\0"
|
||||
#ifdef _DEBUG
|
||||
VALUE "OriginalFilename", "tinyxml2d.dll\0"
|
||||
#else
|
||||
|
40
extlib/tinyxml2/xmltest.cpp
vendored
40
extlib/tinyxml2/xmltest.cpp
vendored
@ -632,6 +632,10 @@ int main( int argc, const char ** argv )
|
||||
ele->SetAttribute( "int", 1 );
|
||||
ele->SetAttribute( "double", -1.0 );
|
||||
|
||||
const char* answer = 0;
|
||||
ele->QueryAttribute("str", &answer);
|
||||
XMLTest("Query char attribute", "strValue", answer);
|
||||
|
||||
const char* cStr = ele->Attribute( "str" );
|
||||
{
|
||||
XMLError queryResult = ele->QueryIntAttribute( "int", &iVal );
|
||||
@ -643,11 +647,11 @@ int main( int argc, const char ** argv )
|
||||
}
|
||||
|
||||
{
|
||||
int queryResult = ele->QueryAttribute( "int", &iVal2 );
|
||||
XMLError queryResult = ele->QueryAttribute( "int", &iVal2 );
|
||||
XMLTest( "Query int attribute generic", (int)XML_SUCCESS, queryResult);
|
||||
}
|
||||
{
|
||||
int queryResult = ele->QueryAttribute( "double", &dVal2 );
|
||||
XMLError queryResult = ele->QueryAttribute( "double", &dVal2 );
|
||||
XMLTest( "Query double attribute generic", (int)XML_SUCCESS, queryResult);
|
||||
}
|
||||
|
||||
@ -819,7 +823,7 @@ int main( int argc, const char ** argv )
|
||||
}
|
||||
{
|
||||
int v = 0;
|
||||
int queryResult = element->QueryAttribute("attrib", &v);
|
||||
XMLError queryResult = element->QueryAttribute("attrib", &v);
|
||||
XMLTest("Attribute: int", (int)XML_SUCCESS, queryResult, true);
|
||||
XMLTest("Attribute: int", -100, v, true);
|
||||
}
|
||||
@ -835,7 +839,7 @@ int main( int argc, const char ** argv )
|
||||
}
|
||||
{
|
||||
unsigned v = 0;
|
||||
int queryResult = element->QueryAttribute("attrib", &v);
|
||||
XMLError queryResult = element->QueryAttribute("attrib", &v);
|
||||
XMLTest("Attribute: unsigned", (int)XML_SUCCESS, queryResult, true);
|
||||
XMLTest("Attribute: unsigned", unsigned(100), v, true);
|
||||
}
|
||||
@ -859,7 +863,7 @@ int main( int argc, const char ** argv )
|
||||
}
|
||||
{
|
||||
int64_t v = 0;
|
||||
int queryResult = element->QueryAttribute("attrib", &v);
|
||||
XMLError queryResult = element->QueryAttribute("attrib", &v);
|
||||
XMLTest("Attribute: int64_t", (int)XML_SUCCESS, queryResult, true);
|
||||
XMLTest("Attribute: int64_t", BIG, v, true);
|
||||
}
|
||||
@ -875,7 +879,7 @@ int main( int argc, const char ** argv )
|
||||
}
|
||||
{
|
||||
uint64_t v = 0;
|
||||
int queryResult = element->QueryAttribute("attrib", &v);
|
||||
XMLError queryResult = element->QueryAttribute("attrib", &v);
|
||||
XMLTest("Attribute: uint64_t", (int)XML_SUCCESS, queryResult, true);
|
||||
XMLTest("Attribute: uint64_t", BIG_POS, v, true);
|
||||
}
|
||||
@ -891,7 +895,7 @@ int main( int argc, const char ** argv )
|
||||
}
|
||||
{
|
||||
bool v = false;
|
||||
int queryResult = element->QueryAttribute("attrib", &v);
|
||||
XMLError queryResult = element->QueryAttribute("attrib", &v);
|
||||
XMLTest("Attribute: bool", (int)XML_SUCCESS, queryResult, true);
|
||||
XMLTest("Attribute: bool", true, v, true);
|
||||
}
|
||||
@ -919,7 +923,7 @@ int main( int argc, const char ** argv )
|
||||
}
|
||||
{
|
||||
double v = 0;
|
||||
int queryResult = element->QueryAttribute("attrib", &v);
|
||||
XMLError queryResult = element->QueryAttribute("attrib", &v);
|
||||
XMLTest("Attribute: bool", (int)XML_SUCCESS, queryResult, true);
|
||||
XMLTest("Attribute: double", 100.0, v, true);
|
||||
}
|
||||
@ -935,7 +939,7 @@ int main( int argc, const char ** argv )
|
||||
}
|
||||
{
|
||||
float v = 0;
|
||||
int queryResult = element->QueryAttribute("attrib", &v);
|
||||
XMLError queryResult = element->QueryAttribute("attrib", &v);
|
||||
XMLTest("Attribute: float", (int)XML_SUCCESS, queryResult, true);
|
||||
XMLTest("Attribute: float", 100.0f, v, true);
|
||||
}
|
||||
@ -1674,6 +1678,24 @@ int main( int argc, const char ** argv )
|
||||
XMLTest("FloatText()) test", true, test6);
|
||||
}
|
||||
|
||||
{
|
||||
// hex value test
|
||||
const char* xml = "<point> <IntText> 0x2020</IntText> <UnsignedText>0X2020</UnsignedText> \
|
||||
<Int64Text> 0x1234</Int64Text></point>";
|
||||
XMLDocument doc;
|
||||
doc.Parse(xml);
|
||||
|
||||
const XMLElement* pointElement = doc.RootElement();
|
||||
int test1 = pointElement->FirstChildElement("IntText")->IntText();
|
||||
XMLTest("IntText() hex value test", 0x2020, test1);
|
||||
|
||||
unsigned test2 = pointElement->FirstChildElement("UnsignedText")->UnsignedText();
|
||||
XMLTest("UnsignedText() hex value test", static_cast<unsigned>(0x2020), test2);
|
||||
|
||||
int64_t test3 = pointElement->FirstChildElement("Int64Text")->Int64Text();
|
||||
XMLTest("Int64Text() hex value test", static_cast<int64_t>(0x1234), test3);
|
||||
}
|
||||
|
||||
{
|
||||
//API:ShallowEqual() test
|
||||
const char* xml = "<playlist id = 'playlist'>"
|
||||
|
Loading…
Reference in New Issue
Block a user