diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 6d9be3cc..5c72ed8c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -12,7 +12,7 @@ jobs:
matrix:
os: [ubuntu, macos]
compiler: [g++, clang++]
- defines: [standard, PUGIXML_WCHAR_MODE, PUGIXML_COMPACT, PUGIXML_NO_EXCEPTIONS, PUGIXML_STRING_VIEW]
+ defines: [standard, PUGIXML_WCHAR_MODE, PUGIXML_COMPACT, PUGIXML_NO_EXCEPTIONS]
exclude:
- os: macos
compiler: g++
@@ -55,7 +55,7 @@ jobs:
strategy:
matrix:
arch: [Win32, x64]
- defines: [standard, PUGIXML_WCHAR_MODE, PUGIXML_COMPACT, PUGIXML_NO_EXCEPTIONS, PUGIXML_STRING_VIEW]
+ defines: [standard, PUGIXML_WCHAR_MODE, PUGIXML_COMPACT, PUGIXML_NO_EXCEPTIONS]
steps:
- uses: actions/checkout@v1
- name: cmake configure
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ede427c0..6542658f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,7 +32,7 @@ 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)
+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
@@ -48,8 +48,7 @@ option(PUGIXML_INSTALL "Enable installation rules" ON)
option(PUGIXML_NO_XPATH "Disable XPath" OFF)
option(PUGIXML_NO_STL "Disable STL" OFF)
option(PUGIXML_NO_EXCEPTIONS "Disable Exceptions" OFF)
-option(PUGIXML_STRING_VIEW "Enable std::string_view overloads" OFF) # requires C++17 and for PUGIXML_NO_STL to be OFF
-mark_as_advanced(PUGIXML_NO_XPATH PUGIXML_NO_STL PUGIXML_NO_EXCEPTIONS PUGIXML_STRING_VIEW)
+mark_as_advanced(PUGIXML_NO_XPATH PUGIXML_NO_STL PUGIXML_NO_EXCEPTIONS)
set(PUGIXML_PUBLIC_DEFINITIONS
$<$PUGIXML_HAS_LONG_LONG
define enables support for long long
type in pugixml. This define is automatically enabled if your platform is known to have long long
support (i.e. has C++11 support or uses a reasonably modern version of a known compiler); if pugixml does not recognize that your platform supports long long
but in fact it does, you can enable the define manually.
PUGIXML_HAS_STRING_VIEW
define enables function overloads that accept std::basic_string_view
arguments. This define is automatically enabled if built targeting c++17 or later AND if PUGIXML_STRING_VIEW
is also defined. The requirement to additionally define PUGIXML_STRING_VIEW
will be retired in a future version.
PUGIXML_HAS_STRING_VIEW
define enables function overloads that accept std::string_view
arguments. This define is automatically enabled if built targeting C++17 or later; if pugixml does not recognize that your platform supports std::string_view
but in fact it does, you can enable the define manually.
-There is a special type, pugi::char_t
, that is defined as the character type and depends on the library configuration; it will be also used in the documentation hereafter. There is also a type pugi::string_t
, which is defined as the STL string of the character type; it corresponds to std::string
in char mode and to std::wstring
in wchar_t mode. Similarly, string_view_t
is defined to be std::basic_string_view<char_t>
. Overloads for string_view_t
are only available when building for c++17 or later (see PUGIXML_HAS_STRING_VIEW
).
pugi::char_t
, that is defined as the character type and depends on the library configuration; it will be also used in the documentation hereafter. There is also a type pugi::string_t
, which is defined as the STL string of the character type; it corresponds to std::string
in char mode and to std::wstring
in wchar_t mode. Similarly, string_view_t
is defined to be std::basic_string_view<char_t>
. Overloads for string_view_t
are only available when building for C++17 or later (see PUGIXML_HAS_STRING_VIEW
).
In addition to the interface, the internal implementation changes to store XML data as pugi::char_t
; this means that these two modes have different memory usage characteristics - generally UTF-8 mode is more memory and performance efficient, especially if sizeof(wchar_t)
is 4. The conversion to pugi::char_t
upon document loading and from pugi::char_t
upon document saving happen automatically, which also carries minor performance penalty. The general advice however is to select the character mode based on usage scenario, i.e. if UTF-8 is inconvenient to process and most of your XML data is non-ASCII, wchar_t mode is probably a better choice.