aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2021-04-27 11:23:17 +0200
committerToni Uhlig <matzeton@googlemail.com>2021-04-27 11:23:17 +0200
commit36cc18d2b6d0eefd00a25a02bb4a407e700b5f9f (patch)
tree575b98e789934a2153a9063d1b91afb42dc27ef4
parentdd086a1608b0e3cd5565174225b8197792bad4b9 (diff)
parent514cb71a6a3e116c229c5dc874369f8632530dc7 (diff)
Merge commit '514cb71a6a3e116c229c5dc874369f8632530dc7' as 'deps/inja'
-rw-r--r--deps/inja/.clang-format7
-rw-r--r--deps/inja/.github/FUNDING.yml8
-rw-r--r--deps/inja/.github/workflows/ci.yml261
-rw-r--r--deps/inja/.github/workflows/documentation.yml27
-rw-r--r--deps/inja/.github/workflows/single-include.yml29
-rw-r--r--deps/inja/.github/workflows/vsenv.bat17
-rw-r--r--deps/inja/.gitignore43
-rw-r--r--deps/inja/CMakeLists.txt188
-rw-r--r--deps/inja/LICENSE50
-rw-r--r--deps/inja/README.md339
-rw-r--r--deps/inja/cmake/Coveralls.cmake125
-rw-r--r--deps/inja/cmake/CoverallsClear.cmake31
-rw-r--r--deps/inja/cmake/CoverallsGenerateGcov.cmake484
-rw-r--r--deps/inja/cmake/config/injaBuildConfig.cmake.in11
-rw-r--r--deps/inja/cmake/config/injaConfig.cmake.in12
-rw-r--r--deps/inja/doc/Doxyfile2484
-rw-r--r--deps/inja/doc/logo-doxygen.jpgbin0 -> 11950 bytes
-rw-r--r--deps/inja/doc/logo.jpgbin0 -> 20743 bytes
-rw-r--r--deps/inja/doc/logo.svg20
-rw-r--r--deps/inja/doc/support.md3
-rw-r--r--deps/inja/include/inja/config.hpp76
-rw-r--r--deps/inja/include/inja/environment.hpp228
-rw-r--r--deps/inja/include/inja/exceptions.hpp50
-rw-r--r--deps/inja/include/inja/function_storage.hpp139
-rw-r--r--deps/inja/include/inja/inja.hpp22
-rw-r--r--deps/inja/include/inja/lexer.hpp420
-rw-r--r--deps/inja/include/inja/node.hpp328
-rw-r--r--deps/inja/include/inja/parser.hpp582
-rw-r--r--deps/inja/include/inja/renderer.hpp611
-rw-r--r--deps/inja/include/inja/statistics.hpp68
-rw-r--r--deps/inja/include/inja/string_view.hpp1416
-rw-r--r--deps/inja/include/inja/template.hpp39
-rw-r--r--deps/inja/include/inja/token.hpp76
-rw-r--r--deps/inja/include/inja/utils.hpp70
-rw-r--r--deps/inja/meson.build49
-rw-r--r--deps/inja/requirements.txt1
-rw-r--r--deps/inja/scripts/amalgamate_config.json9
-rwxr-xr-xdeps/inja/scripts/update_single_include.sh6
-rw-r--r--deps/inja/single_include/inja/inja.hpp4164
-rw-r--r--deps/inja/test/benchmark.cpp29
-rw-r--r--deps/inja/test/data/benchmark/large_data.json8022
-rw-r--r--deps/inja/test/data/benchmark/large_template.txt1733
-rw-r--r--deps/inja/test/data/benchmark/medium_template.txt10
-rw-r--r--deps/inja/test/data/benchmark/small_data.json6
-rwxr-xr-xdeps/inja/test/data/error-unknown/data.json3
-rwxr-xr-xdeps/inja/test/data/error-unknown/template.txt6
-rw-r--r--deps/inja/test/data/html/data.json12
-rw-r--r--deps/inja/test/data/html/footer.txt6
-rw-r--r--deps/inja/test/data/html/header.txt3
-rw-r--r--deps/inja/test/data/html/result.txt26
-rw-r--r--deps/inja/test/data/html/template.txt20
-rwxr-xr-xdeps/inja/test/data/include.txt1
-rwxr-xr-xdeps/inja/test/data/nested-line/data.json4
-rwxr-xr-xdeps/inja/test/data/nested-line/result.txt6
-rwxr-xr-xdeps/inja/test/data/nested-line/template.txt5
-rwxr-xr-xdeps/inja/test/data/nested-whitespace/data.json4
-rwxr-xr-xdeps/inja/test/data/nested-whitespace/result.txt6
-rwxr-xr-xdeps/inja/test/data/nested-whitespace/template.txt3
-rwxr-xr-xdeps/inja/test/data/nested/data.json4
-rwxr-xr-xdeps/inja/test/data/nested/result.txt12
-rwxr-xr-xdeps/inja/test/data/nested/template.txt3
-rwxr-xr-xdeps/inja/test/data/simple-file/data.json3
-rwxr-xr-xdeps/inja/test/data/simple-file/result.txt1
-rwxr-xr-xdeps/inja/test/data/simple-file/template.txt1
-rwxr-xr-xdeps/inja/test/data/simple.txt1
-rw-r--r--deps/inja/test/test-files.cpp79
-rw-r--r--deps/inja/test/test-functions.cpp285
-rw-r--r--deps/inja/test/test-renderer.cpp274
-rw-r--r--deps/inja/test/test-units.cpp51
-rw-r--r--deps/inja/test/test.cpp15
-rw-r--r--deps/inja/third_party/amalgamate/LICENSE.md27
-rwxr-xr-xdeps/inja/third_party/amalgamate/amalgamate.py294
-rw-r--r--deps/inja/third_party/include/doctest/LICENSE.txt21
-rw-r--r--deps/inja/third_party/include/doctest/doctest.h5971
-rwxr-xr-xdeps/inja/third_party/include/hayai/LICENSE.md21
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai.hpp136
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_benchmarker.hpp552
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_clock.hpp367
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_compatibility.hpp10
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_console.hpp199
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_console_outputter.hpp284
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_default_test_factory.hpp27
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_fixture.hpp9
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_json_outputter.hpp355
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_junit_xml_outputter.hpp260
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_main.hpp530
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_outputter.hpp113
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_test.hpp83
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_test_descriptor.hpp365
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_test_factory.hpp26
-rwxr-xr-xdeps/inja/third_party/include/hayai/hayai_test_result.hpp304
-rw-r--r--deps/inja/third_party/include/nlohmann/LICENSE.MIT21
-rw-r--r--deps/inja/third_party/include/nlohmann/json.hpp24665
93 files changed, 57767 insertions, 0 deletions
diff --git a/deps/inja/.clang-format b/deps/inja/.clang-format
new file mode 100644
index 0000000..5486ac5
--- /dev/null
+++ b/deps/inja/.clang-format
@@ -0,0 +1,7 @@
+---
+Language: Cpp
+
+BasedOnStyle: LLVM
+ColumnLimit: 120
+SpaceBeforeCpp11BracedList: true
+...
diff --git a/deps/inja/.github/FUNDING.yml b/deps/inja/.github/FUNDING.yml
new file mode 100644
index 0000000..10e311b
--- /dev/null
+++ b/deps/inja/.github/FUNDING.yml
@@ -0,0 +1,8 @@
+# These are supported funding model platforms
+
+github: [pantor] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+patreon: # Replace with a single Patreon username
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+custom: # Replace with a single custom sponsorship URL
diff --git a/deps/inja/.github/workflows/ci.yml b/deps/inja/.github/workflows/ci.yml
new file mode 100644
index 0000000..c5909c3
--- /dev/null
+++ b/deps/inja/.github/workflows/ci.yml
@@ -0,0 +1,261 @@
+# Based on: https://github.com/onqtam/doctest/blob/master/.github/workflows/main.yml
+
+name: CI
+
+on: [push, pull_request]
+
+jobs:
+ ci:
+ name: ${{ matrix.name }}
+ runs-on: ${{ matrix.os }}
+
+ env:
+ CMAKE_GENERATOR: Ninja
+
+ strategy:
+ fail-fast: false
+ matrix:
+ name: [
+ ubuntu-18.04-gcc-4.9,
+ ubuntu-18.04-gcc-5,
+ ubuntu-18.04-gcc-6,
+ ubuntu-18.04-gcc-7,
+ ubuntu-18.04-gcc-8,
+ ubuntu-18.04-gcc-9,
+ ubuntu-18.04-clang-3.5,
+ ubuntu-18.04-clang-3.8,
+ ubuntu-18.04-clang-4.0,
+ ubuntu-18.04-clang-5.0,
+ ubuntu-18.04-clang-6.0,
+ ubuntu-18.04-clang-7,
+ ubuntu-18.04-clang-8,
+ ubuntu-20.04-clang-9,
+ windows-2016-cl,
+ windows-2016-clang-cl,
+ windows-2016-clang,
+ windows-2016-gcc,
+ windows-2019-cl,
+ windows-2019-clang-cl,
+ windows-2019-clang,
+ windows-2019-gcc,
+ macOS-10.15-gcc-7,
+ macOS-10.15-gcc-8,
+ macOS-10.15-gcc-9,
+ macOS-latest-xcode-11.3,
+ macOS-latest-xcode-12.2,
+ ]
+
+ include:
+ - name: ubuntu-18.04-gcc-4.9
+ os: ubuntu-18.04
+ compiler: gcc
+ version: "4.9"
+
+ - name: ubuntu-18.04-gcc-5
+ os: ubuntu-18.04
+ compiler: gcc
+ version: "5"
+
+ - name: ubuntu-18.04-gcc-6
+ os: ubuntu-18.04
+ compiler: gcc
+ version: "6"
+
+ - name: ubuntu-18.04-gcc-7
+ os: ubuntu-18.04
+ compiler: gcc
+ version: "7"
+
+ - name: ubuntu-18.04-gcc-8
+ os: ubuntu-18.04
+ compiler: gcc
+ version: "8"
+
+ - name: ubuntu-18.04-gcc-9
+ os: ubuntu-18.04
+ compiler: gcc
+ version: "9"
+
+ - name: ubuntu-18.04-clang-3.5
+ os: ubuntu-18.04
+ compiler: clang
+ version: "3.5"
+
+ - name: ubuntu-18.04-clang-3.8
+ os: ubuntu-18.04
+ compiler: clang
+ version: "3.8"
+
+ - name: ubuntu-18.04-clang-4.0
+ os: ubuntu-18.04
+ compiler: clang
+ version: "4.0"
+
+ - name: ubuntu-18.04-clang-5.0
+ os: ubuntu-18.04
+ compiler: clang
+ version: "5.0"
+
+ - name: ubuntu-18.04-clang-6.0
+ os: ubuntu-18.04
+ compiler: clang
+ version: "6.0"
+
+ - name: ubuntu-18.04-clang-7
+ os: ubuntu-18.04
+ compiler: clang
+ version: "7"
+
+ - name: ubuntu-18.04-clang-8
+ os: ubuntu-18.04
+ compiler: clang
+ version: "8"
+
+ - name: ubuntu-20.04-clang-9
+ os: ubuntu-20.04
+ compiler: clang
+ version: "9"
+
+ - name: windows-2016-cl
+ os: windows-2016
+ compiler: cl
+
+ - name: windows-2016-clang-cl
+ os: windows-2016
+ compiler: clang-cl
+
+ - name: windows-2016-clang
+ os: windows-2016
+ compiler: clang
+
+ - name: windows-2019-cl
+ os: windows-2019
+ compiler: cl
+
+ - name: windows-2016-gcc
+ os: windows-2016
+ compiler: gcc
+
+ - name: windows-2019-clang-cl
+ os: windows-2019
+ compiler: clang-cl
+
+ - name: windows-2019-clang
+ os: windows-2019
+ compiler: clang
+
+ - name: windows-2019-gcc
+ os: windows-2019
+ compiler: gcc
+
+ - name: macOS-10.15-gcc-7
+ os: macOS-10.15
+ compiler: gcc
+ version: "7"
+
+ - name: macOS-10.15-gcc-8
+ os: macOS-10.15
+ compiler: gcc
+ version: "8"
+
+ - name: macOS-10.15-gcc-9
+ os: macOS-10.15
+ compiler: gcc
+ version: "9"
+
+ - name: macOS-latest-xcode-11.3
+ os: macOS-latest
+ compiler: xcode
+ version: "11.3"
+
+ - name: macOS-latest-xcode-12.2
+ os: macOS-latest
+ compiler: xcode
+ version: "12.2"
+
+ steps:
+ - uses: actions/checkout@v1
+
+ - name: Install (Linux)
+ if: runner.os == 'Linux'
+ run: |
+ # Required for libc6-dbg:i386 and g++-multilib packages which are
+ # needed for x86 builds.
+ sudo dpkg --add-architecture i386
+ # clang-3.7 and earlier are not available in Bionic anymore so we get
+ # them from the Xenial repositories instead.
+ sudo add-apt-repository "deb http://dk.archive.ubuntu.com/ubuntu/ xenial main"
+ sudo add-apt-repository "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe"
+
+ sudo apt-get update
+ # libc6-dbg:i386 is required for running valgrind on x86.
+ sudo apt-get install -y ninja-build valgrind libc6-dbg:i386 -o APT::Immediate-Configure=0
+ if [ "${{ matrix.compiler }}" = "gcc" ]; then
+ sudo apt-get install -y g++-${{ matrix.version }} g++-${{ matrix.version }}-multilib
+ echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
+ echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
+ else
+ sudo apt-get install -y clang-${{ matrix.version }} g++-multilib
+ echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV
+ echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV
+ fi
+
+ - name: Install (macOS)
+ if: runner.os == 'macOS'
+ run: |
+ brew install ninja
+ if [ "${{ matrix.compiler }}" = "gcc" ]; then
+ brew install gcc@${{ matrix.version }}
+ brew link gcc@${{ matrix.version }}
+ echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV
+ echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV
+ else
+ sudo xcode-select -switch /Applications/Xcode_${{ matrix.version }}.app
+ echo "CC=clang" >> $GITHUB_ENV
+ echo "CXX=clang++" >> $GITHUB_ENV
+ fi
+
+ - name: Install (Windows)
+ if: runner.os == 'Windows'
+ shell: powershell
+ run: |
+ Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
+ scoop install ninja --global
+ if ("${{ matrix.compiler }}".StartsWith("clang")) {
+ scoop install llvm --global
+ }
+ if ("${{ matrix.compiler }}" -eq "gcc") {
+ # Chocolatey GCC is broken on the windows-2019 image.
+ # See: https://github.com/DaanDeMeyer/doctest/runs/231595515
+ # See: https://github.community/t5/GitHub-Actions/Something-is-wrong-with-the-chocolatey-installed-version-of-gcc/td-p/32413
+ # scoop install gcc --global
+ choco install mingw
+ echo "CC=gcc" >> $GITHUB_ENV
+ echo "CXX=g++" >> $GITHUB_ENV
+ } elseif ("${{ matrix.compiler }}" -eq "clang") {
+ echo "CC=clang" >> $GITHUB_ENV
+ echo "CXX=clang++" >> $GITHUB_ENV
+ } else {
+ echo "CC=${{ matrix.compiler }}" >> $GITHUB_ENV
+ echo "CXX=${{ matrix.compiler }}" >> $GITHUB_ENV
+ }
+ # Scoop modifies the PATH so we make the modified PATH global.
+ echo "PATH=$env:PATH" >> $GITHUB_ENV
+
+ - name: Configure
+ if: runner.os == 'Windows'
+ run: .github\workflows\vsenv.bat -arch=x64 -host_arch=x64
+
+ - name: Build & Test Debug
+ run: |
+ cmake -E remove_directory build
+ cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug
+ cmake --build build -j2
+ cd build && ctest -j2 --output-on-failure
+
+ - name: Build & Test Release
+ run: |
+ cmake -E remove_directory build
+ cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
+ cmake --build build -j2
+ cd build && ctest -j2 --output-on-failure
diff --git a/deps/inja/.github/workflows/documentation.yml b/deps/inja/.github/workflows/documentation.yml
new file mode 100644
index 0000000..cddd438
--- /dev/null
+++ b/deps/inja/.github/workflows/documentation.yml
@@ -0,0 +1,27 @@
+name: Documentation
+
+on:
+ push:
+ branches:
+ - master
+
+jobs:
+ build-deploy:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@master
+
+ - name: dependencies
+ env:
+ dependency_packages: doxygen
+ run: sudo apt-get update && sudo apt-get -y install ${dependency_packages}
+
+ - name: build
+ run: cd doc && doxygen ./Doxyfile
+
+ - name: deploy
+ uses: peaceiris/actions-gh-pages@v2.2.0
+ env:
+ ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
+ PUBLISH_BRANCH: gh-pages
+ PUBLISH_DIR: ./doc/html
diff --git a/deps/inja/.github/workflows/single-include.yml b/deps/inja/.github/workflows/single-include.yml
new file mode 100644
index 0000000..44a5a66
--- /dev/null
+++ b/deps/inja/.github/workflows/single-include.yml
@@ -0,0 +1,29 @@
+name: Single Include
+
+on: [push, pull_request]
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@master
+
+ - name: update single include
+ run: |
+ mv single_include/inja/inja.hpp single_include/inja/inja_old.hpp
+ bash scripts/update_single_include.sh
+
+ - name: check if equal
+ working-directory: ${{runner.workspace}}/inja/single_include/
+ shell: bash
+ run: |
+ pwd
+ ls inja
+ cat inja/inja.hpp
+ cat inja/inja_old.hpp
+ diff inja/inja.hpp inja/inja_old.hpp >/dev/null
+
+ - uses: actions/upload-artifact@v1
+ with:
+ name: single_include_inja
+ path: single_include/inja/inja.hpp
diff --git a/deps/inja/.github/workflows/vsenv.bat b/deps/inja/.github/workflows/vsenv.bat
new file mode 100644
index 0000000..8fa2223
--- /dev/null
+++ b/deps/inja/.github/workflows/vsenv.bat
@@ -0,0 +1,17 @@
+@echo off
+
+SET VSWHERE="C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere"
+
+:: See https://github.com/microsoft/vswhere/wiki/Find-VC
+for /f "usebackq delims=*" %%i in (`%VSWHERE% -latest -property installationPath`) do (
+ call "%%i"\Common7\Tools\vsdevcmd.bat %*
+)
+
+:: Loop over all environment variables and make them global using set-env.
+:: See: https://help.github.com/en/articles/development-tools-for-github-actions#set-an-environment-variable-set-env
+:: See: https://stackoverflow.com/questions/39183272/loop-through-all-environmental-variables-and-take-actions-depending-on-prefix
+setlocal
+for /f "delims== tokens=1,2" %%a in ('set') do (
+ echo %%a=%%b >> $GITHUB_ENV
+)
+endlocal
diff --git a/deps/inja/.gitignore b/deps/inja/.gitignore
new file mode 100644
index 0000000..060ca13
--- /dev/null
+++ b/deps/inja/.gitignore
@@ -0,0 +1,43 @@
+# Prerequisites
+*.d
+
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.obj
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Compiled Dynamic libraries
+*.so
+*.dylib
+*.dll
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
+
+# Executables
+*.exe
+*.out
+*.app
+
+# Build Folders
+build
+buildc
+dist
+
+# Coveralls repo token
+.coveralls.yml
+
+.vscode
+
+doc/html
+doc/latex
+
+examples
diff --git a/deps/inja/CMakeLists.txt b/deps/inja/CMakeLists.txt
new file mode 100644
index 0000000..87691d4
--- /dev/null
+++ b/deps/inja/CMakeLists.txt
@@ -0,0 +1,188 @@
+cmake_minimum_required(VERSION 3.5)
+
+
+project(inja LANGUAGES CXX VERSION 3.1.0)
+
+
+option(INJA_USE_EMBEDDED_JSON "Use the shipped json header if not available on the system" ON)
+option(INJA_INSTALL "Generate install targets for inja" ON)
+option(INJA_EXPORT "Export the current build tree to the package registry" ON)
+option(BUILD_TESTING "Build unit tests" ON)
+option(INJA_BUILD_TESTS "Build unit tests when BUILD_TESTING is enabled." ON)
+option(BUILD_BENCHMARK "Build benchmark" ON)
+option(COVERALLS "Generate coveralls data" OFF)
+
+set(INJA_INSTALL_INCLUDE_DIR "include")
+
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
+
+if(CMAKE_COMPILER_IS_GNUCC)
+ add_compile_options(-Wall)
+endif()
+
+if(MSVC)
+ add_compile_options(/W4 /permissive- /utf-8 /Zc:__cplusplus)
+endif()
+
+
+add_library(inja INTERFACE)
+add_library(pantor::inja ALIAS inja)
+
+target_include_directories(inja INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:${INJA_INSTALL_INCLUDE_DIR}>
+)
+
+target_compile_features(inja INTERFACE cxx_std_11)
+
+set(INJA_PACKAGE_USE_EMBEDDED_JSON OFF)
+
+if(INJA_USE_EMBEDDED_JSON)
+ find_package(nlohmann_json QUIET)
+ if(NOT nlohmann_json_FOUND)
+ set(INJA_PACKAGE_USE_EMBEDDED_JSON ON)
+ add_library(nlohmann_json INTERFACE)
+ add_library(pantor::nlohmann_json ALIAS nlohmann_json)
+
+ target_include_directories(nlohmann_json INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/third_party/include>
+ $<INSTALL_INTERFACE:${INJA_INSTALL_INCLUDE_DIR}/inja/json/include>
+ )
+
+ target_compile_features(nlohmann_json INTERFACE cxx_std_11)
+
+ install(TARGETS nlohmann_json EXPORT injaTargets)
+
+ set(INJA_SELECTED_JSON_LIBRARY "pantor::nlohmann_json")
+ else()
+ set(INJA_SELECTED_JSON_LIBRARY "nlohmann_json::nlohmann_json")
+ endif()
+else()
+ # If target already exists, e.g. by git submodules
+ if(TARGET nlohmann_json)
+ set(INJA_SELECTED_JSON_LIBRARY "nlohmann_json::nlohmann_json")
+ else()
+ find_package(nlohmann_json REQUIRED)
+ set(INJA_SELECTED_JSON_LIBRARY "nlohmann_json::nlohmann_json")
+ endif()
+endif()
+
+target_link_libraries(inja INTERFACE ${INJA_SELECTED_JSON_LIBRARY})
+
+execute_process(COMMAND scripts/update_single_include.sh WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
+# CMake: add_custom_command
+
+
+if(BUILD_TESTING AND INJA_BUILD_TESTS)
+ enable_testing()
+
+ add_executable(inja_test test/test.cpp)
+ target_link_libraries(inja_test PRIVATE inja)
+
+ add_test(inja_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/inja_test)
+
+
+ add_library(single_inja INTERFACE)
+ target_compile_features(single_inja INTERFACE cxx_std_11)
+ target_include_directories(single_inja INTERFACE single_include include third_party/include)
+
+ add_executable(single_inja_test test/test.cpp)
+ target_link_libraries(single_inja_test PRIVATE single_inja)
+
+ add_test(single_inja_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/single_inja_test)
+endif()
+
+
+if(BUILD_BENCHMARK)
+ add_executable(inja_benchmark test/benchmark.cpp)
+ target_link_libraries(inja_benchmark PRIVATE inja)
+endif()
+
+
+if(COVERALLS)
+ include(Coveralls)
+ coveralls_turn_on_coverage()
+
+ file(GLOB_RECURSE COVERAGE_SRCS include/inja/*.hpp)
+
+ # set(COVERAGE_SRCS test/unit.cpp test/unit-renderer.cpp include/inja)
+
+ coveralls_setup("${COVERAGE_SRCS}" OFF) # If we should upload.
+endif()
+
+
+include(CMakePackageConfigHelpers)
+
+write_basic_package_version_file(
+ "${CMAKE_CURRENT_BINARY_DIR}/injaConfigVersion.cmake"
+ VERSION ${PROJECT_VERSION}
+ COMPATIBILITY SameMajorVersion
+)
+
+
+# build tree package config
+configure_file(
+ cmake/config/injaBuildConfig.cmake.in
+ injaConfig.cmake
+ @ONLY
+)
+
+
+install(TARGETS inja EXPORT injaTargets)
+
+
+export(
+ EXPORT injaTargets
+ NAMESPACE pantor::
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/injaTargets.cmake"
+)
+
+# build tree package config
+configure_file(
+ cmake/config/injaBuildConfig.cmake.in
+ injaConfig.cmake
+ @ONLY
+)
+
+
+if(INJA_INSTALL)
+ set(INJA_CONFIG_PATH "lib/cmake/inja")
+
+ # install tree package config
+ configure_package_config_file(
+ cmake/config/injaConfig.cmake.in
+ ${INJA_CONFIG_PATH}/injaConfig.cmake
+ INSTALL_DESTINATION ${INJA_CONFIG_PATH}
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
+ )
+
+ install(
+ DIRECTORY include/inja
+ DESTINATION ${INJA_INSTALL_INCLUDE_DIR}
+ FILES_MATCHING PATTERN "*.hpp"
+ )
+ if(INJA_USE_EMBEDDED_JSON)
+ install(
+ DIRECTORY third_party/include/nlohmann
+ DESTINATION ${INJA_INSTALL_INCLUDE_DIR}
+ FILES_MATCHING PATTERN "*.hpp"
+ )
+ endif()
+ install(
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/${INJA_CONFIG_PATH}/injaConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/injaConfigVersion.cmake"
+ DESTINATION ${INJA_CONFIG_PATH}
+ )
+
+ install(
+ EXPORT injaTargets FILE injaTargets.cmake
+ NAMESPACE pantor::
+ DESTINATION ${INJA_CONFIG_PATH}
+ )
+endif()
+
+
+if(INJA_EXPORT)
+ export(PACKAGE inja)
+endif()
diff --git a/deps/inja/LICENSE b/deps/inja/LICENSE
new file mode 100644
index 0000000..c6a3b44
--- /dev/null
+++ b/deps/inja/LICENSE
@@ -0,0 +1,50 @@
+MIT License
+
+Copyright (c) 2018 lbersch
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+
+---
+
+
+Copyright (c) 2009-2018 FIRST
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the FIRST nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY FIRST AND CONTRIBUTORS``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file
diff --git a/deps/inja/README.md b/deps/inja/README.md
new file mode 100644
index 0000000..4c55556
--- /dev/null
+++ b/deps/inja/README.md
@@ -0,0 +1,339 @@
+[<div align="center"><img width="500" src="https://raw.githubusercontent.com/pantor/inja/master/doc/logo.svg?sanitize=true"></div>](https://github.com/pantor/inja/releases)
+
+<p align="center">
+ <a href="https://github.com/pantor/inja/actions">
+ <img src="https://github.com/pantor/inja/workflows/CI/badge.svg" alt="CI Status">
+ </a>
+
+ <a href="https://github.com/pantor/inja/actions">
+ <img src="https://github.com/pantor/inja/workflows/Documentation/badge.svg" alt="Documentation Status">
+ </a>
+
+ <a href="https://www.codacy.com/manual/pantor/inja?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=pantor/inja&amp;utm_campaign=Badge_Grade">
+ <img src="https://app.codacy.com/project/badge/Grade/211718f7a36541819d1244c0e2ee6f08"/>
+ </a>
+
+ <a href="https://github.com/pantor/inja/releases">
+ <img src="https://img.shields.io/github/release/pantor/inja.svg" alt="Github Releases">
+ </a>
+
+ <a href="http://github.com/pantor/inja/issues">
+ <img src="https://img.shields.io/github/issues/pantor/inja.svg" alt="Github Issues">
+ </a>
+
+ <a href="https://raw.githubusercontent.com/pantor/inja/master/LICENSE">
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="GitHub License">
+ </a>
+</p>
+
+Inja is a template engine for modern C++, loosely inspired by [jinja](http://jinja.pocoo.org) for python. It has an easy and yet powerful template syntax with all variables, loops, conditions, includes, callbacks, and comments you need, nested and combined as you like. Inja uses the wonderful [json](https://github.com/nlohmann/json) library by nlohmann for data input. Most importantly, inja needs only two header files, which is (nearly) as trivial as integration in C++ can get. Of course, everything is tested on all relevant compilers. Here is what it looks like:
+
+```.cpp
+json data;
+data["name"] = "world";
+
+inja::render("Hello {{ name }}!", data); // Returns "Hello world!"
+```
+
+## Integration
+
+Inja is a headers only library, which can be downloaded from the [releases](https://github.com/pantor/inja/releases) or directly from the `include/` or `single_include/` folder. Inja uses `nlohmann/json.hpp` (>= v3.8.0) as its single dependency, so make sure it can be included from `inja.hpp`. json can be downloaded [here](https://github.com/nlohmann/json/releases). Then integration is as easy as:
+
+```.cpp
+#include <inja.hpp>
+
+// Just for convenience
+using namespace inja;
+using json = nlohmann::json;
+```
+
+If you are using the [Meson Build System](http://mesonbuild.com), then you can wrap this repository as a subproject.
+
+If you are using [Conan](https://conan.io) to manage your dependencies, have a look at [this repository](https://github.com/DEGoodmanWilson/conan-inja). Please file issues [here](https://github.com/DEGoodmanWilson/conan-inja/issues) if you experience problems with the packages.
+
+You can also integrate inja in your project using [Hunter](https://github.com/cpp-pm/hunter), a package manager for C++.
+
+If you are using [vcpkg](https://github.com/Microsoft/vcpkg) on your project for external dependencies, then you can use the [inja package](https://github.com/Microsoft/vcpkg/tree/master/ports/inja). Please see the vcpkg project for any issues regarding the packaging.
+
+If you are using [cget](https://cget.readthedocs.io/en/latest/), you can install the latest development version with `cget install pantor/inja`. A specific version can be installed with `cget install pantor/inja@v2.1.0`.
+
+On macOS, you can install inja via [Homebrew](https://formulae.brew.sh/formula/inja#default) and `brew install inja`.
+
+If you are using [conda](https://docs.conda.io/en/latest/), you can install the latest version from [conda-forge](https://anaconda.org/conda-forge/inja) with `conda install -c conda-forge inja`.
+
+## Tutorial
+
+This tutorial will give you an idea how to use inja. It will explain the most important concepts and give practical advices using examples and executable code. Beside this tutorial, you may check out the [documentation](https://pantor.github.io/inja).
+
+### Template Rendering
+
+The basic template rendering takes a template as a `std::string` and a `json` object for all data. It returns the rendered template as an `std::string`.
+
+```.cpp
+json data;
+data["name"] = "world";
+
+render("Hello {{ name }}!", data); // Returns std::string "Hello world!"
+render_to(std::cout, "Hello {{ name }}!", data); // Writes "Hello world!" to stream
+```
+
+For more advanced usage, an environment is recommended.
+```.cpp
+Environment env;
+
+// Render a string with json data
+std::string result = env.render("Hello {{ name }}!", data); // "Hello world!"
+
+// Or directly read a template file
+Template temp = env.parse_template("./templates/greeting.txt");
+std::string result = env.render(temp, data); // "Hello world!"
+
+data["name"] = "Inja";
+std::string result = env.render(temp, data); // "Hello Inja!"
+
+// Or read the template file (and/or the json file) directly from the environment
+result = env.render_file("./templates/greeting.txt", data);
+result = env.render_file_with_json_file("./templates/greeting.txt", "./data.json");
+
+// Or write a rendered template file
+env.write(temp, data, "./result.txt");
+env.write_with_json_file("./templates/greeting.txt", "./data.json", "./result.txt");
+```
+
+The environment class can be configured to your needs.
+```.cpp
+// With default settings
+Environment env_default;
+
+// With global path to template files and where files will be saved
+Environment env_1 {"../path/templates/"};
+
+// With separate input and output path
+Environment env_2 {"../path/templates/", "../path/results/"};
+
+// With other opening and closing strings (here the defaults)
+env.set_expression("{{", "}}"); // Expressions
+env.set_comment("{#", "#}"); // Comments
+env.set_statement("{%", "%}"); // Statements {% %} for many things, see below
+env.set_line_statement("##"); // Line statements ## (just an opener)
+```
+
+### Variables
+
+Variables are rendered within the `{{ ... }}` expressions.
+```.cpp
+json data;
+data["neighbour"] = "Peter";
+data["guests"] = {"Jeff", "Tom", "Patrick"};
+data["time"]["start"] = 16;
+data["time"]["end"] = 22;
+
+// Indexing in array
+render("{{ guests.1 }}", data); // "Tom"
+
+// Objects
+render("{{ time.start }} to {{ time.end + 1 }}pm", data); // "16 to 23pm"
+```
+If no variable is found, valid JSON is printed directly, otherwise an `inja::RenderError` is thrown.
+
+### Statements
+
+Statements can be written either with the `{% ... %}` syntax or the `##` syntax for entire lines. Note that `##` needs to start the line without indentation. The most important statements are loops, conditions and file includes. All statements can be nested.
+
+#### Loops
+
+```.cpp
+// Combining loops and line statements
+render(R"(Guest List:
+## for guest in guests
+ {{ loop.index1 }}: {{ guest }}
+## endfor )", data)
+
+/* Guest List:
+ 1: Jeff
+ 2: Tom
+ 3: Patrick */
+```
+In a loop, the special variables `loop/index (number)`, `loop/index1 (number)`, `loop/is_first (boolean)` and `loop/is_last (boolean)` are defined. In nested loops, the parent loop variables are available e.g. via `loop/parent/index`. You can also iterate over objects like `{% for key, value in time %}`.
+
+#### Conditions
+
+Conditions support the typical if, else if and else statements. Following conditions are for example possible:
+```.cpp
+// Standard comparisons with a variable
+render("{% if time.hour >= 20 %}Serve{% else if time.hour >= 18 %}Make{% endif %} dinner.", data); // Serve dinner.
+
+// Variable in list
+render("{% if neighbour in guests %}Turn up the music!{% endif %}", data); // Turn up the music!
+
+// Logical operations
+render("{% if guest_count < (3+2) and all_tired %}Sleepy...{% else %}Keep going...{% endif %}", data); // Sleepy...
+
+// Negations
+render("{% if not guest_count %}The End{% endif %}", data); // The End
+```
+
+#### Includes
+
+You can either include other in-memory templates or from the file system.
+```.cpp
+// To include in-memory templates, add them to the environment first
+inja::Template content_template = env.parse("Hello {{ neighbour }}!");
+env.include_template("content", content_template);
+env.render("Content: {% include \"content\" %}", data); // "Content: Hello Peter!"
+
+// Other template files are included relative from the current file location
+render("{% include \"footer.html\" %}", data);
+
+// You can disable to search for templates in the file system via
+env.set_search_included_templates_in_files(false);
+```
+
+Inja will throw an `inja::RenderError` if an included file is not found. To disable this error, you can call `env.set_throw_at_missing_includes(false)`.
+
+#### Assignments
+
+Variables can also be defined within the template using the set statment.
+```.cpp
+render("{% set new_hour=23 %}{{ new_hour }}pm", data); // "23pm"
+```
+
+### Functions
+
+A few functions are implemented within the inja template syntax. They can be called with
+```.cpp
+// Upper and lower function, for string cases
+render("Hello {{ upper(neighbour) }}!", data); // "Hello PETER!"
+render("Hello {{ lower(neighbour) }}!", data); // "Hello peter!"
+
+// Range function, useful for loops
+render("{% for i in range(4) %}{{ loop.index1 }}{% endfor %}", data); // "1234"
+render("{% for i in range(3) %}{{ at(guests, i) }} {% endfor %}", data); // "Jeff Tom Patrick "
+
+// Length function (please don't combine with range, use list directly...)
+render("I count {{ length(guests) }} guests.", data); // "I count 3 guests."
+
+// Get first and last element in a list
+render("{{ first(guests) }} was first.", data); // "Jeff was first."
+render("{{ last(guests) }} was last.", data); // "Patir was last."
+
+// Sort a list
+render("{{ sort([3,2,1]) }}", data); // "[1,2,3]"
+render("{{ sort(guests) }}", data); // "[\"Jeff\", \"Patrick\", \"Tom\"]"
+
+// Round numbers to a given precision
+render("{{ round(3.1415, 0) }}", data); // 3
+render("{{ round(3.1415, 3) }}", data); // 3.142
+
+// Check if a value is odd, even or divisible by a number
+render("{{ odd(42) }}", data); // false
+render("{{ even(42) }}", data); // true
+render("{{ divisibleBy(42, 7) }}", data); // true
+
+// Maximum and minimum values from a list
+render("{{ max([1, 2, 3]) }}", data); // 3
+render("{{ min([-2.4, -1.2, 4.5]) }}", data); // -2.4
+
+// Convert strings to numbers
+render("{{ int(\"2\") == 2 }}", data); // true
+render("{{ float(\"1.8\") > 2 }}", data); // false
+
+// Set default values if variables are not defined
+render("Hello {{ default(neighbour, \"my friend\") }}!", data); // "Hello Peter!"
+render("Hello {{ default(colleague, \"my friend\") }}!", data); // "Hello my friend!"
+
+// Check if a key exists in an object
+render("{{ exists(\"guests\") }}", data); // "true"
+render("{{ exists(\"city\") }}", data); // "false"
+render("{{ existsIn(time, \"start\") }}", data); // "true"
+render("{{ existsIn(time, neighbour) }}", data); // "false"
+
+// Check if a key is a specific type
+render("{{ isString(neighbour) }}", data); // "true"
+render("{{ isArray(guests) }}", data); // "true"
+// Implemented type checks: isArray, isBoolean, isFloat, isInteger, isNumber, isObject, isString,
+```
+
+### Whitespace Control
+
+In the default configuration, no whitespace is removed while rendering the file. To support a more readable template style, you can configure the environment to control whitespaces before and after a statement automatically. While enabling `set_trim_blocks` removes the first newline after a statement, `set_lstrip_blocks` strips tabs and spaces from the beginning of a line to the start of a block.
+
+```.cpp
+Environment env;
+env.set_trim_blocks(true);
+env.set_lstrip_blocks(true);
+```
+
+With both `trim_blocks` and `lstrip_blocks` enabled, you can put statements on their own lines. Furthermore, you can also strip whitespaces for both statements and expressions by hand. If you add a minus sign (`-`) to the start or end, the whitespaces before or after that block will be removed:
+
+```.cpp
+render("Hello {{- name -}} !", data); // "Hello Inja!"
+render("{% if neighbour in guests -%} I was there{% endif -%} !", data); // Renders without any whitespaces
+```
+
+Stripping behind a statement or expression also removes any newlines.
+
+### Callbacks
+
+You can create your own and more complex functions with callbacks. These are implemented with `std::function`, so you can for example use C++ lambdas. Inja `Arguments` are a vector of json pointers.
+```.cpp
+Environment env;
+
+/*
+ * Callbacks are defined by its:
+ * - name,
+ * - (optional) number of arguments,
+ * - callback function.
+ */
+env.add_callback("double", 1, [](Arguments& args) {
+ int number = args.at(0)->get<int>(); // Adapt the index and type of the argument
+ return 2 * number;
+});
+
+// You can then use a callback like a regular function
+env.render("{{ double(16) }}", data); // "32"
+
+// Inja falls back to variadic callbacks if the number of expected arguments is omitted.
+env.add_callback("argmax", [](Arguments& args) {
+ auto result = std::max_element(args.begin(), args.end(), [](const json* a, const json* b) { return *a < *b;});
+ return std::distance(args.begin(), result);
+});
+env.render("{{ argmax(4, 2, 6) }}", data); // "2"
+env.render("{{ argmax(0, 2, 6, 8, 3) }}", data); // "3"
+
+// A callback without argument can be used like a dynamic variable:
+std::string greet = "Hello";
+env.add_callback("double-greetings", 0, [greet](Arguments args) {
+ return greet + " " + greet + "!";
+});
+env.render("{{ double-greetings }}", data); // "Hello Hello!"
+```
+You can also add a void callback without return variable, e.g. for debugging:
+```.cpp
+env.add_void_callback("log", 1, [greet](Arguments args) {
+ std::cout << "logging: " << args[0] << std::endl;
+});
+env.render("{{ log(neighbour) }}", data); // Prints nothing to result, only to cout...
+```
+
+### Comments
+
+Comments can be written with the `{# ... #}` syntax.
+```.cpp
+render("Hello{# Todo #}!", data); // "Hello!"
+```
+
+### Exceptions
+
+Inja uses exceptions to handle ill-formed template input. However, exceptions can be switched off with either using the compiler flag `-fno-exceptions` or by defining the symbol `INJA_NOEXCEPTION`. In this case, exceptions are replaced by `abort()` calls.
+
+
+## Supported compilers
+
+Inja uses `string_view` from C++17, but includes the [polyfill](https://github.com/martinmoene/string-view-lite) from martinmoene. This way, the minimum version is C++11. Currently, the following compilers are tested:
+
+- GCC 4.8 - 9 (and possibly later)
+- Clang 3.5 - 9 (and possibly later)
+- Microsoft Visual C++ 2016 - 2019 (and possibly later)
+
+The unit tests fail to compile with GCC 4.8 but should just work fine. A complete list of supported compiler / os versions can be found in the [CI definition](https://github.com/pantor/inja/blob/master/.github/workflows/ci.yml).
diff --git a/deps/inja/cmake/Coveralls.cmake b/deps/inja/cmake/Coveralls.cmake
new file mode 100644
index 0000000..e0701d4
--- /dev/null
+++ b/deps/inja/cmake/Coveralls.cmake
@@ -0,0 +1,125 @@
+#
+# The MIT License (MIT)
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+# Copyright (C) 2014 Joakim Söderberg <joakim.soderberg@gmail.com>
+#
+
+set(_CMAKE_SCRIPT_PATH ${CMAKE_CURRENT_LIST_DIR}) # must be outside coveralls_setup() to get correct path
+
+#
+# Param _COVERAGE_SRCS A list of source files that coverage should be collected for.
+# Param _COVERALLS_UPLOAD Upload the result to coveralls?
+#
+
+function(coveralls_setup _COVERAGE_SRCS _COVERALLS_UPLOAD)
+
+ if (ARGC GREATER 2)
+ set(_CMAKE_SCRIPT_PATH ${ARGN})
+ message(STATUS "Coveralls: Using alternate CMake script dir: ${_CMAKE_SCRIPT_PATH}")
+ endif()
+
+ if (NOT EXISTS "${_CMAKE_SCRIPT_PATH}/CoverallsClear.cmake")
+ message(FATAL_ERROR "Coveralls: Missing ${_CMAKE_SCRIPT_PATH}/CoverallsClear.cmake")
+ endif()
+
+ if (NOT EXISTS "${_CMAKE_SCRIPT_PATH}/CoverallsGenerateGcov.cmake")
+ message(FATAL_ERROR "Coveralls: Missing ${_CMAKE_SCRIPT_PATH}/CoverallsGenerateGcov.cmake")
+ endif()
+
+ # When passing a CMake list to an external process, the list
+ # will be converted from the format "1;2;3" to "1 2 3".
+ # This means the script we're calling won't see it as a list
+ # of sources, but rather just one long path. We remedy this
+ # by replacing ";" with "*" and then reversing that in the script
+ # that we're calling.
+ # http://cmake.3232098.n2.nabble.com/Passing-a-CMake-list-quot-as-is-quot-to-a-custom-target-td6505681.html
+ set(COVERAGE_SRCS_TMP ${_COVERAGE_SRCS})
+ set(COVERAGE_SRCS "")
+ foreach (COVERAGE_SRC ${COVERAGE_SRCS_TMP})
+ set(COVERAGE_SRCS "${COVERAGE_SRCS}*${COVERAGE_SRC}")
+ endforeach()
+
+ #message("Coverage sources: ${COVERAGE_SRCS}")
+ set(COVERALLS_FILE ${PROJECT_BINARY_DIR}/coveralls.json)
+
+ add_custom_target(coveralls_generate
+
+ # Zero the coverage counters.
+ COMMAND ${CMAKE_COMMAND} -DPROJECT_BINARY_DIR="${PROJECT_BINARY_DIR}" -P "${_CMAKE_SCRIPT_PATH}/CoverallsClear.cmake"
+
+ # Run regress tests.
+ COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
+
+ # Generate Gcov and translate it into coveralls JSON.
+ # We do this by executing an external CMake script.
+ # (We don't want this to run at CMake generation time, but after compilation and everything has run).
+ COMMAND ${CMAKE_COMMAND}
+ -DCOVERAGE_SRCS="${COVERAGE_SRCS}" # TODO: This is passed like: "a b c", not "a;b;c"
+ -DCOVERALLS_OUTPUT_FILE="${COVERALLS_FILE}"
+ -DCOV_PATH="${PROJECT_BINARY_DIR}"
+ -DPROJECT_ROOT="${PROJECT_SOURCE_DIR}"
+ -P "${_CMAKE_SCRIPT_PATH}/CoverallsGenerateGcov.cmake"
+
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
+ COMMENT "Generating coveralls output..."
+ )
+
+ if (_COVERALLS_UPLOAD)
+ message("COVERALLS UPLOAD: ON")
+
+ find_program(CURL_EXECUTABLE curl)
+
+ if (NOT CURL_EXECUTABLE)
+ message(FATAL_ERROR "Coveralls: curl not found! Aborting")
+ endif()
+
+ add_custom_target(coveralls_upload
+ # Upload the JSON to coveralls.
+ COMMAND ${CURL_EXECUTABLE}
+ -S -F json_file=@${COVERALLS_FILE}
+ https://coveralls.io/api/v1/jobs
+
+ DEPENDS coveralls_generate
+
+ WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
+ COMMENT "Uploading coveralls output...")
+
+ add_custom_target(coveralls DEPENDS coveralls_upload)
+ else()
+ message("COVERALLS UPLOAD: OFF")
+ add_custom_target(coveralls DEPENDS coveralls_generate)
+ endif()
+
+endfunction()
+
+macro(coveralls_turn_on_coverage)
+ if(NOT (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
+ AND (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang"))
+ message(FATAL_ERROR "Coveralls: Compiler ${CMAKE_C_COMPILER_ID} is not GNU gcc! Aborting... You can set this on the command line using CC=/usr/bin/gcc CXX=/usr/bin/g++ cmake <options> ..")
+ endif()
+
+ if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
+ message(FATAL_ERROR "Coveralls: Code coverage results with an optimised (non-Debug) build may be misleading! Add -DCMAKE_BUILD_TYPE=Debug")
+ endif()
+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
+endmacro()
diff --git a/deps/inja/cmake/CoverallsClear.cmake b/deps/inja/cmake/CoverallsClear.cmake
new file mode 100644
index 0000000..7206886
--- /dev/null
+++ b/deps/inja/cmake/CoverallsClear.cmake
@@ -0,0 +1,31 @@
+#
+# The MIT License (MIT)
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+# Copyright (C) 2014 Joakim Söderberg <joakim.soderberg@gmail.com>
+#
+
+# do not follow symlinks in file(GLOB_RECURSE ...)
+cmake_policy(SET CMP0009 NEW)
+
+file(GLOB_RECURSE GCDA_FILES "${PROJECT_BINARY_DIR}/*.gcda")
+if(NOT GCDA_FILES STREQUAL "")
+ file(REMOVE ${GCDA_FILES})
+endif()
diff --git a/deps/inja/cmake/CoverallsGenerateGcov.cmake b/deps/inja/cmake/CoverallsGenerateGcov.cmake
new file mode 100644
index 0000000..5f916ed
--- /dev/null
+++ b/deps/inja/cmake/CoverallsGenerateGcov.cmake
@@ -0,0 +1,484 @@
+#
+# The MIT License (MIT)
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+#
+# Copyright (C) 2014 Joakim Söderberg <joakim.soderberg@gmail.com>
+#
+# This is intended to be run by a custom target in a CMake project like this.
+# 0. Compile program with coverage support.
+# 1. Clear coverage data. (Recursively delete *.gcda in build dir)
+# 2. Run the unit tests.
+# 3. Run this script specifying which source files the coverage should be performed on.
+#
+# This script will then use gcov to generate .gcov files in the directory specified
+# via the COV_PATH var. This should probably be the same as your cmake build dir.
+#
+# It then parses the .gcov files to convert them into the Coveralls JSON format:
+# https://coveralls.io/docs/api
+#
+# Example for running as standalone CMake script from the command line:
+# (Note it is important the -P is at the end...)
+# $ cmake -DCOV_PATH=$(pwd)
+# -DCOVERAGE_SRCS="catcierge_rfid.c;catcierge_timer.c"
+# -P ../cmake/CoverallsGcovUpload.cmake
+#
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+
+#
+# Make sure we have the needed arguments.
+#
+if (NOT COVERALLS_OUTPUT_FILE)
+ message(FATAL_ERROR "Coveralls: No coveralls output file specified. Please set COVERALLS_OUTPUT_FILE")
+endif()
+
+if (NOT COV_PATH)
+ message(FATAL_ERROR "Coveralls: Missing coverage directory path where gcov files will be generated. Please set COV_PATH")
+endif()
+
+if (NOT COVERAGE_SRCS)
+ message(FATAL_ERROR "Coveralls: Missing the list of source files that we should get the coverage data for COVERAGE_SRCS")
+endif()
+
+if (NOT PROJECT_ROOT)
+ message(FATAL_ERROR "Coveralls: Missing PROJECT_ROOT.")
+endif()
+
+# Since it's not possible to pass a CMake list properly in the
+# "1;2;3" format to an external process, we have replaced the
+# ";" with "*", so reverse that here so we get it back into the
+# CMake list format.
+string(REGEX REPLACE "\\*" ";" COVERAGE_SRCS ${COVERAGE_SRCS})
+
+if (NOT DEFINED ENV{GCOV})
+ find_program(GCOV_EXECUTABLE gcov)
+else()
+ find_program(GCOV_EXECUTABLE $ENV{GCOV})
+endif()
+
+# convert all paths in COVERAGE_SRCS to absolute paths
+set(COVERAGE_SRCS_TMP "")
+foreach (COVERAGE_SRC ${COVERAGE_SRCS})
+ if (NOT "${COVERAGE_SRC}" MATCHES "^/")
+ set(COVERAGE_SRC ${PROJECT_ROOT}/${COVERAGE_SRC})
+ endif()
+ list(APPEND COVERAGE_SRCS_TMP ${COVERAGE_SRC})
+endforeach()
+set(COVERAGE_SRCS ${COVERAGE_SRCS_TMP})
+unset(COVERAGE_SRCS_TMP)
+
+if (NOT GCOV_EXECUTABLE)
+ message(FATAL_ERROR "gcov not found! Aborting...")
+endif()
+
+find_package(Git)
+
+set(JSON_REPO_TEMPLATE
+ "{
+ \"head\": {
+ \"id\": \"\@GIT_COMMIT_HASH\@\",
+ \"author_name\": \"\@GIT_AUTHOR_NAME\@\",
+ \"author_email\": \"\@GIT_AUTHOR_EMAIL\@\",
+ \"committer_name\": \"\@GIT_COMMITTER_NAME\@\",
+ \"committer_email\": \"\@GIT_COMMITTER_EMAIL\@\",
+ \"message\": \"\@GIT_COMMIT_MESSAGE\@\"
+ },
+ \"branch\": \"@GIT_BRANCH@\",
+ \"remotes\": []
+ }"
+)
+
+# TODO: Fill in git remote data
+if (GIT_FOUND)
+ # Branch.
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE GIT_BRANCH
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ macro (git_log_format FORMAT_CHARS VAR_NAME)
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} log -1 --pretty=format:%${FORMAT_CHARS}
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE ${VAR_NAME}
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ endmacro()
+
+ git_log_format(an GIT_AUTHOR_NAME)
+ git_log_format(ae GIT_AUTHOR_EMAIL)
+ git_log_format(cn GIT_COMMITTER_NAME)
+ git_log_format(ce GIT_COMMITTER_EMAIL)
+ git_log_format(B GIT_COMMIT_MESSAGE)
+ git_log_format(H GIT_COMMIT_HASH)
+
+ if(GIT_COMMIT_MESSAGE)
+ string(REPLACE "\n" "\\n" GIT_COMMIT_MESSAGE ${GIT_COMMIT_MESSAGE})
+ endif()
+
+ message("Git exe: ${GIT_EXECUTABLE}")
+ message("Git branch: ${GIT_BRANCH}")
+ message("Git author: ${GIT_AUTHOR_NAME}")
+ message("Git e-mail: ${GIT_AUTHOR_EMAIL}")
+ message("Git commiter name: ${GIT_COMMITTER_NAME}")
+ message("Git commiter e-mail: ${GIT_COMMITTER_EMAIL}")
+ message("Git commit hash: ${GIT_COMMIT_HASH}")
+ message("Git commit message: ${GIT_COMMIT_MESSAGE}")
+
+ string(CONFIGURE ${JSON_REPO_TEMPLATE} JSON_REPO_DATA)
+else()
+ set(JSON_REPO_DATA "{}")
+endif()
+
+############################# Macros #########################################
+
+#
+# This macro converts from the full path format gcov outputs:
+#
+# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
+#
+# to the original source file path the .gcov is for:
+#
+# /path/to/project/root/subdir/the_file.c
+#
+macro(get_source_path_from_gcov_filename _SRC_FILENAME _GCOV_FILENAME)
+
+ # /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
+ # ->
+ # #path#to#project#root#subdir#the_file.c.gcov
+ get_filename_component(_GCOV_FILENAME_WEXT ${_GCOV_FILENAME} NAME)
+
+ # #path#to#project#root#subdir#the_file.c.gcov -> /path/to/project/root/subdir/the_file.c
+ string(REGEX REPLACE "\\.gcov$" "" SRC_FILENAME_TMP ${_GCOV_FILENAME_WEXT})
+ string(REGEX REPLACE "\\^" ".." SRC_FILENAME_TMP ${SRC_FILENAME_TMP})
+ string(REGEX REPLACE "\#" "/" SRC_FILENAME_TMP ${SRC_FILENAME_TMP})
+ get_filename_component(SRC_FILENAME_TMP_ABSOLUTE ${SRC_FILENAME_TMP} ABSOLUTE)
+ set(${_SRC_FILENAME} "${SRC_FILENAME_TMP_ABSOLUTE}")
+endmacro()
+
+##############################################################################
+
+# Get the coverage data.
+file(GLOB_RECURSE GCDA_FILES "${COV_PATH}/*.gcda")
+message("GCDA files:")
+
+# Get a list of all the object directories needed by gcov
+# (The directories the .gcda files and .o files are found in)
+# and run gcov on those.
+foreach(GCDA ${GCDA_FILES})
+ message("Process: ${GCDA}")
+ message("------------------------------------------------------------------------------")
+ get_filename_component(GCDA_DIR ${GCDA} PATH)
+
+ #
+ # The -p below refers to "Preserve path components",
+ # This means that the generated gcov filename of a source file will
+ # keep the original files entire filepath, but / is replaced with #.
+ # Example:
+ #
+ # /path/to/project/root/build/CMakeFiles/the_file.dir/subdir/the_file.c.gcda
+ # ------------------------------------------------------------------------------
+ # File '/path/to/project/root/subdir/the_file.c'
+ # Lines executed:68.34% of 199
+ # /path/to/project/root/subdir/the_file.c:creating '#path#to#project#root#subdir#the_file.c.gcov'
+ #
+ # If -p is not specified then the file is named only "the_file.c.gcov"
+ #
+ execute_process(
+ COMMAND ${GCOV_EXECUTABLE} -p -o ${GCDA_DIR} ${GCDA}
+ WORKING_DIRECTORY ${COV_PATH}
+ )
+endforeach()
+
+# TODO: Make these be absolute path
+file(GLOB ALL_GCOV_FILES ${COV_PATH}/*.gcov)
+
+# Get only the filenames to use for filtering.
+#set(COVERAGE_SRCS_NAMES "")
+#foreach (COVSRC ${COVERAGE_SRCS})
+# get_filename_component(COVSRC_NAME ${COVSRC} NAME)
+# message("${COVSRC} -> ${COVSRC_NAME}")
+# list(APPEND COVERAGE_SRCS_NAMES "${COVSRC_NAME}")
+#endforeach()
+
+#
+# Filter out all but the gcov files we want.
+#
+# We do this by comparing the list of COVERAGE_SRCS filepaths that the
+# user wants the coverage data for with the paths of the generated .gcov files,
+# so that we only keep the relevant gcov files.
+#
+# Example:
+# COVERAGE_SRCS =
+# /path/to/project/root/subdir/the_file.c
+#
+# ALL_GCOV_FILES =
+# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
+# /path/to/project/root/build/#path#to#project#root#subdir#other_file.c.gcov
+#
+# Result should be:
+# GCOV_FILES =
+# /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
+#
+set(GCOV_FILES "")
+#message("Look in coverage sources: ${COVERAGE_SRCS}")
+message("\nFilter out unwanted GCOV files:")
+message("===============================")
+
+set(COVERAGE_SRCS_REMAINING ${COVERAGE_SRCS})
+
+foreach (GCOV_FILE ${ALL_GCOV_FILES})
+
+ #
+ # /path/to/project/root/build/#path#to#project#root#subdir#the_file.c.gcov
+ # ->
+ # /path/to/project/root/subdir/the_file.c
+ get_source_path_from_gcov_filename(GCOV_SRC_PATH ${GCOV_FILE})
+ file(RELATIVE_PATH GCOV_SRC_REL_PATH "${PROJECT_ROOT}" "${GCOV_SRC_PATH}")
+
+ # Is this in the list of source files?
+ # TODO: We want to match against relative path filenames from the source file root...
+ list(FIND COVERAGE_SRCS ${GCOV_SRC_PATH} WAS_FOUND)
+
+ if (NOT WAS_FOUND EQUAL -1)
+ message("YES: ${GCOV_FILE}")
+ list(APPEND GCOV_FILES ${GCOV_FILE})
+
+ # We remove it from the list, so we don't bother searching for it again.
+ # Also files left in COVERAGE_SRCS_REMAINING after this loop ends should
+ # have coverage data generated from them (no lines are covered).
+ list(REMOVE_ITEM COVERAGE_SRCS_REMAINING ${GCOV_SRC_PATH})
+ else()
+ message("NO: ${GCOV_FILE}")
+ endif()
+endforeach()
+
+# TODO: Enable setting these
+set(JSON_SERVICE_NAME "travis-ci")
+set(JSON_SERVICE_JOB_ID $ENV{TRAVIS_JOB_ID})
+set(JSON_REPO_TOKEN $ENV{COVERALLS_REPO_TOKEN})
+
+set(JSON_TEMPLATE
+"{
+ \"repo_token\": \"\@JSON_REPO_TOKEN\@\",
+ \"service_name\": \"\@JSON_SERVICE_NAME\@\",
+ \"service_job_id\": \"\@JSON_SERVICE_JOB_ID\@\",
+ \"source_files\": \@JSON_GCOV_FILES\@,
+ \"git\": \@JSON_REPO_DATA\@
+}"
+)
+
+set(SRC_FILE_TEMPLATE
+"{
+ \"name\": \"\@GCOV_SRC_REL_PATH\@\",
+ \"source_digest\": \"\@GCOV_CONTENTS_MD5\@\",
+ \"coverage\": \@GCOV_FILE_COVERAGE\@
+ }"
+)
+
+message("\nGenerate JSON for files:")
+message("=========================")
+
+set(JSON_GCOV_FILES "[")
+
+# Read the GCOV files line by line and get the coverage data.
+foreach (GCOV_FILE ${GCOV_FILES})
+
+ get_source_path_from_gcov_filename(GCOV_SRC_PATH ${GCOV_FILE})
+ file(RELATIVE_PATH GCOV_SRC_REL_PATH "${PROJECT_ROOT}" "${GCOV_SRC_PATH}")
+
+ # The new coveralls API doesn't need the entire source (Yay!)
+ # However, still keeping that part for now. Will cleanup in the future.
+ file(MD5 "${GCOV_SRC_PATH}" GCOV_CONTENTS_MD5)
+ message("MD5: ${GCOV_SRC_PATH} = ${GCOV_CONTENTS_MD5}")
+
+ # Loads the gcov file as a list of lines.
+ # (We first open the file and replace all occurences of [] with _
+ # because CMake will fail to parse a line containing unmatched brackets...
+ # also the \ to escaped \n in macros screws up things.)
+ # https://public.kitware.com/Bug/view.php?id=15369
+ file(READ ${GCOV_FILE} GCOV_CONTENTS)
+ string(REPLACE "[" "_" GCOV_CONTENTS "${GCOV_CONTENTS}")
+ string(REPLACE "]" "_" GCOV_CONTENTS "${GCOV_CONTENTS}")
+ string(REPLACE "\\" "_" GCOV_CONTENTS "${GCOV_CONTENTS}")
+
+ # Remove file contents to avoid encoding issues (cmake 2.8 has no ENCODING option)
+ string(REGEX REPLACE "([^:]*):([^:]*):([^\n]*)\n" "\\1:\\2: \n" GCOV_CONTENTS "${GCOV_CONTENTS}")
+ file(WRITE ${GCOV_FILE}_tmp "${GCOV_CONTENTS}")
+
+ file(STRINGS ${GCOV_FILE}_tmp GCOV_LINES)
+ list(LENGTH GCOV_LINES LINE_COUNT)
+
+ # Instead of trying to parse the source from the
+ # gcov file, simply read the file contents from the source file.
+ # (Parsing it from the gcov is hard because C-code uses ; in many places
+ # which also happens to be the same as the CMake list delimeter).
+ file(READ ${GCOV_SRC_PATH} GCOV_FILE_SOURCE)
+
+ string(REPLACE "\\" "\\\\" GCOV_FILE_SOURCE "${GCOV_FILE_SOURCE}")
+ string(REGEX REPLACE "\"" "\\\\\"" GCOV_FILE_SOURCE "${GCOV_FILE_SOURCE}")
+ string(REPLACE "\t" "\\\\t" GCOV_FILE_SOURCE "${GCOV_FILE_SOURCE}")
+ string(REPLACE "\r" "\\\\r" GCOV_FILE_SOURCE "${GCOV_FILE_SOURCE}")
+ string(REPLACE "\n" "\\\\n" GCOV_FILE_SOURCE "${GCOV_FILE_SOURCE}")
+ # According to http://json.org/ these should be escaped as well.
+ # Don't know how to do that in CMake however...
+ #string(REPLACE "\b" "\\\\b" GCOV_FILE_SOURCE "${GCOV_FILE_SOURCE}")
+ #string(REPLACE "\f" "\\\\f" GCOV_FILE_SOURCE "${GCOV_FILE_SOURCE}")
+ #string(REGEX REPLACE "\u([a-fA-F0-9]{4})" "\\\\u\\1" GCOV_FILE_SOURCE "${GCOV_FILE_SOURCE}")
+
+ # We want a json array of coverage data as a single string
+ # start building them from the contents of the .gcov
+ set(GCOV_FILE_COVERAGE "[")
+
+ set(GCOV_LINE_COUNT 1) # Line number for the .gcov.
+ set(DO_SKIP 0)
+ foreach (GCOV_LINE ${GCOV_LINES})
+ #message("${GCOV_LINE}")
+ # Example of what we're parsing:
+ # Hitcount |Line | Source
+ # " 8: 26: if (!allowed || (strlen(allowed) == 0))"
+ string(REGEX REPLACE
+ "^([^:]*):([^:]*):(.*)$"
+ "\\1;\\2;\\3"
+ RES
+ "${GCOV_LINE}")
+
+ # Check if we should exclude lines using the Lcov syntax.
+ string(REGEX MATCH "LCOV_EXCL_START" START_SKIP "${GCOV_LINE}")
+ string(REGEX MATCH "LCOV_EXCL_END" END_SKIP "${GCOV_LINE}")
+ string(REGEX MATCH "LCOV_EXCL_LINE" LINE_SKIP "${GCOV_LINE}")
+
+ set(RESET_SKIP 0)
+ if (LINE_SKIP AND NOT DO_SKIP)
+ set(DO_SKIP 1)
+ set(RESET_SKIP 1)
+ endif()
+
+ if (START_SKIP)
+ set(DO_SKIP 1)
+ message("${GCOV_LINE_COUNT}: Start skip")
+ endif()
+
+ if (END_SKIP)
+ set(DO_SKIP 0)
+ endif()
+
+ list(LENGTH RES RES_COUNT)
+
+ if (RES_COUNT GREATER 2)
+ list(GET RES 0 HITCOUNT)
+ list(GET RES 1 LINE)
+ list(GET RES 2 SOURCE)
+
+ string(STRIP ${HITCOUNT} HITCOUNT)
+ string(STRIP ${LINE} LINE)
+
+ # Lines with 0 line numbers are metadata and can be ignored.
+ if (NOT ${LINE} EQUAL 0)
+
+ if (DO_SKIP)
+ set(GCOV_FILE_COVERAGE "${GCOV_FILE_COVERAGE}null, ")
+ else()
+ # Translate the hitcount into valid JSON values.
+ if (${HITCOUNT} STREQUAL "#####" OR ${HITCOUNT} STREQUAL "=====")
+ set(GCOV_FILE_COVERAGE "${GCOV_FILE_COVERAGE}0, ")
+ elseif (${HITCOUNT} STREQUAL "-")
+ set(GCOV_FILE_COVERAGE "${GCOV_FILE_COVERAGE}null, ")
+ else()
+ set(GCOV_FILE_COVERAGE "${GCOV_FILE_COVERAGE}${HITCOUNT}, ")
+ endif()
+ endif()
+ endif()
+ else()
+ message(WARNING "Failed to properly parse line (RES_COUNT = ${RES_COUNT}) ${GCOV_FILE}:${GCOV_LINE_COUNT}\n-->${GCOV_LINE}")
+ endif()
+
+ if (RESET_SKIP)
+ set(DO_SKIP 0)
+ endif()
+ math(EXPR GCOV_LINE_COUNT "${GCOV_LINE_COUNT}+1")
+ endforeach()
+
+ message("${GCOV_LINE_COUNT} of ${LINE_COUNT} lines read!")
+
+ # Advanced way of removing the trailing comma in the JSON array.
+ # "[1, 2, 3, " -> "[1, 2, 3"
+ string(REGEX REPLACE ",[ ]*$" "" GCOV_FILE_COVERAGE ${GCOV_FILE_COVERAGE})
+
+ # Append the trailing ] to complete the JSON array.
+ set(GCOV_FILE_COVERAGE "${GCOV_FILE_COVERAGE}]")
+
+ # Generate the final JSON for this file.
+ message("Generate JSON for file: ${GCOV_SRC_REL_PATH}...")
+ string(CONFIGURE ${SRC_FILE_TEMPLATE} FILE_JSON)
+
+ set(JSON_GCOV_FILES "${JSON_GCOV_FILES}${FILE_JSON}, ")
+endforeach()
+
+# Loop through all files we couldn't find any coverage for
+# as well, and generate JSON for those as well with 0% coverage.
+foreach(NOT_COVERED_SRC ${COVERAGE_SRCS_REMAINING})
+
+ # Set variables for json replacement
+ set(GCOV_SRC_PATH ${NOT_COVERED_SRC})
+ file(MD5 "${GCOV_SRC_PATH}" GCOV_CONTENTS_MD5)
+ file(RELATIVE_PATH GCOV_SRC_REL_PATH "${PROJECT_ROOT}" "${GCOV_SRC_PATH}")
+
+ # Loads the source file as a list of lines.
+ file(STRINGS ${NOT_COVERED_SRC} SRC_LINES)
+
+ set(GCOV_FILE_COVERAGE "[")
+ set(GCOV_FILE_SOURCE "")
+
+ foreach (SOURCE ${SRC_LINES})
+ set(GCOV_FILE_COVERAGE "${GCOV_FILE_COVERAGE}null, ")
+
+ string(REPLACE "\\" "\\\\" SOURCE "${SOURCE}")
+ string(REGEX REPLACE "\"" "\\\\\"" SOURCE "${SOURCE}")
+ string(REPLACE "\t" "\\\\t" SOURCE "${SOURCE}")
+ string(REPLACE "\r" "\\\\r" SOURCE "${SOURCE}")
+ set(GCOV_FILE_SOURCE "${GCOV_FILE_SOURCE}${SOURCE}\\n")
+ endforeach()
+
+ # Remove trailing comma, and complete JSON array with ]
+ string(REGEX REPLACE ",[ ]*$" "" GCOV_FILE_COVERAGE ${GCOV_FILE_COVERAGE})
+ set(GCOV_FILE_COVERAGE "${GCOV_FILE_COVERAGE}]")
+
+ # Generate the final JSON for this file.
+ message("Generate JSON for non-gcov file: ${NOT_COVERED_SRC}...")
+ string(CONFIGURE ${SRC_FILE_TEMPLATE} FILE_JSON)
+ set(JSON_GCOV_FILES "${JSON_GCOV_FILES}${FILE_JSON}, ")
+endforeach()
+
+# Get rid of trailing comma.
+string(REGEX REPLACE ",[ ]*$" "" JSON_GCOV_FILES ${JSON_GCOV_FILES})
+set(JSON_GCOV_FILES "${JSON_GCOV_FILES}]")
+
+# Generate the final complete JSON!
+message("Generate final JSON...")
+string(CONFIGURE ${JSON_TEMPLATE} JSON)
+
+file(WRITE "${COVERALLS_OUTPUT_FILE}" "${JSON}")
+message("###########################################################################")
+message("Generated coveralls JSON containing coverage data:")
+message("${COVERALLS_OUTPUT_FILE}")
+message("###########################################################################")
diff --git a/deps/inja/cmake/config/injaBuildConfig.cmake.in b/deps/inja/cmake/config/injaBuildConfig.cmake.in
new file mode 100644
index 0000000..ccbc2ae
--- /dev/null
+++ b/deps/inja/cmake/config/injaBuildConfig.cmake.in
@@ -0,0 +1,11 @@
+set(INJA_VERSION "@PROJECT_VERSION@")
+
+set(INJA_PACKAGE_USE_EMBEDDED_JSON "@INJA_PACKAGE_USE_EMBEDDED_JSON@")
+
+include(CMakeFindDependencyMacro)
+
+if(NOT INJA_PACKAGE_USE_EMBEDDED_JSON)
+ find_dependency(nlohmann_json REQUIRED)
+endif()
+
+include("${CMAKE_CURRENT_LIST_DIR}/injaTargets.cmake")
diff --git a/deps/inja/cmake/config/injaConfig.cmake.in b/deps/inja/cmake/config/injaConfig.cmake.in
new file mode 100644
index 0000000..ea81ef6
--- /dev/null
+++ b/deps/inja/cmake/config/injaConfig.cmake.in
@@ -0,0 +1,12 @@
+@PACKAGE_INIT@
+set(INJA_VERSION "@PROJECT_VERSION@")
+
+set(INJA_PACKAGE_USE_EMBEDDED_JSON "@INJA_PACKAGE_USE_EMBEDDED_JSON@")
+
+include(CMakeFindDependencyMacro)
+
+if(NOT INJA_PACKAGE_USE_EMBEDDED_JSON)
+ find_dependency(nlohmann_json REQUIRED)
+endif()
+
+include("${CMAKE_CURRENT_LIST_DIR}/injaTargets.cmake")
diff --git a/deps/inja/doc/Doxyfile b/deps/inja/doc/Doxyfile
new file mode 100644
index 0000000..10bbe55
--- /dev/null
+++ b/deps/inja/doc/Doxyfile
@@ -0,0 +1,2484 @@
+# Doxyfile 1.8.14
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See
+# https://www.gnu.org/software/libiconv/ for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME = "Inja"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER = 3.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
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF = "A Template Engine for Modern C++"
+
+# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
+# in the documentation. The maximum height of the logo should not exceed 55
+# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
+# the logo to the output directory.
+
+PROJECT_LOGO = "./logo-doxygen.jpg"
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS = NO
+
+# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
+# characters to appear in the names of generated files. If set to NO, non-ASCII
+# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
+# U+3044.
+# The default value is: NO.
+
+ALLOW_UNICODE_NAMES = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF = "The $name class" \
+ "The $name widget" \
+ "The $name file" \
+ is \
+ provides \
+ specifies \
+ contains \
+ represents \
+ a \
+ an \
+ the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
+# page for each member. If set to NO, the documentation of a member will be part
+# of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines (in the resulting output). You can put ^^ in the value part of an
+# alias to insert a newline as if a physical newline was in the original file.
+
+ALIASES =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
+# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
+# Fortran. In the later case the parser tries to guess whether the code is fixed
+# or free formatted code, this is the default for Fortran type files), VHDL. For
+# instance to make doxygen treat .inc files as Fortran files (default is PHP),
+# and .f files as C (default is Fortran), use: inc=Fortran f=C.
+#
+# Note: For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT = YES
+
+# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
+# to that level are automatically included in the table of contents, even if
+# they do not have an id attribute.
+# Note: This feature currently applies only to Markdown headings.
+# Minimum value: 0, maximum value: 99, default value: 0.
+# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
+
+TOC_INCLUDE_HEADINGS = 0
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by putting a % sign in front of the word or
+# globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# If one adds a struct or class to a group and this option is enabled, then also
+# any nested class or struct is added to the same group. By default this option
+# is disabled and one has to add nested compounds explicitly via \ingroup.
+# The default value is: NO.
+
+GROUP_NESTED_COMPOUNDS = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE = NO
+
+# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO,
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. If set to YES, local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO, only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO, these classes will be included in the various overviews. This option
+# has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO, these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO, these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES, upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES, the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
+# append additional text to a page's title, such as Class Reference. If set to
+# YES the compound reference will be hidden.
+# The default value is: NO.
+
+HIDE_COMPOUND_REFERENCE= NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
+# list. This list is created by putting \todo commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
+# list. This list is created by putting \test commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES, the
+# list will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. See also \cite for info how to create references.
+
+CITE_BIB_FILES =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO, doxygen will only warn about wrong or incomplete
+# parameter documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC = NO
+
+# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
+# a warning is encountered.
+# The default value is: NO.
+
+WARN_AS_ERROR = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
+# Note: If this tag is empty the current directory is searched.
+
+INPUT = ../include/inja \
+ ../README.md \
+ support.md
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: https://www.gnu.org/software/libiconv/) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# read by doxygen.
+#
+# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
+# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
+# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
+# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
+# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf.
+
+FILE_PATTERNS = *.c \
+ *.cc \
+ *.cxx \
+ *.cpp \
+ *.c++ \
+ *.java \
+ *.ii \
+ *.ixx \
+ *.ipp \
+ *.i++ \
+ *.inl \
+ *.idl \
+ *.ddl \
+ *.odl \
+ *.h \
+ *.hh \
+ *.hxx \
+ *.hpp \
+ *.h++ \
+ *.cs \
+ *.d \
+ *.php \
+ *.php4 \
+ *.php5 \
+ *.phtml \
+ *.inc \
+ *.m \
+ *.markdown \
+ *.md \
+ *.mm \
+ *.dox \
+ *.py \
+ *.pyw \
+ *.f90 \
+ *.f95 \
+ *.f03 \
+ *.f08 \
+ *.f \
+ *.for \
+ *.tcl \
+ *.vhd \
+ *.vhdl \
+ *.ucf \
+ *.qsf
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS = stdinja
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH = ./examples
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS = *
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE = YES
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE = ../README.md
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see https://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# cascading style sheets that are included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefore more robust against future updates.
+# Doxygen will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list). For an example see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the style sheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to YES can help to show when doxygen was last run and thus if the
+# documentation is up to date.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP = NO
+
+# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
+# documentation will contain a main index with vertical navigation menus that
+# are dynamically created via Javascript. If disabled, the navigation index will
+# consists of multiple levels of tabs that are statically embedded in every HTML
+# page. Disable this option to support browsers that do not have Javascript,
+# like the Qt help browser.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_MENUS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: https://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler (hhc.exe). If non-empty,
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated
+# (YES) or that it should be included in the master .chm file (NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated
+# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
+# enables the Previous and Next buttons.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH = 250
+
+# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# https://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from https://www.mathjax.org before deployment.
+# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
+# setting. When disabled, doxygen will generate a PHP script for searching and
+# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
+# and searching needs to be provided by external tools. See the section
+# "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: https://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: https://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. The package can be specified just
+# by its name or with the correct syntax as to be used with the LaTeX
+# \usepackage command. To get the times font for instance you can specify :
+# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
+# To use the option intlimits with the amsmath package you can specify:
+# EXTRA_PACKAGES=[intlimits]{amsmath}
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
+# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
+# string, for the replacement values of the other commands the user is referred
+# to HTML_HEADER.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer. See
+# LATEX_HEADER for more information on how to generate a default footer and what
+# special commands can be used inside the footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER =
+
+# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# LaTeX style sheets that are included after the standard style sheets created
+# by doxygen. Using this option one can overrule certain style aspects. Doxygen
+# will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_STYLESHEET =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES, to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE = plain
+
+# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_TIMESTAMP = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE =
+
+# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
+# with syntax highlighting in the RTF output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_SOURCE_CODE = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION = .3
+
+# The MAN_SUBDIR tag determines the name of the directory created within
+# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
+# MAN_EXTENSION with the initial . removed.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_SUBDIR =
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT = xml
+
+# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT = docbook
+
+# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
+# program listings (including syntax highlighting and cross-referencing
+# information) to the DOCBOOK output. Note that enabling this will significantly
+# increase the size of the DOCBOOK output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_PROGRAMLISTING = NO
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
+# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
+# the structure of the code including all documentation. Note that this feature
+# is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO, the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
+# in the source code. If set to NO, only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES, the include files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all references to function-like macros that are alone on a line, have
+# an all uppercase name, and do not end with a semicolon. Such function macros
+# are typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have a unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
+# the class index. If set to NO, only the inherited external classes will be
+# listed.
+# The default value is: NO.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS = YES
+
+# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH =
+
+# If set to YES the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS = 0
+
+# When you want a differently looking font in the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command. Disabling a call graph can be
+# accomplished by means of the command \hidecallgraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command. Disabling a caller graph can be
+# accomplished by means of the command \hidecallergraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. For an explanation of the image formats see the section
+# output formats in the documentation of the dot tool (Graphviz (see:
+# http://www.graphviz.org/)).
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo,
+# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
+# png:gdiplus:gdiplus.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS =
+
+# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
+# path where java can find the plantuml.jar file. If left blank, it is assumed
+# PlantUML is not used or called during a preprocessing step. Doxygen will
+# generate a warning when it encounters a \startuml command in this case and
+# will not generate output for the diagram.
+
+PLANTUML_JAR_PATH =
+
+# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
+# configuration file for plantuml.
+
+PLANTUML_CFG_FILE =
+
+# When using plantuml, the specified paths are searched for files specified by
+# the !include statement in a plantuml block.
+
+PLANTUML_INCLUDE_PATH =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP = YES
diff --git a/deps/inja/doc/logo-doxygen.jpg b/deps/inja/doc/logo-doxygen.jpg
new file mode 100644
index 0000000..e318fbe
--- /dev/null
+++ b/deps/inja/doc/logo-doxygen.jpg
Binary files differ
diff --git a/deps/inja/doc/logo.jpg b/deps/inja/doc/logo.jpg
new file mode 100644
index 0000000..4181d4d
--- /dev/null
+++ b/deps/inja/doc/logo.jpg
Binary files differ
diff --git a/deps/inja/doc/logo.svg b/deps/inja/doc/logo.svg
new file mode 100644
index 0000000..7960a18
--- /dev/null
+++ b/deps/inja/doc/logo.svg
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Created with Inkpad (http://inkpad.envoza.com/) --><svg height="116pt" viewBox="0,0,468,116" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="468pt" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" xmlns:inkpad="http://inkpad.envoza.com/svg_extensions">
+<metadata>
+</metadata>
+<g id="IMG_0071" inkscape:label="IMG_0071" inkscape:groupmode="layer" inkpad:layerName="IMG_0071">
+<use opacity="1" xlink:href="#Image" transform="matrix(1 0 0 1 0 0)"/>
+</g>
+<g id="Ebene 1" inkscape:label="Ebene 1" inkscape:groupmode="layer" inkpad:layerName="Ebene 1">
+<path stroke="#323e28" stroke-width="1.5" d="M147.778+25.1548C144.409+25.1548+141.976+24.509+140.478+23.2175C138.981+21.926+138.232+20.1011+138.232+17.7427C138.232+15.272+139.187+13.2411+141.096+11.6501C143.005+10.0592+145.719+9.26367+149.238+9.26367C152.832+9.26367+155.377+9.94686+156.875+11.3132C158.372+12.6796+159.121+14.4671+159.121+16.6758C159.121+19.109+158.222+21.1305+156.426+22.7402C154.629+24.3499+151.746+25.1548+147.778+25.1548ZM158.054+81.3071L164.68+81.3071C165.316+82.5425+165.635+83.9276+165.635+85.4624C165.635+86.7726+165.363+87.6898+164.82+88.2139C164.278+88.738+163.22+89+161.648+89L134.695+89C134.058+87.4277+133.74+85.9491+133.74+84.564C133.74+83.4035+134.002+82.5706+134.526+82.0652C135.05+81.5598+135.892+81.3071+137.053+81.3071L141.657+81.3071C141.845+76.5155+141.938+71.4056+141.938+65.9775C141.938+57.7044+141.873+52.2109+141.742+49.4968C141.611+46.7828+141.321+44.7987+140.871+43.5447C140.422+42.2906+139.73+41.5045+138.794+41.1863C137.858+40.8681+136.491+40.709+134.695+40.709C134.058+39.6608+133.74+38.4442+133.74+37.0591C133.74+34.9627+134.601+33.6712+136.323+33.1846C138.045+32.6979+141.545+32.4546+146.823+32.4546C150.792+32.4546+153.496+32.6043+154.938+32.9038C156.379+33.2033+157.202+33.7929+157.408+34.6726C157.614+35.5523+157.717+36.7783+157.717+38.3506L157.717+65.9775C157.754+71.4056+157.867+76.5155+158.054+81.3071Z" fill="#354e13" stroke-linecap="round" opacity="1" stroke-linejoin="round"/>
+<path stroke="#323e28" stroke-width="1.5" d="M191.802+38.9121C195.882+36.3665+199.803+34.5603+203.565+33.4934C207.328+32.4265+210.482+31.8931+213.027+31.8931C218.305+31.8931+222.227+33.0535+224.791+35.3745C227.355+37.6955+228.637+42.3748+228.637+49.4126C228.637+67.8306+228.974+77.7602+229.648+79.2014C230.322+80.6427+231.782+81.3446+234.028+81.3071C234.59+82.6548+234.87+84.0586+234.87+85.5186C234.87+86.8662+234.431+87.7834+233.551+88.27C232.671+88.7567+230.996+89+228.525+89C222.461+89+218.624+88.9064+217.014+88.7192C215.404+88.5321+214.3+87.9237+213.701+86.8943C213.102+85.8648+212.802+84.1335+212.802+81.7002L212.802+61.8784C212.802+54.2417+212.101+49.1225+210.697+46.5208C209.293+43.919+207.019+42.6182+203.874+42.6182C201.216+42.6182+199.12+43.3949+197.585+44.9485C196.05+46.502+195.283+49.7495+195.283+54.6909L195.283+65.9775C195.283+70.6943+195.377+75.8042+195.564+81.3071L202.246+81.3071C202.882+82.5425+203.2+83.9276+203.2+85.4624C203.2+86.7726+202.929+87.6898+202.386+88.2139C201.843+88.738+200.786+89+199.214+89L172.766+89C172.092+87.4277+171.755+85.9491+171.755+84.564C171.755+83.4035+172.017+82.5706+172.541+82.0652C173.065+81.5598+173.908+81.3071+175.068+81.3071L179.167+81.3071C179.354+75.1304+179.448+68.7477+179.448+62.1592C179.448+51.6774+178.952+45.4819+177.96+43.5728C176.968+41.6636+175.237+40.709+172.766+40.709C172.092+39.2116+171.755+37.7142+171.755+36.2168C171.755+34.8691+172.251+33.9894+173.243+33.5776C174.235+33.1659+180.421+32.7915+191.802+32.4546C191.989+34.0269+191.989+36.1794+191.802+38.9121Z" fill="#354e13" stroke-linecap="round" opacity="1" stroke-linejoin="round"/>
+<path stroke="#323e28" stroke-width="1.5" d="M265.698+42.2812C265.698+55.6455+265.735+65.4441+265.81+71.677C265.885+77.9099+265.923+84.2083+265.923+90.5723C265.923+95.888+265.174+100.118+263.677+103.263C262.179+106.407+259.793+108.934+256.517+110.843C253.242+112.752+248.59+113.707+242.563+113.707C238.558+113.707+235.778+113.426+234.225+112.865C232.671+112.303+231.894+110.862+231.894+108.541C231.894+106.07+232.718+103.749+234.365+101.578C240.617+103.45+244.763+104.011+246.803+103.263C248.843+102.514+249.863+97.7598+249.863+89L249.863+65.9775C249.863+57.7044+249.798+52.2202+249.667+49.5249C249.535+46.8296+249.245+44.8455+248.796+43.5728C248.347+42.3+247.617+41.5045+246.606+41.1863C245.595+40.8681+244.267+40.709+242.619+40.709C241.983+39.6608+241.665+38.4442+241.665+37.0591C241.665+35.3371+242.32+34.1392+243.63+33.4653C244.94+32.7915+249.002+32.4546+255.815+32.4546C259.634+32.4546+262.142+32.6418+263.34+33.0161C264.538+33.3905+265.23+34.0924+265.417+35.1218C265.604+36.1513+265.698+38.5378+265.698+42.2812ZM254.748+25.1548C251.379+25.1548+248.946+24.509+247.448+23.2175C245.951+21.926+245.202+20.1011+245.202+17.7427C245.24+15.272+246.204+13.2411+248.094+11.6501C249.985+10.0592+252.689+9.26367+256.208+9.26367C259.802+9.26367+262.348+9.94686+263.845+11.3132C265.342+12.6796+266.091+14.4671+266.091+16.6758C266.091+19.109+265.193+21.1305+263.396+22.7402C261.599+24.3499+258.716+25.1548+254.748+25.1548Z" fill="#354e13" stroke-linecap="round" opacity="1" stroke-linejoin="round"/>
+<path stroke="#323e28" stroke-width="1.5" d="M314.326+84.6763C311.518+86.0988+308.318+87.3622+304.724+88.4666C301.13+89.5709+297.742+90.123+294.56+90.123C289.132+90.123+285.155+88.869+282.628+86.3608C280.101+83.8527+278.838+80.3338+278.838+75.8042C278.838+69.4777+281.009+64.7796+285.351+61.71C289.694+58.6403+296.544+57.1055+305.903+57.1055L312.024+57.1055C311.687+51.3405+310.732+47.4005+309.16+45.2854C307.588+43.1703+305.229+42.1128+302.085+42.1128C300.363+42.1128+298.491+42.3374+296.469+42.7866C295.159+45.2573+294.382+46.5675+294.139+46.7173C293.896+46.867+292.604+47.2039+290.265+47.728C287.925+48.2521+286.268+48.0837+285.295+47.2227C284.322+46.3617+283.339+44.8455+282.347+42.6743C281.355+40.5031+280.859+38.6688+280.859+37.1714C280.859+36.2355+281.243+35.5055+282.01+34.9814C282.778+34.4574+285.613+33.8958+290.517+33.2969C295.421+32.6979+300.643+32.3984+306.184+32.3984C312.772+32.3984+317.938+33.5308+321.682+35.7957C325.425+38.0605+327.297+42.4497+327.297+48.9634L327.297+63.8438C327.297+72.1169+327.653+77.1986+328.364+79.0891C329.075+80.9796+330.348+81.7189+332.182+81.3071C332.744+82.3553+333.025+83.3848+333.025+84.3955C333.025+86.0801+332.023+87.3622+330.021+88.2419C328.018+89.1217+325.313+89.5615+321.906+89.5615C320.409+89.5615+319.23+89.3743+318.369+89C317.508+88.6257+316.16+87.1844+314.326+84.6763ZM312.024+66.0337C309.328+65.4722+306.596+65.1914+303.825+65.1914C300.681+65.1914+298.435+65.7155+297.087+66.7637C295.74+67.8118+295.066+69.7959+295.066+72.7158C295.066+75.2614+295.73+77.1799+297.059+78.4714C298.388+79.7629+300.325+80.4087+302.871+80.4087C304.892+80.4087+306.68+79.9782+308.233+79.1172C309.787+78.2562+310.807+77.0302+311.294+75.4392C311.78+73.8482+312.024+71.7799+312.024+69.2344L312.024+66.0337Z" fill="#354e13" stroke-linecap="round" opacity="1" stroke-linejoin="round"/>
+<path stroke="#608a32" stroke-width="1.5" d="M390.534+54.7471C386.454+52.3512+384.414+48.5703+384.414+43.4043C384.414+37.7891+384.601+32.5295+384.975+27.6255C385.35+22.7215+385.368+19.0997+385.031+16.76C384.695+14.4203+383.534+12.8855+381.55+12.1555C379.566+11.4255+375.018+12.3521+367.905+14.9351C365.846+13.0259+364.817+10.5926+364.817+7.63525C364.817+5.05225+365.603+3.33024+367.175+2.46924C368.747+1.60824+372.285+1.17773+377.788+1.17773C384.264+1.17773+389.131+1.86092+392.387+3.22729C395.644+4.59367+398.031+6.84912+399.547+9.99365C401.063+13.1382+401.821+17.8737+401.821+24.2002L401.821+40.0913C401.821+45.145+402.813+48.7107+404.797+50.7883C406.781+52.866+407.773+54.1762+407.773+54.719C407.773+55.2618+406.781+56.5814+404.797+58.6777C402.813+60.7741+401.821+64.3304+401.821+69.3467L401.821+83.1602C401.821+89.0749+401.063+93.6045+399.547+96.749C398.031+99.8936+395.279+102.598+391.292+104.863C387.306+107.128+382.112+108.26+375.71+108.26C371.592+108.26+368.747+107.83+367.175+106.969C365.603+106.108+364.817+104.386+364.817+101.803C364.817+98.8454+365.846+96.4121+367.905+94.5029C375.018+97.0859+379.566+98.0125+381.55+97.2825C383.534+96.5525+384.695+95.0177+385.031+92.678C385.368+90.3383+385.35+86.7165+384.975+81.8125C384.601+76.9085+384.414+71.6676+384.414+66.0898C384.414+60.8864+386.454+57.1055+390.534+54.7471Z" fill="#88c34d" stroke-linecap="round" opacity="1" stroke-linejoin="round"/>
+<path stroke="#608a32" stroke-width="1.5" d="M446.518+54.7471C442.438+52.3512+440.398+48.5703+440.398+43.4043C440.398+37.7891+440.585+32.5295+440.959+27.6255C441.334+22.7215+441.352+19.0997+441.015+16.76C440.678+14.4203+439.518+12.8855+437.534+12.1555C435.55+11.4255+431.001+12.3521+423.889+14.9351C421.83+13.0259+420.8+10.5926+420.8+7.63525C420.8+5.05225+421.587+3.33024+423.159+2.46924C424.731+1.60824+428.269+1.17773+433.772+1.17773C440.248+1.17773+445.114+1.86092+448.371+3.22729C451.628+4.59367+454.015+6.84912+455.531+9.99365C457.047+13.1382+457.805+17.8737+457.805+24.2002L457.805+40.0913C457.805+45.145+458.797+48.7107+460.781+50.7883C462.765+52.866+463.757+54.1762+463.757+54.719C463.757+55.2618+462.765+56.5814+460.781+58.6777C458.797+60.7741+457.805+64.3304+457.805+69.3467L457.805+83.1602C457.805+89.0749+457.047+93.6045+455.531+96.749C454.015+99.8936+451.263+102.598+447.276+104.863C443.289+107.128+438.095+108.26+431.694+108.26C427.576+108.26+424.731+107.83+423.159+106.969C421.587+106.108+420.8+104.386+420.8+101.803C420.8+98.8454+421.83+96.4121+423.889+94.5029C431.001+97.0859+435.55+98.0125+437.534+97.2825C439.518+96.5525+440.678+95.0177+441.015+92.678C441.352+90.3383+441.334+86.7165+440.959+81.8125C440.585+76.9085+440.398+71.6676+440.398+66.0898C440.398+60.8864+442.438+57.1055+446.518+54.7471Z" fill="#88c34d" stroke-linecap="round" opacity="1" stroke-linejoin="round"/>
+<path stroke="#608a32" stroke-width="1.5" d="M19.8506+54.7471C23.9684+57.1055+26.0273+60.8864+26.0273+66.0898C26.0273+71.6676+25.8402+76.9085+25.4658+81.8125C25.0915+86.7165+25.0727+90.3383+25.4097+92.678C25.7466+95.0177+26.9071+96.5525+28.8911+97.2825C30.8752+98.0125+35.4235+97.0859+42.5361+94.5029C44.5576+96.4121+45.5683+98.8454+45.5683+101.803C45.5683+104.386+44.7916+106.108+43.238+106.969C41.6845+107.83+38.1562+108.26+32.6533+108.26C26.1771+108.26+21.3012+107.577+18.0256+106.211C14.7501+104.844+12.3636+102.589+10.8662+99.4443C9.3688+96.2998+8.62011+91.583+8.62011+85.2939L8.62011+69.3467C8.62011+64.293+7.61872+60.7273+5.61596+58.6497C3.61319+56.572+2.61181+55.2618+2.61181+54.719C2.61181+54.1762+3.61319+52.8566+5.61596+50.7603C7.61872+48.6639+8.62011+45.1076+8.62011+40.0913L8.62011+26.2778C8.62011+20.3631+9.3688+15.8335+10.8662+12.689C12.3636+9.54443+15.1151+6.83976+19.1206+4.57495C23.1261+2.31014+28.3296+1.17773+34.7309+1.17773C38.8488+1.17773+41.6845+1.60824+43.238+2.46924C44.7916+3.33024+45.5683+5.05225+45.5683+7.63525C45.5683+10.5926+44.5576+13.0259+42.5361+14.9351C35.4235+12.3521+30.8752+11.4255+28.8911+12.1555C26.9071+12.8855+25.7466+14.4203+25.4097+16.76C25.0727+19.0997+25.0915+22.7215+25.4658+27.6255C25.8402+32.5295+26.0273+37.7891+26.0273+43.4043C26.0273+48.5703+23.9684+52.3512+19.8506+54.7471Z" fill="#88c34d" stroke-linecap="round" opacity="1" stroke-linejoin="round"/>
+<path stroke="#608a32" stroke-width="1.5" d="M75.8345+54.7471C79.9523+57.1055+82.0112+60.8864+82.0112+66.0898C82.0112+71.6676+81.824+76.9085+81.4497+81.8125C81.0753+86.7165+81.0566+90.3383+81.3935+92.678C81.7305+95.0177+82.8909+96.5525+84.875+97.2825C86.859+98.0125+91.4074+97.0859+98.52+94.5029C100.541+96.4121+101.552+98.8454+101.552+101.803C101.552+104.386+100.775+106.108+99.2219+106.969C97.6684+107.83+94.1401+108.26+88.6372+108.26C82.161+108.26+77.2851+107.577+74.0095+106.211C70.734+104.844+68.3475+102.589+66.8501+99.4443C65.3527+96.2998+64.604+91.583+64.604+85.2939L64.604+69.3467C64.604+64.293+63.6026+60.7273+61.5998+58.6497C59.5971+56.572+58.5957+55.2618+58.5957+54.719C58.5957+54.1762+59.5971+52.8566+61.5998+50.7603C63.6026+48.6639+64.604+45.1076+64.604+40.0913L64.604+26.2778C64.604+20.3631+65.3527+15.8335+66.8501+12.689C68.3475+9.54443+71.0989+6.83976+75.1045+4.57495C79.11+2.31014+84.3135+1.17773+90.7148+1.17773C94.8327+1.17773+97.6684+1.60824+99.2219+2.46924C100.775+3.33024+101.552+5.05225+101.552+7.63525C101.552+10.5926+100.541+13.0259+98.52+14.9351C91.4074+12.3521+86.859+11.4255+84.875+12.1555C82.8909+12.8855+81.7305+14.4203+81.3935+16.76C81.0566+19.0997+81.0753+22.7215+81.4497+27.6255C81.824+32.5295+82.0112+37.7891+82.0112+43.4043C82.0112+48.5703+79.9523+52.3512+75.8345+54.7471Z" fill="#88c34d" stroke-linecap="round" opacity="1" stroke-linejoin="round"/>
+</g>
+</svg>
diff --git a/deps/inja/doc/support.md b/deps/inja/doc/support.md
new file mode 100644
index 0000000..9d4101d
--- /dev/null
+++ b/deps/inja/doc/support.md
@@ -0,0 +1,3 @@
+@page support_page Support
+
+If you have questions or issues regarding the use of doxygen, please use the Github [Issue Tracker](https://github.com/pantor/inja/issues). You can always contribute by helping with programming, testing and filing bug reports, and improving documentation! \ No newline at end of file
diff --git a/deps/inja/include/inja/config.hpp b/deps/inja/include/inja/config.hpp
new file mode 100644
index 0000000..3f284a4
--- /dev/null
+++ b/deps/inja/include/inja/config.hpp
@@ -0,0 +1,76 @@
+// Copyright (c) 2019 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_CONFIG_HPP_
+#define INCLUDE_INJA_CONFIG_HPP_
+
+#include <functional>
+#include <string>
+
+#include "string_view.hpp"
+
+namespace inja {
+
+/*!
+ * \brief Class for lexer configuration.
+ */
+struct LexerConfig {
+ std::string statement_open {"{%"};
+ std::string statement_open_no_lstrip {"{%+"};
+ std::string statement_open_force_lstrip {"{%-"};
+ std::string statement_close {"%}"};
+ std::string statement_close_force_rstrip {"-%}"};
+ std::string line_statement {"##"};
+ std::string expression_open {"{{"};
+ std::string expression_open_force_lstrip {"{{-"};
+ std::string expression_close {"}}"};
+ std::string expression_close_force_rstrip {"-}}"};
+ std::string comment_open {"{#"};
+ std::string comment_close {"#}"};
+ std::string open_chars {"#{"};
+
+ bool trim_blocks {false};
+ bool lstrip_blocks {false};
+
+ void update_open_chars() {
+ open_chars = "";
+ if (open_chars.find(line_statement[0]) == std::string::npos) {
+ open_chars += line_statement[0];
+ }
+ if (open_chars.find(statement_open[0]) == std::string::npos) {
+ open_chars += statement_open[0];
+ }
+ if (open_chars.find(statement_open_no_lstrip[0]) == std::string::npos) {
+ open_chars += statement_open_no_lstrip[0];
+ }
+ if (open_chars.find(statement_open_force_lstrip[0]) == std::string::npos) {
+ open_chars += statement_open_force_lstrip[0];
+ }
+ if (open_chars.find(expression_open[0]) == std::string::npos) {
+ open_chars += expression_open[0];
+ }
+ if (open_chars.find(expression_open_force_lstrip[0]) == std::string::npos) {
+ open_chars += expression_open_force_lstrip[0];
+ }
+ if (open_chars.find(comment_open[0]) == std::string::npos) {
+ open_chars += comment_open[0];
+ }
+ }
+};
+
+/*!
+ * \brief Class for parser configuration.
+ */
+struct ParserConfig {
+ bool search_included_templates_in_files {true};
+};
+
+/*!
+ * \brief Class for render configuration.
+ */
+struct RenderConfig {
+ bool throw_at_missing_includes {true};
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_CONFIG_HPP_
diff --git a/deps/inja/include/inja/environment.hpp b/deps/inja/include/inja/environment.hpp
new file mode 100644
index 0000000..ed99537
--- /dev/null
+++ b/deps/inja/include/inja/environment.hpp
@@ -0,0 +1,228 @@
+// Copyright (c) 2019 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_ENVIRONMENT_HPP_
+#define INCLUDE_INJA_ENVIRONMENT_HPP_
+
+#include <fstream>
+#include <iostream>
+#include <memory>
+#include <sstream>
+#include <string>
+
+#include <nlohmann/json.hpp>
+
+#include "config.hpp"
+#include "function_storage.hpp"
+#include "parser.hpp"
+#include "renderer.hpp"
+#include "string_view.hpp"
+#include "template.hpp"
+#include "utils.hpp"
+
+namespace inja {
+
+using json = nlohmann::json;
+
+/*!
+ * \brief Class for changing the configuration.
+ */
+class Environment {
+ std::string input_path;
+ std::string output_path;
+
+ LexerConfig lexer_config;
+ ParserConfig parser_config;
+ RenderConfig render_config;
+
+ FunctionStorage function_storage;
+ TemplateStorage template_storage;
+
+public:
+ Environment() : Environment("") {}
+
+ explicit Environment(const std::string &global_path) : input_path(global_path), output_path(global_path) {}
+
+ Environment(const std::string &input_path, const std::string &output_path)
+ : input_path(input_path), output_path(output_path) {}
+
+ /// Sets the opener and closer for template statements
+ void set_statement(const std::string &open, const std::string &close) {
+ lexer_config.statement_open = open;
+ lexer_config.statement_open_no_lstrip = open + "+";
+ lexer_config.statement_open_force_lstrip = open + "-";
+ lexer_config.statement_close = close;
+ lexer_config.statement_close_force_rstrip = "-" + close;
+ lexer_config.update_open_chars();
+ }
+
+ /// Sets the opener for template line statements
+ void set_line_statement(const std::string &open) {
+ lexer_config.line_statement = open;
+ lexer_config.update_open_chars();
+ }
+
+ /// Sets the opener and closer for template expressions
+ void set_expression(const std::string &open, const std::string &close) {
+ lexer_config.expression_open = open;
+ lexer_config.expression_open_force_lstrip = open + "-";
+ lexer_config.expression_close = close;
+ lexer_config.expression_close_force_rstrip = "-" + close;
+ lexer_config.update_open_chars();
+ }
+
+ /// Sets the opener and closer for template comments
+ void set_comment(const std::string &open, const std::string &close) {
+ lexer_config.comment_open = open;
+ lexer_config.comment_close = close;
+ lexer_config.update_open_chars();
+ }
+
+ /// Sets whether to remove the first newline after a block
+ void set_trim_blocks(bool trim_blocks) {
+ lexer_config.trim_blocks = trim_blocks;
+ }
+
+ /// Sets whether to strip the spaces and tabs from the start of a line to a block
+ void set_lstrip_blocks(bool lstrip_blocks) {
+ lexer_config.lstrip_blocks = lstrip_blocks;
+ }
+
+ /// Sets the element notation syntax
+ void set_search_included_templates_in_files(bool search_in_files) {
+ parser_config.search_included_templates_in_files = search_in_files;
+ }
+
+ /// Sets whether a missing include will throw an error
+ void set_throw_at_missing_includes(bool will_throw) {
+ render_config.throw_at_missing_includes = will_throw;
+ }
+
+ Template parse(nonstd::string_view input) {
+ Parser parser(parser_config, lexer_config, template_storage, function_storage);
+ return parser.parse(input);
+ }
+
+ Template parse_template(const std::string &filename) {
+ Parser parser(parser_config, lexer_config, template_storage, function_storage);
+ auto result = Template(parser.load_file(input_path + static_cast<std::string>(filename)));
+ parser.parse_into_template(result, input_path + static_cast<std::string>(filename));
+ return result;
+ }
+
+ Template parse_file(const std::string &filename) {
+ return parse_template(filename);
+ }
+
+ std::string render(nonstd::string_view input, const json &data) { return render(parse(input), data); }
+
+ std::string render(const Template &tmpl, const json &data) {
+ std::stringstream os;
+ render_to(os, tmpl, data);
+ return os.str();
+ }
+
+ std::string render_file(const std::string &filename, const json &data) {
+ return render(parse_template(filename), data);
+ }
+
+ std::string render_file_with_json_file(const std::string &filename, const std::string &filename_data) {
+ const json data = load_json(filename_data);
+ return render_file(filename, data);
+ }
+
+ void write(const std::string &filename, const json &data, const std::string &filename_out) {
+ std::ofstream file(output_path + filename_out);
+ file << render_file(filename, data);
+ file.close();
+ }
+
+ void write(const Template &temp, const json &data, const std::string &filename_out) {
+ std::ofstream file(output_path + filename_out);
+ file << render(temp, data);
+ file.close();
+ }
+
+ void write_with_json_file(const std::string &filename, const std::string &filename_data,
+ const std::string &filename_out) {
+ const json data = load_json(filename_data);
+ write(filename, data, filename_out);
+ }
+
+ void write_with_json_file(const Template &temp, const std::string &filename_data, const std::string &filename_out) {
+ const json data = load_json(filename_data);
+ write(temp, data, filename_out);
+ }
+
+ std::ostream &render_to(std::ostream &os, const Template &tmpl, const json &data) {
+ Renderer(render_config, template_storage, function_storage).render_to(os, tmpl, data);
+ return os;
+ }
+
+ std::string load_file(const std::string &filename) {
+ Parser parser(parser_config, lexer_config, template_storage, function_storage);
+ return parser.load_file(input_path + filename);
+ }
+
+ json load_json(const std::string &filename) {
+ std::ifstream file;
+ open_file_or_throw(input_path + filename, file);
+ json j;
+ file >> j;
+ return j;
+ }
+
+ /*!
+ @brief Adds a variadic callback
+ */
+ void add_callback(const std::string &name, const CallbackFunction &callback) {
+ add_callback(name, -1, callback);
+ }
+
+ /*!
+ @brief Adds a variadic void callback
+ */
+ void add_void_callback(const std::string &name, const VoidCallbackFunction &callback) {
+ add_void_callback(name, -1, callback);
+ }
+
+ /*!
+ @brief Adds a callback with given number or arguments
+ */
+ void add_callback(const std::string &name, int num_args, const CallbackFunction &callback) {
+ function_storage.add_callback(name, num_args, callback);
+ }
+
+ /*!
+ @brief Adds a void callback with given number or arguments
+ */
+ void add_void_callback(const std::string &name, int num_args, const VoidCallbackFunction &callback) {
+ function_storage.add_callback(name, num_args, [callback](Arguments& args) { callback(args); return json(); });
+ }
+
+ /** Includes a template with a given name into the environment.
+ * Then, a template can be rendered in another template using the
+ * include "<name>" syntax.
+ */
+ void include_template(const std::string &name, const Template &tmpl) {
+ template_storage[name] = tmpl;
+ }
+};
+
+/*!
+@brief render with default settings to a string
+*/
+inline std::string render(nonstd::string_view input, const json &data) {
+ return Environment().render(input, data);
+}
+
+/*!
+@brief render with default settings to the given output stream
+*/
+inline void render_to(std::ostream &os, nonstd::string_view input, const json &data) {
+ Environment env;
+ env.render_to(os, env.parse(input), data);
+}
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_ENVIRONMENT_HPP_
diff --git a/deps/inja/include/inja/exceptions.hpp b/deps/inja/include/inja/exceptions.hpp
new file mode 100644
index 0000000..2784da8
--- /dev/null
+++ b/deps/inja/include/inja/exceptions.hpp
@@ -0,0 +1,50 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_EXCEPTIONS_HPP_
+#define INCLUDE_INJA_EXCEPTIONS_HPP_
+
+#include <stdexcept>
+#include <string>
+
+namespace inja {
+
+struct SourceLocation {
+ size_t line;
+ size_t column;
+};
+
+struct InjaError : public std::runtime_error {
+ const std::string type;
+ const std::string message;
+
+ const SourceLocation location;
+
+ explicit InjaError(const std::string &type, const std::string &message)
+ : std::runtime_error("[inja.exception." + type + "] " + message), type(type), message(message), location({0, 0}) {}
+
+ explicit InjaError(const std::string &type, const std::string &message, SourceLocation location)
+ : std::runtime_error("[inja.exception." + type + "] (at " + std::to_string(location.line) + ":" +
+ std::to_string(location.column) + ") " + message),
+ type(type), message(message), location(location) {}
+};
+
+struct ParserError : public InjaError {
+ explicit ParserError(const std::string &message, SourceLocation location) : InjaError("parser_error", message, location) {}
+};
+
+struct RenderError : public InjaError {
+ explicit RenderError(const std::string &message, SourceLocation location) : InjaError("render_error", message, location) {}
+};
+
+struct FileError : public InjaError {
+ explicit FileError(const std::string &message) : InjaError("file_error", message) {}
+ explicit FileError(const std::string &message, SourceLocation location) : InjaError("file_error", message, location) {}
+};
+
+struct JsonError : public InjaError {
+ explicit JsonError(const std::string &message, SourceLocation location) : InjaError("json_error", message, location) {}
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_EXCEPTIONS_HPP_
diff --git a/deps/inja/include/inja/function_storage.hpp b/deps/inja/include/inja/function_storage.hpp
new file mode 100644
index 0000000..b0091bd
--- /dev/null
+++ b/deps/inja/include/inja/function_storage.hpp
@@ -0,0 +1,139 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_FUNCTION_STORAGE_HPP_
+#define INCLUDE_INJA_FUNCTION_STORAGE_HPP_
+
+#include <vector>
+
+#include "string_view.hpp"
+
+namespace inja {
+
+using json = nlohmann::json;
+
+using Arguments = std::vector<const json *>;
+using CallbackFunction = std::function<json(Arguments &args)>;
+using VoidCallbackFunction = std::function<void(Arguments &args)>;
+
+/*!
+ * \brief Class for builtin functions and user-defined callbacks.
+ */
+class FunctionStorage {
+public:
+ enum class Operation {
+ Not,
+ And,
+ Or,
+ In,
+ Equal,
+ NotEqual,
+ Greater,
+ GreaterEqual,
+ Less,
+ LessEqual,
+ Add,
+ Subtract,
+ Multiplication,
+ Division,
+ Power,
+ Modulo,
+ AtId,
+ At,
+ Default,
+ DivisibleBy,
+ Even,
+ Exists,
+ ExistsInObject,
+ First,
+ Float,
+ Int,
+ IsArray,
+ IsBoolean,
+ IsFloat,
+ IsInteger,
+ IsNumber,
+ IsObject,
+ IsString,
+ Last,
+ Length,
+ Lower,
+ Max,
+ Min,
+ Odd,
+ Range,
+ Round,
+ Sort,
+ Upper,
+ Callback,
+ ParenLeft,
+ ParenRight,
+ None,
+ };
+
+ struct FunctionData {
+ explicit FunctionData(const Operation &op, const CallbackFunction &cb = CallbackFunction{}) : operation(op), callback(cb) {}
+ const Operation operation;
+ const CallbackFunction callback;
+ };
+
+private:
+ const int VARIADIC {-1};
+
+ std::map<std::pair<std::string, int>, FunctionData> function_storage = {
+ {std::make_pair("at", 2), FunctionData { Operation::At }},
+ {std::make_pair("default", 2), FunctionData { Operation::Default }},
+ {std::make_pair("divisibleBy", 2), FunctionData { Operation::DivisibleBy }},
+ {std::make_pair("even", 1), FunctionData { Operation::Even }},
+ {std::make_pair("exists", 1), FunctionData { Operation::Exists }},
+ {std::make_pair("existsIn", 2), FunctionData { Operation::ExistsInObject }},
+ {std::make_pair("first", 1), FunctionData { Operation::First }},
+ {std::make_pair("float", 1), FunctionData { Operation::Float }},
+ {std::make_pair("int", 1), FunctionData { Operation::Int }},
+ {std::make_pair("isArray", 1), FunctionData { Operation::IsArray }},
+ {std::make_pair("isBoolean", 1), FunctionData { Operation::IsBoolean }},
+ {std::make_pair("isFloat", 1), FunctionData { Operation::IsFloat }},
+ {std::make_pair("isInteger", 1), FunctionData { Operation::IsInteger }},
+ {std::make_pair("isNumber", 1), FunctionData { Operation::IsNumber }},
+ {std::make_pair("isObject", 1), FunctionData { Operation::IsObject }},
+ {std::make_pair("isString", 1), FunctionData { Operation::IsString }},
+ {std::make_pair("last", 1), FunctionData { Operation::Last }},
+ {std::make_pair("length", 1), FunctionData { Operation::Length }},
+ {std::make_pair("lower", 1), FunctionData { Operation::Lower }},
+ {std::make_pair("max", 1), FunctionData { Operation::Max }},
+ {std::make_pair("min", 1), FunctionData { Operation::Min }},
+ {std::make_pair("odd", 1), FunctionData { Operation::Odd }},
+ {std::make_pair("range", 1), FunctionData { Operation::Range }},
+ {std::make_pair("round", 2), FunctionData { Operation::Round }},
+ {std::make_pair("sort", 1), FunctionData { Operation::Sort }},
+ {std::make_pair("upper", 1), FunctionData { Operation::Upper }},
+ };
+
+public:
+ void add_builtin(nonstd::string_view name, int num_args, Operation op) {
+ function_storage.emplace(std::make_pair(static_cast<std::string>(name), num_args), FunctionData { op });
+ }
+
+ void add_callback(nonstd::string_view name, int num_args, const CallbackFunction &callback) {
+ function_storage.emplace(std::make_pair(static_cast<std::string>(name), num_args), FunctionData { Operation::Callback, callback });
+ }
+
+ FunctionData find_function(nonstd::string_view name, int num_args) const {
+ auto it = function_storage.find(std::make_pair(static_cast<std::string>(name), num_args));
+ if (it != function_storage.end()) {
+ return it->second;
+
+ // Find variadic function
+ } else if (num_args > 0) {
+ it = function_storage.find(std::make_pair(static_cast<std::string>(name), VARIADIC));
+ if (it != function_storage.end()) {
+ return it->second;
+ }
+ }
+
+ return FunctionData { Operation::None };
+ }
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_FUNCTION_STORAGE_HPP_
diff --git a/deps/inja/include/inja/inja.hpp b/deps/inja/include/inja/inja.hpp
new file mode 100644
index 0000000..86b8a0a
--- /dev/null
+++ b/deps/inja/include/inja/inja.hpp
@@ -0,0 +1,22 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_INJA_HPP_
+#define INCLUDE_INJA_INJA_HPP_
+
+#include <nlohmann/json.hpp>
+
+#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(INJA_NOEXCEPTION)
+ #define INJA_THROW(exception) throw exception
+#else
+ #include <cstdlib>
+ #define INJA_THROW(exception) std::abort()
+#endif
+
+#include "environment.hpp"
+#include "exceptions.hpp"
+#include "parser.hpp"
+#include "renderer.hpp"
+#include "string_view.hpp"
+#include "template.hpp"
+
+#endif // INCLUDE_INJA_INJA_HPP_
diff --git a/deps/inja/include/inja/lexer.hpp b/deps/inja/include/inja/lexer.hpp
new file mode 100644
index 0000000..e31c3d6
--- /dev/null
+++ b/deps/inja/include/inja/lexer.hpp
@@ -0,0 +1,420 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_LEXER_HPP_
+#define INCLUDE_INJA_LEXER_HPP_
+
+#include <cctype>
+#include <locale>
+
+#include "config.hpp"
+#include "token.hpp"
+#include "utils.hpp"
+
+namespace inja {
+
+/*!
+ * \brief Class for lexing an inja Template.
+ */
+class Lexer {
+ enum class State {
+ Text,
+ ExpressionStart,
+ ExpressionStartForceLstrip,
+ ExpressionBody,
+ LineStart,
+ LineBody,
+ StatementStart,
+ StatementStartNoLstrip,
+ StatementStartForceLstrip,
+ StatementBody,
+ CommentStart,
+ CommentBody,
+ };
+
+ enum class MinusState {
+ Operator,
+ Number,
+ };
+
+ const LexerConfig &config;
+
+ State state;
+ MinusState minus_state;
+ nonstd::string_view m_in;
+ size_t tok_start;
+ size_t pos;
+
+
+ Token scan_body(nonstd::string_view close, Token::Kind closeKind, nonstd::string_view close_trim = nonstd::string_view(), bool trim = false) {
+ again:
+ // skip whitespace (except for \n as it might be a close)
+ if (tok_start >= m_in.size()) {
+ return make_token(Token::Kind::Eof);
+ }
+ char ch = m_in[tok_start];
+ if (ch == ' ' || ch == '\t' || ch == '\r') {
+ tok_start += 1;
+ goto again;
+ }
+
+ // check for close
+ if (!close_trim.empty() && inja::string_view::starts_with(m_in.substr(tok_start), close_trim)) {
+ state = State::Text;
+ pos = tok_start + close_trim.size();
+ Token tok = make_token(closeKind);
+ skip_whitespaces_and_newlines();
+ return tok;
+ }
+
+ if (inja::string_view::starts_with(m_in.substr(tok_start), close)) {
+ state = State::Text;
+ pos = tok_start + close.size();
+ Token tok = make_token(closeKind);
+ if (trim) {
+ skip_whitespaces_and_first_newline();
+ }
+ return tok;
+ }
+
+ // skip \n
+ if (ch == '\n') {
+ tok_start += 1;
+ goto again;
+ }
+
+ pos = tok_start + 1;
+ if (std::isalpha(ch)) {
+ minus_state = MinusState::Operator;
+ return scan_id();
+ }
+
+ MinusState current_minus_state = minus_state;
+ if (minus_state == MinusState::Operator) {
+ minus_state = MinusState::Number;
+ }
+
+ switch (ch) {
+ case '+':
+ return make_token(Token::Kind::Plus);
+ case '-':
+ if (current_minus_state == MinusState::Operator) {
+ return make_token(Token::Kind::Minus);
+ }
+ return scan_number();
+ case '*':
+ return make_token(Token::Kind::Times);
+ case '/':
+ return make_token(Token::Kind::Slash);
+ case '^':
+ return make_token(Token::Kind::Power);
+ case '%':
+ return make_token(Token::Kind::Percent);
+ case '.':
+ return make_token(Token::Kind::Dot);
+ case ',':
+ return make_token(Token::Kind::Comma);
+ case ':':
+ return make_token(Token::Kind::Colon);
+ case '(':
+ return make_token(Token::Kind::LeftParen);
+ case ')':
+ minus_state = MinusState::Operator;
+ return make_token(Token::Kind::RightParen);
+ case '[':
+ return make_token(Token::Kind::LeftBracket);
+ case ']':
+ minus_state = MinusState::Operator;
+ return make_token(Token::Kind::RightBracket);
+ case '{':
+ return make_token(Token::Kind::LeftBrace);
+ case '}':
+ minus_state = MinusState::Operator;
+ return make_token(Token::Kind::RightBrace);
+ case '>':
+ if (pos < m_in.size() && m_in[pos] == '=') {
+ pos += 1;
+ return make_token(Token::Kind::GreaterEqual);
+ }
+ return make_token(Token::Kind::GreaterThan);
+ case '<':
+ if (pos < m_in.size() && m_in[pos] == '=') {
+ pos += 1;
+ return make_token(Token::Kind::LessEqual);
+ }
+ return make_token(Token::Kind::LessThan);
+ case '=':
+ if (pos < m_in.size() && m_in[pos] == '=') {
+ pos += 1;
+ return make_token(Token::Kind::Equal);
+ }
+ return make_token(Token::Kind::Unknown);
+ case '!':
+ if (pos < m_in.size() && m_in[pos] == '=') {
+ pos += 1;
+ return make_token(Token::Kind::NotEqual);
+ }
+ return make_token(Token::Kind::Unknown);
+ case '\"':
+ return scan_string();
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ minus_state = MinusState::Operator;
+ return scan_number();
+ case '_':
+ case '@':
+ case '$':
+ minus_state = MinusState::Operator;
+ return scan_id();
+ default:
+ return make_token(Token::Kind::Unknown);
+ }
+ }
+
+ Token scan_id() {
+ for (;;) {
+ if (pos >= m_in.size()) {
+ break;
+ }
+ char ch = m_in[pos];
+ if (!std::isalnum(ch) && ch != '.' && ch != '/' && ch != '_' && ch != '-') {
+ break;
+ }
+ pos += 1;
+ }
+ return make_token(Token::Kind::Id);
+ }
+
+ Token scan_number() {
+ for (;;) {
+ if (pos >= m_in.size()) {
+ break;
+ }
+ char ch = m_in[pos];
+ // be very permissive in lexer (we'll catch errors when conversion happens)
+ if (!std::isdigit(ch) && ch != '.' && ch != 'e' && ch != 'E' && ch != '+' && ch != '-') {
+ break;
+ }
+ pos += 1;
+ }
+ return make_token(Token::Kind::Number);
+ }
+
+ Token scan_string() {
+ bool escape {false};
+ for (;;) {
+ if (pos >= m_in.size()) {
+ break;
+ }
+ char ch = m_in[pos++];
+ if (ch == '\\') {
+ escape = true;
+ } else if (!escape && ch == m_in[tok_start]) {
+ break;
+ } else {
+ escape = false;
+ }
+ }
+ return make_token(Token::Kind::String);
+ }
+
+ Token make_token(Token::Kind kind) const { return Token(kind, string_view::slice(m_in, tok_start, pos)); }
+
+ void skip_whitespaces_and_newlines() {
+ if (pos < m_in.size()) {
+ while (pos < m_in.size() && (m_in[pos] == ' ' || m_in[pos] == '\t' || m_in[pos] == '\n' || m_in[pos] == '\r')) {
+ pos += 1;
+ }
+ }
+ }
+
+ void skip_whitespaces_and_first_newline() {
+ if (pos < m_in.size()) {
+ while (pos < m_in.size() && (m_in[pos] == ' ' || m_in[pos] == '\t')) {
+ pos += 1;
+ }
+ }
+
+ if (pos < m_in.size()) {
+ char ch = m_in[pos];
+ if (ch == '\n') {
+ pos += 1;
+ } else if (ch == '\r') {
+ pos += 1;
+ if (pos < m_in.size() && m_in[pos] == '\n') {
+ pos += 1;
+ }
+ }
+ }
+ }
+
+ static nonstd::string_view clear_final_line_if_whitespace(nonstd::string_view text) {
+ nonstd::string_view result = text;
+ while (!result.empty()) {
+ char ch = result.back();
+ if (ch == ' ' || ch == '\t') {
+ result.remove_suffix(1);
+ } else if (ch == '\n' || ch == '\r') {
+ break;
+ } else {
+ return text;
+ }
+ }
+ return result;
+ }
+
+public:
+ explicit Lexer(const LexerConfig &config) : config(config), state(State::Text), minus_state(MinusState::Number) {}
+
+ SourceLocation current_position() const {
+ return get_source_location(m_in, tok_start);
+ }
+
+ void start(nonstd::string_view input) {
+ m_in = input;
+ tok_start = 0;
+ pos = 0;
+ state = State::Text;
+ minus_state = MinusState::Number;
+
+ // Consume byte order mark (BOM) for UTF-8
+ if (inja::string_view::starts_with(m_in, "\xEF\xBB\xBF")) {
+ m_in = m_in.substr(3);
+ }
+ }
+
+ Token scan() {
+ tok_start = pos;
+
+ again:
+ if (tok_start >= m_in.size()) {
+ return make_token(Token::Kind::Eof);
+ }
+
+ switch (state) {
+ default:
+ case State::Text: {
+ // fast-scan to first open character
+ size_t open_start = m_in.substr(pos).find_first_of(config.open_chars);
+ if (open_start == nonstd::string_view::npos) {
+ // didn't find open, return remaining text as text token
+ pos = m_in.size();
+ return make_token(Token::Kind::Text);
+ }
+ pos += open_start;
+
+ // try to match one of the opening sequences, and get the close
+ nonstd::string_view open_str = m_in.substr(pos);
+ bool must_lstrip = false;
+ if (inja::string_view::starts_with(open_str, config.expression_open)) {
+ if (inja::string_view::starts_with(open_str, config.expression_open_force_lstrip)) {
+ state = State::ExpressionStartForceLstrip;
+ must_lstrip = true;
+ } else {
+ state = State::ExpressionStart;
+ }
+ } else if (inja::string_view::starts_with(open_str, config.statement_open)) {
+ if (inja::string_view::starts_with(open_str, config.statement_open_no_lstrip)) {
+ state = State::StatementStartNoLstrip;
+ } else if (inja::string_view::starts_with(open_str, config.statement_open_force_lstrip )) {
+ state = State::StatementStartForceLstrip;
+ must_lstrip = true;
+ } else {
+ state = State::StatementStart;
+ must_lstrip = config.lstrip_blocks;
+ }
+ } else if (inja::string_view::starts_with(open_str, config.comment_open)) {
+ state = State::CommentStart;
+ must_lstrip = config.lstrip_blocks;
+ } else if ((pos == 0 || m_in[pos - 1] == '\n') && inja::string_view::starts_with(open_str, config.line_statement)) {
+ state = State::LineStart;
+ } else {
+ pos += 1; // wasn't actually an opening sequence
+ goto again;
+ }
+
+ nonstd::string_view text = string_view::slice(m_in, tok_start, pos);
+ if (must_lstrip) {
+ text = clear_final_line_if_whitespace(text);
+ }
+
+ if (text.empty()) {
+ goto again; // don't generate empty token
+ }
+ return Token(Token::Kind::Text, text);
+ }
+ case State::ExpressionStart: {
+ state = State::ExpressionBody;
+ pos += config.expression_open.size();
+ return make_token(Token::Kind::ExpressionOpen);
+ }
+ case State::ExpressionStartForceLstrip: {
+ state = State::ExpressionBody;
+ pos += config.expression_open_force_lstrip.size();
+ return make_token(Token::Kind::ExpressionOpen);
+ }
+ case State::LineStart: {
+ state = State::LineBody;
+ pos += config.line_statement.size();
+ return make_token(Token::Kind::LineStatementOpen);
+ }
+ case State::StatementStart: {
+ state = State::StatementBody;
+ pos += config.statement_open.size();
+ return make_token(Token::Kind::StatementOpen);
+ }
+ case State::StatementStartNoLstrip: {
+ state = State::StatementBody;
+ pos += config.statement_open_no_lstrip.size();
+ return make_token(Token::Kind::StatementOpen);
+ }
+ case State::StatementStartForceLstrip: {
+ state = State::StatementBody;
+ pos += config.statement_open_force_lstrip.size();
+ return make_token(Token::Kind::StatementOpen);
+ }
+ case State::CommentStart: {
+ state = State::CommentBody;
+ pos += config.comment_open.size();
+ return make_token(Token::Kind::CommentOpen);
+ }
+ case State::ExpressionBody:
+ return scan_body(config.expression_close, Token::Kind::ExpressionClose, config.expression_close_force_rstrip);
+ case State::LineBody:
+ return scan_body("\n", Token::Kind::LineStatementClose);
+ case State::StatementBody:
+ return scan_body(config.statement_close, Token::Kind::StatementClose, config.statement_close_force_rstrip, config.trim_blocks);
+ case State::CommentBody: {
+ // fast-scan to comment close
+ size_t end = m_in.substr(pos).find(config.comment_close);
+ if (end == nonstd::string_view::npos) {
+ pos = m_in.size();
+ return make_token(Token::Kind::Eof);
+ }
+ // return the entire comment in the close token
+ state = State::Text;
+ pos += end + config.comment_close.size();
+ Token tok = make_token(Token::Kind::CommentClose);
+ if (config.trim_blocks) {
+ skip_whitespaces_and_first_newline();
+ }
+ return tok;
+ }
+ }
+ }
+
+ const LexerConfig &get_config() const {
+ return config;
+ }
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_LEXER_HPP_
diff --git a/deps/inja/include/inja/node.hpp b/deps/inja/include/inja/node.hpp
new file mode 100644
index 0000000..84a8b8a
--- /dev/null
+++ b/deps/inja/include/inja/node.hpp
@@ -0,0 +1,328 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_NODE_HPP_
+#define INCLUDE_INJA_NODE_HPP_
+
+#include <string>
+#include <utility>
+
+#include <nlohmann/json.hpp>
+
+#include "function_storage.hpp"
+#include "string_view.hpp"
+
+
+namespace inja {
+
+class NodeVisitor;
+class BlockNode;
+class TextNode;
+class ExpressionNode;
+class LiteralNode;
+class JsonNode;
+class FunctionNode;
+class ExpressionListNode;
+class StatementNode;
+class ForStatementNode;
+class ForArrayStatementNode;
+class ForObjectStatementNode;
+class IfStatementNode;
+class IncludeStatementNode;
+class SetStatementNode;
+
+
+class NodeVisitor {
+public:
+ virtual void visit(const BlockNode& node) = 0;
+ virtual void visit(const TextNode& node) = 0;
+ virtual void visit(const ExpressionNode& node) = 0;
+ virtual void visit(const LiteralNode& node) = 0;
+ virtual void visit(const JsonNode& node) = 0;
+ virtual void visit(const FunctionNode& node) = 0;
+ virtual void visit(const ExpressionListNode& node) = 0;
+ virtual void visit(const StatementNode& node) = 0;
+ virtual void visit(const ForStatementNode& node) = 0;
+ virtual void visit(const ForArrayStatementNode& node) = 0;
+ virtual void visit(const ForObjectStatementNode& node) = 0;
+ virtual void visit(const IfStatementNode& node) = 0;
+ virtual void visit(const IncludeStatementNode& node) = 0;
+ virtual void visit(const SetStatementNode& node) = 0;
+};
+
+/*!
+ * \brief Base node class for the abstract syntax tree (AST).
+ */
+class AstNode {
+public:
+ virtual void accept(NodeVisitor& v) const = 0;
+
+ size_t pos;
+
+ AstNode(size_t pos) : pos(pos) { }
+ virtual ~AstNode() { };
+};
+
+
+class BlockNode : public AstNode {
+public:
+ std::vector<std::shared_ptr<AstNode>> nodes;
+
+ explicit BlockNode() : AstNode(0) {}
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class TextNode : public AstNode {
+public:
+ const size_t length;
+
+ explicit TextNode(size_t pos, size_t length): AstNode(pos), length(length) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class ExpressionNode : public AstNode {
+public:
+ explicit ExpressionNode(size_t pos) : AstNode(pos) {}
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class LiteralNode : public ExpressionNode {
+public:
+ const nlohmann::json value;
+
+ explicit LiteralNode(const nlohmann::json& value, size_t pos) : ExpressionNode(pos), value(value) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class JsonNode : public ExpressionNode {
+public:
+ const std::string name;
+ const json::json_pointer ptr;
+
+ static std::string convert_dot_to_json_ptr(nonstd::string_view ptr_name) {
+ std::string result;
+ do {
+ nonstd::string_view part;
+ std::tie(part, ptr_name) = string_view::split(ptr_name, '.');
+ result.push_back('/');
+ result.append(part.begin(), part.end());
+ } while (!ptr_name.empty());
+ return result;
+ }
+
+ explicit JsonNode(nonstd::string_view ptr_name, size_t pos) : ExpressionNode(pos), name(ptr_name), ptr(json::json_pointer(convert_dot_to_json_ptr(ptr_name))) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class FunctionNode : public ExpressionNode {
+ using Op = FunctionStorage::Operation;
+
+public:
+ enum class Associativity {
+ Left,
+ Right,
+ };
+
+ unsigned int precedence;
+ Associativity associativity;
+
+ Op operation;
+
+ std::string name;
+ int number_args; // Should also be negative -> -1 for unknown number
+ CallbackFunction callback;
+
+ explicit FunctionNode(nonstd::string_view name, size_t pos) : ExpressionNode(pos), precedence(8), associativity(Associativity::Left), operation(Op::Callback), name(name), number_args(1) { }
+ explicit FunctionNode(Op operation, size_t pos) : ExpressionNode(pos), operation(operation), number_args(1) {
+ switch (operation) {
+ case Op::Not: {
+ precedence = 4;
+ associativity = Associativity::Left;
+ } break;
+ case Op::And: {
+ precedence = 1;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Or: {
+ precedence = 1;
+ associativity = Associativity::Left;
+ } break;
+ case Op::In: {
+ precedence = 2;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Equal: {
+ precedence = 2;
+ associativity = Associativity::Left;
+ } break;
+ case Op::NotEqual: {
+ precedence = 2;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Greater: {
+ precedence = 2;
+ associativity = Associativity::Left;
+ } break;
+ case Op::GreaterEqual: {
+ precedence = 2;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Less: {
+ precedence = 2;
+ associativity = Associativity::Left;
+ } break;
+ case Op::LessEqual: {
+ precedence = 2;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Add: {
+ precedence = 3;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Subtract: {
+ precedence = 3;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Multiplication: {
+ precedence = 4;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Division: {
+ precedence = 4;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Power: {
+ precedence = 5;
+ associativity = Associativity::Right;
+ } break;
+ case Op::Modulo: {
+ precedence = 4;
+ associativity = Associativity::Left;
+ } break;
+ case Op::AtId: {
+ precedence = 8;
+ associativity = Associativity::Left;
+ } break;
+ default: {
+ precedence = 1;
+ associativity = Associativity::Left;
+ }
+ }
+ }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class ExpressionListNode : public AstNode {
+public:
+ std::vector<std::shared_ptr<ExpressionNode>> rpn_output;
+
+ explicit ExpressionListNode() : AstNode(0) { }
+ explicit ExpressionListNode(size_t pos) : AstNode(pos) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class StatementNode : public AstNode {
+public:
+ StatementNode(size_t pos) : AstNode(pos) { }
+
+ virtual void accept(NodeVisitor& v) const = 0;
+};
+
+class ForStatementNode : public StatementNode {
+public:
+ ExpressionListNode condition;
+ BlockNode body;
+ BlockNode *const parent;
+
+ ForStatementNode(BlockNode *const parent, size_t pos) : StatementNode(pos), parent(parent) { }
+
+ virtual void accept(NodeVisitor& v) const = 0;
+};
+
+class ForArrayStatementNode : public ForStatementNode {
+public:
+ const std::string value;
+
+ explicit ForArrayStatementNode(const std::string& value, BlockNode *const parent, size_t pos) : ForStatementNode(parent, pos), value(value) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class ForObjectStatementNode : public ForStatementNode {
+public:
+ const std::string key;
+ const std::string value;
+
+ explicit ForObjectStatementNode(const std::string& key, const std::string& value, BlockNode *const parent, size_t pos) : ForStatementNode(parent, pos), key(key), value(value) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class IfStatementNode : public StatementNode {
+public:
+ ExpressionListNode condition;
+ BlockNode true_statement;
+ BlockNode false_statement;
+ BlockNode *const parent;
+
+ const bool is_nested;
+ bool has_false_statement {false};
+
+ explicit IfStatementNode(BlockNode *const parent, size_t pos) : StatementNode(pos), parent(parent), is_nested(false) { }
+ explicit IfStatementNode(bool is_nested, BlockNode *const parent, size_t pos) : StatementNode(pos), parent(parent), is_nested(is_nested) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class IncludeStatementNode : public StatementNode {
+public:
+ const std::string file;
+
+ explicit IncludeStatementNode(const std::string& file, size_t pos) : StatementNode(pos), file(file) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ };
+};
+
+class SetStatementNode : public StatementNode {
+public:
+ const std::string key;
+ ExpressionListNode expression;
+
+ explicit SetStatementNode(const std::string& key, size_t pos) : StatementNode(pos), key(key) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ };
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_NODE_HPP_
diff --git a/deps/inja/include/inja/parser.hpp b/deps/inja/include/inja/parser.hpp
new file mode 100644
index 0000000..6266c4a
--- /dev/null
+++ b/deps/inja/include/inja/parser.hpp
@@ -0,0 +1,582 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_PARSER_HPP_
+#define INCLUDE_INJA_PARSER_HPP_
+
+#include <limits>
+#include <stack>
+#include <string>
+#include <utility>
+#include <queue>
+#include <vector>
+
+#include "config.hpp"
+#include "exceptions.hpp"
+#include "function_storage.hpp"
+#include "lexer.hpp"
+#include "node.hpp"
+#include "template.hpp"
+#include "token.hpp"
+#include "utils.hpp"
+
+#include <nlohmann/json.hpp>
+
+namespace inja {
+
+/*!
+ * \brief Class for parsing an inja Template.
+ */
+class Parser {
+ const ParserConfig &config;
+
+ Lexer lexer;
+ TemplateStorage &template_storage;
+ const FunctionStorage &function_storage;
+
+ Token tok, peek_tok;
+ bool have_peek_tok {false};
+
+ size_t current_paren_level {0};
+ size_t current_bracket_level {0};
+ size_t current_brace_level {0};
+
+ nonstd::string_view json_literal_start;
+
+ BlockNode *current_block {nullptr};
+ ExpressionListNode *current_expression_list {nullptr};
+ std::stack<std::pair<FunctionNode*, size_t>> function_stack;
+
+ std::stack<std::shared_ptr<FunctionNode>> operator_stack;
+ std::stack<IfStatementNode*> if_statement_stack;
+ std::stack<ForStatementNode*> for_statement_stack;
+
+ void throw_parser_error(const std::string &message) {
+ INJA_THROW(ParserError(message, lexer.current_position()));
+ }
+
+ void get_next_token() {
+ if (have_peek_tok) {
+ tok = peek_tok;
+ have_peek_tok = false;
+ } else {
+ tok = lexer.scan();
+ }
+ }
+
+ void get_peek_token() {
+ if (!have_peek_tok) {
+ peek_tok = lexer.scan();
+ have_peek_tok = true;
+ }
+ }
+
+ void add_json_literal(const char* content_ptr) {
+ nonstd::string_view json_text(json_literal_start.data(), tok.text.data() - json_literal_start.data() + tok.text.size());
+ current_expression_list->rpn_output.emplace_back(std::make_shared<LiteralNode>(json::parse(json_text), json_text.data() - content_ptr));
+ }
+
+ bool parse_expression(Template &tmpl, Token::Kind closing) {
+ while (tok.kind != closing && tok.kind != Token::Kind::Eof) {
+ // Literals
+ switch (tok.kind) {
+ case Token::Kind::String: {
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ json_literal_start = tok.text;
+ add_json_literal(tmpl.content.c_str());
+ }
+
+ } break;
+ case Token::Kind::Number: {
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ json_literal_start = tok.text;
+ add_json_literal(tmpl.content.c_str());
+ }
+
+ } break;
+ case Token::Kind::LeftBracket: {
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ json_literal_start = tok.text;
+ }
+ current_bracket_level += 1;
+
+ } break;
+ case Token::Kind::LeftBrace: {
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ json_literal_start = tok.text;
+ }
+ current_brace_level += 1;
+
+ } break;
+ case Token::Kind::RightBracket: {
+ if (current_bracket_level == 0) {
+ throw_parser_error("unexpected ']'");
+ }
+
+ current_bracket_level -= 1;
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ add_json_literal(tmpl.content.c_str());
+ }
+
+ } break;
+ case Token::Kind::RightBrace: {
+ if (current_brace_level == 0) {
+ throw_parser_error("unexpected '}'");
+ }
+
+ current_brace_level -= 1;
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ add_json_literal(tmpl.content.c_str());
+ }
+
+ } break;
+ case Token::Kind::Id: {
+ get_peek_token();
+
+ // Json Literal
+ if (tok.text == static_cast<decltype(tok.text)>("true") || tok.text == static_cast<decltype(tok.text)>("false") || tok.text == static_cast<decltype(tok.text)>("null")) {
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ json_literal_start = tok.text;
+ add_json_literal(tmpl.content.c_str());
+ }
+
+ // Operator
+ } else if (tok.text == "and" || tok.text == "or" || tok.text == "in" || tok.text == "not") {
+ goto parse_operator;
+
+ // Functions
+ } else if (peek_tok.kind == Token::Kind::LeftParen) {
+ operator_stack.emplace(std::make_shared<FunctionNode>(static_cast<std::string>(tok.text), tok.text.data() - tmpl.content.c_str()));
+ function_stack.emplace(operator_stack.top().get(), current_paren_level);
+
+ // Variables
+ } else {
+ current_expression_list->rpn_output.emplace_back(std::make_shared<JsonNode>(static_cast<std::string>(tok.text), tok.text.data() - tmpl.content.c_str()));
+ }
+
+ // Operators
+ } break;
+ case Token::Kind::Equal:
+ case Token::Kind::NotEqual:
+ case Token::Kind::GreaterThan:
+ case Token::Kind::GreaterEqual:
+ case Token::Kind::LessThan:
+ case Token::Kind::LessEqual:
+ case Token::Kind::Plus:
+ case Token::Kind::Minus:
+ case Token::Kind::Times:
+ case Token::Kind::Slash:
+ case Token::Kind::Power:
+ case Token::Kind::Percent:
+ case Token::Kind::Dot: {
+
+ parse_operator:
+ FunctionStorage::Operation operation;
+ switch (tok.kind) {
+ case Token::Kind::Id: {
+ if (tok.text == "and") {
+ operation = FunctionStorage::Operation::And;
+ } else if (tok.text == "or") {
+ operation = FunctionStorage::Operation::Or;
+ } else if (tok.text == "in") {
+ operation = FunctionStorage::Operation::In;
+ } else if (tok.text == "not") {
+ operation = FunctionStorage::Operation::Not;
+ } else {
+ throw_parser_error("unknown operator in parser.");
+ }
+ } break;
+ case Token::Kind::Equal: {
+ operation = FunctionStorage::Operation::Equal;
+ } break;
+ case Token::Kind::NotEqual: {
+ operation = FunctionStorage::Operation::NotEqual;
+ } break;
+ case Token::Kind::GreaterThan: {
+ operation = FunctionStorage::Operation::Greater;
+ } break;
+ case Token::Kind::GreaterEqual: {
+ operation = FunctionStorage::Operation::GreaterEqual;
+ } break;
+ case Token::Kind::LessThan: {
+ operation = FunctionStorage::Operation::Less;
+ } break;
+ case Token::Kind::LessEqual: {
+ operation = FunctionStorage::Operation::LessEqual;
+ } break;
+ case Token::Kind::Plus: {
+ operation = FunctionStorage::Operation::Add;
+ } break;
+ case Token::Kind::Minus: {
+ operation = FunctionStorage::Operation::Subtract;
+ } break;
+ case Token::Kind::Times: {
+ operation = FunctionStorage::Operation::Multiplication;
+ } break;
+ case Token::Kind::Slash: {
+ operation = FunctionStorage::Operation::Division;
+ } break;
+ case Token::Kind::Power: {
+ operation = FunctionStorage::Operation::Power;
+ } break;
+ case Token::Kind::Percent: {
+ operation = FunctionStorage::Operation::Modulo;
+ } break;
+ case Token::Kind::Dot: {
+ operation = FunctionStorage::Operation::AtId;
+ } break;
+ default: {
+ throw_parser_error("unknown operator in parser.");
+ }
+ }
+ auto function_node = std::make_shared<FunctionNode>(operation, tok.text.data() - tmpl.content.c_str());
+
+ while (!operator_stack.empty() && ((operator_stack.top()->precedence > function_node->precedence) || (operator_stack.top()->precedence == function_node->precedence && function_node->associativity == FunctionNode::Associativity::Left)) && (operator_stack.top()->operation != FunctionStorage::Operation::ParenLeft)) {
+ current_expression_list->rpn_output.emplace_back(operator_stack.top());
+ operator_stack.pop();
+ }
+
+ operator_stack.emplace(function_node);
+
+ } break;
+ case Token::Kind::Comma: {
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ if (function_stack.empty()) {
+ throw_parser_error("unexpected ','");
+ }
+
+ function_stack.top().first->number_args += 1;
+ }
+
+ } break;
+ case Token::Kind::Colon: {
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ throw_parser_error("unexpected ':'");
+ }
+
+ } break;
+ case Token::Kind::LeftParen: {
+ current_paren_level += 1;
+ operator_stack.emplace(std::make_shared<FunctionNode>(FunctionStorage::Operation::ParenLeft, tok.text.data() - tmpl.content.c_str()));
+
+ get_peek_token();
+ if (peek_tok.kind == Token::Kind::RightParen) {
+ if (!function_stack.empty() && function_stack.top().second == current_paren_level - 1) {
+ function_stack.top().first->number_args = 0;
+ }
+ }
+
+ } break;
+ case Token::Kind::RightParen: {
+ current_paren_level -= 1;
+ while (!operator_stack.empty() && operator_stack.top()->operation != FunctionStorage::Operation::ParenLeft) {
+ current_expression_list->rpn_output.emplace_back(operator_stack.top());
+ operator_stack.pop();
+ }
+
+ if (!operator_stack.empty() && operator_stack.top()->operation == FunctionStorage::Operation::ParenLeft) {
+ operator_stack.pop();
+ }
+
+ if (!function_stack.empty() && function_stack.top().second == current_paren_level) {
+ auto func = function_stack.top().first;
+ auto function_data = function_storage.find_function(func->name, func->number_args);
+ if (function_data.operation == FunctionStorage::Operation::None) {
+ throw_parser_error("unknown function " + func->name);
+ }
+ func->operation = function_data.operation;
+ if (function_data.operation == FunctionStorage::Operation::Callback) {
+ func->callback = function_data.callback;
+ }
+
+ if (operator_stack.empty()) {
+ throw_parser_error("internal error at function " + func->name);
+ }
+
+ current_expression_list->rpn_output.emplace_back(operator_stack.top());
+ operator_stack.pop();
+ function_stack.pop();
+ }
+ }
+ default:
+ break;
+ }
+
+ get_next_token();
+ }
+
+ while (!operator_stack.empty()) {
+ current_expression_list->rpn_output.emplace_back(operator_stack.top());
+ operator_stack.pop();
+ }
+
+ return true;
+ }
+
+ bool parse_statement(Template &tmpl, Token::Kind closing, nonstd::string_view path) {
+ if (tok.kind != Token::Kind::Id) {
+ return false;
+ }
+
+ if (tok.text == static_cast<decltype(tok.text)>("if")) {
+ get_next_token();
+
+ auto if_statement_node = std::make_shared<IfStatementNode>(current_block, tok.text.data() - tmpl.content.c_str());
+ current_block->nodes.emplace_back(if_statement_node);
+ if_statement_stack.emplace(if_statement_node.get());
+ current_block = &if_statement_node->true_statement;
+ current_expression_list = &if_statement_node->condition;
+
+ if (!parse_expression(tmpl, closing)) {
+ return false;
+ }
+
+ } else if (tok.text == static_cast<decltype(tok.text)>("else")) {
+ if (if_statement_stack.empty()) {
+ throw_parser_error("else without matching if");
+ }
+ auto &if_statement_data = if_statement_stack.top();
+ get_next_token();
+
+ if_statement_data->has_false_statement = true;
+ current_block = &if_statement_data->false_statement;
+
+ // Chained else if
+ if (tok.kind == Token::Kind::Id && tok.text == static_cast<decltype(tok.text)>("if")) {
+ get_next_token();
+
+ auto if_statement_node = std::make_shared<IfStatementNode>(true, current_block, tok.text.data() - tmpl.content.c_str());
+ current_block->nodes.emplace_back(if_statement_node);
+ if_statement_stack.emplace(if_statement_node.get());
+ current_block = &if_statement_node->true_statement;
+ current_expression_list = &if_statement_node->condition;
+
+ if (!parse_expression(tmpl, closing)) {
+ return false;
+ }
+ }
+
+ } else if (tok.text == static_cast<decltype(tok.text)>("endif")) {
+ if (if_statement_stack.empty()) {
+ throw_parser_error("endif without matching if");
+ }
+
+ // Nested if statements
+ while (if_statement_stack.top()->is_nested) {
+ if_statement_stack.pop();
+ }
+
+ auto &if_statement_data = if_statement_stack.top();
+ get_next_token();
+
+ current_block = if_statement_data->parent;
+ if_statement_stack.pop();
+
+ } else if (tok.text == static_cast<decltype(tok.text)>("for")) {
+ get_next_token();
+
+ // options: for a in arr; for a, b in obj
+ if (tok.kind != Token::Kind::Id) {
+ throw_parser_error("expected id, got '" + tok.describe() + "'");
+ }
+
+ Token value_token = tok;
+ get_next_token();
+
+ // Object type
+ std::shared_ptr<ForStatementNode> for_statement_node;
+ if (tok.kind == Token::Kind::Comma) {
+ get_next_token();
+ if (tok.kind != Token::Kind::Id) {
+ throw_parser_error("expected id, got '" + tok.describe() + "'");
+ }
+
+ Token key_token = std::move(value_token);
+ value_token = tok;
+ get_next_token();
+
+ for_statement_node = std::make_shared<ForObjectStatementNode>(static_cast<std::string>(key_token.text), static_cast<std::string>(value_token.text), current_block, tok.text.data() - tmpl.content.c_str());
+
+ // Array type
+ } else {
+ for_statement_node = std::make_shared<ForArrayStatementNode>(static_cast<std::string>(value_token.text), current_block, tok.text.data() - tmpl.content.c_str());
+ }
+
+ current_block->nodes.emplace_back(for_statement_node);
+ for_statement_stack.emplace(for_statement_node.get());
+ current_block = &for_statement_node->body;
+ current_expression_list = &for_statement_node->condition;
+
+ if (tok.kind != Token::Kind::Id || tok.text != static_cast<decltype(tok.text)>("in")) {
+ throw_parser_error("expected 'in', got '" + tok.describe() + "'");
+ }
+ get_next_token();
+
+ if (!parse_expression(tmpl, closing)) {
+ return false;
+ }
+
+ } else if (tok.text == static_cast<decltype(tok.text)>("endfor")) {
+ if (for_statement_stack.empty()) {
+ throw_parser_error("endfor without matching for");
+ }
+
+ auto &for_statement_data = for_statement_stack.top();
+ get_next_token();
+
+ current_block = for_statement_data->parent;
+ for_statement_stack.pop();
+
+ } else if (tok.text == static_cast<decltype(tok.text)>("include")) {
+ get_next_token();
+
+ if (tok.kind != Token::Kind::String) {
+ throw_parser_error("expected string, got '" + tok.describe() + "'");
+ }
+
+ // Build the relative path
+ json json_name = json::parse(tok.text);
+ std::string pathname = static_cast<std::string>(path);
+ pathname += json_name.get_ref<const std::string &>();
+ if (pathname.compare(0, 2, "./") == 0) {
+ pathname.erase(0, 2);
+ }
+ // sys::path::remove_dots(pathname, true, sys::path::Style::posix);
+
+ if (config.search_included_templates_in_files && template_storage.find(pathname) == template_storage.end()) {
+ auto include_template = Template(load_file(pathname));
+ template_storage.emplace(pathname, include_template);
+ parse_into_template(template_storage[pathname], pathname);
+ }
+
+ current_block->nodes.emplace_back(std::make_shared<IncludeStatementNode>(pathname, tok.text.data() - tmpl.content.c_str()));
+
+ get_next_token();
+
+ } else if (tok.text == static_cast<decltype(tok.text)>("set")) {
+ get_next_token();
+
+ if (tok.kind != Token::Kind::Id) {
+ throw_parser_error("expected variable name, got '" + tok.describe() + "'");
+ }
+
+ std::string key = static_cast<std::string>(tok.text);
+ get_next_token();
+
+ auto set_statement_node = std::make_shared<SetStatementNode>(key, tok.text.data() - tmpl.content.c_str());
+ current_block->nodes.emplace_back(set_statement_node);
+ current_expression_list = &set_statement_node->expression;
+
+ if (tok.text != static_cast<decltype(tok.text)>("=")) {
+ throw_parser_error("expected '=', got '" + tok.describe() + "'");
+ }
+ get_next_token();
+
+ if (!parse_expression(tmpl, closing)) {
+ return false;
+ }
+
+ } else {
+ return false;
+ }
+ return true;
+ }
+
+ void parse_into(Template &tmpl, nonstd::string_view path) {
+ lexer.start(tmpl.content);
+ current_block = &tmpl.root;
+
+ for (;;) {
+ get_next_token();
+ switch (tok.kind) {
+ case Token::Kind::Eof: {
+ if (!if_statement_stack.empty()) {
+ throw_parser_error("unmatched if");
+ }
+ if (!for_statement_stack.empty()) {
+ throw_parser_error("unmatched for");
+ }
+ } return;
+ case Token::Kind::Text: {
+ current_block->nodes.emplace_back(std::make_shared<TextNode>(tok.text.data() - tmpl.content.c_str(), tok.text.size()));
+ } break;
+ case Token::Kind::StatementOpen: {
+ get_next_token();
+ if (!parse_statement(tmpl, Token::Kind::StatementClose, path)) {
+ throw_parser_error("expected statement, got '" + tok.describe() + "'");
+ }
+ if (tok.kind != Token::Kind::StatementClose) {
+ throw_parser_error("expected statement close, got '" + tok.describe() + "'");
+ }
+ } break;
+ case Token::Kind::LineStatementOpen: {
+ get_next_token();
+ if (!parse_statement(tmpl, Token::Kind::LineStatementClose, path)) {
+ throw_parser_error("expected statement, got '" + tok.describe() + "'");
+ }
+ if (tok.kind != Token::Kind::LineStatementClose && tok.kind != Token::Kind::Eof) {
+ throw_parser_error("expected line statement close, got '" + tok.describe() + "'");
+ }
+ } break;
+ case Token::Kind::ExpressionOpen: {
+ get_next_token();
+
+ auto expression_list_node = std::make_shared<ExpressionListNode>(tok.text.data() - tmpl.content.c_str());
+ current_block->nodes.emplace_back(expression_list_node);
+ current_expression_list = expression_list_node.get();
+
+ if (!parse_expression(tmpl, Token::Kind::ExpressionClose)) {
+ throw_parser_error("expected expression, got '" + tok.describe() + "'");
+ }
+
+ if (tok.kind != Token::Kind::ExpressionClose) {
+ throw_parser_error("expected expression close, got '" + tok.describe() + "'");
+ }
+ } break;
+ case Token::Kind::CommentOpen: {
+ get_next_token();
+ if (tok.kind != Token::Kind::CommentClose) {
+ throw_parser_error("expected comment close, got '" + tok.describe() + "'");
+ }
+ } break;
+ default: {
+ throw_parser_error("unexpected token '" + tok.describe() + "'");
+ } break;
+ }
+ }
+ }
+
+
+public:
+ explicit Parser(const ParserConfig &parser_config, const LexerConfig &lexer_config,
+ TemplateStorage &template_storage, const FunctionStorage &function_storage)
+ : config(parser_config), lexer(lexer_config), template_storage(template_storage), function_storage(function_storage) { }
+
+ Template parse(nonstd::string_view input, nonstd::string_view path) {
+ auto result = Template(static_cast<std::string>(input));
+ parse_into(result, path);
+ return result;
+ }
+
+ Template parse(nonstd::string_view input) {
+ return parse(input, "./");
+ }
+
+ void parse_into_template(Template& tmpl, nonstd::string_view filename) {
+ nonstd::string_view path = filename.substr(0, filename.find_last_of("/\\") + 1);
+
+ // StringRef path = sys::path::parent_path(filename);
+ auto sub_parser = Parser(config, lexer.get_config(), template_storage, function_storage);
+ sub_parser.parse_into(tmpl, path);
+ }
+
+ std::string load_file(nonstd::string_view filename) {
+ std::ifstream file;
+ open_file_or_throw(static_cast<std::string>(filename), file);
+ std::string text((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
+ return text;
+ }
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_PARSER_HPP_
diff --git a/deps/inja/include/inja/renderer.hpp b/deps/inja/include/inja/renderer.hpp
new file mode 100644
index 0000000..7bc518f
--- /dev/null
+++ b/deps/inja/include/inja/renderer.hpp
@@ -0,0 +1,611 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_RENDERER_HPP_
+#define INCLUDE_INJA_RENDERER_HPP_
+
+#include <algorithm>
+#include <numeric>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include <nlohmann/json.hpp>
+
+#include "config.hpp"
+#include "exceptions.hpp"
+#include "node.hpp"
+#include "template.hpp"
+#include "utils.hpp"
+
+namespace inja {
+
+/*!
+ * \brief Class for rendering a Template with data.
+ */
+class Renderer : public NodeVisitor {
+ using Op = FunctionStorage::Operation;
+
+ const RenderConfig config;
+ const Template *current_template;
+ const TemplateStorage &template_storage;
+ const FunctionStorage &function_storage;
+
+ const json *json_input;
+ std::ostream *output_stream;
+
+ json json_additional_data;
+ json* current_loop_data = &json_additional_data["loop"];
+
+ std::vector<std::shared_ptr<json>> json_tmp_stack;
+ std::stack<const json*> json_eval_stack;
+ std::stack<const JsonNode*> not_found_stack;
+
+ bool truthy(const json* data) const {
+ if (data->is_boolean()) {
+ return data->get<bool>();
+ } else if (data->is_number()) {
+ return (*data != 0);
+ } else if (data->is_null()) {
+ return false;
+ }
+ return !data->empty();
+ }
+
+ void print_json(const std::shared_ptr<json> value) {
+ if (value->is_string()) {
+ *output_stream << value->get_ref<const json::string_t&>();
+ } else if (value->is_number_integer()) {
+ *output_stream << value->get<const json::number_integer_t>();
+ } else if (value->is_null()) {
+ } else {
+ *output_stream << value->dump();
+ }
+ }
+
+ const std::shared_ptr<json> eval_expression_list(const ExpressionListNode& expression_list) {
+ for (auto& expression : expression_list.rpn_output) {
+ expression->accept(*this);
+ }
+
+ if (json_eval_stack.empty()) {
+ throw_renderer_error("empty expression", expression_list);
+ } else if (json_eval_stack.size() != 1) {
+ throw_renderer_error("malformed expression", expression_list);
+ }
+
+ auto result = json_eval_stack.top();
+ json_eval_stack.pop();
+
+ if (!result) {
+ if (not_found_stack.empty()) {
+ throw_renderer_error("expression could not be evaluated", expression_list);
+ }
+
+ auto node = not_found_stack.top();
+ not_found_stack.pop();
+
+ throw_renderer_error("variable '" + static_cast<std::string>(node->name) + "' not found", *node);
+ }
+ return std::make_shared<json>(*result);
+ }
+
+ void throw_renderer_error(const std::string &message, const AstNode& node) {
+ SourceLocation loc = get_source_location(current_template->content, node.pos);
+ INJA_THROW(RenderError(message, loc));
+ }
+
+ template<size_t N, bool throw_not_found=true>
+ std::array<const json*, N> get_arguments(const AstNode& node) {
+ if (json_eval_stack.size() < N) {
+ throw_renderer_error("function needs " + std::to_string(N) + " variables, but has only found " + std::to_string(json_eval_stack.size()), node);
+ }
+
+ std::array<const json*, N> result;
+ for (size_t i = 0; i < N; i += 1) {
+ result[N - i - 1] = json_eval_stack.top();
+ json_eval_stack.pop();
+
+ if (!result[N - i - 1]) {
+ auto json_node = not_found_stack.top();
+ not_found_stack.pop();
+
+ if (throw_not_found) {
+ throw_renderer_error("variable '" + static_cast<std::string>(json_node->name) + "' not found", *json_node);
+ }
+ }
+ }
+ return result;
+ }
+
+ template<bool throw_not_found=true>
+ Arguments get_argument_vector(size_t N, const AstNode& node) {
+ if (json_eval_stack.size() < N) {
+ throw_renderer_error("function needs " + std::to_string(N) + " variables, but has only found " + std::to_string(json_eval_stack.size()), node);
+ }
+
+ Arguments result {N};
+ for (size_t i = 0; i < N; i += 1) {
+ result[N - i - 1] = json_eval_stack.top();
+ json_eval_stack.pop();
+
+ if (!result[N - i - 1]) {
+ auto json_node = not_found_stack.top();
+ not_found_stack.pop();
+
+ if (throw_not_found) {
+ throw_renderer_error("variable '" + static_cast<std::string>(json_node->name) + "' not found", *json_node);
+ }
+ }
+ }
+ return result;
+ }
+
+ void visit(const BlockNode& node) {
+ for (auto& n : node.nodes) {
+ n->accept(*this);
+ }
+ }
+
+ void visit(const TextNode& node) {
+ output_stream->write(current_template->content.c_str() + node.pos, node.length);
+ }
+
+ void visit(const ExpressionNode&) { }
+
+ void visit(const LiteralNode& node) {
+ json_eval_stack.push(&node.value);
+ }
+
+ void visit(const JsonNode& node) {
+ if (json_additional_data.contains(node.ptr)) {
+ json_eval_stack.push(&(json_additional_data[node.ptr]));
+
+ } else if (json_input->contains(node.ptr)) {
+ json_eval_stack.push(&(*json_input)[node.ptr]);
+
+ } else {
+ // Try to evaluate as a no-argument callback
+ auto function_data = function_storage.find_function(node.name, 0);
+ if (function_data.operation == FunctionStorage::Operation::Callback) {
+ Arguments empty_args {};
+ auto value = std::make_shared<json>(function_data.callback(empty_args));
+ json_tmp_stack.push_back(value);
+ json_eval_stack.push(value.get());
+
+ } else {
+ json_eval_stack.push(nullptr);
+ not_found_stack.emplace(&node);
+ }
+ }
+ }
+
+ void visit(const FunctionNode& node) {
+ std::shared_ptr<json> result_ptr;
+
+ switch (node.operation) {
+ case Op::Not: {
+ auto args = get_arguments<1>(node);
+ result_ptr = std::make_shared<json>(!truthy(args[0]));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::And: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(truthy(args[0]) && truthy(args[1]));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Or: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(truthy(args[0]) || truthy(args[1]));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::In: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(std::find(args[1]->begin(), args[1]->end(), *args[0]) != args[1]->end());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Equal: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(*args[0] == *args[1]);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::NotEqual: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(*args[0] != *args[1]);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Greater: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(*args[0] > *args[1]);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::GreaterEqual: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(*args[0] >= *args[1]);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Less: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(*args[0] < *args[1]);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::LessEqual: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(*args[0] <= *args[1]);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Add: {
+ auto args = get_arguments<2>(node);
+ if (args[0]->is_string() && args[1]->is_string()) {
+ result_ptr = std::make_shared<json>(args[0]->get_ref<const std::string&>() + args[1]->get_ref<const std::string&>());
+ json_tmp_stack.push_back(result_ptr);
+ } else if (args[0]->is_number_integer() && args[1]->is_number_integer()) {
+ result_ptr = std::make_shared<json>(args[0]->get<int>() + args[1]->get<int>());
+ json_tmp_stack.push_back(result_ptr);
+ } else {
+ result_ptr = std::make_shared<json>(args[0]->get<double>() + args[1]->get<double>());
+ json_tmp_stack.push_back(result_ptr);
+ }
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Subtract: {
+ auto args = get_arguments<2>(node);
+ if (args[0]->is_number_integer() && args[1]->is_number_integer()) {
+ result_ptr = std::make_shared<json>(args[0]->get<int>() - args[1]->get<int>());
+ json_tmp_stack.push_back(result_ptr);
+ } else {
+ result_ptr = std::make_shared<json>(args[0]->get<double>() - args[1]->get<double>());
+ json_tmp_stack.push_back(result_ptr);
+ }
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Multiplication: {
+ auto args = get_arguments<2>(node);
+ if (args[0]->is_number_integer() && args[1]->is_number_integer()) {
+ result_ptr = std::make_shared<json>(args[0]->get<int>() * args[1]->get<int>());
+ json_tmp_stack.push_back(result_ptr);
+ } else {
+ result_ptr = std::make_shared<json>(args[0]->get<double>() * args[1]->get<double>());
+ json_tmp_stack.push_back(result_ptr);
+ }
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Division: {
+ auto args = get_arguments<2>(node);
+ if (args[1]->get<double>() == 0) {
+ throw_renderer_error("division by zero", node);
+ }
+ result_ptr = std::make_shared<json>(args[0]->get<double>() / args[1]->get<double>());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Power: {
+ auto args = get_arguments<2>(node);
+ if (args[0]->is_number_integer() && args[1]->get<int>() >= 0) {
+ int result = std::pow(args[0]->get<int>(), args[1]->get<int>());
+ result_ptr = std::make_shared<json>(std::move(result));
+ json_tmp_stack.push_back(result_ptr);
+ } else {
+ double result = std::pow(args[0]->get<double>(), args[1]->get<int>());
+ result_ptr = std::make_shared<json>(std::move(result));
+ json_tmp_stack.push_back(result_ptr);
+ }
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Modulo: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(args[0]->get<int>() % args[1]->get<int>());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::AtId: {
+ json_eval_stack.pop(); // Pop id nullptr
+ auto container = get_arguments<1, false>(node)[0];
+ if (not_found_stack.empty()) {
+ throw_renderer_error("could not find element with given name", node);
+ }
+ auto id_node = not_found_stack.top();
+ not_found_stack.pop();
+ json_eval_stack.push(&container->at(id_node->name));
+ } break;
+ case Op::At: {
+ auto args = get_arguments<2>(node);
+ json_eval_stack.push(&args[0]->at(args[1]->get<int>()));
+ } break;
+ case Op::Default: {
+ auto default_arg = get_arguments<1>(node)[0];
+ auto test_arg = get_arguments<1, false>(node)[0];
+ json_eval_stack.push(test_arg ? test_arg : default_arg);
+ } break;
+ case Op::DivisibleBy: {
+ auto args = get_arguments<2>(node);
+ int divisor = args[1]->get<int>();
+ result_ptr = std::make_shared<json>((divisor != 0) && (args[0]->get<int>() % divisor == 0));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Even: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->get<int>() % 2 == 0);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Exists: {
+ auto &&name = get_arguments<1>(node)[0]->get_ref<const std::string &>();
+ result_ptr = std::make_shared<json>(json_input->contains(json::json_pointer(JsonNode::convert_dot_to_json_ptr(name))));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::ExistsInObject: {
+ auto args = get_arguments<2>(node);
+ auto &&name = args[1]->get_ref<const std::string &>();
+ result_ptr = std::make_shared<json>(args[0]->find(name) != args[0]->end());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::First: {
+ auto result = &get_arguments<1>(node)[0]->front();
+ json_eval_stack.push(result);
+ } break;
+ case Op::Float: {
+ result_ptr = std::make_shared<json>(std::stod(get_arguments<1>(node)[0]->get_ref<const std::string &>()));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Int: {
+ result_ptr = std::make_shared<json>(std::stoi(get_arguments<1>(node)[0]->get_ref<const std::string &>()));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Last: {
+ auto result = &get_arguments<1>(node)[0]->back();
+ json_eval_stack.push(result);
+ } break;
+ case Op::Length: {
+ auto val = get_arguments<1>(node)[0];
+ if (val->is_string()) {
+ result_ptr = std::make_shared<json>(val->get_ref<const std::string &>().length());
+ } else {
+ result_ptr = std::make_shared<json>(val->size());
+ }
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Lower: {
+ std::string result = get_arguments<1>(node)[0]->get<std::string>();
+ std::transform(result.begin(), result.end(), result.begin(), ::tolower);
+ result_ptr = std::make_shared<json>(std::move(result));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Max: {
+ auto args = get_arguments<1>(node);
+ auto result = std::max_element(args[0]->begin(), args[0]->end());
+ json_eval_stack.push(&(*result));
+ } break;
+ case Op::Min: {
+ auto args = get_arguments<1>(node);
+ auto result = std::min_element(args[0]->begin(), args[0]->end());
+ json_eval_stack.push(&(*result));
+ } break;
+ case Op::Odd: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->get<int>() % 2 != 0);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Range: {
+ std::vector<int> result(get_arguments<1>(node)[0]->get<int>());
+ std::iota(result.begin(), result.end(), 0);
+ result_ptr = std::make_shared<json>(std::move(result));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Round: {
+ auto args = get_arguments<2>(node);
+ int precision = args[1]->get<int>();
+ double result = std::round(args[0]->get<double>() * std::pow(10.0, precision)) / std::pow(10.0, precision);
+ result_ptr = std::make_shared<json>(std::move(result));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Sort: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->get<std::vector<json>>());
+ std::sort(result_ptr->begin(), result_ptr->end());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Upper: {
+ std::string result = get_arguments<1>(node)[0]->get<std::string>();
+ std::transform(result.begin(), result.end(), result.begin(), ::toupper);
+ result_ptr = std::make_shared<json>(std::move(result));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::IsBoolean: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->is_boolean());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::IsNumber: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->is_number());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::IsInteger: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->is_number_integer());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::IsFloat: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->is_number_float());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::IsObject: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->is_object());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::IsArray: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->is_array());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::IsString: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->is_string());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Callback: {
+ auto args = get_argument_vector(node.number_args, node);
+ result_ptr = std::make_shared<json>(node.callback(args));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::ParenLeft:
+ case Op::ParenRight:
+ case Op::None:
+ break;
+ }
+ }
+
+ void visit(const ExpressionListNode& node) {
+ print_json(eval_expression_list(node));
+ }
+
+ void visit(const StatementNode&) { }
+
+ void visit(const ForStatementNode&) { }
+
+ void visit(const ForArrayStatementNode& node) {
+ auto result = eval_expression_list(node.condition);
+ if (!result->is_array()) {
+ throw_renderer_error("object must be an array", node);
+ }
+
+ if (!current_loop_data->empty()) {
+ auto tmp = *current_loop_data; // Because of clang-3
+ (*current_loop_data)["parent"] = std::move(tmp);
+ }
+
+ size_t index = 0;
+ (*current_loop_data)["is_first"] = true;
+ (*current_loop_data)["is_last"] = (result->size() <= 1);
+ for (auto it = result->begin(); it != result->end(); ++it) {
+ json_additional_data[static_cast<std::string>(node.value)] = *it;
+
+ (*current_loop_data)["index"] = index;
+ (*current_loop_data)["index1"] = index + 1;
+ if (index == 1) {
+ (*current_loop_data)["is_first"] = false;
+ }
+ if (index == result->size() - 1) {
+ (*current_loop_data)["is_last"] = true;
+ }
+
+ node.body.accept(*this);
+ ++index;
+ }
+
+ json_additional_data[static_cast<std::string>(node.value)].clear();
+ if (!(*current_loop_data)["parent"].empty()) {
+ auto tmp = (*current_loop_data)["parent"];
+ *current_loop_data = std::move(tmp);
+ } else {
+ current_loop_data = &json_additional_data["loop"];
+ }
+ }
+
+ void visit(const ForObjectStatementNode& node) {
+ auto result = eval_expression_list(node.condition);
+ if (!result->is_object()) {
+ throw_renderer_error("object must be an object", node);
+ }
+
+ if (!current_loop_data->empty()) {
+ (*current_loop_data)["parent"] = std::move(*current_loop_data);
+ }
+
+ size_t index = 0;
+ (*current_loop_data)["is_first"] = true;
+ (*current_loop_data)["is_last"] = (result->size() <= 1);
+ for (auto it = result->begin(); it != result->end(); ++it) {
+ json_additional_data[static_cast<std::string>(node.key)] = it.key();
+ json_additional_data[static_cast<std::string>(node.value)] = it.value();
+
+ (*current_loop_data)["index"] = index;
+ (*current_loop_data)["index1"] = index + 1;
+ if (index == 1) {
+ (*current_loop_data)["is_first"] = false;
+ }
+ if (index == result->size() - 1) {
+ (*current_loop_data)["is_last"] = true;
+ }
+
+ node.body.accept(*this);
+ ++index;
+ }
+
+ json_additional_data[static_cast<std::string>(node.key)].clear();
+ json_additional_data[static_cast<std::string>(node.value)].clear();
+ if (!(*current_loop_data)["parent"].empty()) {
+ *current_loop_data = std::move((*current_loop_data)["parent"]);
+ } else {
+ current_loop_data = &json_additional_data["loop"];
+ }
+ }
+
+ void visit(const IfStatementNode& node) {
+ auto result = eval_expression_list(node.condition);
+ if (truthy(result.get())) {
+ node.true_statement.accept(*this);
+ } else if (node.has_false_statement) {
+ node.false_statement.accept(*this);
+ }
+ }
+
+ void visit(const IncludeStatementNode& node) {
+ auto sub_renderer = Renderer(config, template_storage, function_storage);
+ auto included_template_it = template_storage.find(node.file);
+
+ if (included_template_it != template_storage.end()) {
+ sub_renderer.render_to(*output_stream, included_template_it->second, *json_input, &json_additional_data);
+ } else if (config.throw_at_missing_includes) {
+ throw_renderer_error("include '" + node.file + "' not found", node);
+ }
+ }
+
+ void visit(const SetStatementNode& node) {
+ json_additional_data[node.key] = *eval_expression_list(node.expression);
+ }
+
+public:
+ Renderer(const RenderConfig& config, const TemplateStorage &template_storage, const FunctionStorage &function_storage)
+ : config(config), template_storage(template_storage), function_storage(function_storage) { }
+
+ void render_to(std::ostream &os, const Template &tmpl, const json &data, json *loop_data = nullptr) {
+ output_stream = &os;
+ current_template = &tmpl;
+ json_input = &data;
+ if (loop_data) {
+ json_additional_data = *loop_data;
+ current_loop_data = &json_additional_data["loop"];
+ }
+
+ current_template->root.accept(*this);
+
+ json_tmp_stack.clear();
+ }
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_RENDERER_HPP_
diff --git a/deps/inja/include/inja/statistics.hpp b/deps/inja/include/inja/statistics.hpp
new file mode 100644
index 0000000..71fc719
--- /dev/null
+++ b/deps/inja/include/inja/statistics.hpp
@@ -0,0 +1,68 @@
+// Copyright (c) 2019 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_STATISTICS_HPP_
+#define INCLUDE_INJA_STATISTICS_HPP_
+
+#include "node.hpp"
+
+
+namespace inja {
+
+/*!
+ * \brief A class for counting statistics on a Template.
+ */
+class StatisticsVisitor : public NodeVisitor {
+ void visit(const BlockNode& node) {
+ for (auto& n : node.nodes) {
+ n->accept(*this);
+ }
+ }
+
+ void visit(const TextNode&) { }
+ void visit(const ExpressionNode&) { }
+ void visit(const LiteralNode&) { }
+
+ void visit(const JsonNode&) {
+ variable_counter += 1;
+ }
+
+ void visit(const FunctionNode&) { }
+
+ void visit(const ExpressionListNode& node) {
+ for (auto& n : node.rpn_output) {
+ n->accept(*this);
+ }
+ }
+
+ void visit(const StatementNode&) { }
+ void visit(const ForStatementNode&) { }
+
+ void visit(const ForArrayStatementNode& node) {
+ node.condition.accept(*this);
+ node.body.accept(*this);
+ }
+
+ void visit(const ForObjectStatementNode& node) {
+ node.condition.accept(*this);
+ node.body.accept(*this);
+ }
+
+ void visit(const IfStatementNode& node) {
+ node.condition.accept(*this);
+ node.true_statement.accept(*this);
+ node.false_statement.accept(*this);
+ }
+
+ void visit(const IncludeStatementNode&) { }
+
+ void visit(const SetStatementNode&) { }
+
+public:
+ unsigned int variable_counter;
+
+ explicit StatisticsVisitor() : variable_counter(0) { }
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_STATISTICS_HPP_
diff --git a/deps/inja/include/inja/string_view.hpp b/deps/inja/include/inja/string_view.hpp
new file mode 100644
index 0000000..2bb50c9
--- /dev/null
+++ b/deps/inja/include/inja/string_view.hpp
@@ -0,0 +1,1416 @@
+// Copyright 2017-2019 by Martin Moene
+//
+// string-view lite, a C++17-like string_view for C++98 and later.
+// For more information see https://github.com/martinmoene/string-view-lite
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#pragma once
+
+#ifndef NONSTD_SV_LITE_H_INCLUDED
+#define NONSTD_SV_LITE_H_INCLUDED
+
+#define string_view_lite_MAJOR 1
+#define string_view_lite_MINOR 4
+#define string_view_lite_PATCH 0
+
+#define string_view_lite_VERSION \
+ nssv_STRINGIFY(string_view_lite_MAJOR) "." nssv_STRINGIFY(string_view_lite_MINOR) "." nssv_STRINGIFY( \
+ string_view_lite_PATCH)
+
+#define nssv_STRINGIFY(x) nssv_STRINGIFY_(x)
+#define nssv_STRINGIFY_(x) #x
+
+// string-view lite configuration:
+
+#define nssv_STRING_VIEW_DEFAULT 0
+#define nssv_STRING_VIEW_NONSTD 1
+#define nssv_STRING_VIEW_STD 2
+
+#if !defined(nssv_CONFIG_SELECT_STRING_VIEW)
+#define nssv_CONFIG_SELECT_STRING_VIEW (nssv_HAVE_STD_STRING_VIEW ? nssv_STRING_VIEW_STD : nssv_STRING_VIEW_NONSTD)
+#endif
+
+#if defined(nssv_CONFIG_SELECT_STD_STRING_VIEW) || defined(nssv_CONFIG_SELECT_NONSTD_STRING_VIEW)
+#error nssv_CONFIG_SELECT_STD_STRING_VIEW and nssv_CONFIG_SELECT_NONSTD_STRING_VIEW are deprecated and removed, please use nssv_CONFIG_SELECT_STRING_VIEW=nssv_STRING_VIEW_...
+#endif
+
+#ifndef nssv_CONFIG_STD_SV_OPERATOR
+#define nssv_CONFIG_STD_SV_OPERATOR 0
+#endif
+
+#ifndef nssv_CONFIG_USR_SV_OPERATOR
+#define nssv_CONFIG_USR_SV_OPERATOR 1
+#endif
+
+#ifdef nssv_CONFIG_CONVERSION_STD_STRING
+#define nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS nssv_CONFIG_CONVERSION_STD_STRING
+#define nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS nssv_CONFIG_CONVERSION_STD_STRING
+#endif
+
+#ifndef nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS
+#define nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS 1
+#endif
+
+#ifndef nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
+#define nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS 1
+#endif
+
+// Control presence of exception handling (try and auto discover):
+
+#ifndef nssv_CONFIG_NO_EXCEPTIONS
+#if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)
+#define nssv_CONFIG_NO_EXCEPTIONS 0
+#else
+#define nssv_CONFIG_NO_EXCEPTIONS 1
+#endif
+#endif
+
+// C++ language version detection (C++20 is speculative):
+// Note: VC14.0/1900 (VS2015) lacks too much from C++14.
+
+#ifndef nssv_CPLUSPLUS
+#if defined(_MSVC_LANG) && !defined(__clang__)
+#define nssv_CPLUSPLUS (_MSC_VER == 1900 ? 201103L : _MSVC_LANG)
+#else
+#define nssv_CPLUSPLUS __cplusplus
+#endif
+#endif
+
+#define nssv_CPP98_OR_GREATER (nssv_CPLUSPLUS >= 199711L)
+#define nssv_CPP11_OR_GREATER (nssv_CPLUSPLUS >= 201103L)
+#define nssv_CPP11_OR_GREATER_ (nssv_CPLUSPLUS >= 201103L)
+#define nssv_CPP14_OR_GREATER (nssv_CPLUSPLUS >= 201402L)
+#define nssv_CPP17_OR_GREATER (nssv_CPLUSPLUS >= 201703L)
+#define nssv_CPP20_OR_GREATER (nssv_CPLUSPLUS >= 202000L)
+
+// use C++17 std::string_view if available and requested:
+
+#if nssv_CPP17_OR_GREATER && defined(__has_include)
+#if __has_include(<string_view> )
+#define nssv_HAVE_STD_STRING_VIEW 1
+#else
+#define nssv_HAVE_STD_STRING_VIEW 0
+#endif
+#else
+#define nssv_HAVE_STD_STRING_VIEW 0
+#endif
+
+#define nssv_USES_STD_STRING_VIEW \
+ ((nssv_CONFIG_SELECT_STRING_VIEW == nssv_STRING_VIEW_STD) || \
+ ((nssv_CONFIG_SELECT_STRING_VIEW == nssv_STRING_VIEW_DEFAULT) && nssv_HAVE_STD_STRING_VIEW))
+
+#define nssv_HAVE_STARTS_WITH (nssv_CPP20_OR_GREATER || !nssv_USES_STD_STRING_VIEW)
+#define nssv_HAVE_ENDS_WITH nssv_HAVE_STARTS_WITH
+
+//
+// Use C++17 std::string_view:
+//
+
+#if nssv_USES_STD_STRING_VIEW
+
+#include <string_view>
+
+// Extensions for std::string:
+
+#if nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
+
+namespace nonstd {
+
+template <class CharT, class Traits, class Allocator = std::allocator<CharT>>
+std::basic_string<CharT, Traits, Allocator> to_string(std::basic_string_view<CharT, Traits> v,
+ Allocator const &a = Allocator()) {
+ return std::basic_string<CharT, Traits, Allocator>(v.begin(), v.end(), a);
+}
+
+template <class CharT, class Traits, class Allocator>
+std::basic_string_view<CharT, Traits> to_string_view(std::basic_string<CharT, Traits, Allocator> const &s) {
+ return std::basic_string_view<CharT, Traits>(s.data(), s.size());
+}
+
+// Literal operators sv and _sv:
+
+#if nssv_CONFIG_STD_SV_OPERATOR
+
+using namespace std::literals::string_view_literals;
+
+#endif
+
+#if nssv_CONFIG_USR_SV_OPERATOR
+
+inline namespace literals {
+inline namespace string_view_literals {
+
+constexpr std::string_view operator"" _sv(const char *str, size_t len) noexcept // (1)
+{
+ return std::string_view {str, len};
+}
+
+constexpr std::u16string_view operator"" _sv(const char16_t *str, size_t len) noexcept // (2)
+{
+ return std::u16string_view {str, len};
+}
+
+constexpr std::u32string_view operator"" _sv(const char32_t *str, size_t len) noexcept // (3)
+{
+ return std::u32string_view {str, len};
+}
+
+constexpr std::wstring_view operator"" _sv(const wchar_t *str, size_t len) noexcept // (4)
+{
+ return std::wstring_view {str, len};
+}
+
+} // namespace string_view_literals
+} // namespace literals
+
+#endif // nssv_CONFIG_USR_SV_OPERATOR
+
+} // namespace nonstd
+
+#endif // nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
+
+namespace nonstd {
+
+using std::basic_string_view;
+using std::string_view;
+using std::u16string_view;
+using std::u32string_view;
+using std::wstring_view;
+
+// literal "sv" and "_sv", see above
+
+using std::operator==;
+using std::operator!=;
+using std::operator<;
+using std::operator<=;
+using std::operator>;
+using std::operator>=;
+
+using std::operator<<;
+
+} // namespace nonstd
+
+#else // nssv_HAVE_STD_STRING_VIEW
+
+//
+// Before C++17: use string_view lite:
+//
+
+// Compiler versions:
+//
+// MSVC++ 6.0 _MSC_VER == 1200 (Visual Studio 6.0)
+// MSVC++ 7.0 _MSC_VER == 1300 (Visual Studio .NET 2002)
+// MSVC++ 7.1 _MSC_VER == 1310 (Visual Studio .NET 2003)
+// MSVC++ 8.0 _MSC_VER == 1400 (Visual Studio 2005)
+// MSVC++ 9.0 _MSC_VER == 1500 (Visual Studio 2008)
+// MSVC++ 10.0 _MSC_VER == 1600 (Visual Studio 2010)
+// MSVC++ 11.0 _MSC_VER == 1700 (Visual Studio 2012)
+// MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)
+// MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015)
+// MSVC++ 14.1 _MSC_VER >= 1910 (Visual Studio 2017)
+
+#if defined(_MSC_VER) && !defined(__clang__)
+#define nssv_COMPILER_MSVC_VER (_MSC_VER)
+#define nssv_COMPILER_MSVC_VERSION (_MSC_VER / 10 - 10 * (5 + (_MSC_VER < 1900)))
+#else
+#define nssv_COMPILER_MSVC_VER 0
+#define nssv_COMPILER_MSVC_VERSION 0
+#endif
+
+#define nssv_COMPILER_VERSION(major, minor, patch) (10 * (10 * (major) + (minor)) + (patch))
+
+#if defined(__clang__)
+#define nssv_COMPILER_CLANG_VERSION nssv_COMPILER_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
+#else
+#define nssv_COMPILER_CLANG_VERSION 0
+#endif
+
+#if defined(__GNUC__) && !defined(__clang__)
+#define nssv_COMPILER_GNUC_VERSION nssv_COMPILER_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
+#else
+#define nssv_COMPILER_GNUC_VERSION 0
+#endif
+
+// half-open range [lo..hi):
+#define nssv_BETWEEN(v, lo, hi) ((lo) <= (v) && (v) < (hi))
+
+// Presence of language and library features:
+
+#ifdef _HAS_CPP0X
+#define nssv_HAS_CPP0X _HAS_CPP0X
+#else
+#define nssv_HAS_CPP0X 0
+#endif
+
+// Unless defined otherwise below, consider VC14 as C++11 for variant-lite:
+
+#if nssv_COMPILER_MSVC_VER >= 1900
+#undef nssv_CPP11_OR_GREATER
+#define nssv_CPP11_OR_GREATER 1
+#endif
+
+#define nssv_CPP11_90 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1500)
+#define nssv_CPP11_100 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1600)
+#define nssv_CPP11_110 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1700)
+#define nssv_CPP11_120 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1800)
+#define nssv_CPP11_140 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1900)
+#define nssv_CPP11_141 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1910)
+
+#define nssv_CPP14_000 (nssv_CPP14_OR_GREATER)
+#define nssv_CPP17_000 (nssv_CPP17_OR_GREATER)
+
+// Presence of C++11 language features:
+
+#define nssv_HAVE_CONSTEXPR_11 nssv_CPP11_140
+#define nssv_HAVE_EXPLICIT_CONVERSION nssv_CPP11_140
+#define nssv_HAVE_INLINE_NAMESPACE nssv_CPP11_140
+#define nssv_HAVE_NOEXCEPT nssv_CPP11_140
+#define nssv_HAVE_NULLPTR nssv_CPP11_100
+#define nssv_HAVE_REF_QUALIFIER nssv_CPP11_140
+#define nssv_HAVE_UNICODE_LITERALS nssv_CPP11_140
+#define nssv_HAVE_USER_DEFINED_LITERALS nssv_CPP11_140
+#define nssv_HAVE_WCHAR16_T nssv_CPP11_100
+#define nssv_HAVE_WCHAR32_T nssv_CPP11_100
+
+#if !((nssv_CPP11_OR_GREATER && nssv_COMPILER_CLANG_VERSION) || nssv_BETWEEN(nssv_COMPILER_CLANG_VERSION, 300, 400))
+#define nssv_HAVE_STD_DEFINED_LITERALS nssv_CPP11_140
+#else
+#define nssv_HAVE_STD_DEFINED_LITERALS 0
+#endif
+
+// Presence of C++14 language features:
+
+#define nssv_HAVE_CONSTEXPR_14 nssv_CPP14_000
+
+// Presence of C++17 language features:
+
+#define nssv_HAVE_NODISCARD nssv_CPP17_000
+
+// Presence of C++ library features:
+
+#define nssv_HAVE_STD_HASH nssv_CPP11_120
+
+// C++ feature usage:
+
+#if nssv_HAVE_CONSTEXPR_11
+#define nssv_constexpr constexpr
+#else
+#define nssv_constexpr /*constexpr*/
+#endif
+
+#if nssv_HAVE_CONSTEXPR_14
+#define nssv_constexpr14 constexpr
+#else
+#define nssv_constexpr14 /*constexpr*/
+#endif
+
+#if nssv_HAVE_EXPLICIT_CONVERSION
+#define nssv_explicit explicit
+#else
+#define nssv_explicit /*explicit*/
+#endif
+
+#if nssv_HAVE_INLINE_NAMESPACE
+#define nssv_inline_ns inline
+#else
+#define nssv_inline_ns /*inline*/
+#endif
+
+#if nssv_HAVE_NOEXCEPT
+#define nssv_noexcept noexcept
+#else
+#define nssv_noexcept /*noexcept*/
+#endif
+
+//#if nssv_HAVE_REF_QUALIFIER
+//# define nssv_ref_qual &
+//# define nssv_refref_qual &&
+//#else
+//# define nssv_ref_qual /*&*/
+//# define nssv_refref_qual /*&&*/
+//#endif
+
+#if nssv_HAVE_NULLPTR
+#define nssv_nullptr nullptr
+#else
+#define nssv_nullptr NULL
+#endif
+
+#if nssv_HAVE_NODISCARD
+#define nssv_nodiscard [[nodiscard]]
+#else
+#define nssv_nodiscard /*[[nodiscard]]*/
+#endif
+
+// Additional includes:
+
+#include <algorithm>
+#include <cassert>
+#include <iterator>
+#include <limits>
+#include <ostream>
+#include <string> // std::char_traits<>
+
+#if !nssv_CONFIG_NO_EXCEPTIONS
+#include <stdexcept>
+#endif
+
+#if nssv_CPP11_OR_GREATER
+#include <type_traits>
+#endif
+
+// Clang, GNUC, MSVC warning suppression macros:
+
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wreserved-user-defined-literal"
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wuser-defined-literals"
+#elif defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wliteral-suffix"
+#endif // __clang__
+
+#if nssv_COMPILER_MSVC_VERSION >= 140
+#define nssv_SUPPRESS_MSGSL_WARNING(expr) [[gsl::suppress(expr)]]
+#define nssv_SUPPRESS_MSVC_WARNING(code, descr) __pragma(warning(suppress : code))
+#define nssv_DISABLE_MSVC_WARNINGS(codes) __pragma(warning(push)) __pragma(warning(disable : codes))
+#else
+#define nssv_SUPPRESS_MSGSL_WARNING(expr)
+#define nssv_SUPPRESS_MSVC_WARNING(code, descr)
+#define nssv_DISABLE_MSVC_WARNINGS(codes)
+#endif
+
+#if defined(__clang__)
+#define nssv_RESTORE_WARNINGS() _Pragma("clang diagnostic pop")
+#elif defined(__GNUC__)
+#define nssv_RESTORE_WARNINGS() _Pragma("GCC diagnostic pop")
+#elif nssv_COMPILER_MSVC_VERSION >= 140
+#define nssv_RESTORE_WARNINGS() __pragma(warning(pop))
+#else
+#define nssv_RESTORE_WARNINGS()
+#endif
+
+// Suppress the following MSVC (GSL) warnings:
+// - C4455, non-gsl : 'operator ""sv': literal suffix identifiers that do not
+// start with an underscore are reserved
+// - C26472, gsl::t.1 : don't use a static_cast for arithmetic conversions;
+// use brace initialization, gsl::narrow_cast or gsl::narow
+// - C26481: gsl::b.1 : don't use pointer arithmetic. Use span instead
+
+nssv_DISABLE_MSVC_WARNINGS(4455 26481 26472)
+ // nssv_DISABLE_CLANG_WARNINGS( "-Wuser-defined-literals" )
+ // nssv_DISABLE_GNUC_WARNINGS( -Wliteral-suffix )
+
+ namespace nonstd {
+ namespace sv_lite {
+
+#if nssv_CPP11_OR_GREATER
+
+ namespace detail {
+
+ // Expect tail call optimization to make length() non-recursive:
+
+ template <typename CharT> inline constexpr std::size_t length(CharT *s, std::size_t result = 0) {
+ return *s == '\0' ? result : length(s + 1, result + 1);
+ }
+
+ } // namespace detail
+
+#endif // nssv_CPP11_OR_GREATER
+
+ template <class CharT, class Traits = std::char_traits<CharT>> class basic_string_view;
+
+ //
+ // basic_string_view:
+ //
+
+ template <class CharT, class Traits /* = std::char_traits<CharT> */
+ >
+ class basic_string_view {
+ public:
+ // Member types:
+
+ typedef Traits traits_type;
+ typedef CharT value_type;
+
+ typedef CharT *pointer;
+ typedef CharT const *const_pointer;
+ typedef CharT &reference;
+ typedef CharT const &const_reference;
+
+ typedef const_pointer iterator;
+ typedef const_pointer const_iterator;
+ typedef std::reverse_iterator<const_iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+
+ // 24.4.2.1 Construction and assignment:
+
+ nssv_constexpr basic_string_view() nssv_noexcept : data_(nssv_nullptr), size_(0) {}
+
+#if nssv_CPP11_OR_GREATER
+ nssv_constexpr basic_string_view(basic_string_view const &other) nssv_noexcept = default;
+#else
+ nssv_constexpr basic_string_view(basic_string_view const &other) nssv_noexcept : data_(other.data_),
+ size_(other.size_) {}
+#endif
+
+ nssv_constexpr basic_string_view(CharT const *s, size_type count) nssv_noexcept // non-standard noexcept
+ : data_(s),
+ size_(count) {}
+
+ nssv_constexpr basic_string_view(CharT const *s) nssv_noexcept // non-standard noexcept
+ : data_(s)
+#if nssv_CPP17_OR_GREATER
+ ,
+ size_(Traits::length(s))
+#elif nssv_CPP11_OR_GREATER
+ ,
+ size_(detail::length(s))
+#else
+ ,
+ size_(Traits::length(s))
+#endif
+ {
+ }
+
+ // Assignment:
+
+#if nssv_CPP11_OR_GREATER
+ nssv_constexpr14 basic_string_view &operator=(basic_string_view const &other) nssv_noexcept = default;
+#else
+ nssv_constexpr14 basic_string_view &operator=(basic_string_view const &other) nssv_noexcept {
+ data_ = other.data_;
+ size_ = other.size_;
+ return *this;
+ }
+#endif
+
+ // 24.4.2.2 Iterator support:
+
+ nssv_constexpr const_iterator begin() const nssv_noexcept { return data_; }
+ nssv_constexpr const_iterator end() const nssv_noexcept { return data_ + size_; }
+
+ nssv_constexpr const_iterator cbegin() const nssv_noexcept { return begin(); }
+ nssv_constexpr const_iterator cend() const nssv_noexcept { return end(); }
+
+ nssv_constexpr const_reverse_iterator rbegin() const nssv_noexcept { return const_reverse_iterator(end()); }
+ nssv_constexpr const_reverse_iterator rend() const nssv_noexcept { return const_reverse_iterator(begin()); }
+
+ nssv_constexpr const_reverse_iterator crbegin() const nssv_noexcept { return rbegin(); }
+ nssv_constexpr const_reverse_iterator crend() const nssv_noexcept { return rend(); }
+
+ // 24.4.2.3 Capacity:
+
+ nssv_constexpr size_type size() const nssv_noexcept { return size_; }
+ nssv_constexpr size_type length() const nssv_noexcept { return size_; }
+ nssv_constexpr size_type max_size() const nssv_noexcept { return (std::numeric_limits<size_type>::max)(); }
+
+ // since C++20
+ nssv_nodiscard nssv_constexpr bool empty() const nssv_noexcept { return 0 == size_; }
+
+ // 24.4.2.4 Element access:
+
+ nssv_constexpr const_reference operator[](size_type pos) const { return data_at(pos); }
+
+ nssv_constexpr14 const_reference at(size_type pos) const {
+#if nssv_CONFIG_NO_EXCEPTIONS
+ assert(pos < size());
+#else
+ if (pos >= size()) {
+ throw std::out_of_range("nonstd::string_view::at()");
+ }
+#endif
+ return data_at(pos);
+ }
+
+ nssv_constexpr const_reference front() const { return data_at(0); }
+ nssv_constexpr const_reference back() const { return data_at(size() - 1); }
+
+ nssv_constexpr const_pointer data() const nssv_noexcept { return data_; }
+
+ // 24.4.2.5 Modifiers:
+
+ nssv_constexpr14 void remove_prefix(size_type n) {
+ assert(n <= size());
+ data_ += n;
+ size_ -= n;
+ }
+
+ nssv_constexpr14 void remove_suffix(size_type n) {
+ assert(n <= size());
+ size_ -= n;
+ }
+
+ nssv_constexpr14 void swap(basic_string_view &other) nssv_noexcept {
+ using std::swap;
+ swap(data_, other.data_);
+ swap(size_, other.size_);
+ }
+
+ // 24.4.2.6 String operations:
+
+ size_type copy(CharT *dest, size_type n, size_type pos = 0) const {
+#if nssv_CONFIG_NO_EXCEPTIONS
+ assert(pos <= size());
+#else
+ if (pos > size()) {
+ throw std::out_of_range("nonstd::string_view::copy()");
+ }
+#endif
+ const size_type rlen = (std::min)(n, size() - pos);
+
+ (void)Traits::copy(dest, data() + pos, rlen);
+
+ return rlen;
+ }
+
+ nssv_constexpr14 basic_string_view substr(size_type pos = 0, size_type n = npos) const {
+#if nssv_CONFIG_NO_EXCEPTIONS
+ assert(pos <= size());
+#else
+ if (pos > size()) {
+ throw std::out_of_range("nonstd::string_view::substr()");
+ }
+#endif
+ return basic_string_view(data() + pos, (std::min)(n, size() - pos));
+ }
+
+ // compare(), 6x:
+
+ nssv_constexpr14 int compare(basic_string_view other) const nssv_noexcept // (1)
+ {
+ if (const int result = Traits::compare(data(), other.data(), (std::min)(size(), other.size()))) {
+ return result;
+ }
+
+ return size() == other.size() ? 0 : size() < other.size() ? -1 : 1;
+ }
+
+ nssv_constexpr int compare(size_type pos1, size_type n1, basic_string_view other) const // (2)
+ {
+ return substr(pos1, n1).compare(other);
+ }
+
+ nssv_constexpr int compare(size_type pos1, size_type n1, basic_string_view other, size_type pos2,
+ size_type n2) const // (3)
+ {
+ return substr(pos1, n1).compare(other.substr(pos2, n2));
+ }
+
+ nssv_constexpr int compare(CharT const *s) const // (4)
+ {
+ return compare(basic_string_view(s));
+ }
+
+ nssv_constexpr int compare(size_type pos1, size_type n1, CharT const *s) const // (5)
+ {
+ return substr(pos1, n1).compare(basic_string_view(s));
+ }
+
+ nssv_constexpr int compare(size_type pos1, size_type n1, CharT const *s, size_type n2) const // (6)
+ {
+ return substr(pos1, n1).compare(basic_string_view(s, n2));
+ }
+
+ // 24.4.2.7 Searching:
+
+ // starts_with(), 3x, since C++20:
+
+ nssv_constexpr bool starts_with(basic_string_view v) const nssv_noexcept // (1)
+ {
+ return size() >= v.size() && compare(0, v.size(), v) == 0;
+ }
+
+ nssv_constexpr bool starts_with(CharT c) const nssv_noexcept // (2)
+ {
+ return starts_with(basic_string_view(&c, 1));
+ }
+
+ nssv_constexpr bool starts_with(CharT const *s) const // (3)
+ {
+ return starts_with(basic_string_view(s));
+ }
+
+ // ends_with(), 3x, since C++20:
+
+ nssv_constexpr bool ends_with(basic_string_view v) const nssv_noexcept // (1)
+ {
+ return size() >= v.size() && compare(size() - v.size(), npos, v) == 0;
+ }
+
+ nssv_constexpr bool ends_with(CharT c) const nssv_noexcept // (2)
+ {
+ return ends_with(basic_string_view(&c, 1));
+ }
+
+ nssv_constexpr bool ends_with(CharT const *s) const // (3)
+ {
+ return ends_with(basic_string_view(s));
+ }
+
+ // find(), 4x:
+
+ nssv_constexpr14 size_type find(basic_string_view v, size_type pos = 0) const nssv_noexcept // (1)
+ {
+ return assert(v.size() == 0 || v.data() != nssv_nullptr),
+ pos >= size() ? npos : to_pos(std::search(cbegin() + pos, cend(), v.cbegin(), v.cend(), Traits::eq));
+ }
+
+ nssv_constexpr14 size_type find(CharT c, size_type pos = 0) const nssv_noexcept // (2)
+ {
+ return find(basic_string_view(&c, 1), pos);
+ }
+
+ nssv_constexpr14 size_type find(CharT const *s, size_type pos, size_type n) const // (3)
+ {
+ return find(basic_string_view(s, n), pos);
+ }
+
+ nssv_constexpr14 size_type find(CharT const *s, size_type pos = 0) const // (4)
+ {
+ return find(basic_string_view(s), pos);
+ }
+
+ // rfind(), 4x:
+
+ nssv_constexpr14 size_type rfind(basic_string_view v, size_type pos = npos) const nssv_noexcept // (1)
+ {
+ if (size() < v.size()) {
+ return npos;
+ }
+
+ if (v.empty()) {
+ return (std::min)(size(), pos);
+ }
+
+ const_iterator last = cbegin() + (std::min)(size() - v.size(), pos) + v.size();
+ const_iterator result = std::find_end(cbegin(), last, v.cbegin(), v.cend(), Traits::eq);
+
+ return result != last ? size_type(result - cbegin()) : npos;
+ }
+
+ nssv_constexpr14 size_type rfind(CharT c, size_type pos = npos) const nssv_noexcept // (2)
+ {
+ return rfind(basic_string_view(&c, 1), pos);
+ }
+
+ nssv_constexpr14 size_type rfind(CharT const *s, size_type pos, size_type n) const // (3)
+ {
+ return rfind(basic_string_view(s, n), pos);
+ }
+
+ nssv_constexpr14 size_type rfind(CharT const *s, size_type pos = npos) const // (4)
+ {
+ return rfind(basic_string_view(s), pos);
+ }
+
+ // find_first_of(), 4x:
+
+ nssv_constexpr size_type find_first_of(basic_string_view v, size_type pos = 0) const nssv_noexcept // (1)
+ {
+ return pos >= size() ? npos
+ : to_pos(std::find_first_of(cbegin() + pos, cend(), v.cbegin(), v.cend(), Traits::eq));
+ }
+
+ nssv_constexpr size_type find_first_of(CharT c, size_type pos = 0) const nssv_noexcept // (2)
+ {
+ return find_first_of(basic_string_view(&c, 1), pos);
+ }
+
+ nssv_constexpr size_type find_first_of(CharT const *s, size_type pos, size_type n) const // (3)
+ {
+ return find_first_of(basic_string_view(s, n), pos);
+ }
+
+ nssv_constexpr size_type find_first_of(CharT const *s, size_type pos = 0) const // (4)
+ {
+ return find_first_of(basic_string_view(s), pos);
+ }
+
+ // find_last_of(), 4x:
+
+ nssv_constexpr size_type find_last_of(basic_string_view v, size_type pos = npos) const nssv_noexcept // (1)
+ {
+ return empty() ? npos
+ : pos >= size() ? find_last_of(v, size() - 1)
+ : to_pos(std::find_first_of(const_reverse_iterator(cbegin() + pos + 1), crend(),
+ v.cbegin(), v.cend(), Traits::eq));
+ }
+
+ nssv_constexpr size_type find_last_of(CharT c, size_type pos = npos) const nssv_noexcept // (2)
+ {
+ return find_last_of(basic_string_view(&c, 1), pos);
+ }
+
+ nssv_constexpr size_type find_last_of(CharT const *s, size_type pos, size_type count) const // (3)
+ {
+ return find_last_of(basic_string_view(s, count), pos);
+ }
+
+ nssv_constexpr size_type find_last_of(CharT const *s, size_type pos = npos) const // (4)
+ {
+ return find_last_of(basic_string_view(s), pos);
+ }
+
+ // find_first_not_of(), 4x:
+
+ nssv_constexpr size_type find_first_not_of(basic_string_view v, size_type pos = 0) const nssv_noexcept // (1)
+ {
+ return pos >= size() ? npos : to_pos(std::find_if(cbegin() + pos, cend(), not_in_view(v)));
+ }
+
+ nssv_constexpr size_type find_first_not_of(CharT c, size_type pos = 0) const nssv_noexcept // (2)
+ {
+ return find_first_not_of(basic_string_view(&c, 1), pos);
+ }
+
+ nssv_constexpr size_type find_first_not_of(CharT const *s, size_type pos, size_type count) const // (3)
+ {
+ return find_first_not_of(basic_string_view(s, count), pos);
+ }
+
+ nssv_constexpr size_type find_first_not_of(CharT const *s, size_type pos = 0) const // (4)
+ {
+ return find_first_not_of(basic_string_view(s), pos);
+ }
+
+ // find_last_not_of(), 4x:
+
+ nssv_constexpr size_type find_last_not_of(basic_string_view v, size_type pos = npos) const nssv_noexcept // (1)
+ {
+ return empty() ? npos
+ : pos >= size()
+ ? find_last_not_of(v, size() - 1)
+ : to_pos(std::find_if(const_reverse_iterator(cbegin() + pos + 1), crend(), not_in_view(v)));
+ }
+
+ nssv_constexpr size_type find_last_not_of(CharT c, size_type pos = npos) const nssv_noexcept // (2)
+ {
+ return find_last_not_of(basic_string_view(&c, 1), pos);
+ }
+
+ nssv_constexpr size_type find_last_not_of(CharT const *s, size_type pos, size_type count) const // (3)
+ {
+ return find_last_not_of(basic_string_view(s, count), pos);
+ }
+
+ nssv_constexpr size_type find_last_not_of(CharT const *s, size_type pos = npos) const // (4)
+ {
+ return find_last_not_of(basic_string_view(s), pos);
+ }
+
+ // Constants:
+
+#if nssv_CPP17_OR_GREATER
+ static nssv_constexpr size_type npos = size_type(-1);
+#elif nssv_CPP11_OR_GREATER
+ enum : size_type { npos = size_type(-1) };
+#else
+ enum { npos = size_type(-1) };
+#endif
+
+ private:
+ struct not_in_view {
+ const basic_string_view v;
+
+ nssv_constexpr explicit not_in_view(basic_string_view v) : v(v) {}
+
+ nssv_constexpr bool operator()(CharT c) const { return npos == v.find_first_of(c); }
+ };
+
+ nssv_constexpr size_type to_pos(const_iterator it) const { return it == cend() ? npos : size_type(it - cbegin()); }
+
+ nssv_constexpr size_type to_pos(const_reverse_iterator it) const {
+ return it == crend() ? npos : size_type(crend() - it - 1);
+ }
+
+ nssv_constexpr const_reference data_at(size_type pos) const {
+#if nssv_BETWEEN(nssv_COMPILER_GNUC_VERSION, 1, 500)
+ return data_[pos];
+#else
+ return assert(pos < size()), data_[pos];
+#endif
+ }
+
+ private:
+ const_pointer data_;
+ size_type size_;
+
+ public:
+#if nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS
+
+ template <class Allocator>
+ basic_string_view(std::basic_string<CharT, Traits, Allocator> const &s) nssv_noexcept : data_(s.data()),
+ size_(s.size()) {}
+
+#if nssv_HAVE_EXPLICIT_CONVERSION
+
+ template <class Allocator> explicit operator std::basic_string<CharT, Traits, Allocator>() const {
+ return to_string(Allocator());
+ }
+
+#endif // nssv_HAVE_EXPLICIT_CONVERSION
+
+#if nssv_CPP11_OR_GREATER
+
+ template <class Allocator = std::allocator<CharT>>
+ std::basic_string<CharT, Traits, Allocator> to_string(Allocator const &a = Allocator()) const {
+ return std::basic_string<CharT, Traits, Allocator>(begin(), end(), a);
+ }
+
+#else
+
+ std::basic_string<CharT, Traits> to_string() const { return std::basic_string<CharT, Traits>(begin(), end()); }
+
+ template <class Allocator> std::basic_string<CharT, Traits, Allocator> to_string(Allocator const &a) const {
+ return std::basic_string<CharT, Traits, Allocator>(begin(), end(), a);
+ }
+
+#endif // nssv_CPP11_OR_GREATER
+
+#endif // nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS
+ };
+
+ //
+ // Non-member functions:
+ //
+
+ // 24.4.3 Non-member comparison functions:
+ // lexicographically compare two string views (function template):
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator==(basic_string_view<CharT, Traits> lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) == 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator!=(basic_string_view<CharT, Traits> lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) != 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<(basic_string_view<CharT, Traits> lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) < 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<=(basic_string_view<CharT, Traits> lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) <= 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>(basic_string_view<CharT, Traits> lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) > 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>=(basic_string_view<CharT, Traits> lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) >= 0;
+ }
+
+ // Let S be basic_string_view<CharT, Traits>, and sv be an instance of S.
+ // Implementations shall provide sufficient additional overloads marked
+ // constexpr and noexcept so that an object t with an implicit conversion
+ // to S can be compared according to Table 67.
+
+#if !nssv_CPP11_OR_GREATER || nssv_BETWEEN(nssv_COMPILER_MSVC_VERSION, 100, 141)
+
+ // accomodate for older compilers:
+
+ // ==
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator==(basic_string_view<CharT, Traits> lhs, char const *rhs) nssv_noexcept {
+ return lhs.compare(rhs) == 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator==(char const *lhs, basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return rhs.compare(lhs) == 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator==(basic_string_view<CharT, Traits> lhs,
+ std::basic_string<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.size() == rhs.size() && lhs.compare(rhs) == 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator==(std::basic_string<CharT, Traits> rhs,
+ basic_string_view<CharT, Traits> lhs) nssv_noexcept {
+ return lhs.size() == rhs.size() && lhs.compare(rhs) == 0;
+ }
+
+ // !=
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator!=(basic_string_view<CharT, Traits> lhs, char const *rhs) nssv_noexcept {
+ return lhs.compare(rhs) != 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator!=(char const *lhs, basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return rhs.compare(lhs) != 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator!=(basic_string_view<CharT, Traits> lhs,
+ std::basic_string<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.size() != rhs.size() && lhs.compare(rhs) != 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator!=(std::basic_string<CharT, Traits> rhs,
+ basic_string_view<CharT, Traits> lhs) nssv_noexcept {
+ return lhs.size() != rhs.size() || rhs.compare(lhs) != 0;
+ }
+
+ // <
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<(basic_string_view<CharT, Traits> lhs, char const *rhs) nssv_noexcept {
+ return lhs.compare(rhs) < 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<(char const *lhs, basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return rhs.compare(lhs) > 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<(basic_string_view<CharT, Traits> lhs,
+ std::basic_string<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) < 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<(std::basic_string<CharT, Traits> rhs,
+ basic_string_view<CharT, Traits> lhs) nssv_noexcept {
+ return rhs.compare(lhs) > 0;
+ }
+
+ // <=
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<=(basic_string_view<CharT, Traits> lhs, char const *rhs) nssv_noexcept {
+ return lhs.compare(rhs) <= 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<=(char const *lhs, basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return rhs.compare(lhs) >= 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<=(basic_string_view<CharT, Traits> lhs,
+ std::basic_string<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) <= 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<=(std::basic_string<CharT, Traits> rhs,
+ basic_string_view<CharT, Traits> lhs) nssv_noexcept {
+ return rhs.compare(lhs) >= 0;
+ }
+
+ // >
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>(basic_string_view<CharT, Traits> lhs, char const *rhs) nssv_noexcept {
+ return lhs.compare(rhs) > 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>(char const *lhs, basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return rhs.compare(lhs) < 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>(basic_string_view<CharT, Traits> lhs,
+ std::basic_string<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) > 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>(std::basic_string<CharT, Traits> rhs,
+ basic_string_view<CharT, Traits> lhs) nssv_noexcept {
+ return rhs.compare(lhs) < 0;
+ }
+
+ // >=
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>=(basic_string_view<CharT, Traits> lhs, char const *rhs) nssv_noexcept {
+ return lhs.compare(rhs) >= 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>=(char const *lhs, basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return rhs.compare(lhs) <= 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>=(basic_string_view<CharT, Traits> lhs,
+ std::basic_string<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) >= 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>=(std::basic_string<CharT, Traits> rhs,
+ basic_string_view<CharT, Traits> lhs) nssv_noexcept {
+ return rhs.compare(lhs) <= 0;
+ }
+
+#else // newer compilers:
+
+#define nssv_BASIC_STRING_VIEW_I(T, U) typename std::decay<basic_string_view<T, U>>::type
+
+#if nssv_BETWEEN(nssv_COMPILER_MSVC_VERSION, 140, 150)
+#define nssv_MSVC_ORDER(x) , int = x
+#else
+#define nssv_MSVC_ORDER(x) /*, int=x*/
+#endif
+
+ // ==
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(1)>
+ nssv_constexpr bool operator==(basic_string_view<CharT, Traits> lhs,
+ nssv_BASIC_STRING_VIEW_I(CharT, Traits) rhs) nssv_noexcept {
+ return lhs.compare(rhs) == 0;
+ }
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(2)>
+ nssv_constexpr bool operator==(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.size() == rhs.size() && lhs.compare(rhs) == 0;
+ }
+
+ // !=
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(1)>
+ nssv_constexpr bool operator!=(basic_string_view<CharT, Traits> lhs,
+ nssv_BASIC_STRING_VIEW_I(CharT, Traits) rhs) nssv_noexcept {
+ return lhs.size() != rhs.size() || lhs.compare(rhs) != 0;
+ }
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(2)>
+ nssv_constexpr bool operator!=(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) != 0;
+ }
+
+ // <
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(1)>
+ nssv_constexpr bool operator<(basic_string_view<CharT, Traits> lhs,
+ nssv_BASIC_STRING_VIEW_I(CharT, Traits) rhs) nssv_noexcept {
+ return lhs.compare(rhs) < 0;
+ }
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(2)>
+ nssv_constexpr bool operator<(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) < 0;
+ }
+
+ // <=
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(1)>
+ nssv_constexpr bool operator<=(basic_string_view<CharT, Traits> lhs,
+ nssv_BASIC_STRING_VIEW_I(CharT, Traits) rhs) nssv_noexcept {
+ return lhs.compare(rhs) <= 0;
+ }
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(2)>
+ nssv_constexpr bool operator<=(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) <= 0;
+ }
+
+ // >
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(1)>
+ nssv_constexpr bool operator>(basic_string_view<CharT, Traits> lhs,
+ nssv_BASIC_STRING_VIEW_I(CharT, Traits) rhs) nssv_noexcept {
+ return lhs.compare(rhs) > 0;
+ }
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(2)>
+ nssv_constexpr bool operator>(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) > 0;
+ }
+
+ // >=
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(1)>
+ nssv_constexpr bool operator>=(basic_string_view<CharT, Traits> lhs,
+ nssv_BASIC_STRING_VIEW_I(CharT, Traits) rhs) nssv_noexcept {
+ return lhs.compare(rhs) >= 0;
+ }
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(2)>
+ nssv_constexpr bool operator>=(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) >= 0;
+ }
+
+#undef nssv_MSVC_ORDER
+#undef nssv_BASIC_STRING_VIEW_I
+
+#endif // compiler-dependent approach to comparisons
+
+ // 24.4.4 Inserters and extractors:
+
+ namespace detail {
+
+ template <class Stream> void write_padding(Stream &os, std::streamsize n) {
+ for (std::streamsize i = 0; i < n; ++i)
+ os.rdbuf()->sputc(os.fill());
+ }
+
+ template <class Stream, class View> Stream &write_to_stream(Stream &os, View const &sv) {
+ typename Stream::sentry sentry(os);
+
+ if (!os)
+ return os;
+
+ const std::streamsize length = static_cast<std::streamsize>(sv.length());
+
+ // Whether, and how, to pad:
+ const bool pad = (length < os.width());
+ const bool left_pad = pad && (os.flags() & std::ios_base::adjustfield) == std::ios_base::right;
+
+ if (left_pad)
+ write_padding(os, os.width() - length);
+
+ // Write span characters:
+ os.rdbuf()->sputn(sv.begin(), length);
+
+ if (pad && !left_pad)
+ write_padding(os, os.width() - length);
+
+ // Reset output stream width:
+ os.width(0);
+
+ return os;
+ }
+
+ } // namespace detail
+
+ template <class CharT, class Traits>
+ std::basic_ostream<CharT, Traits> &operator<<(std::basic_ostream<CharT, Traits> &os,
+ basic_string_view<CharT, Traits> sv) {
+ return detail::write_to_stream(os, sv);
+ }
+
+ // Several typedefs for common character types are provided:
+
+ typedef basic_string_view<char> string_view;
+ typedef basic_string_view<wchar_t> wstring_view;
+#if nssv_HAVE_WCHAR16_T
+ typedef basic_string_view<char16_t> u16string_view;
+ typedef basic_string_view<char32_t> u32string_view;
+#endif
+
+ } // namespace sv_lite
+} // namespace nonstd::sv_lite
+
+//
+// 24.4.6 Suffix for basic_string_view literals:
+//
+
+#if nssv_HAVE_USER_DEFINED_LITERALS
+
+namespace nonstd {
+nssv_inline_ns namespace literals {
+ nssv_inline_ns namespace string_view_literals {
+
+#if nssv_CONFIG_STD_SV_OPERATOR && nssv_HAVE_STD_DEFINED_LITERALS
+
+ nssv_constexpr nonstd::sv_lite::string_view operator"" sv(const char *str, size_t len) nssv_noexcept // (1)
+ {
+ return nonstd::sv_lite::string_view {str, len};
+ }
+
+ nssv_constexpr nonstd::sv_lite::u16string_view operator"" sv(const char16_t *str, size_t len) nssv_noexcept // (2)
+ {
+ return nonstd::sv_lite::u16string_view {str, len};
+ }
+
+ nssv_constexpr nonstd::sv_lite::u32string_view operator"" sv(const char32_t *str, size_t len) nssv_noexcept // (3)
+ {
+ return nonstd::sv_lite::u32string_view {str, len};
+ }
+
+ nssv_constexpr nonstd::sv_lite::wstring_view operator"" sv(const wchar_t *str, size_t len) nssv_noexcept // (4)
+ {
+ return nonstd::sv_lite::wstring_view {str, len};
+ }
+
+#endif // nssv_CONFIG_STD_SV_OPERATOR && nssv_HAVE_STD_DEFINED_LITERALS
+
+#if nssv_CONFIG_USR_SV_OPERATOR
+
+ nssv_constexpr nonstd::sv_lite::string_view operator"" _sv(const char *str, size_t len) nssv_noexcept // (1)
+ {
+ return nonstd::sv_lite::string_view {str, len};
+ }
+
+ nssv_constexpr nonstd::sv_lite::u16string_view operator"" _sv(const char16_t *str, size_t len) nssv_noexcept // (2)
+ {
+ return nonstd::sv_lite::u16string_view {str, len};
+ }
+
+ nssv_constexpr nonstd::sv_lite::u32string_view operator"" _sv(const char32_t *str, size_t len) nssv_noexcept // (3)
+ {
+ return nonstd::sv_lite::u32string_view {str, len};
+ }
+
+ nssv_constexpr nonstd::sv_lite::wstring_view operator"" _sv(const wchar_t *str, size_t len) nssv_noexcept // (4)
+ {
+ return nonstd::sv_lite::wstring_view {str, len};
+ }
+
+#endif // nssv_CONFIG_USR_SV_OPERATOR
+ }
+}
+} // namespace nonstd
+
+#endif
+
+//
+// Extensions for std::string:
+//
+
+#if nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
+
+namespace nonstd {
+namespace sv_lite {
+
+// Exclude MSVC 14 (19.00): it yields ambiguous to_string():
+
+#if nssv_CPP11_OR_GREATER && nssv_COMPILER_MSVC_VERSION != 140
+
+template <class CharT, class Traits, class Allocator = std::allocator<CharT>>
+std::basic_string<CharT, Traits, Allocator> to_string(basic_string_view<CharT, Traits> v,
+ Allocator const &a = Allocator()) {
+ return std::basic_string<CharT, Traits, Allocator>(v.begin(), v.end(), a);
+}
+
+#else
+
+template <class CharT, class Traits> std::basic_string<CharT, Traits> to_string(basic_string_view<CharT, Traits> v) {
+ return std::basic_string<CharT, Traits>(v.begin(), v.end());
+}
+
+template <class CharT, class Traits, class Allocator>
+std::basic_string<CharT, Traits, Allocator> to_string(basic_string_view<CharT, Traits> v, Allocator const &a) {
+ return std::basic_string<CharT, Traits, Allocator>(v.begin(), v.end(), a);
+}
+
+#endif // nssv_CPP11_OR_GREATER
+
+template <class CharT, class Traits, class Allocator>
+basic_string_view<CharT, Traits> to_string_view(std::basic_string<CharT, Traits, Allocator> const &s) {
+ return basic_string_view<CharT, Traits>(s.data(), s.size());
+}
+
+} // namespace sv_lite
+} // namespace nonstd
+
+#endif // nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
+
+//
+// make types and algorithms available in namespace nonstd:
+//
+
+namespace nonstd {
+
+using sv_lite::basic_string_view;
+using sv_lite::string_view;
+using sv_lite::wstring_view;
+
+#if nssv_HAVE_WCHAR16_T
+using sv_lite::u16string_view;
+#endif
+#if nssv_HAVE_WCHAR32_T
+using sv_lite::u32string_view;
+#endif
+
+// literal "sv"
+
+using sv_lite::operator==;
+using sv_lite::operator!=;
+using sv_lite::operator<;
+using sv_lite::operator<=;
+using sv_lite::operator>;
+using sv_lite::operator>=;
+
+using sv_lite::operator<<;
+
+#if nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
+using sv_lite::to_string;
+using sv_lite::to_string_view;
+#endif
+
+} // namespace nonstd
+
+// 24.4.5 Hash support (C++11):
+
+// Note: The hash value of a string view object is equal to the hash value of
+// the corresponding string object.
+
+#if nssv_HAVE_STD_HASH
+
+#include <functional>
+
+namespace std {
+
+template <> struct hash<nonstd::string_view> {
+public:
+ std::size_t operator()(nonstd::string_view v) const nssv_noexcept {
+ return std::hash<std::string>()(std::string(v.data(), v.size()));
+ }
+};
+
+template <> struct hash<nonstd::wstring_view> {
+public:
+ std::size_t operator()(nonstd::wstring_view v) const nssv_noexcept {
+ return std::hash<std::wstring>()(std::wstring(v.data(), v.size()));
+ }
+};
+
+template <> struct hash<nonstd::u16string_view> {
+public:
+ std::size_t operator()(nonstd::u16string_view v) const nssv_noexcept {
+ return std::hash<std::u16string>()(std::u16string(v.data(), v.size()));
+ }
+};
+
+template <> struct hash<nonstd::u32string_view> {
+public:
+ std::size_t operator()(nonstd::u32string_view v) const nssv_noexcept {
+ return std::hash<std::u32string>()(std::u32string(v.data(), v.size()));
+ }
+};
+
+} // namespace std
+
+#endif // nssv_HAVE_STD_HASH
+
+nssv_RESTORE_WARNINGS()
+
+#endif // nssv_HAVE_STD_STRING_VIEW
+#endif // NONSTD_SV_LITE_H_INCLUDED
diff --git a/deps/inja/include/inja/template.hpp b/deps/inja/include/inja/template.hpp
new file mode 100644
index 0000000..9de0a96
--- /dev/null
+++ b/deps/inja/include/inja/template.hpp
@@ -0,0 +1,39 @@
+// Copyright (c) 2019 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_TEMPLATE_HPP_
+#define INCLUDE_INJA_TEMPLATE_HPP_
+
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "node.hpp"
+#include "statistics.hpp"
+
+
+namespace inja {
+
+/*!
+ * \brief The main inja Template.
+ */
+struct Template {
+ BlockNode root;
+ std::string content;
+
+ explicit Template() { }
+ explicit Template(const std::string& content): content(content) { }
+
+ /// Return number of variables (total number, not distinct ones) in the template
+ int count_variables() {
+ auto statistic_visitor = StatisticsVisitor();
+ root.accept(statistic_visitor);
+ return statistic_visitor.variable_counter;
+ }
+};
+
+using TemplateStorage = std::map<std::string, Template>;
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_TEMPLATE_HPP_
diff --git a/deps/inja/include/inja/token.hpp b/deps/inja/include/inja/token.hpp
new file mode 100644
index 0000000..c000138
--- /dev/null
+++ b/deps/inja/include/inja/token.hpp
@@ -0,0 +1,76 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_TOKEN_HPP_
+#define INCLUDE_INJA_TOKEN_HPP_
+
+#include <string>
+
+#include "string_view.hpp"
+
+namespace inja {
+
+/*!
+ * \brief Helper-class for the inja Lexer.
+ */
+struct Token {
+ enum class Kind {
+ Text,
+ ExpressionOpen, // {{
+ ExpressionClose, // }}
+ LineStatementOpen, // ##
+ LineStatementClose, // \n
+ StatementOpen, // {%
+ StatementClose, // %}
+ CommentOpen, // {#
+ CommentClose, // #}
+ Id, // this, this.foo
+ Number, // 1, 2, -1, 5.2, -5.3
+ String, // "this"
+ Plus, // +
+ Minus, // -
+ Times, // *
+ Slash, // /
+ Percent, // %
+ Power, // ^
+ Comma, // ,
+ Dot, // .
+ Colon, // :
+ LeftParen, // (
+ RightParen, // )
+ LeftBracket, // [
+ RightBracket, // ]
+ LeftBrace, // {
+ RightBrace, // }
+ Equal, // ==
+ NotEqual, // !=
+ GreaterThan, // >
+ GreaterEqual, // >=
+ LessThan, // <
+ LessEqual, // <=
+ Unknown,
+ Eof,
+ };
+
+ Kind kind {Kind::Unknown};
+ nonstd::string_view text;
+
+ explicit constexpr Token() = default;
+ explicit constexpr Token(Kind kind, nonstd::string_view text) : kind(kind), text(text) {}
+
+ std::string describe() const {
+ switch (kind) {
+ case Kind::Text:
+ return "<text>";
+ case Kind::LineStatementClose:
+ return "<eol>";
+ case Kind::Eof:
+ return "<eof>";
+ default:
+ return static_cast<std::string>(text);
+ }
+ }
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_TOKEN_HPP_
diff --git a/deps/inja/include/inja/utils.hpp b/deps/inja/include/inja/utils.hpp
new file mode 100644
index 0000000..fb1736c
--- /dev/null
+++ b/deps/inja/include/inja/utils.hpp
@@ -0,0 +1,70 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_UTILS_HPP_
+#define INCLUDE_INJA_UTILS_HPP_
+
+#include <algorithm>
+#include <fstream>
+#include <string>
+#include <utility>
+
+#include "exceptions.hpp"
+#include "string_view.hpp"
+
+namespace inja {
+
+inline void open_file_or_throw(const std::string &path, std::ifstream &file) {
+ file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
+ try {
+ file.open(path);
+ } catch (const std::ios_base::failure & /*e*/) {
+ INJA_THROW(FileError("failed accessing file at '" + path + "'"));
+ }
+}
+
+namespace string_view {
+inline nonstd::string_view slice(nonstd::string_view view, size_t start, size_t end) {
+ start = std::min(start, view.size());
+ end = std::min(std::max(start, end), view.size());
+ return view.substr(start, end - start);
+}
+
+inline std::pair<nonstd::string_view, nonstd::string_view> split(nonstd::string_view view, char Separator) {
+ size_t idx = view.find(Separator);
+ if (idx == nonstd::string_view::npos) {
+ return std::make_pair(view, nonstd::string_view());
+ }
+ return std::make_pair(slice(view, 0, idx), slice(view, idx + 1, nonstd::string_view::npos));
+}
+
+inline bool starts_with(nonstd::string_view view, nonstd::string_view prefix) {
+ return (view.size() >= prefix.size() && view.compare(0, prefix.size(), prefix) == 0);
+}
+} // namespace string_view
+
+inline SourceLocation get_source_location(nonstd::string_view content, size_t pos) {
+ // Get line and offset position (starts at 1:1)
+ auto sliced = string_view::slice(content, 0, pos);
+ std::size_t last_newline = sliced.rfind("\n");
+
+ if (last_newline == nonstd::string_view::npos) {
+ return {1, sliced.length() + 1};
+ }
+
+ // Count newlines
+ size_t count_lines = 0;
+ size_t search_start = 0;
+ while (search_start <= sliced.size()) {
+ search_start = sliced.find("\n", search_start) + 1;
+ if (search_start == 0) {
+ break;
+ }
+ count_lines += 1;
+ }
+
+ return {count_lines + 1, sliced.length() - last_newline};
+}
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_UTILS_HPP_
diff --git a/deps/inja/meson.build b/deps/inja/meson.build
new file mode 100644
index 0000000..6797057
--- /dev/null
+++ b/deps/inja/meson.build
@@ -0,0 +1,49 @@
+project('inja', 'cpp', default_options: ['cpp_std=c++17'])
+
+
+#option('build_tests', type: 'boolean', value: true)
+#option('build_benchmark', type: 'boolean', value: true)
+
+
+inja_dep = declare_dependency(
+ include_directories: include_directories('include', 'third_party/include')
+)
+
+
+
+amalg_script = files('scripts/update_single_include.sh')
+
+amalg_files = files(
+ 'include/inja/inja.hpp',
+ 'include/inja/renderer.hpp',
+ 'include/inja/environment.hpp',
+)
+
+amalg_tgt = run_target( 'amalg',
+ command: amalg_script
+)
+
+
+inja_test = executable(
+ 'inja_test',
+ 'test/test.cpp',
+ dependencies: inja_dep
+)
+
+inja_single_test = executable(
+ 'inja_single_test',
+ 'test/test.cpp',
+ 'single_include/inja/inja.hpp',
+ dependencies: [inja_dep]
+)
+
+
+inja_benchmark = executable(
+ 'inja_benchmark',
+ 'test/benchmark.cpp',
+ dependencies: inja_dep
+)
+
+
+test('Inja unit test', inja_test)
+test('Inja single include test', inja_single_test)
diff --git a/deps/inja/requirements.txt b/deps/inja/requirements.txt
new file mode 100644
index 0000000..27ab78a
--- /dev/null
+++ b/deps/inja/requirements.txt
@@ -0,0 +1 @@
+nlohmann/json@v3.8.0
diff --git a/deps/inja/scripts/amalgamate_config.json b/deps/inja/scripts/amalgamate_config.json
new file mode 100644
index 0000000..71cff85
--- /dev/null
+++ b/deps/inja/scripts/amalgamate_config.json
@@ -0,0 +1,9 @@
+{
+ "project": "inja",
+ "target": "single_include/inja/inja.hpp",
+ "sources": [
+ "inja/inja.hpp"
+ ],
+ "include_paths": [
+ ]
+}
diff --git a/deps/inja/scripts/update_single_include.sh b/deps/inja/scripts/update_single_include.sh
new file mode 100755
index 0000000..ca86063
--- /dev/null
+++ b/deps/inja/scripts/update_single_include.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
+cd $(dirname "${DIR}")
+
+python3 third_party/amalgamate/amalgamate.py -c scripts/amalgamate_config.json -s include -v yes
diff --git a/deps/inja/single_include/inja/inja.hpp b/deps/inja/single_include/inja/inja.hpp
new file mode 100644
index 0000000..42dea1c
--- /dev/null
+++ b/deps/inja/single_include/inja/inja.hpp
@@ -0,0 +1,4164 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_INJA_HPP_
+#define INCLUDE_INJA_INJA_HPP_
+
+#include <nlohmann/json.hpp>
+
+#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(INJA_NOEXCEPTION)
+ #define INJA_THROW(exception) throw exception
+#else
+ #include <cstdlib>
+ #define INJA_THROW(exception) std::abort()
+#endif
+
+// #include "environment.hpp"
+// Copyright (c) 2019 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_ENVIRONMENT_HPP_
+#define INCLUDE_INJA_ENVIRONMENT_HPP_
+
+#include <fstream>
+#include <iostream>
+#include <memory>
+#include <sstream>
+#include <string>
+
+#include <nlohmann/json.hpp>
+
+// #include "config.hpp"
+// Copyright (c) 2019 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_CONFIG_HPP_
+#define INCLUDE_INJA_CONFIG_HPP_
+
+#include <functional>
+#include <string>
+
+// #include "string_view.hpp"
+// Copyright 2017-2019 by Martin Moene
+//
+// string-view lite, a C++17-like string_view for C++98 and later.
+// For more information see https://github.com/martinmoene/string-view-lite
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+
+#ifndef NONSTD_SV_LITE_H_INCLUDED
+#define NONSTD_SV_LITE_H_INCLUDED
+
+#define string_view_lite_MAJOR 1
+#define string_view_lite_MINOR 4
+#define string_view_lite_PATCH 0
+
+#define string_view_lite_VERSION \
+ nssv_STRINGIFY(string_view_lite_MAJOR) "." nssv_STRINGIFY(string_view_lite_MINOR) "." nssv_STRINGIFY( \
+ string_view_lite_PATCH)
+
+#define nssv_STRINGIFY(x) nssv_STRINGIFY_(x)
+#define nssv_STRINGIFY_(x) #x
+
+// string-view lite configuration:
+
+#define nssv_STRING_VIEW_DEFAULT 0
+#define nssv_STRING_VIEW_NONSTD 1
+#define nssv_STRING_VIEW_STD 2
+
+#if !defined(nssv_CONFIG_SELECT_STRING_VIEW)
+#define nssv_CONFIG_SELECT_STRING_VIEW (nssv_HAVE_STD_STRING_VIEW ? nssv_STRING_VIEW_STD : nssv_STRING_VIEW_NONSTD)
+#endif
+
+#if defined(nssv_CONFIG_SELECT_STD_STRING_VIEW) || defined(nssv_CONFIG_SELECT_NONSTD_STRING_VIEW)
+#error nssv_CONFIG_SELECT_STD_STRING_VIEW and nssv_CONFIG_SELECT_NONSTD_STRING_VIEW are deprecated and removed, please use nssv_CONFIG_SELECT_STRING_VIEW=nssv_STRING_VIEW_...
+#endif
+
+#ifndef nssv_CONFIG_STD_SV_OPERATOR
+#define nssv_CONFIG_STD_SV_OPERATOR 0
+#endif
+
+#ifndef nssv_CONFIG_USR_SV_OPERATOR
+#define nssv_CONFIG_USR_SV_OPERATOR 1
+#endif
+
+#ifdef nssv_CONFIG_CONVERSION_STD_STRING
+#define nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS nssv_CONFIG_CONVERSION_STD_STRING
+#define nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS nssv_CONFIG_CONVERSION_STD_STRING
+#endif
+
+#ifndef nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS
+#define nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS 1
+#endif
+
+#ifndef nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
+#define nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS 1
+#endif
+
+// Control presence of exception handling (try and auto discover):
+
+#ifndef nssv_CONFIG_NO_EXCEPTIONS
+#if defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)
+#define nssv_CONFIG_NO_EXCEPTIONS 0
+#else
+#define nssv_CONFIG_NO_EXCEPTIONS 1
+#endif
+#endif
+
+// C++ language version detection (C++20 is speculative):
+// Note: VC14.0/1900 (VS2015) lacks too much from C++14.
+
+#ifndef nssv_CPLUSPLUS
+#if defined(_MSVC_LANG) && !defined(__clang__)
+#define nssv_CPLUSPLUS (_MSC_VER == 1900 ? 201103L : _MSVC_LANG)
+#else
+#define nssv_CPLUSPLUS __cplusplus
+#endif
+#endif
+
+#define nssv_CPP98_OR_GREATER (nssv_CPLUSPLUS >= 199711L)
+#define nssv_CPP11_OR_GREATER (nssv_CPLUSPLUS >= 201103L)
+#define nssv_CPP11_OR_GREATER_ (nssv_CPLUSPLUS >= 201103L)
+#define nssv_CPP14_OR_GREATER (nssv_CPLUSPLUS >= 201402L)
+#define nssv_CPP17_OR_GREATER (nssv_CPLUSPLUS >= 201703L)
+#define nssv_CPP20_OR_GREATER (nssv_CPLUSPLUS >= 202000L)
+
+// use C++17 std::string_view if available and requested:
+
+#if nssv_CPP17_OR_GREATER && defined(__has_include)
+#if __has_include(<string_view> )
+#define nssv_HAVE_STD_STRING_VIEW 1
+#else
+#define nssv_HAVE_STD_STRING_VIEW 0
+#endif
+#else
+#define nssv_HAVE_STD_STRING_VIEW 0
+#endif
+
+#define nssv_USES_STD_STRING_VIEW \
+ ((nssv_CONFIG_SELECT_STRING_VIEW == nssv_STRING_VIEW_STD) || \
+ ((nssv_CONFIG_SELECT_STRING_VIEW == nssv_STRING_VIEW_DEFAULT) && nssv_HAVE_STD_STRING_VIEW))
+
+#define nssv_HAVE_STARTS_WITH (nssv_CPP20_OR_GREATER || !nssv_USES_STD_STRING_VIEW)
+#define nssv_HAVE_ENDS_WITH nssv_HAVE_STARTS_WITH
+
+//
+// Use C++17 std::string_view:
+//
+
+#if nssv_USES_STD_STRING_VIEW
+
+#include <string_view>
+
+// Extensions for std::string:
+
+#if nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
+
+namespace nonstd {
+
+template <class CharT, class Traits, class Allocator = std::allocator<CharT>>
+std::basic_string<CharT, Traits, Allocator> to_string(std::basic_string_view<CharT, Traits> v,
+ Allocator const &a = Allocator()) {
+ return std::basic_string<CharT, Traits, Allocator>(v.begin(), v.end(), a);
+}
+
+template <class CharT, class Traits, class Allocator>
+std::basic_string_view<CharT, Traits> to_string_view(std::basic_string<CharT, Traits, Allocator> const &s) {
+ return std::basic_string_view<CharT, Traits>(s.data(), s.size());
+}
+
+// Literal operators sv and _sv:
+
+#if nssv_CONFIG_STD_SV_OPERATOR
+
+using namespace std::literals::string_view_literals;
+
+#endif
+
+#if nssv_CONFIG_USR_SV_OPERATOR
+
+inline namespace literals {
+inline namespace string_view_literals {
+
+constexpr std::string_view operator"" _sv(const char *str, size_t len) noexcept // (1)
+{
+ return std::string_view {str, len};
+}
+
+constexpr std::u16string_view operator"" _sv(const char16_t *str, size_t len) noexcept // (2)
+{
+ return std::u16string_view {str, len};
+}
+
+constexpr std::u32string_view operator"" _sv(const char32_t *str, size_t len) noexcept // (3)
+{
+ return std::u32string_view {str, len};
+}
+
+constexpr std::wstring_view operator"" _sv(const wchar_t *str, size_t len) noexcept // (4)
+{
+ return std::wstring_view {str, len};
+}
+
+} // namespace string_view_literals
+} // namespace literals
+
+#endif // nssv_CONFIG_USR_SV_OPERATOR
+
+} // namespace nonstd
+
+#endif // nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
+
+namespace nonstd {
+
+using std::basic_string_view;
+using std::string_view;
+using std::u16string_view;
+using std::u32string_view;
+using std::wstring_view;
+
+// literal "sv" and "_sv", see above
+
+using std::operator==;
+using std::operator!=;
+using std::operator<;
+using std::operator<=;
+using std::operator>;
+using std::operator>=;
+
+using std::operator<<;
+
+} // namespace nonstd
+
+#else // nssv_HAVE_STD_STRING_VIEW
+
+//
+// Before C++17: use string_view lite:
+//
+
+// Compiler versions:
+//
+// MSVC++ 6.0 _MSC_VER == 1200 (Visual Studio 6.0)
+// MSVC++ 7.0 _MSC_VER == 1300 (Visual Studio .NET 2002)
+// MSVC++ 7.1 _MSC_VER == 1310 (Visual Studio .NET 2003)
+// MSVC++ 8.0 _MSC_VER == 1400 (Visual Studio 2005)
+// MSVC++ 9.0 _MSC_VER == 1500 (Visual Studio 2008)
+// MSVC++ 10.0 _MSC_VER == 1600 (Visual Studio 2010)
+// MSVC++ 11.0 _MSC_VER == 1700 (Visual Studio 2012)
+// MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)
+// MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015)
+// MSVC++ 14.1 _MSC_VER >= 1910 (Visual Studio 2017)
+
+#if defined(_MSC_VER) && !defined(__clang__)
+#define nssv_COMPILER_MSVC_VER (_MSC_VER)
+#define nssv_COMPILER_MSVC_VERSION (_MSC_VER / 10 - 10 * (5 + (_MSC_VER < 1900)))
+#else
+#define nssv_COMPILER_MSVC_VER 0
+#define nssv_COMPILER_MSVC_VERSION 0
+#endif
+
+#define nssv_COMPILER_VERSION(major, minor, patch) (10 * (10 * (major) + (minor)) + (patch))
+
+#if defined(__clang__)
+#define nssv_COMPILER_CLANG_VERSION nssv_COMPILER_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
+#else
+#define nssv_COMPILER_CLANG_VERSION 0
+#endif
+
+#if defined(__GNUC__) && !defined(__clang__)
+#define nssv_COMPILER_GNUC_VERSION nssv_COMPILER_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
+#else
+#define nssv_COMPILER_GNUC_VERSION 0
+#endif
+
+// half-open range [lo..hi):
+#define nssv_BETWEEN(v, lo, hi) ((lo) <= (v) && (v) < (hi))
+
+// Presence of language and library features:
+
+#ifdef _HAS_CPP0X
+#define nssv_HAS_CPP0X _HAS_CPP0X
+#else
+#define nssv_HAS_CPP0X 0
+#endif
+
+// Unless defined otherwise below, consider VC14 as C++11 for variant-lite:
+
+#if nssv_COMPILER_MSVC_VER >= 1900
+#undef nssv_CPP11_OR_GREATER
+#define nssv_CPP11_OR_GREATER 1
+#endif
+
+#define nssv_CPP11_90 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1500)
+#define nssv_CPP11_100 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1600)
+#define nssv_CPP11_110 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1700)
+#define nssv_CPP11_120 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1800)
+#define nssv_CPP11_140 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1900)
+#define nssv_CPP11_141 (nssv_CPP11_OR_GREATER_ || nssv_COMPILER_MSVC_VER >= 1910)
+
+#define nssv_CPP14_000 (nssv_CPP14_OR_GREATER)
+#define nssv_CPP17_000 (nssv_CPP17_OR_GREATER)
+
+// Presence of C++11 language features:
+
+#define nssv_HAVE_CONSTEXPR_11 nssv_CPP11_140
+#define nssv_HAVE_EXPLICIT_CONVERSION nssv_CPP11_140
+#define nssv_HAVE_INLINE_NAMESPACE nssv_CPP11_140
+#define nssv_HAVE_NOEXCEPT nssv_CPP11_140
+#define nssv_HAVE_NULLPTR nssv_CPP11_100
+#define nssv_HAVE_REF_QUALIFIER nssv_CPP11_140
+#define nssv_HAVE_UNICODE_LITERALS nssv_CPP11_140
+#define nssv_HAVE_USER_DEFINED_LITERALS nssv_CPP11_140
+#define nssv_HAVE_WCHAR16_T nssv_CPP11_100
+#define nssv_HAVE_WCHAR32_T nssv_CPP11_100
+
+#if !((nssv_CPP11_OR_GREATER && nssv_COMPILER_CLANG_VERSION) || nssv_BETWEEN(nssv_COMPILER_CLANG_VERSION, 300, 400))
+#define nssv_HAVE_STD_DEFINED_LITERALS nssv_CPP11_140
+#else
+#define nssv_HAVE_STD_DEFINED_LITERALS 0
+#endif
+
+// Presence of C++14 language features:
+
+#define nssv_HAVE_CONSTEXPR_14 nssv_CPP14_000
+
+// Presence of C++17 language features:
+
+#define nssv_HAVE_NODISCARD nssv_CPP17_000
+
+// Presence of C++ library features:
+
+#define nssv_HAVE_STD_HASH nssv_CPP11_120
+
+// C++ feature usage:
+
+#if nssv_HAVE_CONSTEXPR_11
+#define nssv_constexpr constexpr
+#else
+#define nssv_constexpr /*constexpr*/
+#endif
+
+#if nssv_HAVE_CONSTEXPR_14
+#define nssv_constexpr14 constexpr
+#else
+#define nssv_constexpr14 /*constexpr*/
+#endif
+
+#if nssv_HAVE_EXPLICIT_CONVERSION
+#define nssv_explicit explicit
+#else
+#define nssv_explicit /*explicit*/
+#endif
+
+#if nssv_HAVE_INLINE_NAMESPACE
+#define nssv_inline_ns inline
+#else
+#define nssv_inline_ns /*inline*/
+#endif
+
+#if nssv_HAVE_NOEXCEPT
+#define nssv_noexcept noexcept
+#else
+#define nssv_noexcept /*noexcept*/
+#endif
+
+//#if nssv_HAVE_REF_QUALIFIER
+//# define nssv_ref_qual &
+//# define nssv_refref_qual &&
+//#else
+//# define nssv_ref_qual /*&*/
+//# define nssv_refref_qual /*&&*/
+//#endif
+
+#if nssv_HAVE_NULLPTR
+#define nssv_nullptr nullptr
+#else
+#define nssv_nullptr NULL
+#endif
+
+#if nssv_HAVE_NODISCARD
+#define nssv_nodiscard [[nodiscard]]
+#else
+#define nssv_nodiscard /*[[nodiscard]]*/
+#endif
+
+// Additional includes:
+
+#include <algorithm>
+#include <cassert>
+#include <iterator>
+#include <limits>
+#include <ostream>
+#include <string> // std::char_traits<>
+
+#if !nssv_CONFIG_NO_EXCEPTIONS
+#include <stdexcept>
+#endif
+
+#if nssv_CPP11_OR_GREATER
+#include <type_traits>
+#endif
+
+// Clang, GNUC, MSVC warning suppression macros:
+
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Wreserved-user-defined-literal"
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wuser-defined-literals"
+#elif defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wliteral-suffix"
+#endif // __clang__
+
+#if nssv_COMPILER_MSVC_VERSION >= 140
+#define nssv_SUPPRESS_MSGSL_WARNING(expr) [[gsl::suppress(expr)]]
+#define nssv_SUPPRESS_MSVC_WARNING(code, descr) __pragma(warning(suppress : code))
+#define nssv_DISABLE_MSVC_WARNINGS(codes) __pragma(warning(push)) __pragma(warning(disable : codes))
+#else
+#define nssv_SUPPRESS_MSGSL_WARNING(expr)
+#define nssv_SUPPRESS_MSVC_WARNING(code, descr)
+#define nssv_DISABLE_MSVC_WARNINGS(codes)
+#endif
+
+#if defined(__clang__)
+#define nssv_RESTORE_WARNINGS() _Pragma("clang diagnostic pop")
+#elif defined(__GNUC__)
+#define nssv_RESTORE_WARNINGS() _Pragma("GCC diagnostic pop")
+#elif nssv_COMPILER_MSVC_VERSION >= 140
+#define nssv_RESTORE_WARNINGS() __pragma(warning(pop))
+#else
+#define nssv_RESTORE_WARNINGS()
+#endif
+
+// Suppress the following MSVC (GSL) warnings:
+// - C4455, non-gsl : 'operator ""sv': literal suffix identifiers that do not
+// start with an underscore are reserved
+// - C26472, gsl::t.1 : don't use a static_cast for arithmetic conversions;
+// use brace initialization, gsl::narrow_cast or gsl::narow
+// - C26481: gsl::b.1 : don't use pointer arithmetic. Use span instead
+
+nssv_DISABLE_MSVC_WARNINGS(4455 26481 26472)
+ // nssv_DISABLE_CLANG_WARNINGS( "-Wuser-defined-literals" )
+ // nssv_DISABLE_GNUC_WARNINGS( -Wliteral-suffix )
+
+ namespace nonstd {
+ namespace sv_lite {
+
+#if nssv_CPP11_OR_GREATER
+
+ namespace detail {
+
+ // Expect tail call optimization to make length() non-recursive:
+
+ template <typename CharT> inline constexpr std::size_t length(CharT *s, std::size_t result = 0) {
+ return *s == '\0' ? result : length(s + 1, result + 1);
+ }
+
+ } // namespace detail
+
+#endif // nssv_CPP11_OR_GREATER
+
+ template <class CharT, class Traits = std::char_traits<CharT>> class basic_string_view;
+
+ //
+ // basic_string_view:
+ //
+
+ template <class CharT, class Traits /* = std::char_traits<CharT> */
+ >
+ class basic_string_view {
+ public:
+ // Member types:
+
+ typedef Traits traits_type;
+ typedef CharT value_type;
+
+ typedef CharT *pointer;
+ typedef CharT const *const_pointer;
+ typedef CharT &reference;
+ typedef CharT const &const_reference;
+
+ typedef const_pointer iterator;
+ typedef const_pointer const_iterator;
+ typedef std::reverse_iterator<const_iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+
+ // 24.4.2.1 Construction and assignment:
+
+ nssv_constexpr basic_string_view() nssv_noexcept : data_(nssv_nullptr), size_(0) {}
+
+#if nssv_CPP11_OR_GREATER
+ nssv_constexpr basic_string_view(basic_string_view const &other) nssv_noexcept = default;
+#else
+ nssv_constexpr basic_string_view(basic_string_view const &other) nssv_noexcept : data_(other.data_),
+ size_(other.size_) {}
+#endif
+
+ nssv_constexpr basic_string_view(CharT const *s, size_type count) nssv_noexcept // non-standard noexcept
+ : data_(s),
+ size_(count) {}
+
+ nssv_constexpr basic_string_view(CharT const *s) nssv_noexcept // non-standard noexcept
+ : data_(s)
+#if nssv_CPP17_OR_GREATER
+ ,
+ size_(Traits::length(s))
+#elif nssv_CPP11_OR_GREATER
+ ,
+ size_(detail::length(s))
+#else
+ ,
+ size_(Traits::length(s))
+#endif
+ {
+ }
+
+ // Assignment:
+
+#if nssv_CPP11_OR_GREATER
+ nssv_constexpr14 basic_string_view &operator=(basic_string_view const &other) nssv_noexcept = default;
+#else
+ nssv_constexpr14 basic_string_view &operator=(basic_string_view const &other) nssv_noexcept {
+ data_ = other.data_;
+ size_ = other.size_;
+ return *this;
+ }
+#endif
+
+ // 24.4.2.2 Iterator support:
+
+ nssv_constexpr const_iterator begin() const nssv_noexcept { return data_; }
+ nssv_constexpr const_iterator end() const nssv_noexcept { return data_ + size_; }
+
+ nssv_constexpr const_iterator cbegin() const nssv_noexcept { return begin(); }
+ nssv_constexpr const_iterator cend() const nssv_noexcept { return end(); }
+
+ nssv_constexpr const_reverse_iterator rbegin() const nssv_noexcept { return const_reverse_iterator(end()); }
+ nssv_constexpr const_reverse_iterator rend() const nssv_noexcept { return const_reverse_iterator(begin()); }
+
+ nssv_constexpr const_reverse_iterator crbegin() const nssv_noexcept { return rbegin(); }
+ nssv_constexpr const_reverse_iterator crend() const nssv_noexcept { return rend(); }
+
+ // 24.4.2.3 Capacity:
+
+ nssv_constexpr size_type size() const nssv_noexcept { return size_; }
+ nssv_constexpr size_type length() const nssv_noexcept { return size_; }
+ nssv_constexpr size_type max_size() const nssv_noexcept { return (std::numeric_limits<size_type>::max)(); }
+
+ // since C++20
+ nssv_nodiscard nssv_constexpr bool empty() const nssv_noexcept { return 0 == size_; }
+
+ // 24.4.2.4 Element access:
+
+ nssv_constexpr const_reference operator[](size_type pos) const { return data_at(pos); }
+
+ nssv_constexpr14 const_reference at(size_type pos) const {
+#if nssv_CONFIG_NO_EXCEPTIONS
+ assert(pos < size());
+#else
+ if (pos >= size()) {
+ throw std::out_of_range("nonstd::string_view::at()");
+ }
+#endif
+ return data_at(pos);
+ }
+
+ nssv_constexpr const_reference front() const { return data_at(0); }
+ nssv_constexpr const_reference back() const { return data_at(size() - 1); }
+
+ nssv_constexpr const_pointer data() const nssv_noexcept { return data_; }
+
+ // 24.4.2.5 Modifiers:
+
+ nssv_constexpr14 void remove_prefix(size_type n) {
+ assert(n <= size());
+ data_ += n;
+ size_ -= n;
+ }
+
+ nssv_constexpr14 void remove_suffix(size_type n) {
+ assert(n <= size());
+ size_ -= n;
+ }
+
+ nssv_constexpr14 void swap(basic_string_view &other) nssv_noexcept {
+ using std::swap;
+ swap(data_, other.data_);
+ swap(size_, other.size_);
+ }
+
+ // 24.4.2.6 String operations:
+
+ size_type copy(CharT *dest, size_type n, size_type pos = 0) const {
+#if nssv_CONFIG_NO_EXCEPTIONS
+ assert(pos <= size());
+#else
+ if (pos > size()) {
+ throw std::out_of_range("nonstd::string_view::copy()");
+ }
+#endif
+ const size_type rlen = (std::min)(n, size() - pos);
+
+ (void)Traits::copy(dest, data() + pos, rlen);
+
+ return rlen;
+ }
+
+ nssv_constexpr14 basic_string_view substr(size_type pos = 0, size_type n = npos) const {
+#if nssv_CONFIG_NO_EXCEPTIONS
+ assert(pos <= size());
+#else
+ if (pos > size()) {
+ throw std::out_of_range("nonstd::string_view::substr()");
+ }
+#endif
+ return basic_string_view(data() + pos, (std::min)(n, size() - pos));
+ }
+
+ // compare(), 6x:
+
+ nssv_constexpr14 int compare(basic_string_view other) const nssv_noexcept // (1)
+ {
+ if (const int result = Traits::compare(data(), other.data(), (std::min)(size(), other.size()))) {
+ return result;
+ }
+
+ return size() == other.size() ? 0 : size() < other.size() ? -1 : 1;
+ }
+
+ nssv_constexpr int compare(size_type pos1, size_type n1, basic_string_view other) const // (2)
+ {
+ return substr(pos1, n1).compare(other);
+ }
+
+ nssv_constexpr int compare(size_type pos1, size_type n1, basic_string_view other, size_type pos2,
+ size_type n2) const // (3)
+ {
+ return substr(pos1, n1).compare(other.substr(pos2, n2));
+ }
+
+ nssv_constexpr int compare(CharT const *s) const // (4)
+ {
+ return compare(basic_string_view(s));
+ }
+
+ nssv_constexpr int compare(size_type pos1, size_type n1, CharT const *s) const // (5)
+ {
+ return substr(pos1, n1).compare(basic_string_view(s));
+ }
+
+ nssv_constexpr int compare(size_type pos1, size_type n1, CharT const *s, size_type n2) const // (6)
+ {
+ return substr(pos1, n1).compare(basic_string_view(s, n2));
+ }
+
+ // 24.4.2.7 Searching:
+
+ // starts_with(), 3x, since C++20:
+
+ nssv_constexpr bool starts_with(basic_string_view v) const nssv_noexcept // (1)
+ {
+ return size() >= v.size() && compare(0, v.size(), v) == 0;
+ }
+
+ nssv_constexpr bool starts_with(CharT c) const nssv_noexcept // (2)
+ {
+ return starts_with(basic_string_view(&c, 1));
+ }
+
+ nssv_constexpr bool starts_with(CharT const *s) const // (3)
+ {
+ return starts_with(basic_string_view(s));
+ }
+
+ // ends_with(), 3x, since C++20:
+
+ nssv_constexpr bool ends_with(basic_string_view v) const nssv_noexcept // (1)
+ {
+ return size() >= v.size() && compare(size() - v.size(), npos, v) == 0;
+ }
+
+ nssv_constexpr bool ends_with(CharT c) const nssv_noexcept // (2)
+ {
+ return ends_with(basic_string_view(&c, 1));
+ }
+
+ nssv_constexpr bool ends_with(CharT const *s) const // (3)
+ {
+ return ends_with(basic_string_view(s));
+ }
+
+ // find(), 4x:
+
+ nssv_constexpr14 size_type find(basic_string_view v, size_type pos = 0) const nssv_noexcept // (1)
+ {
+ return assert(v.size() == 0 || v.data() != nssv_nullptr),
+ pos >= size() ? npos : to_pos(std::search(cbegin() + pos, cend(), v.cbegin(), v.cend(), Traits::eq));
+ }
+
+ nssv_constexpr14 size_type find(CharT c, size_type pos = 0) const nssv_noexcept // (2)
+ {
+ return find(basic_string_view(&c, 1), pos);
+ }
+
+ nssv_constexpr14 size_type find(CharT const *s, size_type pos, size_type n) const // (3)
+ {
+ return find(basic_string_view(s, n), pos);
+ }
+
+ nssv_constexpr14 size_type find(CharT const *s, size_type pos = 0) const // (4)
+ {
+ return find(basic_string_view(s), pos);
+ }
+
+ // rfind(), 4x:
+
+ nssv_constexpr14 size_type rfind(basic_string_view v, size_type pos = npos) const nssv_noexcept // (1)
+ {
+ if (size() < v.size()) {
+ return npos;
+ }
+
+ if (v.empty()) {
+ return (std::min)(size(), pos);
+ }
+
+ const_iterator last = cbegin() + (std::min)(size() - v.size(), pos) + v.size();
+ const_iterator result = std::find_end(cbegin(), last, v.cbegin(), v.cend(), Traits::eq);
+
+ return result != last ? size_type(result - cbegin()) : npos;
+ }
+
+ nssv_constexpr14 size_type rfind(CharT c, size_type pos = npos) const nssv_noexcept // (2)
+ {
+ return rfind(basic_string_view(&c, 1), pos);
+ }
+
+ nssv_constexpr14 size_type rfind(CharT const *s, size_type pos, size_type n) const // (3)
+ {
+ return rfind(basic_string_view(s, n), pos);
+ }
+
+ nssv_constexpr14 size_type rfind(CharT const *s, size_type pos = npos) const // (4)
+ {
+ return rfind(basic_string_view(s), pos);
+ }
+
+ // find_first_of(), 4x:
+
+ nssv_constexpr size_type find_first_of(basic_string_view v, size_type pos = 0) const nssv_noexcept // (1)
+ {
+ return pos >= size() ? npos
+ : to_pos(std::find_first_of(cbegin() + pos, cend(), v.cbegin(), v.cend(), Traits::eq));
+ }
+
+ nssv_constexpr size_type find_first_of(CharT c, size_type pos = 0) const nssv_noexcept // (2)
+ {
+ return find_first_of(basic_string_view(&c, 1), pos);
+ }
+
+ nssv_constexpr size_type find_first_of(CharT const *s, size_type pos, size_type n) const // (3)
+ {
+ return find_first_of(basic_string_view(s, n), pos);
+ }
+
+ nssv_constexpr size_type find_first_of(CharT const *s, size_type pos = 0) const // (4)
+ {
+ return find_first_of(basic_string_view(s), pos);
+ }
+
+ // find_last_of(), 4x:
+
+ nssv_constexpr size_type find_last_of(basic_string_view v, size_type pos = npos) const nssv_noexcept // (1)
+ {
+ return empty() ? npos
+ : pos >= size() ? find_last_of(v, size() - 1)
+ : to_pos(std::find_first_of(const_reverse_iterator(cbegin() + pos + 1), crend(),
+ v.cbegin(), v.cend(), Traits::eq));
+ }
+
+ nssv_constexpr size_type find_last_of(CharT c, size_type pos = npos) const nssv_noexcept // (2)
+ {
+ return find_last_of(basic_string_view(&c, 1), pos);
+ }
+
+ nssv_constexpr size_type find_last_of(CharT const *s, size_type pos, size_type count) const // (3)
+ {
+ return find_last_of(basic_string_view(s, count), pos);
+ }
+
+ nssv_constexpr size_type find_last_of(CharT const *s, size_type pos = npos) const // (4)
+ {
+ return find_last_of(basic_string_view(s), pos);
+ }
+
+ // find_first_not_of(), 4x:
+
+ nssv_constexpr size_type find_first_not_of(basic_string_view v, size_type pos = 0) const nssv_noexcept // (1)
+ {
+ return pos >= size() ? npos : to_pos(std::find_if(cbegin() + pos, cend(), not_in_view(v)));
+ }
+
+ nssv_constexpr size_type find_first_not_of(CharT c, size_type pos = 0) const nssv_noexcept // (2)
+ {
+ return find_first_not_of(basic_string_view(&c, 1), pos);
+ }
+
+ nssv_constexpr size_type find_first_not_of(CharT const *s, size_type pos, size_type count) const // (3)
+ {
+ return find_first_not_of(basic_string_view(s, count), pos);
+ }
+
+ nssv_constexpr size_type find_first_not_of(CharT const *s, size_type pos = 0) const // (4)
+ {
+ return find_first_not_of(basic_string_view(s), pos);
+ }
+
+ // find_last_not_of(), 4x:
+
+ nssv_constexpr size_type find_last_not_of(basic_string_view v, size_type pos = npos) const nssv_noexcept // (1)
+ {
+ return empty() ? npos
+ : pos >= size()
+ ? find_last_not_of(v, size() - 1)
+ : to_pos(std::find_if(const_reverse_iterator(cbegin() + pos + 1), crend(), not_in_view(v)));
+ }
+
+ nssv_constexpr size_type find_last_not_of(CharT c, size_type pos = npos) const nssv_noexcept // (2)
+ {
+ return find_last_not_of(basic_string_view(&c, 1), pos);
+ }
+
+ nssv_constexpr size_type find_last_not_of(CharT const *s, size_type pos, size_type count) const // (3)
+ {
+ return find_last_not_of(basic_string_view(s, count), pos);
+ }
+
+ nssv_constexpr size_type find_last_not_of(CharT const *s, size_type pos = npos) const // (4)
+ {
+ return find_last_not_of(basic_string_view(s), pos);
+ }
+
+ // Constants:
+
+#if nssv_CPP17_OR_GREATER
+ static nssv_constexpr size_type npos = size_type(-1);
+#elif nssv_CPP11_OR_GREATER
+ enum : size_type { npos = size_type(-1) };
+#else
+ enum { npos = size_type(-1) };
+#endif
+
+ private:
+ struct not_in_view {
+ const basic_string_view v;
+
+ nssv_constexpr explicit not_in_view(basic_string_view v) : v(v) {}
+
+ nssv_constexpr bool operator()(CharT c) const { return npos == v.find_first_of(c); }
+ };
+
+ nssv_constexpr size_type to_pos(const_iterator it) const { return it == cend() ? npos : size_type(it - cbegin()); }
+
+ nssv_constexpr size_type to_pos(const_reverse_iterator it) const {
+ return it == crend() ? npos : size_type(crend() - it - 1);
+ }
+
+ nssv_constexpr const_reference data_at(size_type pos) const {
+#if nssv_BETWEEN(nssv_COMPILER_GNUC_VERSION, 1, 500)
+ return data_[pos];
+#else
+ return assert(pos < size()), data_[pos];
+#endif
+ }
+
+ private:
+ const_pointer data_;
+ size_type size_;
+
+ public:
+#if nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS
+
+ template <class Allocator>
+ basic_string_view(std::basic_string<CharT, Traits, Allocator> const &s) nssv_noexcept : data_(s.data()),
+ size_(s.size()) {}
+
+#if nssv_HAVE_EXPLICIT_CONVERSION
+
+ template <class Allocator> explicit operator std::basic_string<CharT, Traits, Allocator>() const {
+ return to_string(Allocator());
+ }
+
+#endif // nssv_HAVE_EXPLICIT_CONVERSION
+
+#if nssv_CPP11_OR_GREATER
+
+ template <class Allocator = std::allocator<CharT>>
+ std::basic_string<CharT, Traits, Allocator> to_string(Allocator const &a = Allocator()) const {
+ return std::basic_string<CharT, Traits, Allocator>(begin(), end(), a);
+ }
+
+#else
+
+ std::basic_string<CharT, Traits> to_string() const { return std::basic_string<CharT, Traits>(begin(), end()); }
+
+ template <class Allocator> std::basic_string<CharT, Traits, Allocator> to_string(Allocator const &a) const {
+ return std::basic_string<CharT, Traits, Allocator>(begin(), end(), a);
+ }
+
+#endif // nssv_CPP11_OR_GREATER
+
+#endif // nssv_CONFIG_CONVERSION_STD_STRING_CLASS_METHODS
+ };
+
+ //
+ // Non-member functions:
+ //
+
+ // 24.4.3 Non-member comparison functions:
+ // lexicographically compare two string views (function template):
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator==(basic_string_view<CharT, Traits> lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) == 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator!=(basic_string_view<CharT, Traits> lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) != 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<(basic_string_view<CharT, Traits> lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) < 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<=(basic_string_view<CharT, Traits> lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) <= 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>(basic_string_view<CharT, Traits> lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) > 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>=(basic_string_view<CharT, Traits> lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) >= 0;
+ }
+
+ // Let S be basic_string_view<CharT, Traits>, and sv be an instance of S.
+ // Implementations shall provide sufficient additional overloads marked
+ // constexpr and noexcept so that an object t with an implicit conversion
+ // to S can be compared according to Table 67.
+
+#if !nssv_CPP11_OR_GREATER || nssv_BETWEEN(nssv_COMPILER_MSVC_VERSION, 100, 141)
+
+ // accomodate for older compilers:
+
+ // ==
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator==(basic_string_view<CharT, Traits> lhs, char const *rhs) nssv_noexcept {
+ return lhs.compare(rhs) == 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator==(char const *lhs, basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return rhs.compare(lhs) == 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator==(basic_string_view<CharT, Traits> lhs,
+ std::basic_string<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.size() == rhs.size() && lhs.compare(rhs) == 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator==(std::basic_string<CharT, Traits> rhs,
+ basic_string_view<CharT, Traits> lhs) nssv_noexcept {
+ return lhs.size() == rhs.size() && lhs.compare(rhs) == 0;
+ }
+
+ // !=
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator!=(basic_string_view<CharT, Traits> lhs, char const *rhs) nssv_noexcept {
+ return lhs.compare(rhs) != 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator!=(char const *lhs, basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return rhs.compare(lhs) != 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator!=(basic_string_view<CharT, Traits> lhs,
+ std::basic_string<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.size() != rhs.size() && lhs.compare(rhs) != 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator!=(std::basic_string<CharT, Traits> rhs,
+ basic_string_view<CharT, Traits> lhs) nssv_noexcept {
+ return lhs.size() != rhs.size() || rhs.compare(lhs) != 0;
+ }
+
+ // <
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<(basic_string_view<CharT, Traits> lhs, char const *rhs) nssv_noexcept {
+ return lhs.compare(rhs) < 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<(char const *lhs, basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return rhs.compare(lhs) > 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<(basic_string_view<CharT, Traits> lhs,
+ std::basic_string<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) < 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<(std::basic_string<CharT, Traits> rhs,
+ basic_string_view<CharT, Traits> lhs) nssv_noexcept {
+ return rhs.compare(lhs) > 0;
+ }
+
+ // <=
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<=(basic_string_view<CharT, Traits> lhs, char const *rhs) nssv_noexcept {
+ return lhs.compare(rhs) <= 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<=(char const *lhs, basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return rhs.compare(lhs) >= 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<=(basic_string_view<CharT, Traits> lhs,
+ std::basic_string<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) <= 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator<=(std::basic_string<CharT, Traits> rhs,
+ basic_string_view<CharT, Traits> lhs) nssv_noexcept {
+ return rhs.compare(lhs) >= 0;
+ }
+
+ // >
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>(basic_string_view<CharT, Traits> lhs, char const *rhs) nssv_noexcept {
+ return lhs.compare(rhs) > 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>(char const *lhs, basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return rhs.compare(lhs) < 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>(basic_string_view<CharT, Traits> lhs,
+ std::basic_string<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) > 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>(std::basic_string<CharT, Traits> rhs,
+ basic_string_view<CharT, Traits> lhs) nssv_noexcept {
+ return rhs.compare(lhs) < 0;
+ }
+
+ // >=
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>=(basic_string_view<CharT, Traits> lhs, char const *rhs) nssv_noexcept {
+ return lhs.compare(rhs) >= 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>=(char const *lhs, basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return rhs.compare(lhs) <= 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>=(basic_string_view<CharT, Traits> lhs,
+ std::basic_string<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) >= 0;
+ }
+
+ template <class CharT, class Traits>
+ nssv_constexpr bool operator>=(std::basic_string<CharT, Traits> rhs,
+ basic_string_view<CharT, Traits> lhs) nssv_noexcept {
+ return rhs.compare(lhs) <= 0;
+ }
+
+#else // newer compilers:
+
+#define nssv_BASIC_STRING_VIEW_I(T, U) typename std::decay<basic_string_view<T, U>>::type
+
+#if nssv_BETWEEN(nssv_COMPILER_MSVC_VERSION, 140, 150)
+#define nssv_MSVC_ORDER(x) , int = x
+#else
+#define nssv_MSVC_ORDER(x) /*, int=x*/
+#endif
+
+ // ==
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(1)>
+ nssv_constexpr bool operator==(basic_string_view<CharT, Traits> lhs,
+ nssv_BASIC_STRING_VIEW_I(CharT, Traits) rhs) nssv_noexcept {
+ return lhs.compare(rhs) == 0;
+ }
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(2)>
+ nssv_constexpr bool operator==(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.size() == rhs.size() && lhs.compare(rhs) == 0;
+ }
+
+ // !=
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(1)>
+ nssv_constexpr bool operator!=(basic_string_view<CharT, Traits> lhs,
+ nssv_BASIC_STRING_VIEW_I(CharT, Traits) rhs) nssv_noexcept {
+ return lhs.size() != rhs.size() || lhs.compare(rhs) != 0;
+ }
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(2)>
+ nssv_constexpr bool operator!=(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) != 0;
+ }
+
+ // <
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(1)>
+ nssv_constexpr bool operator<(basic_string_view<CharT, Traits> lhs,
+ nssv_BASIC_STRING_VIEW_I(CharT, Traits) rhs) nssv_noexcept {
+ return lhs.compare(rhs) < 0;
+ }
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(2)>
+ nssv_constexpr bool operator<(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) < 0;
+ }
+
+ // <=
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(1)>
+ nssv_constexpr bool operator<=(basic_string_view<CharT, Traits> lhs,
+ nssv_BASIC_STRING_VIEW_I(CharT, Traits) rhs) nssv_noexcept {
+ return lhs.compare(rhs) <= 0;
+ }
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(2)>
+ nssv_constexpr bool operator<=(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) <= 0;
+ }
+
+ // >
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(1)>
+ nssv_constexpr bool operator>(basic_string_view<CharT, Traits> lhs,
+ nssv_BASIC_STRING_VIEW_I(CharT, Traits) rhs) nssv_noexcept {
+ return lhs.compare(rhs) > 0;
+ }
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(2)>
+ nssv_constexpr bool operator>(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) > 0;
+ }
+
+ // >=
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(1)>
+ nssv_constexpr bool operator>=(basic_string_view<CharT, Traits> lhs,
+ nssv_BASIC_STRING_VIEW_I(CharT, Traits) rhs) nssv_noexcept {
+ return lhs.compare(rhs) >= 0;
+ }
+
+ template <class CharT, class Traits nssv_MSVC_ORDER(2)>
+ nssv_constexpr bool operator>=(nssv_BASIC_STRING_VIEW_I(CharT, Traits) lhs,
+ basic_string_view<CharT, Traits> rhs) nssv_noexcept {
+ return lhs.compare(rhs) >= 0;
+ }
+
+#undef nssv_MSVC_ORDER
+#undef nssv_BASIC_STRING_VIEW_I
+
+#endif // compiler-dependent approach to comparisons
+
+ // 24.4.4 Inserters and extractors:
+
+ namespace detail {
+
+ template <class Stream> void write_padding(Stream &os, std::streamsize n) {
+ for (std::streamsize i = 0; i < n; ++i)
+ os.rdbuf()->sputc(os.fill());
+ }
+
+ template <class Stream, class View> Stream &write_to_stream(Stream &os, View const &sv) {
+ typename Stream::sentry sentry(os);
+
+ if (!os)
+ return os;
+
+ const std::streamsize length = static_cast<std::streamsize>(sv.length());
+
+ // Whether, and how, to pad:
+ const bool pad = (length < os.width());
+ const bool left_pad = pad && (os.flags() & std::ios_base::adjustfield) == std::ios_base::right;
+
+ if (left_pad)
+ write_padding(os, os.width() - length);
+
+ // Write span characters:
+ os.rdbuf()->sputn(sv.begin(), length);
+
+ if (pad && !left_pad)
+ write_padding(os, os.width() - length);
+
+ // Reset output stream width:
+ os.width(0);
+
+ return os;
+ }
+
+ } // namespace detail
+
+ template <class CharT, class Traits>
+ std::basic_ostream<CharT, Traits> &operator<<(std::basic_ostream<CharT, Traits> &os,
+ basic_string_view<CharT, Traits> sv) {
+ return detail::write_to_stream(os, sv);
+ }
+
+ // Several typedefs for common character types are provided:
+
+ typedef basic_string_view<char> string_view;
+ typedef basic_string_view<wchar_t> wstring_view;
+#if nssv_HAVE_WCHAR16_T
+ typedef basic_string_view<char16_t> u16string_view;
+ typedef basic_string_view<char32_t> u32string_view;
+#endif
+
+ } // namespace sv_lite
+} // namespace nonstd::sv_lite
+
+//
+// 24.4.6 Suffix for basic_string_view literals:
+//
+
+#if nssv_HAVE_USER_DEFINED_LITERALS
+
+namespace nonstd {
+nssv_inline_ns namespace literals {
+ nssv_inline_ns namespace string_view_literals {
+
+#if nssv_CONFIG_STD_SV_OPERATOR && nssv_HAVE_STD_DEFINED_LITERALS
+
+ nssv_constexpr nonstd::sv_lite::string_view operator"" sv(const char *str, size_t len) nssv_noexcept // (1)
+ {
+ return nonstd::sv_lite::string_view {str, len};
+ }
+
+ nssv_constexpr nonstd::sv_lite::u16string_view operator"" sv(const char16_t *str, size_t len) nssv_noexcept // (2)
+ {
+ return nonstd::sv_lite::u16string_view {str, len};
+ }
+
+ nssv_constexpr nonstd::sv_lite::u32string_view operator"" sv(const char32_t *str, size_t len) nssv_noexcept // (3)
+ {
+ return nonstd::sv_lite::u32string_view {str, len};
+ }
+
+ nssv_constexpr nonstd::sv_lite::wstring_view operator"" sv(const wchar_t *str, size_t len) nssv_noexcept // (4)
+ {
+ return nonstd::sv_lite::wstring_view {str, len};
+ }
+
+#endif // nssv_CONFIG_STD_SV_OPERATOR && nssv_HAVE_STD_DEFINED_LITERALS
+
+#if nssv_CONFIG_USR_SV_OPERATOR
+
+ nssv_constexpr nonstd::sv_lite::string_view operator"" _sv(const char *str, size_t len) nssv_noexcept // (1)
+ {
+ return nonstd::sv_lite::string_view {str, len};
+ }
+
+ nssv_constexpr nonstd::sv_lite::u16string_view operator"" _sv(const char16_t *str, size_t len) nssv_noexcept // (2)
+ {
+ return nonstd::sv_lite::u16string_view {str, len};
+ }
+
+ nssv_constexpr nonstd::sv_lite::u32string_view operator"" _sv(const char32_t *str, size_t len) nssv_noexcept // (3)
+ {
+ return nonstd::sv_lite::u32string_view {str, len};
+ }
+
+ nssv_constexpr nonstd::sv_lite::wstring_view operator"" _sv(const wchar_t *str, size_t len) nssv_noexcept // (4)
+ {
+ return nonstd::sv_lite::wstring_view {str, len};
+ }
+
+#endif // nssv_CONFIG_USR_SV_OPERATOR
+ }
+}
+} // namespace nonstd
+
+#endif
+
+//
+// Extensions for std::string:
+//
+
+#if nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
+
+namespace nonstd {
+namespace sv_lite {
+
+// Exclude MSVC 14 (19.00): it yields ambiguous to_string():
+
+#if nssv_CPP11_OR_GREATER && nssv_COMPILER_MSVC_VERSION != 140
+
+template <class CharT, class Traits, class Allocator = std::allocator<CharT>>
+std::basic_string<CharT, Traits, Allocator> to_string(basic_string_view<CharT, Traits> v,
+ Allocator const &a = Allocator()) {
+ return std::basic_string<CharT, Traits, Allocator>(v.begin(), v.end(), a);
+}
+
+#else
+
+template <class CharT, class Traits> std::basic_string<CharT, Traits> to_string(basic_string_view<CharT, Traits> v) {
+ return std::basic_string<CharT, Traits>(v.begin(), v.end());
+}
+
+template <class CharT, class Traits, class Allocator>
+std::basic_string<CharT, Traits, Allocator> to_string(basic_string_view<CharT, Traits> v, Allocator const &a) {
+ return std::basic_string<CharT, Traits, Allocator>(v.begin(), v.end(), a);
+}
+
+#endif // nssv_CPP11_OR_GREATER
+
+template <class CharT, class Traits, class Allocator>
+basic_string_view<CharT, Traits> to_string_view(std::basic_string<CharT, Traits, Allocator> const &s) {
+ return basic_string_view<CharT, Traits>(s.data(), s.size());
+}
+
+} // namespace sv_lite
+} // namespace nonstd
+
+#endif // nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
+
+//
+// make types and algorithms available in namespace nonstd:
+//
+
+namespace nonstd {
+
+using sv_lite::basic_string_view;
+using sv_lite::string_view;
+using sv_lite::wstring_view;
+
+#if nssv_HAVE_WCHAR16_T
+using sv_lite::u16string_view;
+#endif
+#if nssv_HAVE_WCHAR32_T
+using sv_lite::u32string_view;
+#endif
+
+// literal "sv"
+
+using sv_lite::operator==;
+using sv_lite::operator!=;
+using sv_lite::operator<;
+using sv_lite::operator<=;
+using sv_lite::operator>;
+using sv_lite::operator>=;
+
+using sv_lite::operator<<;
+
+#if nssv_CONFIG_CONVERSION_STD_STRING_FREE_FUNCTIONS
+using sv_lite::to_string;
+using sv_lite::to_string_view;
+#endif
+
+} // namespace nonstd
+
+// 24.4.5 Hash support (C++11):
+
+// Note: The hash value of a string view object is equal to the hash value of
+// the corresponding string object.
+
+#if nssv_HAVE_STD_HASH
+
+#include <functional>
+
+namespace std {
+
+template <> struct hash<nonstd::string_view> {
+public:
+ std::size_t operator()(nonstd::string_view v) const nssv_noexcept {
+ return std::hash<std::string>()(std::string(v.data(), v.size()));
+ }
+};
+
+template <> struct hash<nonstd::wstring_view> {
+public:
+ std::size_t operator()(nonstd::wstring_view v) const nssv_noexcept {
+ return std::hash<std::wstring>()(std::wstring(v.data(), v.size()));
+ }
+};
+
+template <> struct hash<nonstd::u16string_view> {
+public:
+ std::size_t operator()(nonstd::u16string_view v) const nssv_noexcept {
+ return std::hash<std::u16string>()(std::u16string(v.data(), v.size()));
+ }
+};
+
+template <> struct hash<nonstd::u32string_view> {
+public:
+ std::size_t operator()(nonstd::u32string_view v) const nssv_noexcept {
+ return std::hash<std::u32string>()(std::u32string(v.data(), v.size()));
+ }
+};
+
+} // namespace std
+
+#endif // nssv_HAVE_STD_HASH
+
+nssv_RESTORE_WARNINGS()
+
+#endif // nssv_HAVE_STD_STRING_VIEW
+#endif // NONSTD_SV_LITE_H_INCLUDED
+
+
+namespace inja {
+
+/*!
+ * \brief Class for lexer configuration.
+ */
+struct LexerConfig {
+ std::string statement_open {"{%"};
+ std::string statement_open_no_lstrip {"{%+"};
+ std::string statement_open_force_lstrip {"{%-"};
+ std::string statement_close {"%}"};
+ std::string statement_close_force_rstrip {"-%}"};
+ std::string line_statement {"##"};
+ std::string expression_open {"{{"};
+ std::string expression_open_force_lstrip {"{{-"};
+ std::string expression_close {"}}"};
+ std::string expression_close_force_rstrip {"-}}"};
+ std::string comment_open {"{#"};
+ std::string comment_close {"#}"};
+ std::string open_chars {"#{"};
+
+ bool trim_blocks {false};
+ bool lstrip_blocks {false};
+
+ void update_open_chars() {
+ open_chars = "";
+ if (open_chars.find(line_statement[0]) == std::string::npos) {
+ open_chars += line_statement[0];
+ }
+ if (open_chars.find(statement_open[0]) == std::string::npos) {
+ open_chars += statement_open[0];
+ }
+ if (open_chars.find(statement_open_no_lstrip[0]) == std::string::npos) {
+ open_chars += statement_open_no_lstrip[0];
+ }
+ if (open_chars.find(statement_open_force_lstrip[0]) == std::string::npos) {
+ open_chars += statement_open_force_lstrip[0];
+ }
+ if (open_chars.find(expression_open[0]) == std::string::npos) {
+ open_chars += expression_open[0];
+ }
+ if (open_chars.find(expression_open_force_lstrip[0]) == std::string::npos) {
+ open_chars += expression_open_force_lstrip[0];
+ }
+ if (open_chars.find(comment_open[0]) == std::string::npos) {
+ open_chars += comment_open[0];
+ }
+ }
+};
+
+/*!
+ * \brief Class for parser configuration.
+ */
+struct ParserConfig {
+ bool search_included_templates_in_files {true};
+};
+
+/*!
+ * \brief Class for render configuration.
+ */
+struct RenderConfig {
+ bool throw_at_missing_includes {true};
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_CONFIG_HPP_
+
+// #include "function_storage.hpp"
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_FUNCTION_STORAGE_HPP_
+#define INCLUDE_INJA_FUNCTION_STORAGE_HPP_
+
+#include <vector>
+
+// #include "string_view.hpp"
+
+
+namespace inja {
+
+using json = nlohmann::json;
+
+using Arguments = std::vector<const json *>;
+using CallbackFunction = std::function<json(Arguments &args)>;
+using VoidCallbackFunction = std::function<void(Arguments &args)>;
+
+/*!
+ * \brief Class for builtin functions and user-defined callbacks.
+ */
+class FunctionStorage {
+public:
+ enum class Operation {
+ Not,
+ And,
+ Or,
+ In,
+ Equal,
+ NotEqual,
+ Greater,
+ GreaterEqual,
+ Less,
+ LessEqual,
+ Add,
+ Subtract,
+ Multiplication,
+ Division,
+ Power,
+ Modulo,
+ AtId,
+ At,
+ Default,
+ DivisibleBy,
+ Even,
+ Exists,
+ ExistsInObject,
+ First,
+ Float,
+ Int,
+ IsArray,
+ IsBoolean,
+ IsFloat,
+ IsInteger,
+ IsNumber,
+ IsObject,
+ IsString,
+ Last,
+ Length,
+ Lower,
+ Max,
+ Min,
+ Odd,
+ Range,
+ Round,
+ Sort,
+ Upper,
+ Callback,
+ ParenLeft,
+ ParenRight,
+ None,
+ };
+
+ struct FunctionData {
+ explicit FunctionData(const Operation &op, const CallbackFunction &cb = CallbackFunction{}) : operation(op), callback(cb) {}
+ const Operation operation;
+ const CallbackFunction callback;
+ };
+
+private:
+ const int VARIADIC {-1};
+
+ std::map<std::pair<std::string, int>, FunctionData> function_storage = {
+ {std::make_pair("at", 2), FunctionData { Operation::At }},
+ {std::make_pair("default", 2), FunctionData { Operation::Default }},
+ {std::make_pair("divisibleBy", 2), FunctionData { Operation::DivisibleBy }},
+ {std::make_pair("even", 1), FunctionData { Operation::Even }},
+ {std::make_pair("exists", 1), FunctionData { Operation::Exists }},
+ {std::make_pair("existsIn", 2), FunctionData { Operation::ExistsInObject }},
+ {std::make_pair("first", 1), FunctionData { Operation::First }},
+ {std::make_pair("float", 1), FunctionData { Operation::Float }},
+ {std::make_pair("int", 1), FunctionData { Operation::Int }},
+ {std::make_pair("isArray", 1), FunctionData { Operation::IsArray }},
+ {std::make_pair("isBoolean", 1), FunctionData { Operation::IsBoolean }},
+ {std::make_pair("isFloat", 1), FunctionData { Operation::IsFloat }},
+ {std::make_pair("isInteger", 1), FunctionData { Operation::IsInteger }},
+ {std::make_pair("isNumber", 1), FunctionData { Operation::IsNumber }},
+ {std::make_pair("isObject", 1), FunctionData { Operation::IsObject }},
+ {std::make_pair("isString", 1), FunctionData { Operation::IsString }},
+ {std::make_pair("last", 1), FunctionData { Operation::Last }},
+ {std::make_pair("length", 1), FunctionData { Operation::Length }},
+ {std::make_pair("lower", 1), FunctionData { Operation::Lower }},
+ {std::make_pair("max", 1), FunctionData { Operation::Max }},
+ {std::make_pair("min", 1), FunctionData { Operation::Min }},
+ {std::make_pair("odd", 1), FunctionData { Operation::Odd }},
+ {std::make_pair("range", 1), FunctionData { Operation::Range }},
+ {std::make_pair("round", 2), FunctionData { Operation::Round }},
+ {std::make_pair("sort", 1), FunctionData { Operation::Sort }},
+ {std::make_pair("upper", 1), FunctionData { Operation::Upper }},
+ };
+
+public:
+ void add_builtin(nonstd::string_view name, int num_args, Operation op) {
+ function_storage.emplace(std::make_pair(static_cast<std::string>(name), num_args), FunctionData { op });
+ }
+
+ void add_callback(nonstd::string_view name, int num_args, const CallbackFunction &callback) {
+ function_storage.emplace(std::make_pair(static_cast<std::string>(name), num_args), FunctionData { Operation::Callback, callback });
+ }
+
+ FunctionData find_function(nonstd::string_view name, int num_args) const {
+ auto it = function_storage.find(std::make_pair(static_cast<std::string>(name), num_args));
+ if (it != function_storage.end()) {
+ return it->second;
+
+ // Find variadic function
+ } else if (num_args > 0) {
+ it = function_storage.find(std::make_pair(static_cast<std::string>(name), VARIADIC));
+ if (it != function_storage.end()) {
+ return it->second;
+ }
+ }
+
+ return FunctionData { Operation::None };
+ }
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_FUNCTION_STORAGE_HPP_
+
+// #include "parser.hpp"
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_PARSER_HPP_
+#define INCLUDE_INJA_PARSER_HPP_
+
+#include <limits>
+#include <stack>
+#include <string>
+#include <utility>
+#include <queue>
+#include <vector>
+
+// #include "config.hpp"
+
+// #include "exceptions.hpp"
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_EXCEPTIONS_HPP_
+#define INCLUDE_INJA_EXCEPTIONS_HPP_
+
+#include <stdexcept>
+#include <string>
+
+namespace inja {
+
+struct SourceLocation {
+ size_t line;
+ size_t column;
+};
+
+struct InjaError : public std::runtime_error {
+ const std::string type;
+ const std::string message;
+
+ const SourceLocation location;
+
+ explicit InjaError(const std::string &type, const std::string &message)
+ : std::runtime_error("[inja.exception." + type + "] " + message), type(type), message(message), location({0, 0}) {}
+
+ explicit InjaError(const std::string &type, const std::string &message, SourceLocation location)
+ : std::runtime_error("[inja.exception." + type + "] (at " + std::to_string(location.line) + ":" +
+ std::to_string(location.column) + ") " + message),
+ type(type), message(message), location(location) {}
+};
+
+struct ParserError : public InjaError {
+ explicit ParserError(const std::string &message, SourceLocation location) : InjaError("parser_error", message, location) {}
+};
+
+struct RenderError : public InjaError {
+ explicit RenderError(const std::string &message, SourceLocation location) : InjaError("render_error", message, location) {}
+};
+
+struct FileError : public InjaError {
+ explicit FileError(const std::string &message) : InjaError("file_error", message) {}
+ explicit FileError(const std::string &message, SourceLocation location) : InjaError("file_error", message, location) {}
+};
+
+struct JsonError : public InjaError {
+ explicit JsonError(const std::string &message, SourceLocation location) : InjaError("json_error", message, location) {}
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_EXCEPTIONS_HPP_
+
+// #include "function_storage.hpp"
+
+// #include "lexer.hpp"
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_LEXER_HPP_
+#define INCLUDE_INJA_LEXER_HPP_
+
+#include <cctype>
+#include <locale>
+
+// #include "config.hpp"
+
+// #include "token.hpp"
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_TOKEN_HPP_
+#define INCLUDE_INJA_TOKEN_HPP_
+
+#include <string>
+
+// #include "string_view.hpp"
+
+
+namespace inja {
+
+/*!
+ * \brief Helper-class for the inja Lexer.
+ */
+struct Token {
+ enum class Kind {
+ Text,
+ ExpressionOpen, // {{
+ ExpressionClose, // }}
+ LineStatementOpen, // ##
+ LineStatementClose, // \n
+ StatementOpen, // {%
+ StatementClose, // %}
+ CommentOpen, // {#
+ CommentClose, // #}
+ Id, // this, this.foo
+ Number, // 1, 2, -1, 5.2, -5.3
+ String, // "this"
+ Plus, // +
+ Minus, // -
+ Times, // *
+ Slash, // /
+ Percent, // %
+ Power, // ^
+ Comma, // ,
+ Dot, // .
+ Colon, // :
+ LeftParen, // (
+ RightParen, // )
+ LeftBracket, // [
+ RightBracket, // ]
+ LeftBrace, // {
+ RightBrace, // }
+ Equal, // ==
+ NotEqual, // !=
+ GreaterThan, // >
+ GreaterEqual, // >=
+ LessThan, // <
+ LessEqual, // <=
+ Unknown,
+ Eof,
+ };
+
+ Kind kind {Kind::Unknown};
+ nonstd::string_view text;
+
+ explicit constexpr Token() = default;
+ explicit constexpr Token(Kind kind, nonstd::string_view text) : kind(kind), text(text) {}
+
+ std::string describe() const {
+ switch (kind) {
+ case Kind::Text:
+ return "<text>";
+ case Kind::LineStatementClose:
+ return "<eol>";
+ case Kind::Eof:
+ return "<eof>";
+ default:
+ return static_cast<std::string>(text);
+ }
+ }
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_TOKEN_HPP_
+
+// #include "utils.hpp"
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_UTILS_HPP_
+#define INCLUDE_INJA_UTILS_HPP_
+
+#include <algorithm>
+#include <fstream>
+#include <string>
+#include <utility>
+
+// #include "exceptions.hpp"
+
+// #include "string_view.hpp"
+
+
+namespace inja {
+
+inline void open_file_or_throw(const std::string &path, std::ifstream &file) {
+ file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
+ try {
+ file.open(path);
+ } catch (const std::ios_base::failure & /*e*/) {
+ INJA_THROW(FileError("failed accessing file at '" + path + "'"));
+ }
+}
+
+namespace string_view {
+inline nonstd::string_view slice(nonstd::string_view view, size_t start, size_t end) {
+ start = std::min(start, view.size());
+ end = std::min(std::max(start, end), view.size());
+ return view.substr(start, end - start);
+}
+
+inline std::pair<nonstd::string_view, nonstd::string_view> split(nonstd::string_view view, char Separator) {
+ size_t idx = view.find(Separator);
+ if (idx == nonstd::string_view::npos) {
+ return std::make_pair(view, nonstd::string_view());
+ }
+ return std::make_pair(slice(view, 0, idx), slice(view, idx + 1, nonstd::string_view::npos));
+}
+
+inline bool starts_with(nonstd::string_view view, nonstd::string_view prefix) {
+ return (view.size() >= prefix.size() && view.compare(0, prefix.size(), prefix) == 0);
+}
+} // namespace string_view
+
+inline SourceLocation get_source_location(nonstd::string_view content, size_t pos) {
+ // Get line and offset position (starts at 1:1)
+ auto sliced = string_view::slice(content, 0, pos);
+ std::size_t last_newline = sliced.rfind("\n");
+
+ if (last_newline == nonstd::string_view::npos) {
+ return {1, sliced.length() + 1};
+ }
+
+ // Count newlines
+ size_t count_lines = 0;
+ size_t search_start = 0;
+ while (search_start <= sliced.size()) {
+ search_start = sliced.find("\n", search_start) + 1;
+ if (search_start == 0) {
+ break;
+ }
+ count_lines += 1;
+ }
+
+ return {count_lines + 1, sliced.length() - last_newline};
+}
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_UTILS_HPP_
+
+
+namespace inja {
+
+/*!
+ * \brief Class for lexing an inja Template.
+ */
+class Lexer {
+ enum class State {
+ Text,
+ ExpressionStart,
+ ExpressionStartForceLstrip,
+ ExpressionBody,
+ LineStart,
+ LineBody,
+ StatementStart,
+ StatementStartNoLstrip,
+ StatementStartForceLstrip,
+ StatementBody,
+ CommentStart,
+ CommentBody,
+ };
+
+ enum class MinusState {
+ Operator,
+ Number,
+ };
+
+ const LexerConfig &config;
+
+ State state;
+ MinusState minus_state;
+ nonstd::string_view m_in;
+ size_t tok_start;
+ size_t pos;
+
+
+ Token scan_body(nonstd::string_view close, Token::Kind closeKind, nonstd::string_view close_trim = nonstd::string_view(), bool trim = false) {
+ again:
+ // skip whitespace (except for \n as it might be a close)
+ if (tok_start >= m_in.size()) {
+ return make_token(Token::Kind::Eof);
+ }
+ char ch = m_in[tok_start];
+ if (ch == ' ' || ch == '\t' || ch == '\r') {
+ tok_start += 1;
+ goto again;
+ }
+
+ // check for close
+ if (!close_trim.empty() && inja::string_view::starts_with(m_in.substr(tok_start), close_trim)) {
+ state = State::Text;
+ pos = tok_start + close_trim.size();
+ Token tok = make_token(closeKind);
+ skip_whitespaces_and_newlines();
+ return tok;
+ }
+
+ if (inja::string_view::starts_with(m_in.substr(tok_start), close)) {
+ state = State::Text;
+ pos = tok_start + close.size();
+ Token tok = make_token(closeKind);
+ if (trim) {
+ skip_whitespaces_and_first_newline();
+ }
+ return tok;
+ }
+
+ // skip \n
+ if (ch == '\n') {
+ tok_start += 1;
+ goto again;
+ }
+
+ pos = tok_start + 1;
+ if (std::isalpha(ch)) {
+ minus_state = MinusState::Operator;
+ return scan_id();
+ }
+
+ MinusState current_minus_state = minus_state;
+ if (minus_state == MinusState::Operator) {
+ minus_state = MinusState::Number;
+ }
+
+ switch (ch) {
+ case '+':
+ return make_token(Token::Kind::Plus);
+ case '-':
+ if (current_minus_state == MinusState::Operator) {
+ return make_token(Token::Kind::Minus);
+ }
+ return scan_number();
+ case '*':
+ return make_token(Token::Kind::Times);
+ case '/':
+ return make_token(Token::Kind::Slash);
+ case '^':
+ return make_token(Token::Kind::Power);
+ case '%':
+ return make_token(Token::Kind::Percent);
+ case '.':
+ return make_token(Token::Kind::Dot);
+ case ',':
+ return make_token(Token::Kind::Comma);
+ case ':':
+ return make_token(Token::Kind::Colon);
+ case '(':
+ return make_token(Token::Kind::LeftParen);
+ case ')':
+ minus_state = MinusState::Operator;
+ return make_token(Token::Kind::RightParen);
+ case '[':
+ return make_token(Token::Kind::LeftBracket);
+ case ']':
+ minus_state = MinusState::Operator;
+ return make_token(Token::Kind::RightBracket);
+ case '{':
+ return make_token(Token::Kind::LeftBrace);
+ case '}':
+ minus_state = MinusState::Operator;
+ return make_token(Token::Kind::RightBrace);
+ case '>':
+ if (pos < m_in.size() && m_in[pos] == '=') {
+ pos += 1;
+ return make_token(Token::Kind::GreaterEqual);
+ }
+ return make_token(Token::Kind::GreaterThan);
+ case '<':
+ if (pos < m_in.size() && m_in[pos] == '=') {
+ pos += 1;
+ return make_token(Token::Kind::LessEqual);
+ }
+ return make_token(Token::Kind::LessThan);
+ case '=':
+ if (pos < m_in.size() && m_in[pos] == '=') {
+ pos += 1;
+ return make_token(Token::Kind::Equal);
+ }
+ return make_token(Token::Kind::Unknown);
+ case '!':
+ if (pos < m_in.size() && m_in[pos] == '=') {
+ pos += 1;
+ return make_token(Token::Kind::NotEqual);
+ }
+ return make_token(Token::Kind::Unknown);
+ case '\"':
+ return scan_string();
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ minus_state = MinusState::Operator;
+ return scan_number();
+ case '_':
+ case '@':
+ case '$':
+ minus_state = MinusState::Operator;
+ return scan_id();
+ default:
+ return make_token(Token::Kind::Unknown);
+ }
+ }
+
+ Token scan_id() {
+ for (;;) {
+ if (pos >= m_in.size()) {
+ break;
+ }
+ char ch = m_in[pos];
+ if (!std::isalnum(ch) && ch != '.' && ch != '/' && ch != '_' && ch != '-') {
+ break;
+ }
+ pos += 1;
+ }
+ return make_token(Token::Kind::Id);
+ }
+
+ Token scan_number() {
+ for (;;) {
+ if (pos >= m_in.size()) {
+ break;
+ }
+ char ch = m_in[pos];
+ // be very permissive in lexer (we'll catch errors when conversion happens)
+ if (!std::isdigit(ch) && ch != '.' && ch != 'e' && ch != 'E' && ch != '+' && ch != '-') {
+ break;
+ }
+ pos += 1;
+ }
+ return make_token(Token::Kind::Number);
+ }
+
+ Token scan_string() {
+ bool escape {false};
+ for (;;) {
+ if (pos >= m_in.size()) {
+ break;
+ }
+ char ch = m_in[pos++];
+ if (ch == '\\') {
+ escape = true;
+ } else if (!escape && ch == m_in[tok_start]) {
+ break;
+ } else {
+ escape = false;
+ }
+ }
+ return make_token(Token::Kind::String);
+ }
+
+ Token make_token(Token::Kind kind) const { return Token(kind, string_view::slice(m_in, tok_start, pos)); }
+
+ void skip_whitespaces_and_newlines() {
+ if (pos < m_in.size()) {
+ while (pos < m_in.size() && (m_in[pos] == ' ' || m_in[pos] == '\t' || m_in[pos] == '\n' || m_in[pos] == '\r')) {
+ pos += 1;
+ }
+ }
+ }
+
+ void skip_whitespaces_and_first_newline() {
+ if (pos < m_in.size()) {
+ while (pos < m_in.size() && (m_in[pos] == ' ' || m_in[pos] == '\t')) {
+ pos += 1;
+ }
+ }
+
+ if (pos < m_in.size()) {
+ char ch = m_in[pos];
+ if (ch == '\n') {
+ pos += 1;
+ } else if (ch == '\r') {
+ pos += 1;
+ if (pos < m_in.size() && m_in[pos] == '\n') {
+ pos += 1;
+ }
+ }
+ }
+ }
+
+ static nonstd::string_view clear_final_line_if_whitespace(nonstd::string_view text) {
+ nonstd::string_view result = text;
+ while (!result.empty()) {
+ char ch = result.back();
+ if (ch == ' ' || ch == '\t') {
+ result.remove_suffix(1);
+ } else if (ch == '\n' || ch == '\r') {
+ break;
+ } else {
+ return text;
+ }
+ }
+ return result;
+ }
+
+public:
+ explicit Lexer(const LexerConfig &config) : config(config), state(State::Text), minus_state(MinusState::Number) {}
+
+ SourceLocation current_position() const {
+ return get_source_location(m_in, tok_start);
+ }
+
+ void start(nonstd::string_view input) {
+ m_in = input;
+ tok_start = 0;
+ pos = 0;
+ state = State::Text;
+ minus_state = MinusState::Number;
+
+ // Consume byte order mark (BOM) for UTF-8
+ if (inja::string_view::starts_with(m_in, "\xEF\xBB\xBF")) {
+ m_in = m_in.substr(3);
+ }
+ }
+
+ Token scan() {
+ tok_start = pos;
+
+ again:
+ if (tok_start >= m_in.size()) {
+ return make_token(Token::Kind::Eof);
+ }
+
+ switch (state) {
+ default:
+ case State::Text: {
+ // fast-scan to first open character
+ size_t open_start = m_in.substr(pos).find_first_of(config.open_chars);
+ if (open_start == nonstd::string_view::npos) {
+ // didn't find open, return remaining text as text token
+ pos = m_in.size();
+ return make_token(Token::Kind::Text);
+ }
+ pos += open_start;
+
+ // try to match one of the opening sequences, and get the close
+ nonstd::string_view open_str = m_in.substr(pos);
+ bool must_lstrip = false;
+ if (inja::string_view::starts_with(open_str, config.expression_open)) {
+ if (inja::string_view::starts_with(open_str, config.expression_open_force_lstrip)) {
+ state = State::ExpressionStartForceLstrip;
+ must_lstrip = true;
+ } else {
+ state = State::ExpressionStart;
+ }
+ } else if (inja::string_view::starts_with(open_str, config.statement_open)) {
+ if (inja::string_view::starts_with(open_str, config.statement_open_no_lstrip)) {
+ state = State::StatementStartNoLstrip;
+ } else if (inja::string_view::starts_with(open_str, config.statement_open_force_lstrip )) {
+ state = State::StatementStartForceLstrip;
+ must_lstrip = true;
+ } else {
+ state = State::StatementStart;
+ must_lstrip = config.lstrip_blocks;
+ }
+ } else if (inja::string_view::starts_with(open_str, config.comment_open)) {
+ state = State::CommentStart;
+ must_lstrip = config.lstrip_blocks;
+ } else if ((pos == 0 || m_in[pos - 1] == '\n') && inja::string_view::starts_with(open_str, config.line_statement)) {
+ state = State::LineStart;
+ } else {
+ pos += 1; // wasn't actually an opening sequence
+ goto again;
+ }
+
+ nonstd::string_view text = string_view::slice(m_in, tok_start, pos);
+ if (must_lstrip) {
+ text = clear_final_line_if_whitespace(text);
+ }
+
+ if (text.empty()) {
+ goto again; // don't generate empty token
+ }
+ return Token(Token::Kind::Text, text);
+ }
+ case State::ExpressionStart: {
+ state = State::ExpressionBody;
+ pos += config.expression_open.size();
+ return make_token(Token::Kind::ExpressionOpen);
+ }
+ case State::ExpressionStartForceLstrip: {
+ state = State::ExpressionBody;
+ pos += config.expression_open_force_lstrip.size();
+ return make_token(Token::Kind::ExpressionOpen);
+ }
+ case State::LineStart: {
+ state = State::LineBody;
+ pos += config.line_statement.size();
+ return make_token(Token::Kind::LineStatementOpen);
+ }
+ case State::StatementStart: {
+ state = State::StatementBody;
+ pos += config.statement_open.size();
+ return make_token(Token::Kind::StatementOpen);
+ }
+ case State::StatementStartNoLstrip: {
+ state = State::StatementBody;
+ pos += config.statement_open_no_lstrip.size();
+ return make_token(Token::Kind::StatementOpen);
+ }
+ case State::StatementStartForceLstrip: {
+ state = State::StatementBody;
+ pos += config.statement_open_force_lstrip.size();
+ return make_token(Token::Kind::StatementOpen);
+ }
+ case State::CommentStart: {
+ state = State::CommentBody;
+ pos += config.comment_open.size();
+ return make_token(Token::Kind::CommentOpen);
+ }
+ case State::ExpressionBody:
+ return scan_body(config.expression_close, Token::Kind::ExpressionClose, config.expression_close_force_rstrip);
+ case State::LineBody:
+ return scan_body("\n", Token::Kind::LineStatementClose);
+ case State::StatementBody:
+ return scan_body(config.statement_close, Token::Kind::StatementClose, config.statement_close_force_rstrip, config.trim_blocks);
+ case State::CommentBody: {
+ // fast-scan to comment close
+ size_t end = m_in.substr(pos).find(config.comment_close);
+ if (end == nonstd::string_view::npos) {
+ pos = m_in.size();
+ return make_token(Token::Kind::Eof);
+ }
+ // return the entire comment in the close token
+ state = State::Text;
+ pos += end + config.comment_close.size();
+ Token tok = make_token(Token::Kind::CommentClose);
+ if (config.trim_blocks) {
+ skip_whitespaces_and_first_newline();
+ }
+ return tok;
+ }
+ }
+ }
+
+ const LexerConfig &get_config() const {
+ return config;
+ }
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_LEXER_HPP_
+
+// #include "node.hpp"
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_NODE_HPP_
+#define INCLUDE_INJA_NODE_HPP_
+
+#include <string>
+#include <utility>
+
+#include <nlohmann/json.hpp>
+
+// #include "function_storage.hpp"
+
+// #include "string_view.hpp"
+
+
+
+namespace inja {
+
+class NodeVisitor;
+class BlockNode;
+class TextNode;
+class ExpressionNode;
+class LiteralNode;
+class JsonNode;
+class FunctionNode;
+class ExpressionListNode;
+class StatementNode;
+class ForStatementNode;
+class ForArrayStatementNode;
+class ForObjectStatementNode;
+class IfStatementNode;
+class IncludeStatementNode;
+class SetStatementNode;
+
+
+class NodeVisitor {
+public:
+ virtual void visit(const BlockNode& node) = 0;
+ virtual void visit(const TextNode& node) = 0;
+ virtual void visit(const ExpressionNode& node) = 0;
+ virtual void visit(const LiteralNode& node) = 0;
+ virtual void visit(const JsonNode& node) = 0;
+ virtual void visit(const FunctionNode& node) = 0;
+ virtual void visit(const ExpressionListNode& node) = 0;
+ virtual void visit(const StatementNode& node) = 0;
+ virtual void visit(const ForStatementNode& node) = 0;
+ virtual void visit(const ForArrayStatementNode& node) = 0;
+ virtual void visit(const ForObjectStatementNode& node) = 0;
+ virtual void visit(const IfStatementNode& node) = 0;
+ virtual void visit(const IncludeStatementNode& node) = 0;
+ virtual void visit(const SetStatementNode& node) = 0;
+};
+
+/*!
+ * \brief Base node class for the abstract syntax tree (AST).
+ */
+class AstNode {
+public:
+ virtual void accept(NodeVisitor& v) const = 0;
+
+ size_t pos;
+
+ AstNode(size_t pos) : pos(pos) { }
+ virtual ~AstNode() { };
+};
+
+
+class BlockNode : public AstNode {
+public:
+ std::vector<std::shared_ptr<AstNode>> nodes;
+
+ explicit BlockNode() : AstNode(0) {}
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class TextNode : public AstNode {
+public:
+ const size_t length;
+
+ explicit TextNode(size_t pos, size_t length): AstNode(pos), length(length) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class ExpressionNode : public AstNode {
+public:
+ explicit ExpressionNode(size_t pos) : AstNode(pos) {}
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class LiteralNode : public ExpressionNode {
+public:
+ const nlohmann::json value;
+
+ explicit LiteralNode(const nlohmann::json& value, size_t pos) : ExpressionNode(pos), value(value) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class JsonNode : public ExpressionNode {
+public:
+ const std::string name;
+ const json::json_pointer ptr;
+
+ static std::string convert_dot_to_json_ptr(nonstd::string_view ptr_name) {
+ std::string result;
+ do {
+ nonstd::string_view part;
+ std::tie(part, ptr_name) = string_view::split(ptr_name, '.');
+ result.push_back('/');
+ result.append(part.begin(), part.end());
+ } while (!ptr_name.empty());
+ return result;
+ }
+
+ explicit JsonNode(nonstd::string_view ptr_name, size_t pos) : ExpressionNode(pos), name(ptr_name), ptr(json::json_pointer(convert_dot_to_json_ptr(ptr_name))) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class FunctionNode : public ExpressionNode {
+ using Op = FunctionStorage::Operation;
+
+public:
+ enum class Associativity {
+ Left,
+ Right,
+ };
+
+ unsigned int precedence;
+ Associativity associativity;
+
+ Op operation;
+
+ std::string name;
+ int number_args; // Should also be negative -> -1 for unknown number
+ CallbackFunction callback;
+
+ explicit FunctionNode(nonstd::string_view name, size_t pos) : ExpressionNode(pos), precedence(8), associativity(Associativity::Left), operation(Op::Callback), name(name), number_args(1) { }
+ explicit FunctionNode(Op operation, size_t pos) : ExpressionNode(pos), operation(operation), number_args(1) {
+ switch (operation) {
+ case Op::Not: {
+ precedence = 4;
+ associativity = Associativity::Left;
+ } break;
+ case Op::And: {
+ precedence = 1;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Or: {
+ precedence = 1;
+ associativity = Associativity::Left;
+ } break;
+ case Op::In: {
+ precedence = 2;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Equal: {
+ precedence = 2;
+ associativity = Associativity::Left;
+ } break;
+ case Op::NotEqual: {
+ precedence = 2;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Greater: {
+ precedence = 2;
+ associativity = Associativity::Left;
+ } break;
+ case Op::GreaterEqual: {
+ precedence = 2;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Less: {
+ precedence = 2;
+ associativity = Associativity::Left;
+ } break;
+ case Op::LessEqual: {
+ precedence = 2;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Add: {
+ precedence = 3;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Subtract: {
+ precedence = 3;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Multiplication: {
+ precedence = 4;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Division: {
+ precedence = 4;
+ associativity = Associativity::Left;
+ } break;
+ case Op::Power: {
+ precedence = 5;
+ associativity = Associativity::Right;
+ } break;
+ case Op::Modulo: {
+ precedence = 4;
+ associativity = Associativity::Left;
+ } break;
+ case Op::AtId: {
+ precedence = 8;
+ associativity = Associativity::Left;
+ } break;
+ default: {
+ precedence = 1;
+ associativity = Associativity::Left;
+ }
+ }
+ }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class ExpressionListNode : public AstNode {
+public:
+ std::vector<std::shared_ptr<ExpressionNode>> rpn_output;
+
+ explicit ExpressionListNode() : AstNode(0) { }
+ explicit ExpressionListNode(size_t pos) : AstNode(pos) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class StatementNode : public AstNode {
+public:
+ StatementNode(size_t pos) : AstNode(pos) { }
+
+ virtual void accept(NodeVisitor& v) const = 0;
+};
+
+class ForStatementNode : public StatementNode {
+public:
+ ExpressionListNode condition;
+ BlockNode body;
+ BlockNode *const parent;
+
+ ForStatementNode(BlockNode *const parent, size_t pos) : StatementNode(pos), parent(parent) { }
+
+ virtual void accept(NodeVisitor& v) const = 0;
+};
+
+class ForArrayStatementNode : public ForStatementNode {
+public:
+ const std::string value;
+
+ explicit ForArrayStatementNode(const std::string& value, BlockNode *const parent, size_t pos) : ForStatementNode(parent, pos), value(value) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class ForObjectStatementNode : public ForStatementNode {
+public:
+ const std::string key;
+ const std::string value;
+
+ explicit ForObjectStatementNode(const std::string& key, const std::string& value, BlockNode *const parent, size_t pos) : ForStatementNode(parent, pos), key(key), value(value) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class IfStatementNode : public StatementNode {
+public:
+ ExpressionListNode condition;
+ BlockNode true_statement;
+ BlockNode false_statement;
+ BlockNode *const parent;
+
+ const bool is_nested;
+ bool has_false_statement {false};
+
+ explicit IfStatementNode(BlockNode *const parent, size_t pos) : StatementNode(pos), parent(parent), is_nested(false) { }
+ explicit IfStatementNode(bool is_nested, BlockNode *const parent, size_t pos) : StatementNode(pos), parent(parent), is_nested(is_nested) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ }
+};
+
+class IncludeStatementNode : public StatementNode {
+public:
+ const std::string file;
+
+ explicit IncludeStatementNode(const std::string& file, size_t pos) : StatementNode(pos), file(file) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ };
+};
+
+class SetStatementNode : public StatementNode {
+public:
+ const std::string key;
+ ExpressionListNode expression;
+
+ explicit SetStatementNode(const std::string& key, size_t pos) : StatementNode(pos), key(key) { }
+
+ void accept(NodeVisitor& v) const {
+ v.visit(*this);
+ };
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_NODE_HPP_
+
+// #include "template.hpp"
+// Copyright (c) 2019 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_TEMPLATE_HPP_
+#define INCLUDE_INJA_TEMPLATE_HPP_
+
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+// #include "node.hpp"
+
+// #include "statistics.hpp"
+// Copyright (c) 2019 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_STATISTICS_HPP_
+#define INCLUDE_INJA_STATISTICS_HPP_
+
+// #include "node.hpp"
+
+
+
+namespace inja {
+
+/*!
+ * \brief A class for counting statistics on a Template.
+ */
+class StatisticsVisitor : public NodeVisitor {
+ void visit(const BlockNode& node) {
+ for (auto& n : node.nodes) {
+ n->accept(*this);
+ }
+ }
+
+ void visit(const TextNode&) { }
+ void visit(const ExpressionNode&) { }
+ void visit(const LiteralNode&) { }
+
+ void visit(const JsonNode&) {
+ variable_counter += 1;
+ }
+
+ void visit(const FunctionNode&) { }
+
+ void visit(const ExpressionListNode& node) {
+ for (auto& n : node.rpn_output) {
+ n->accept(*this);
+ }
+ }
+
+ void visit(const StatementNode&) { }
+ void visit(const ForStatementNode&) { }
+
+ void visit(const ForArrayStatementNode& node) {
+ node.condition.accept(*this);
+ node.body.accept(*this);
+ }
+
+ void visit(const ForObjectStatementNode& node) {
+ node.condition.accept(*this);
+ node.body.accept(*this);
+ }
+
+ void visit(const IfStatementNode& node) {
+ node.condition.accept(*this);
+ node.true_statement.accept(*this);
+ node.false_statement.accept(*this);
+ }
+
+ void visit(const IncludeStatementNode&) { }
+
+ void visit(const SetStatementNode&) { }
+
+public:
+ unsigned int variable_counter;
+
+ explicit StatisticsVisitor() : variable_counter(0) { }
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_STATISTICS_HPP_
+
+
+
+namespace inja {
+
+/*!
+ * \brief The main inja Template.
+ */
+struct Template {
+ BlockNode root;
+ std::string content;
+
+ explicit Template() { }
+ explicit Template(const std::string& content): content(content) { }
+
+ /// Return number of variables (total number, not distinct ones) in the template
+ int count_variables() {
+ auto statistic_visitor = StatisticsVisitor();
+ root.accept(statistic_visitor);
+ return statistic_visitor.variable_counter;
+ }
+};
+
+using TemplateStorage = std::map<std::string, Template>;
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_TEMPLATE_HPP_
+
+// #include "token.hpp"
+
+// #include "utils.hpp"
+
+
+#include <nlohmann/json.hpp>
+
+namespace inja {
+
+/*!
+ * \brief Class for parsing an inja Template.
+ */
+class Parser {
+ const ParserConfig &config;
+
+ Lexer lexer;
+ TemplateStorage &template_storage;
+ const FunctionStorage &function_storage;
+
+ Token tok, peek_tok;
+ bool have_peek_tok {false};
+
+ size_t current_paren_level {0};
+ size_t current_bracket_level {0};
+ size_t current_brace_level {0};
+
+ nonstd::string_view json_literal_start;
+
+ BlockNode *current_block {nullptr};
+ ExpressionListNode *current_expression_list {nullptr};
+ std::stack<std::pair<FunctionNode*, size_t>> function_stack;
+
+ std::stack<std::shared_ptr<FunctionNode>> operator_stack;
+ std::stack<IfStatementNode*> if_statement_stack;
+ std::stack<ForStatementNode*> for_statement_stack;
+
+ void throw_parser_error(const std::string &message) {
+ INJA_THROW(ParserError(message, lexer.current_position()));
+ }
+
+ void get_next_token() {
+ if (have_peek_tok) {
+ tok = peek_tok;
+ have_peek_tok = false;
+ } else {
+ tok = lexer.scan();
+ }
+ }
+
+ void get_peek_token() {
+ if (!have_peek_tok) {
+ peek_tok = lexer.scan();
+ have_peek_tok = true;
+ }
+ }
+
+ void add_json_literal(const char* content_ptr) {
+ nonstd::string_view json_text(json_literal_start.data(), tok.text.data() - json_literal_start.data() + tok.text.size());
+ current_expression_list->rpn_output.emplace_back(std::make_shared<LiteralNode>(json::parse(json_text), json_text.data() - content_ptr));
+ }
+
+ bool parse_expression(Template &tmpl, Token::Kind closing) {
+ while (tok.kind != closing && tok.kind != Token::Kind::Eof) {
+ // Literals
+ switch (tok.kind) {
+ case Token::Kind::String: {
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ json_literal_start = tok.text;
+ add_json_literal(tmpl.content.c_str());
+ }
+
+ } break;
+ case Token::Kind::Number: {
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ json_literal_start = tok.text;
+ add_json_literal(tmpl.content.c_str());
+ }
+
+ } break;
+ case Token::Kind::LeftBracket: {
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ json_literal_start = tok.text;
+ }
+ current_bracket_level += 1;
+
+ } break;
+ case Token::Kind::LeftBrace: {
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ json_literal_start = tok.text;
+ }
+ current_brace_level += 1;
+
+ } break;
+ case Token::Kind::RightBracket: {
+ if (current_bracket_level == 0) {
+ throw_parser_error("unexpected ']'");
+ }
+
+ current_bracket_level -= 1;
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ add_json_literal(tmpl.content.c_str());
+ }
+
+ } break;
+ case Token::Kind::RightBrace: {
+ if (current_brace_level == 0) {
+ throw_parser_error("unexpected '}'");
+ }
+
+ current_brace_level -= 1;
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ add_json_literal(tmpl.content.c_str());
+ }
+
+ } break;
+ case Token::Kind::Id: {
+ get_peek_token();
+
+ // Json Literal
+ if (tok.text == static_cast<decltype(tok.text)>("true") || tok.text == static_cast<decltype(tok.text)>("false") || tok.text == static_cast<decltype(tok.text)>("null")) {
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ json_literal_start = tok.text;
+ add_json_literal(tmpl.content.c_str());
+ }
+
+ // Operator
+ } else if (tok.text == "and" || tok.text == "or" || tok.text == "in" || tok.text == "not") {
+ goto parse_operator;
+
+ // Functions
+ } else if (peek_tok.kind == Token::Kind::LeftParen) {
+ operator_stack.emplace(std::make_shared<FunctionNode>(static_cast<std::string>(tok.text), tok.text.data() - tmpl.content.c_str()));
+ function_stack.emplace(operator_stack.top().get(), current_paren_level);
+
+ // Variables
+ } else {
+ current_expression_list->rpn_output.emplace_back(std::make_shared<JsonNode>(static_cast<std::string>(tok.text), tok.text.data() - tmpl.content.c_str()));
+ }
+
+ // Operators
+ } break;
+ case Token::Kind::Equal:
+ case Token::Kind::NotEqual:
+ case Token::Kind::GreaterThan:
+ case Token::Kind::GreaterEqual:
+ case Token::Kind::LessThan:
+ case Token::Kind::LessEqual:
+ case Token::Kind::Plus:
+ case Token::Kind::Minus:
+ case Token::Kind::Times:
+ case Token::Kind::Slash:
+ case Token::Kind::Power:
+ case Token::Kind::Percent:
+ case Token::Kind::Dot: {
+
+ parse_operator:
+ FunctionStorage::Operation operation;
+ switch (tok.kind) {
+ case Token::Kind::Id: {
+ if (tok.text == "and") {
+ operation = FunctionStorage::Operation::And;
+ } else if (tok.text == "or") {
+ operation = FunctionStorage::Operation::Or;
+ } else if (tok.text == "in") {
+ operation = FunctionStorage::Operation::In;
+ } else if (tok.text == "not") {
+ operation = FunctionStorage::Operation::Not;
+ } else {
+ throw_parser_error("unknown operator in parser.");
+ }
+ } break;
+ case Token::Kind::Equal: {
+ operation = FunctionStorage::Operation::Equal;
+ } break;
+ case Token::Kind::NotEqual: {
+ operation = FunctionStorage::Operation::NotEqual;
+ } break;
+ case Token::Kind::GreaterThan: {
+ operation = FunctionStorage::Operation::Greater;
+ } break;
+ case Token::Kind::GreaterEqual: {
+ operation = FunctionStorage::Operation::GreaterEqual;
+ } break;
+ case Token::Kind::LessThan: {
+ operation = FunctionStorage::Operation::Less;
+ } break;
+ case Token::Kind::LessEqual: {
+ operation = FunctionStorage::Operation::LessEqual;
+ } break;
+ case Token::Kind::Plus: {
+ operation = FunctionStorage::Operation::Add;
+ } break;
+ case Token::Kind::Minus: {
+ operation = FunctionStorage::Operation::Subtract;
+ } break;
+ case Token::Kind::Times: {
+ operation = FunctionStorage::Operation::Multiplication;
+ } break;
+ case Token::Kind::Slash: {
+ operation = FunctionStorage::Operation::Division;
+ } break;
+ case Token::Kind::Power: {
+ operation = FunctionStorage::Operation::Power;
+ } break;
+ case Token::Kind::Percent: {
+ operation = FunctionStorage::Operation::Modulo;
+ } break;
+ case Token::Kind::Dot: {
+ operation = FunctionStorage::Operation::AtId;
+ } break;
+ default: {
+ throw_parser_error("unknown operator in parser.");
+ }
+ }
+ auto function_node = std::make_shared<FunctionNode>(operation, tok.text.data() - tmpl.content.c_str());
+
+ while (!operator_stack.empty() && ((operator_stack.top()->precedence > function_node->precedence) || (operator_stack.top()->precedence == function_node->precedence && function_node->associativity == FunctionNode::Associativity::Left)) && (operator_stack.top()->operation != FunctionStorage::Operation::ParenLeft)) {
+ current_expression_list->rpn_output.emplace_back(operator_stack.top());
+ operator_stack.pop();
+ }
+
+ operator_stack.emplace(function_node);
+
+ } break;
+ case Token::Kind::Comma: {
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ if (function_stack.empty()) {
+ throw_parser_error("unexpected ','");
+ }
+
+ function_stack.top().first->number_args += 1;
+ }
+
+ } break;
+ case Token::Kind::Colon: {
+ if (current_brace_level == 0 && current_bracket_level == 0) {
+ throw_parser_error("unexpected ':'");
+ }
+
+ } break;
+ case Token::Kind::LeftParen: {
+ current_paren_level += 1;
+ operator_stack.emplace(std::make_shared<FunctionNode>(FunctionStorage::Operation::ParenLeft, tok.text.data() - tmpl.content.c_str()));
+
+ get_peek_token();
+ if (peek_tok.kind == Token::Kind::RightParen) {
+ if (!function_stack.empty() && function_stack.top().second == current_paren_level - 1) {
+ function_stack.top().first->number_args = 0;
+ }
+ }
+
+ } break;
+ case Token::Kind::RightParen: {
+ current_paren_level -= 1;
+ while (!operator_stack.empty() && operator_stack.top()->operation != FunctionStorage::Operation::ParenLeft) {
+ current_expression_list->rpn_output.emplace_back(operator_stack.top());
+ operator_stack.pop();
+ }
+
+ if (!operator_stack.empty() && operator_stack.top()->operation == FunctionStorage::Operation::ParenLeft) {
+ operator_stack.pop();
+ }
+
+ if (!function_stack.empty() && function_stack.top().second == current_paren_level) {
+ auto func = function_stack.top().first;
+ auto function_data = function_storage.find_function(func->name, func->number_args);
+ if (function_data.operation == FunctionStorage::Operation::None) {
+ throw_parser_error("unknown function " + func->name);
+ }
+ func->operation = function_data.operation;
+ if (function_data.operation == FunctionStorage::Operation::Callback) {
+ func->callback = function_data.callback;
+ }
+
+ if (operator_stack.empty()) {
+ throw_parser_error("internal error at function " + func->name);
+ }
+
+ current_expression_list->rpn_output.emplace_back(operator_stack.top());
+ operator_stack.pop();
+ function_stack.pop();
+ }
+ }
+ default:
+ break;
+ }
+
+ get_next_token();
+ }
+
+ while (!operator_stack.empty()) {
+ current_expression_list->rpn_output.emplace_back(operator_stack.top());
+ operator_stack.pop();
+ }
+
+ return true;
+ }
+
+ bool parse_statement(Template &tmpl, Token::Kind closing, nonstd::string_view path) {
+ if (tok.kind != Token::Kind::Id) {
+ return false;
+ }
+
+ if (tok.text == static_cast<decltype(tok.text)>("if")) {
+ get_next_token();
+
+ auto if_statement_node = std::make_shared<IfStatementNode>(current_block, tok.text.data() - tmpl.content.c_str());
+ current_block->nodes.emplace_back(if_statement_node);
+ if_statement_stack.emplace(if_statement_node.get());
+ current_block = &if_statement_node->true_statement;
+ current_expression_list = &if_statement_node->condition;
+
+ if (!parse_expression(tmpl, closing)) {
+ return false;
+ }
+
+ } else if (tok.text == static_cast<decltype(tok.text)>("else")) {
+ if (if_statement_stack.empty()) {
+ throw_parser_error("else without matching if");
+ }
+ auto &if_statement_data = if_statement_stack.top();
+ get_next_token();
+
+ if_statement_data->has_false_statement = true;
+ current_block = &if_statement_data->false_statement;
+
+ // Chained else if
+ if (tok.kind == Token::Kind::Id && tok.text == static_cast<decltype(tok.text)>("if")) {
+ get_next_token();
+
+ auto if_statement_node = std::make_shared<IfStatementNode>(true, current_block, tok.text.data() - tmpl.content.c_str());
+ current_block->nodes.emplace_back(if_statement_node);
+ if_statement_stack.emplace(if_statement_node.get());
+ current_block = &if_statement_node->true_statement;
+ current_expression_list = &if_statement_node->condition;
+
+ if (!parse_expression(tmpl, closing)) {
+ return false;
+ }
+ }
+
+ } else if (tok.text == static_cast<decltype(tok.text)>("endif")) {
+ if (if_statement_stack.empty()) {
+ throw_parser_error("endif without matching if");
+ }
+
+ // Nested if statements
+ while (if_statement_stack.top()->is_nested) {
+ if_statement_stack.pop();
+ }
+
+ auto &if_statement_data = if_statement_stack.top();
+ get_next_token();
+
+ current_block = if_statement_data->parent;
+ if_statement_stack.pop();
+
+ } else if (tok.text == static_cast<decltype(tok.text)>("for")) {
+ get_next_token();
+
+ // options: for a in arr; for a, b in obj
+ if (tok.kind != Token::Kind::Id) {
+ throw_parser_error("expected id, got '" + tok.describe() + "'");
+ }
+
+ Token value_token = tok;
+ get_next_token();
+
+ // Object type
+ std::shared_ptr<ForStatementNode> for_statement_node;
+ if (tok.kind == Token::Kind::Comma) {
+ get_next_token();
+ if (tok.kind != Token::Kind::Id) {
+ throw_parser_error("expected id, got '" + tok.describe() + "'");
+ }
+
+ Token key_token = std::move(value_token);
+ value_token = tok;
+ get_next_token();
+
+ for_statement_node = std::make_shared<ForObjectStatementNode>(static_cast<std::string>(key_token.text), static_cast<std::string>(value_token.text), current_block, tok.text.data() - tmpl.content.c_str());
+
+ // Array type
+ } else {
+ for_statement_node = std::make_shared<ForArrayStatementNode>(static_cast<std::string>(value_token.text), current_block, tok.text.data() - tmpl.content.c_str());
+ }
+
+ current_block->nodes.emplace_back(for_statement_node);
+ for_statement_stack.emplace(for_statement_node.get());
+ current_block = &for_statement_node->body;
+ current_expression_list = &for_statement_node->condition;
+
+ if (tok.kind != Token::Kind::Id || tok.text != static_cast<decltype(tok.text)>("in")) {
+ throw_parser_error("expected 'in', got '" + tok.describe() + "'");
+ }
+ get_next_token();
+
+ if (!parse_expression(tmpl, closing)) {
+ return false;
+ }
+
+ } else if (tok.text == static_cast<decltype(tok.text)>("endfor")) {
+ if (for_statement_stack.empty()) {
+ throw_parser_error("endfor without matching for");
+ }
+
+ auto &for_statement_data = for_statement_stack.top();
+ get_next_token();
+
+ current_block = for_statement_data->parent;
+ for_statement_stack.pop();
+
+ } else if (tok.text == static_cast<decltype(tok.text)>("include")) {
+ get_next_token();
+
+ if (tok.kind != Token::Kind::String) {
+ throw_parser_error("expected string, got '" + tok.describe() + "'");
+ }
+
+ // Build the relative path
+ json json_name = json::parse(tok.text);
+ std::string pathname = static_cast<std::string>(path);
+ pathname += json_name.get_ref<const std::string &>();
+ if (pathname.compare(0, 2, "./") == 0) {
+ pathname.erase(0, 2);
+ }
+ // sys::path::remove_dots(pathname, true, sys::path::Style::posix);
+
+ if (config.search_included_templates_in_files && template_storage.find(pathname) == template_storage.end()) {
+ auto include_template = Template(load_file(pathname));
+ template_storage.emplace(pathname, include_template);
+ parse_into_template(template_storage[pathname], pathname);
+ }
+
+ current_block->nodes.emplace_back(std::make_shared<IncludeStatementNode>(pathname, tok.text.data() - tmpl.content.c_str()));
+
+ get_next_token();
+
+ } else if (tok.text == static_cast<decltype(tok.text)>("set")) {
+ get_next_token();
+
+ if (tok.kind != Token::Kind::Id) {
+ throw_parser_error("expected variable name, got '" + tok.describe() + "'");
+ }
+
+ std::string key = static_cast<std::string>(tok.text);
+ get_next_token();
+
+ auto set_statement_node = std::make_shared<SetStatementNode>(key, tok.text.data() - tmpl.content.c_str());
+ current_block->nodes.emplace_back(set_statement_node);
+ current_expression_list = &set_statement_node->expression;
+
+ if (tok.text != static_cast<decltype(tok.text)>("=")) {
+ throw_parser_error("expected '=', got '" + tok.describe() + "'");
+ }
+ get_next_token();
+
+ if (!parse_expression(tmpl, closing)) {
+ return false;
+ }
+
+ } else {
+ return false;
+ }
+ return true;
+ }
+
+ void parse_into(Template &tmpl, nonstd::string_view path) {
+ lexer.start(tmpl.content);
+ current_block = &tmpl.root;
+
+ for (;;) {
+ get_next_token();
+ switch (tok.kind) {
+ case Token::Kind::Eof: {
+ if (!if_statement_stack.empty()) {
+ throw_parser_error("unmatched if");
+ }
+ if (!for_statement_stack.empty()) {
+ throw_parser_error("unmatched for");
+ }
+ } return;
+ case Token::Kind::Text: {
+ current_block->nodes.emplace_back(std::make_shared<TextNode>(tok.text.data() - tmpl.content.c_str(), tok.text.size()));
+ } break;
+ case Token::Kind::StatementOpen: {
+ get_next_token();
+ if (!parse_statement(tmpl, Token::Kind::StatementClose, path)) {
+ throw_parser_error("expected statement, got '" + tok.describe() + "'");
+ }
+ if (tok.kind != Token::Kind::StatementClose) {
+ throw_parser_error("expected statement close, got '" + tok.describe() + "'");
+ }
+ } break;
+ case Token::Kind::LineStatementOpen: {
+ get_next_token();
+ if (!parse_statement(tmpl, Token::Kind::LineStatementClose, path)) {
+ throw_parser_error("expected statement, got '" + tok.describe() + "'");
+ }
+ if (tok.kind != Token::Kind::LineStatementClose && tok.kind != Token::Kind::Eof) {
+ throw_parser_error("expected line statement close, got '" + tok.describe() + "'");
+ }
+ } break;
+ case Token::Kind::ExpressionOpen: {
+ get_next_token();
+
+ auto expression_list_node = std::make_shared<ExpressionListNode>(tok.text.data() - tmpl.content.c_str());
+ current_block->nodes.emplace_back(expression_list_node);
+ current_expression_list = expression_list_node.get();
+
+ if (!parse_expression(tmpl, Token::Kind::ExpressionClose)) {
+ throw_parser_error("expected expression, got '" + tok.describe() + "'");
+ }
+
+ if (tok.kind != Token::Kind::ExpressionClose) {
+ throw_parser_error("expected expression close, got '" + tok.describe() + "'");
+ }
+ } break;
+ case Token::Kind::CommentOpen: {
+ get_next_token();
+ if (tok.kind != Token::Kind::CommentClose) {
+ throw_parser_error("expected comment close, got '" + tok.describe() + "'");
+ }
+ } break;
+ default: {
+ throw_parser_error("unexpected token '" + tok.describe() + "'");
+ } break;
+ }
+ }
+ }
+
+
+public:
+ explicit Parser(const ParserConfig &parser_config, const LexerConfig &lexer_config,
+ TemplateStorage &template_storage, const FunctionStorage &function_storage)
+ : config(parser_config), lexer(lexer_config), template_storage(template_storage), function_storage(function_storage) { }
+
+ Template parse(nonstd::string_view input, nonstd::string_view path) {
+ auto result = Template(static_cast<std::string>(input));
+ parse_into(result, path);
+ return result;
+ }
+
+ Template parse(nonstd::string_view input) {
+ return parse(input, "./");
+ }
+
+ void parse_into_template(Template& tmpl, nonstd::string_view filename) {
+ nonstd::string_view path = filename.substr(0, filename.find_last_of("/\\") + 1);
+
+ // StringRef path = sys::path::parent_path(filename);
+ auto sub_parser = Parser(config, lexer.get_config(), template_storage, function_storage);
+ sub_parser.parse_into(tmpl, path);
+ }
+
+ std::string load_file(nonstd::string_view filename) {
+ std::ifstream file;
+ open_file_or_throw(static_cast<std::string>(filename), file);
+ std::string text((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
+ return text;
+ }
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_PARSER_HPP_
+
+// #include "renderer.hpp"
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#ifndef INCLUDE_INJA_RENDERER_HPP_
+#define INCLUDE_INJA_RENDERER_HPP_
+
+#include <algorithm>
+#include <numeric>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include <nlohmann/json.hpp>
+
+// #include "config.hpp"
+
+// #include "exceptions.hpp"
+
+// #include "node.hpp"
+
+// #include "template.hpp"
+
+// #include "utils.hpp"
+
+
+namespace inja {
+
+/*!
+ * \brief Class for rendering a Template with data.
+ */
+class Renderer : public NodeVisitor {
+ using Op = FunctionStorage::Operation;
+
+ const RenderConfig config;
+ const Template *current_template;
+ const TemplateStorage &template_storage;
+ const FunctionStorage &function_storage;
+
+ const json *json_input;
+ std::ostream *output_stream;
+
+ json json_additional_data;
+ json* current_loop_data = &json_additional_data["loop"];
+
+ std::vector<std::shared_ptr<json>> json_tmp_stack;
+ std::stack<const json*> json_eval_stack;
+ std::stack<const JsonNode*> not_found_stack;
+
+ bool truthy(const json* data) const {
+ if (data->is_boolean()) {
+ return data->get<bool>();
+ } else if (data->is_number()) {
+ return (*data != 0);
+ } else if (data->is_null()) {
+ return false;
+ }
+ return !data->empty();
+ }
+
+ void print_json(const std::shared_ptr<json> value) {
+ if (value->is_string()) {
+ *output_stream << value->get_ref<const json::string_t&>();
+ } else if (value->is_number_integer()) {
+ *output_stream << value->get<const json::number_integer_t>();
+ } else if (value->is_null()) {
+ } else {
+ *output_stream << value->dump();
+ }
+ }
+
+ const std::shared_ptr<json> eval_expression_list(const ExpressionListNode& expression_list) {
+ for (auto& expression : expression_list.rpn_output) {
+ expression->accept(*this);
+ }
+
+ if (json_eval_stack.empty()) {
+ throw_renderer_error("empty expression", expression_list);
+ } else if (json_eval_stack.size() != 1) {
+ throw_renderer_error("malformed expression", expression_list);
+ }
+
+ auto result = json_eval_stack.top();
+ json_eval_stack.pop();
+
+ if (!result) {
+ if (not_found_stack.empty()) {
+ throw_renderer_error("expression could not be evaluated", expression_list);
+ }
+
+ auto node = not_found_stack.top();
+ not_found_stack.pop();
+
+ throw_renderer_error("variable '" + static_cast<std::string>(node->name) + "' not found", *node);
+ }
+ return std::make_shared<json>(*result);
+ }
+
+ void throw_renderer_error(const std::string &message, const AstNode& node) {
+ SourceLocation loc = get_source_location(current_template->content, node.pos);
+ INJA_THROW(RenderError(message, loc));
+ }
+
+ template<size_t N, bool throw_not_found=true>
+ std::array<const json*, N> get_arguments(const AstNode& node) {
+ if (json_eval_stack.size() < N) {
+ throw_renderer_error("function needs " + std::to_string(N) + " variables, but has only found " + std::to_string(json_eval_stack.size()), node);
+ }
+
+ std::array<const json*, N> result;
+ for (size_t i = 0; i < N; i += 1) {
+ result[N - i - 1] = json_eval_stack.top();
+ json_eval_stack.pop();
+
+ if (!result[N - i - 1]) {
+ auto json_node = not_found_stack.top();
+ not_found_stack.pop();
+
+ if (throw_not_found) {
+ throw_renderer_error("variable '" + static_cast<std::string>(json_node->name) + "' not found", *json_node);
+ }
+ }
+ }
+ return result;
+ }
+
+ template<bool throw_not_found=true>
+ Arguments get_argument_vector(size_t N, const AstNode& node) {
+ if (json_eval_stack.size() < N) {
+ throw_renderer_error("function needs " + std::to_string(N) + " variables, but has only found " + std::to_string(json_eval_stack.size()), node);
+ }
+
+ Arguments result {N};
+ for (size_t i = 0; i < N; i += 1) {
+ result[N - i - 1] = json_eval_stack.top();
+ json_eval_stack.pop();
+
+ if (!result[N - i - 1]) {
+ auto json_node = not_found_stack.top();
+ not_found_stack.pop();
+
+ if (throw_not_found) {
+ throw_renderer_error("variable '" + static_cast<std::string>(json_node->name) + "' not found", *json_node);
+ }
+ }
+ }
+ return result;
+ }
+
+ void visit(const BlockNode& node) {
+ for (auto& n : node.nodes) {
+ n->accept(*this);
+ }
+ }
+
+ void visit(const TextNode& node) {
+ output_stream->write(current_template->content.c_str() + node.pos, node.length);
+ }
+
+ void visit(const ExpressionNode&) { }
+
+ void visit(const LiteralNode& node) {
+ json_eval_stack.push(&node.value);
+ }
+
+ void visit(const JsonNode& node) {
+ if (json_additional_data.contains(node.ptr)) {
+ json_eval_stack.push(&(json_additional_data[node.ptr]));
+
+ } else if (json_input->contains(node.ptr)) {
+ json_eval_stack.push(&(*json_input)[node.ptr]);
+
+ } else {
+ // Try to evaluate as a no-argument callback
+ auto function_data = function_storage.find_function(node.name, 0);
+ if (function_data.operation == FunctionStorage::Operation::Callback) {
+ Arguments empty_args {};
+ auto value = std::make_shared<json>(function_data.callback(empty_args));
+ json_tmp_stack.push_back(value);
+ json_eval_stack.push(value.get());
+
+ } else {
+ json_eval_stack.push(nullptr);
+ not_found_stack.emplace(&node);
+ }
+ }
+ }
+
+ void visit(const FunctionNode& node) {
+ std::shared_ptr<json> result_ptr;
+
+ switch (node.operation) {
+ case Op::Not: {
+ auto args = get_arguments<1>(node);
+ result_ptr = std::make_shared<json>(!truthy(args[0]));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::And: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(truthy(args[0]) && truthy(args[1]));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Or: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(truthy(args[0]) || truthy(args[1]));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::In: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(std::find(args[1]->begin(), args[1]->end(), *args[0]) != args[1]->end());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Equal: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(*args[0] == *args[1]);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::NotEqual: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(*args[0] != *args[1]);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Greater: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(*args[0] > *args[1]);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::GreaterEqual: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(*args[0] >= *args[1]);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Less: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(*args[0] < *args[1]);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::LessEqual: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(*args[0] <= *args[1]);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Add: {
+ auto args = get_arguments<2>(node);
+ if (args[0]->is_string() && args[1]->is_string()) {
+ result_ptr = std::make_shared<json>(args[0]->get_ref<const std::string&>() + args[1]->get_ref<const std::string&>());
+ json_tmp_stack.push_back(result_ptr);
+ } else if (args[0]->is_number_integer() && args[1]->is_number_integer()) {
+ result_ptr = std::make_shared<json>(args[0]->get<int>() + args[1]->get<int>());
+ json_tmp_stack.push_back(result_ptr);
+ } else {
+ result_ptr = std::make_shared<json>(args[0]->get<double>() + args[1]->get<double>());
+ json_tmp_stack.push_back(result_ptr);
+ }
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Subtract: {
+ auto args = get_arguments<2>(node);
+ if (args[0]->is_number_integer() && args[1]->is_number_integer()) {
+ result_ptr = std::make_shared<json>(args[0]->get<int>() - args[1]->get<int>());
+ json_tmp_stack.push_back(result_ptr);
+ } else {
+ result_ptr = std::make_shared<json>(args[0]->get<double>() - args[1]->get<double>());
+ json_tmp_stack.push_back(result_ptr);
+ }
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Multiplication: {
+ auto args = get_arguments<2>(node);
+ if (args[0]->is_number_integer() && args[1]->is_number_integer()) {
+ result_ptr = std::make_shared<json>(args[0]->get<int>() * args[1]->get<int>());
+ json_tmp_stack.push_back(result_ptr);
+ } else {
+ result_ptr = std::make_shared<json>(args[0]->get<double>() * args[1]->get<double>());
+ json_tmp_stack.push_back(result_ptr);
+ }
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Division: {
+ auto args = get_arguments<2>(node);
+ if (args[1]->get<double>() == 0) {
+ throw_renderer_error("division by zero", node);
+ }
+ result_ptr = std::make_shared<json>(args[0]->get<double>() / args[1]->get<double>());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Power: {
+ auto args = get_arguments<2>(node);
+ if (args[0]->is_number_integer() && args[1]->get<int>() >= 0) {
+ int result = std::pow(args[0]->get<int>(), args[1]->get<int>());
+ result_ptr = std::make_shared<json>(std::move(result));
+ json_tmp_stack.push_back(result_ptr);
+ } else {
+ double result = std::pow(args[0]->get<double>(), args[1]->get<int>());
+ result_ptr = std::make_shared<json>(std::move(result));
+ json_tmp_stack.push_back(result_ptr);
+ }
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Modulo: {
+ auto args = get_arguments<2>(node);
+ result_ptr = std::make_shared<json>(args[0]->get<int>() % args[1]->get<int>());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::AtId: {
+ json_eval_stack.pop(); // Pop id nullptr
+ auto container = get_arguments<1, false>(node)[0];
+ if (not_found_stack.empty()) {
+ throw_renderer_error("could not find element with given name", node);
+ }
+ auto id_node = not_found_stack.top();
+ not_found_stack.pop();
+ json_eval_stack.push(&container->at(id_node->name));
+ } break;
+ case Op::At: {
+ auto args = get_arguments<2>(node);
+ json_eval_stack.push(&args[0]->at(args[1]->get<int>()));
+ } break;
+ case Op::Default: {
+ auto default_arg = get_arguments<1>(node)[0];
+ auto test_arg = get_arguments<1, false>(node)[0];
+ json_eval_stack.push(test_arg ? test_arg : default_arg);
+ } break;
+ case Op::DivisibleBy: {
+ auto args = get_arguments<2>(node);
+ int divisor = args[1]->get<int>();
+ result_ptr = std::make_shared<json>((divisor != 0) && (args[0]->get<int>() % divisor == 0));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Even: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->get<int>() % 2 == 0);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Exists: {
+ auto &&name = get_arguments<1>(node)[0]->get_ref<const std::string &>();
+ result_ptr = std::make_shared<json>(json_input->contains(json::json_pointer(JsonNode::convert_dot_to_json_ptr(name))));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::ExistsInObject: {
+ auto args = get_arguments<2>(node);
+ auto &&name = args[1]->get_ref<const std::string &>();
+ result_ptr = std::make_shared<json>(args[0]->find(name) != args[0]->end());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::First: {
+ auto result = &get_arguments<1>(node)[0]->front();
+ json_eval_stack.push(result);
+ } break;
+ case Op::Float: {
+ result_ptr = std::make_shared<json>(std::stod(get_arguments<1>(node)[0]->get_ref<const std::string &>()));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Int: {
+ result_ptr = std::make_shared<json>(std::stoi(get_arguments<1>(node)[0]->get_ref<const std::string &>()));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Last: {
+ auto result = &get_arguments<1>(node)[0]->back();
+ json_eval_stack.push(result);
+ } break;
+ case Op::Length: {
+ auto val = get_arguments<1>(node)[0];
+ if (val->is_string()) {
+ result_ptr = std::make_shared<json>(val->get_ref<const std::string &>().length());
+ } else {
+ result_ptr = std::make_shared<json>(val->size());
+ }
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Lower: {
+ std::string result = get_arguments<1>(node)[0]->get<std::string>();
+ std::transform(result.begin(), result.end(), result.begin(), ::tolower);
+ result_ptr = std::make_shared<json>(std::move(result));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Max: {
+ auto args = get_arguments<1>(node);
+ auto result = std::max_element(args[0]->begin(), args[0]->end());
+ json_eval_stack.push(&(*result));
+ } break;
+ case Op::Min: {
+ auto args = get_arguments<1>(node);
+ auto result = std::min_element(args[0]->begin(), args[0]->end());
+ json_eval_stack.push(&(*result));
+ } break;
+ case Op::Odd: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->get<int>() % 2 != 0);
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Range: {
+ std::vector<int> result(get_arguments<1>(node)[0]->get<int>());
+ std::iota(result.begin(), result.end(), 0);
+ result_ptr = std::make_shared<json>(std::move(result));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Round: {
+ auto args = get_arguments<2>(node);
+ int precision = args[1]->get<int>();
+ double result = std::round(args[0]->get<double>() * std::pow(10.0, precision)) / std::pow(10.0, precision);
+ result_ptr = std::make_shared<json>(std::move(result));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Sort: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->get<std::vector<json>>());
+ std::sort(result_ptr->begin(), result_ptr->end());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Upper: {
+ std::string result = get_arguments<1>(node)[0]->get<std::string>();
+ std::transform(result.begin(), result.end(), result.begin(), ::toupper);
+ result_ptr = std::make_shared<json>(std::move(result));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::IsBoolean: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->is_boolean());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::IsNumber: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->is_number());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::IsInteger: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->is_number_integer());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::IsFloat: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->is_number_float());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::IsObject: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->is_object());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::IsArray: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->is_array());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::IsString: {
+ result_ptr = std::make_shared<json>(get_arguments<1>(node)[0]->is_string());
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::Callback: {
+ auto args = get_argument_vector(node.number_args, node);
+ result_ptr = std::make_shared<json>(node.callback(args));
+ json_tmp_stack.push_back(result_ptr);
+ json_eval_stack.push(result_ptr.get());
+ } break;
+ case Op::ParenLeft:
+ case Op::ParenRight:
+ case Op::None:
+ break;
+ }
+ }
+
+ void visit(const ExpressionListNode& node) {
+ print_json(eval_expression_list(node));
+ }
+
+ void visit(const StatementNode&) { }
+
+ void visit(const ForStatementNode&) { }
+
+ void visit(const ForArrayStatementNode& node) {
+ auto result = eval_expression_list(node.condition);
+ if (!result->is_array()) {
+ throw_renderer_error("object must be an array", node);
+ }
+
+ if (!current_loop_data->empty()) {
+ auto tmp = *current_loop_data; // Because of clang-3
+ (*current_loop_data)["parent"] = std::move(tmp);
+ }
+
+ size_t index = 0;
+ (*current_loop_data)["is_first"] = true;
+ (*current_loop_data)["is_last"] = (result->size() <= 1);
+ for (auto it = result->begin(); it != result->end(); ++it) {
+ json_additional_data[static_cast<std::string>(node.value)] = *it;
+
+ (*current_loop_data)["index"] = index;
+ (*current_loop_data)["index1"] = index + 1;
+ if (index == 1) {
+ (*current_loop_data)["is_first"] = false;
+ }
+ if (index == result->size() - 1) {
+ (*current_loop_data)["is_last"] = true;
+ }
+
+ node.body.accept(*this);
+ ++index;
+ }
+
+ json_additional_data[static_cast<std::string>(node.value)].clear();
+ if (!(*current_loop_data)["parent"].empty()) {
+ auto tmp = (*current_loop_data)["parent"];
+ *current_loop_data = std::move(tmp);
+ } else {
+ current_loop_data = &json_additional_data["loop"];
+ }
+ }
+
+ void visit(const ForObjectStatementNode& node) {
+ auto result = eval_expression_list(node.condition);
+ if (!result->is_object()) {
+ throw_renderer_error("object must be an object", node);
+ }
+
+ if (!current_loop_data->empty()) {
+ (*current_loop_data)["parent"] = std::move(*current_loop_data);
+ }
+
+ size_t index = 0;
+ (*current_loop_data)["is_first"] = true;
+ (*current_loop_data)["is_last"] = (result->size() <= 1);
+ for (auto it = result->begin(); it != result->end(); ++it) {
+ json_additional_data[static_cast<std::string>(node.key)] = it.key();
+ json_additional_data[static_cast<std::string>(node.value)] = it.value();
+
+ (*current_loop_data)["index"] = index;
+ (*current_loop_data)["index1"] = index + 1;
+ if (index == 1) {
+ (*current_loop_data)["is_first"] = false;
+ }
+ if (index == result->size() - 1) {
+ (*current_loop_data)["is_last"] = true;
+ }
+
+ node.body.accept(*this);
+ ++index;
+ }
+
+ json_additional_data[static_cast<std::string>(node.key)].clear();
+ json_additional_data[static_cast<std::string>(node.value)].clear();
+ if (!(*current_loop_data)["parent"].empty()) {
+ *current_loop_data = std::move((*current_loop_data)["parent"]);
+ } else {
+ current_loop_data = &json_additional_data["loop"];
+ }
+ }
+
+ void visit(const IfStatementNode& node) {
+ auto result = eval_expression_list(node.condition);
+ if (truthy(result.get())) {
+ node.true_statement.accept(*this);
+ } else if (node.has_false_statement) {
+ node.false_statement.accept(*this);
+ }
+ }
+
+ void visit(const IncludeStatementNode& node) {
+ auto sub_renderer = Renderer(config, template_storage, function_storage);
+ auto included_template_it = template_storage.find(node.file);
+
+ if (included_template_it != template_storage.end()) {
+ sub_renderer.render_to(*output_stream, included_template_it->second, *json_input, &json_additional_data);
+ } else if (config.throw_at_missing_includes) {
+ throw_renderer_error("include '" + node.file + "' not found", node);
+ }
+ }
+
+ void visit(const SetStatementNode& node) {
+ json_additional_data[node.key] = *eval_expression_list(node.expression);
+ }
+
+public:
+ Renderer(const RenderConfig& config, const TemplateStorage &template_storage, const FunctionStorage &function_storage)
+ : config(config), template_storage(template_storage), function_storage(function_storage) { }
+
+ void render_to(std::ostream &os, const Template &tmpl, const json &data, json *loop_data = nullptr) {
+ output_stream = &os;
+ current_template = &tmpl;
+ json_input = &data;
+ if (loop_data) {
+ json_additional_data = *loop_data;
+ current_loop_data = &json_additional_data["loop"];
+ }
+
+ current_template->root.accept(*this);
+
+ json_tmp_stack.clear();
+ }
+};
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_RENDERER_HPP_
+
+// #include "string_view.hpp"
+
+// #include "template.hpp"
+
+// #include "utils.hpp"
+
+
+namespace inja {
+
+using json = nlohmann::json;
+
+/*!
+ * \brief Class for changing the configuration.
+ */
+class Environment {
+ std::string input_path;
+ std::string output_path;
+
+ LexerConfig lexer_config;
+ ParserConfig parser_config;
+ RenderConfig render_config;
+
+ FunctionStorage function_storage;
+ TemplateStorage template_storage;
+
+public:
+ Environment() : Environment("") {}
+
+ explicit Environment(const std::string &global_path) : input_path(global_path), output_path(global_path) {}
+
+ Environment(const std::string &input_path, const std::string &output_path)
+ : input_path(input_path), output_path(output_path) {}
+
+ /// Sets the opener and closer for template statements
+ void set_statement(const std::string &open, const std::string &close) {
+ lexer_config.statement_open = open;
+ lexer_config.statement_open_no_lstrip = open + "+";
+ lexer_config.statement_open_force_lstrip = open + "-";
+ lexer_config.statement_close = close;
+ lexer_config.statement_close_force_rstrip = "-" + close;
+ lexer_config.update_open_chars();
+ }
+
+ /// Sets the opener for template line statements
+ void set_line_statement(const std::string &open) {
+ lexer_config.line_statement = open;
+ lexer_config.update_open_chars();
+ }
+
+ /// Sets the opener and closer for template expressions
+ void set_expression(const std::string &open, const std::string &close) {
+ lexer_config.expression_open = open;
+ lexer_config.expression_open_force_lstrip = open + "-";
+ lexer_config.expression_close = close;
+ lexer_config.expression_close_force_rstrip = "-" + close;
+ lexer_config.update_open_chars();
+ }
+
+ /// Sets the opener and closer for template comments
+ void set_comment(const std::string &open, const std::string &close) {
+ lexer_config.comment_open = open;
+ lexer_config.comment_close = close;
+ lexer_config.update_open_chars();
+ }
+
+ /// Sets whether to remove the first newline after a block
+ void set_trim_blocks(bool trim_blocks) {
+ lexer_config.trim_blocks = trim_blocks;
+ }
+
+ /// Sets whether to strip the spaces and tabs from the start of a line to a block
+ void set_lstrip_blocks(bool lstrip_blocks) {
+ lexer_config.lstrip_blocks = lstrip_blocks;
+ }
+
+ /// Sets the element notation syntax
+ void set_search_included_templates_in_files(bool search_in_files) {
+ parser_config.search_included_templates_in_files = search_in_files;
+ }
+
+ /// Sets whether a missing include will throw an error
+ void set_throw_at_missing_includes(bool will_throw) {
+ render_config.throw_at_missing_includes = will_throw;
+ }
+
+ Template parse(nonstd::string_view input) {
+ Parser parser(parser_config, lexer_config, template_storage, function_storage);
+ return parser.parse(input);
+ }
+
+ Template parse_template(const std::string &filename) {
+ Parser parser(parser_config, lexer_config, template_storage, function_storage);
+ auto result = Template(parser.load_file(input_path + static_cast<std::string>(filename)));
+ parser.parse_into_template(result, input_path + static_cast<std::string>(filename));
+ return result;
+ }
+
+ Template parse_file(const std::string &filename) {
+ return parse_template(filename);
+ }
+
+ std::string render(nonstd::string_view input, const json &data) { return render(parse(input), data); }
+
+ std::string render(const Template &tmpl, const json &data) {
+ std::stringstream os;
+ render_to(os, tmpl, data);
+ return os.str();
+ }
+
+ std::string render_file(const std::string &filename, const json &data) {
+ return render(parse_template(filename), data);
+ }
+
+ std::string render_file_with_json_file(const std::string &filename, const std::string &filename_data) {
+ const json data = load_json(filename_data);
+ return render_file(filename, data);
+ }
+
+ void write(const std::string &filename, const json &data, const std::string &filename_out) {
+ std::ofstream file(output_path + filename_out);
+ file << render_file(filename, data);
+ file.close();
+ }
+
+ void write(const Template &temp, const json &data, const std::string &filename_out) {
+ std::ofstream file(output_path + filename_out);
+ file << render(temp, data);
+ file.close();
+ }
+
+ void write_with_json_file(const std::string &filename, const std::string &filename_data,
+ const std::string &filename_out) {
+ const json data = load_json(filename_data);
+ write(filename, data, filename_out);
+ }
+
+ void write_with_json_file(const Template &temp, const std::string &filename_data, const std::string &filename_out) {
+ const json data = load_json(filename_data);
+ write(temp, data, filename_out);
+ }
+
+ std::ostream &render_to(std::ostream &os, const Template &tmpl, const json &data) {
+ Renderer(render_config, template_storage, function_storage).render_to(os, tmpl, data);
+ return os;
+ }
+
+ std::string load_file(const std::string &filename) {
+ Parser parser(parser_config, lexer_config, template_storage, function_storage);
+ return parser.load_file(input_path + filename);
+ }
+
+ json load_json(const std::string &filename) {
+ std::ifstream file;
+ open_file_or_throw(input_path + filename, file);
+ json j;
+ file >> j;
+ return j;
+ }
+
+ /*!
+ @brief Adds a variadic callback
+ */
+ void add_callback(const std::string &name, const CallbackFunction &callback) {
+ add_callback(name, -1, callback);
+ }
+
+ /*!
+ @brief Adds a variadic void callback
+ */
+ void add_void_callback(const std::string &name, const VoidCallbackFunction &callback) {
+ add_void_callback(name, -1, callback);
+ }
+
+ /*!
+ @brief Adds a callback with given number or arguments
+ */
+ void add_callback(const std::string &name, int num_args, const CallbackFunction &callback) {
+ function_storage.add_callback(name, num_args, callback);
+ }
+
+ /*!
+ @brief Adds a void callback with given number or arguments
+ */
+ void add_void_callback(const std::string &name, int num_args, const VoidCallbackFunction &callback) {
+ function_storage.add_callback(name, num_args, [callback](Arguments& args) { callback(args); return json(); });
+ }
+
+ /** Includes a template with a given name into the environment.
+ * Then, a template can be rendered in another template using the
+ * include "<name>" syntax.
+ */
+ void include_template(const std::string &name, const Template &tmpl) {
+ template_storage[name] = tmpl;
+ }
+};
+
+/*!
+@brief render with default settings to a string
+*/
+inline std::string render(nonstd::string_view input, const json &data) {
+ return Environment().render(input, data);
+}
+
+/*!
+@brief render with default settings to the given output stream
+*/
+inline void render_to(std::ostream &os, nonstd::string_view input, const json &data) {
+ Environment env;
+ env.render_to(os, env.parse(input), data);
+}
+
+} // namespace inja
+
+#endif // INCLUDE_INJA_ENVIRONMENT_HPP_
+
+// #include "exceptions.hpp"
+
+// #include "parser.hpp"
+
+// #include "renderer.hpp"
+
+// #include "string_view.hpp"
+
+// #include "template.hpp"
+
+
+#endif // INCLUDE_INJA_INJA_HPP_
diff --git a/deps/inja/test/benchmark.cpp b/deps/inja/test/benchmark.cpp
new file mode 100644
index 0000000..571a3ed
--- /dev/null
+++ b/deps/inja/test/benchmark.cpp
@@ -0,0 +1,29 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#include "hayai/hayai.hpp"
+#include <inja/inja.hpp>
+
+using json = nlohmann::json;
+
+inja::Environment env;
+
+const std::string test_file_directory {"../test/data/benchmark/"};
+
+json small_data = env.load_json(test_file_directory + "small_data.json");
+json large_data = env.load_json(test_file_directory + "large_data.json");
+std::string medium_template = env.load_file(test_file_directory + "medium_template.txt");
+std::string large_template = env.load_file(test_file_directory + "large_template.txt");
+
+
+BENCHMARK(SmallDataMediumTemplate, render, 5, 30) { env.render(medium_template, small_data); }
+BENCHMARK(LargeDataMediumTemplate, render, 5, 15) { env.render(medium_template, large_data); }
+BENCHMARK(LargeDataLargeTemplate, render, 5, 5) { env.render(large_template, large_data); }
+
+
+int main() {
+ hayai::ConsoleOutputter consoleOutputter;
+
+ hayai::Benchmarker::AddOutputter(consoleOutputter);
+ hayai::Benchmarker::RunAllTests();
+ return 0;
+}
diff --git a/deps/inja/test/data/benchmark/large_data.json b/deps/inja/test/data/benchmark/large_data.json
new file mode 100644
index 0000000..d42d244
--- /dev/null
+++ b/deps/inja/test/data/benchmark/large_data.json
@@ -0,0 +1,8022 @@
+{
+ "name": "Peter",
+ "list001": ["lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit", "aliquam", "accumsan"],
+ "list002": ["donec", "in", "egestas", "diam", "aenean", "suscipit", "scelerisque", "efficitur", "integer", "a"],
+ "list003": ["maecenas", "metus", "erat", "vestibulum", "quis", "porta", "in", "consequat", "sed", "justo"],
+ "data": [
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09953ad88944edf4e10aa4",
+ "index": 0,
+ "guid": "cc5d42de-5241-48d3-a87b-c9f4d09e91c0",
+ "isActive": false,
+ "balance": "$1,566.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Horton Burton",
+ "gender": "male",
+ "company": "NETROPIC",
+ "email": "hortonburton@netropic.com",
+ "phone": "+1 (940) 439-2294",
+ "address": "834 Franklin Street, Robbins, Ohio, 4604",
+ "about": "Nisi non velit ullamco laborum. Fugiat tempor aliquip incididunt id minim pariatur cillum. Labore dolor proident incididunt ullamco nostrud proident ex fugiat labore esse duis irure. Velit occaecat laboris voluptate anim exercitation pariatur. Laboris nisi aliquip anim in ea. Enim excepteur Lorem veniam esse velit ipsum nulla et. Minim est incididunt elit pariatur officia.\r\n",
+ "registered": "2019-12-24T03:13:24 -01:00",
+ "latitude": 73.545742,
+ "longitude": -61.750018,
+ "tags": [
+ "ex",
+ "minim",
+ "aliquip",
+ "reprehenderit",
+ "ullamco",
+ "officia",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Spears Mclean"
+ },
+ {
+ "id": 1,
+ "name": "Misty Knox"
+ },
+ {
+ "id": 2,
+ "name": "Karina Britt"
+ }
+ ],
+ "greeting": "Hello, Horton Burton! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ }
+ ],
+ "data2": [
+ {
+ "_id": "5f09978641a24425882186fd",
+ "index": 0,
+ "guid": "a93587d7-ef40-4b25-b476-6dcbc86e53f3",
+ "isActive": false,
+ "balance": "$3,805.80",
+ "picture": "http://placehold.it/32x32",
+ "age": 29,
+ "eyeColor": "blue",
+ "name": "Lucia Walsh",
+ "gender": "female",
+ "company": "SEQUITUR",
+ "email": "luciawalsh@sequitur.com",
+ "phone": "+1 (897) 401-2492",
+ "address": "751 Pooles Lane, Fostoria, Federated States Of Micronesia, 996",
+ "about": "Eu enim occaecat non sint est cillum eiusmod nostrud. Cillum exercitation ut irure enim ea laborum sit tempor velit sit. Exercitation pariatur excepteur id ea proident reprehenderit enim. Ut duis nulla excepteur adipisicing officia id pariatur. Officia nulla nisi esse dolor nostrud culpa magna aliqua quis occaecat id.\r\n",
+ "registered": "2015-05-03T07:45:41 -02:00",
+ "latitude": -18.330838,
+ "longitude": -75.837919,
+ "tags": [
+ "nostrud",
+ "laboris",
+ "ut",
+ "enim",
+ "voluptate",
+ "occaecat",
+ "aliquip"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Paula Allen"
+ },
+ {
+ "id": 1,
+ "name": "Johnston Head"
+ },
+ {
+ "id": 2,
+ "name": "Wilcox Garrison"
+ }
+ ],
+ "greeting": "Hello, Lucia Walsh! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f0997864792673a282944fc",
+ "index": 1,
+ "guid": "37bab207-5d07-4485-9286-570bcb806571",
+ "isActive": false,
+ "balance": "$1,423.02",
+ "picture": "http://placehold.it/32x32",
+ "age": 33,
+ "eyeColor": "blue",
+ "name": "Brooke Houston",
+ "gender": "female",
+ "company": "GYNK",
+ "email": "brookehouston@gynk.com",
+ "phone": "+1 (908) 489-3503",
+ "address": "779 Hyman Court, Lund, South Dakota, 5007",
+ "about": "Ex in pariatur commodo ex proident consectetur ipsum quis quis id voluptate occaecat. Velit anim eu ut amet aliquip officia. Mollit cupidatat nostrud magna commodo voluptate sunt cillum esse do Lorem id. Duis exercitation excepteur et dolor. Nostrud culpa incididunt culpa esse qui ullamco reprehenderit pariatur ut est. Consectetur ut minim culpa magna est tempor consequat. Mollit excepteur eu amet exercitation incididunt anim cupidatat tempor id ex aliquip.\r\n",
+ "registered": "2017-05-21T12:13:12 -02:00",
+ "latitude": -24.912234,
+ "longitude": -162.584135,
+ "tags": [
+ "fugiat",
+ "enim",
+ "nostrud",
+ "officia",
+ "pariatur",
+ "fugiat",
+ "in"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Noemi Villarreal"
+ },
+ {
+ "id": 1,
+ "name": "Deloris King"
+ },
+ {
+ "id": 2,
+ "name": "Mccormick Bryan"
+ }
+ ],
+ "greeting": "Hello, Brooke Houston! You have 2 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f099786b3fa2feafbb2fd0e",
+ "index": 2,
+ "guid": "8e1b4058-075e-4ebe-af1e-a695e21f053b",
+ "isActive": true,
+ "balance": "$2,684.61",
+ "picture": "http://placehold.it/32x32",
+ "age": 25,
+ "eyeColor": "green",
+ "name": "Francisca Miles",
+ "gender": "female",
+ "company": "RODEOLOGY",
+ "email": "franciscamiles@rodeology.com",
+ "phone": "+1 (853) 449-2333",
+ "address": "856 Ridge Court, Websterville, Nevada, 7669",
+ "about": "Proident velit in cupidatat quis proident in ipsum quis ullamco. Lorem non laboris sint aliqua commodo aliquip. Reprehenderit consectetur culpa proident et pariatur labore ipsum in do. Culpa velit aute Lorem culpa aute eiusmod cupidatat id deserunt. Magna ad tempor cillum dolor consectetur labore quis incididunt consequat. Aliquip non dolor Lorem cillum veniam et dolore ipsum non veniam fugiat consequat.\r\n",
+ "registered": "2019-12-01T06:13:11 -01:00",
+ "latitude": -76.376904,
+ "longitude": -140.91374,
+ "tags": [
+ "magna",
+ "ex",
+ "voluptate",
+ "irure",
+ "et",
+ "ex",
+ "qui"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Farrell Slater"
+ },
+ {
+ "id": 1,
+ "name": "Hewitt Valencia"
+ },
+ {
+ "id": 2,
+ "name": "Shelby Crawford"
+ }
+ ],
+ "greeting": "Hello, Francisca Miles! You have 7 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f0997868a7a8a25f5719fc8",
+ "index": 3,
+ "guid": "ce30c7f7-3851-40cb-bb57-44c374ae03e2",
+ "isActive": false,
+ "balance": "$1,089.23",
+ "picture": "http://placehold.it/32x32",
+ "age": 26,
+ "eyeColor": "blue",
+ "name": "Gloria Nieves",
+ "gender": "female",
+ "company": "CRUSTATIA",
+ "email": "glorianieves@crustatia.com",
+ "phone": "+1 (819) 557-2435",
+ "address": "984 Canton Court, Wolcott, Nebraska, 6707",
+ "about": "Qui sit mollit officia et anim. Ea id qui occaecat elit cillum cupidatat. Mollit cupidatat veniam laborum aute consequat. Ut velit duis in quis. Pariatur duis excepteur irure nisi aliquip officia consectetur culpa sint excepteur exercitation consequat.\r\n",
+ "registered": "2018-07-30T07:14:23 -02:00",
+ "latitude": 36.96077,
+ "longitude": -14.198522,
+ "tags": [
+ "voluptate",
+ "aliquip",
+ "id",
+ "occaecat",
+ "amet",
+ "velit",
+ "cillum"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Nolan Washington"
+ },
+ {
+ "id": 1,
+ "name": "Shelton Green"
+ },
+ {
+ "id": 2,
+ "name": "Brianna Macias"
+ }
+ ],
+ "greeting": "Hello, Gloria Nieves! You have 6 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f099786124ddff8a85fe58b",
+ "index": 4,
+ "guid": "4e5d6604-8ca1-43aa-8ec2-826af6c6cd5f",
+ "isActive": true,
+ "balance": "$2,797.24",
+ "picture": "http://placehold.it/32x32",
+ "age": 34,
+ "eyeColor": "brown",
+ "name": "Smith Castro",
+ "gender": "male",
+ "company": "TERRAGO",
+ "email": "smithcastro@terrago.com",
+ "phone": "+1 (831) 501-2989",
+ "address": "732 Lewis Avenue, Chalfant, Kansas, 6026",
+ "about": "Sunt exercitation non irure velit id aute ea Lorem culpa excepteur ipsum aute. Ex deserunt laboris commodo quis culpa eiusmod occaecat aliqua est et sunt et ex pariatur. Magna reprehenderit do duis adipisicing do id magna. Cillum Lorem voluptate ut laborum exercitation velit minim.\r\n",
+ "registered": "2014-03-19T05:10:54 -01:00",
+ "latitude": -21.337466,
+ "longitude": -107.441678,
+ "tags": [
+ "pariatur",
+ "eiusmod",
+ "aliquip",
+ "consequat",
+ "ut",
+ "deserunt",
+ "magna"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Galloway Goodwin"
+ },
+ {
+ "id": 1,
+ "name": "Miles Crane"
+ },
+ {
+ "id": 2,
+ "name": "Mayer Justice"
+ }
+ ],
+ "greeting": "Hello, Smith Castro! You have 7 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f099786a72fd7cb9a5e7154",
+ "index": 5,
+ "guid": "45e2142a-41f7-479e-a0f0-b3ec92fad8ad",
+ "isActive": false,
+ "balance": "$2,123.99",
+ "picture": "http://placehold.it/32x32",
+ "age": 39,
+ "eyeColor": "brown",
+ "name": "Rodriguez David",
+ "gender": "male",
+ "company": "OVIUM",
+ "email": "rodriguezdavid@ovium.com",
+ "phone": "+1 (824) 420-2762",
+ "address": "850 Seba Avenue, Cetronia, Virgin Islands, 7419",
+ "about": "Enim culpa occaecat magna nulla. Id ut commodo velit ut proident. Voluptate Lorem consectetur commodo incididunt deserunt tempor irure veniam nulla voluptate aute duis consectetur. Anim elit qui sunt nulla laboris dolore eu. Ex reprehenderit proident irure incididunt dolor in aliqua mollit incididunt. Exercitation pariatur duis nostrud nulla proident Lorem laborum veniam ullamco.\r\n",
+ "registered": "2015-05-21T09:19:42 -02:00",
+ "latitude": 47.787065,
+ "longitude": 118.997055,
+ "tags": [
+ "elit",
+ "reprehenderit",
+ "amet",
+ "voluptate",
+ "in",
+ "qui",
+ "incididunt"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Willis Larsen"
+ },
+ {
+ "id": 1,
+ "name": "Figueroa Maldonado"
+ },
+ {
+ "id": 2,
+ "name": "Wyatt Larson"
+ }
+ ],
+ "greeting": "Hello, Rodriguez David! You have 1 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f0997863614c4536d1e6f43",
+ "index": 6,
+ "guid": "2b928c2b-d640-4421-8932-8b884d9d4269",
+ "isActive": true,
+ "balance": "$3,885.56",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "blue",
+ "name": "Mercedes Nguyen",
+ "gender": "female",
+ "company": "NETPLAX",
+ "email": "mercedesnguyen@netplax.com",
+ "phone": "+1 (844) 501-2053",
+ "address": "906 Cobek Court, Fairfield, Massachusetts, 7732",
+ "about": "Ipsum sit aliquip nostrud pariatur culpa nisi ex. Quis consequat anim cupidatat culpa fugiat exercitation ad irure dolor do adipisicing exercitation. Sint dolore est dolor velit.\r\n",
+ "registered": "2014-01-01T10:03:20 -01:00",
+ "latitude": 7.982827,
+ "longitude": -126.052161,
+ "tags": [
+ "quis",
+ "laborum",
+ "consequat",
+ "labore",
+ "voluptate",
+ "elit",
+ "veniam"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Neal Schneider"
+ },
+ {
+ "id": 1,
+ "name": "Randi Booth"
+ },
+ {
+ "id": 2,
+ "name": "Kristen Sherman"
+ }
+ ],
+ "greeting": "Hello, Mercedes Nguyen! You have 8 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09978668b9afcbfed867c4",
+ "index": 7,
+ "guid": "cdc49c36-6449-4ea6-a556-46eb0576bb31",
+ "isActive": true,
+ "balance": "$2,303.38",
+ "picture": "http://placehold.it/32x32",
+ "age": 36,
+ "eyeColor": "green",
+ "name": "Delores Sandoval",
+ "gender": "female",
+ "company": "REVERSUS",
+ "email": "deloressandoval@reversus.com",
+ "phone": "+1 (824) 437-2449",
+ "address": "543 Gotham Avenue, Allamuchy, Alabama, 2425",
+ "about": "Commodo nostrud non ea esse pariatur consequat commodo ullamco incididunt. Do veniam fugiat elit irure adipisicing elit. Enim consectetur qui ex et non adipisicing cupidatat. Quis commodo ad commodo irure occaecat adipisicing qui aliqua proident mollit non exercitation irure sunt. Proident quis reprehenderit dolore ea laborum elit reprehenderit quis do tempor qui anim id.\r\n",
+ "registered": "2018-09-17T01:50:00 -02:00",
+ "latitude": -61.031876,
+ "longitude": 161.489006,
+ "tags": [
+ "culpa",
+ "officia",
+ "excepteur",
+ "commodo",
+ "dolore",
+ "proident",
+ "amet"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Jeannette Hooper"
+ },
+ {
+ "id": 1,
+ "name": "Rivers Collier"
+ },
+ {
+ "id": 2,
+ "name": "Hobbs Swanson"
+ }
+ ],
+ "greeting": "Hello, Delores Sandoval! You have 8 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09978663d20749f76b7450",
+ "index": 8,
+ "guid": "6dd38055-0983-47e8-8f3e-84146da69e77",
+ "isActive": true,
+ "balance": "$1,633.09",
+ "picture": "http://placehold.it/32x32",
+ "age": 30,
+ "eyeColor": "green",
+ "name": "Mullins Erickson",
+ "gender": "male",
+ "company": "ZOINAGE",
+ "email": "mullinserickson@zoinage.com",
+ "phone": "+1 (899) 572-2700",
+ "address": "475 Garnet Street, Spokane, Wisconsin, 3174",
+ "about": "Duis aute nulla amet velit fugiat adipisicing commodo amet exercitation. Labore deserunt adipisicing sit do laboris mollit et. Fugiat in ea adipisicing veniam sint nisi culpa. Aute duis ullamco fugiat commodo exercitation amet Lorem.\r\n",
+ "registered": "2015-04-16T08:39:24 -02:00",
+ "latitude": 2.168979,
+ "longitude": 60.505828,
+ "tags": [
+ "tempor",
+ "enim",
+ "ad",
+ "occaecat",
+ "labore",
+ "anim",
+ "est"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Conrad Shannon"
+ },
+ {
+ "id": 1,
+ "name": "Crane Hensley"
+ },
+ {
+ "id": 2,
+ "name": "Ratliff Adams"
+ }
+ ],
+ "greeting": "Hello, Mullins Erickson! You have 10 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09978613f51078380535b1",
+ "index": 9,
+ "guid": "1c1ae1ec-12a2-47ff-9ea8-39d7d6a5ccb2",
+ "isActive": false,
+ "balance": "$2,590.01",
+ "picture": "http://placehold.it/32x32",
+ "age": 35,
+ "eyeColor": "brown",
+ "name": "Schneider York",
+ "gender": "male",
+ "company": "ONTAGENE",
+ "email": "schneideryork@ontagene.com",
+ "phone": "+1 (880) 587-2205",
+ "address": "541 Dooley Street, Selma, Minnesota, 6837",
+ "about": "Officia aliquip ut ad qui dolore aliqua do cillum eu irure minim non cillum. Qui eiusmod cillum laboris nisi dolor dolor ea adipisicing dolore aliquip adipisicing sunt ex. Magna consectetur aute eu est consectetur aliquip elit adipisicing ipsum nisi tempor mollit dolore mollit. Occaecat aute ullamco ex occaecat do labore enim nostrud ut laboris excepteur ad esse. Magna ad incididunt quis laborum proident consequat. Enim proident ex sint laborum veniam enim aute ex dolor.\r\n",
+ "registered": "2019-09-13T05:28:07 -02:00",
+ "latitude": -39.957673,
+ "longitude": -125.057077,
+ "tags": [
+ "est",
+ "duis",
+ "non",
+ "anim",
+ "voluptate",
+ "elit",
+ "aliqua"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Martina Bean"
+ },
+ {
+ "id": 1,
+ "name": "Esperanza Turner"
+ },
+ {
+ "id": 2,
+ "name": "Gilbert Boyd"
+ }
+ ],
+ "greeting": "Hello, Schneider York! You have 5 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f099786ccaca8d09e1a49f6",
+ "index": 10,
+ "guid": "7c4f04cc-9ffa-4bd3-b4fb-e53a6f641d65",
+ "isActive": true,
+ "balance": "$3,971.62",
+ "picture": "http://placehold.it/32x32",
+ "age": 30,
+ "eyeColor": "brown",
+ "name": "Shannon Gilliam",
+ "gender": "female",
+ "company": "GEEKFARM",
+ "email": "shannongilliam@geekfarm.com",
+ "phone": "+1 (856) 504-2406",
+ "address": "553 Townsend Street, Fidelis, Idaho, 576",
+ "about": "Consequat aute excepteur duis duis aute exercitation ea quis veniam magna est. Exercitation reprehenderit officia elit cupidatat fugiat aliqua proident labore proident veniam pariatur ad. Quis officia exercitation sit laborum exercitation aute anim veniam veniam incididunt consequat aliquip Lorem. Consequat sunt aute ut proident anim aliquip. Eu amet ex excepteur Lorem commodo tempor ea. Id laborum mollit sit est qui veniam eiusmod laboris do cupidatat pariatur.\r\n",
+ "registered": "2020-03-12T07:13:12 -01:00",
+ "latitude": -32.134733,
+ "longitude": -95.550168,
+ "tags": [
+ "ullamco",
+ "ut",
+ "tempor",
+ "anim",
+ "qui",
+ "ut",
+ "et"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Zamora Duke"
+ },
+ {
+ "id": 1,
+ "name": "Odom Case"
+ },
+ {
+ "id": 2,
+ "name": "Erna Rios"
+ }
+ ],
+ "greeting": "Hello, Shannon Gilliam! You have 7 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f0997868ffed01cf2ca682f",
+ "index": 11,
+ "guid": "6d0a233e-7b2a-40e7-aa54-a112bd52c4e7",
+ "isActive": true,
+ "balance": "$1,599.29",
+ "picture": "http://placehold.it/32x32",
+ "age": 25,
+ "eyeColor": "green",
+ "name": "Branch Norris",
+ "gender": "male",
+ "company": "BOSTONIC",
+ "email": "branchnorris@bostonic.com",
+ "phone": "+1 (939) 590-3532",
+ "address": "498 Chapel Street, Iola, Colorado, 3316",
+ "about": "Nisi sint consequat aute qui aliqua sunt eu. Incididunt deserunt veniam occaecat reprehenderit magna amet reprehenderit aliqua sunt voluptate. Dolore Lorem anim commodo labore do culpa anim do. Id dolore ipsum dolor elit dolor Lorem veniam anim. Occaecat ex sit non consectetur. Nulla ex officia aute enim cillum ut mollit veniam cillum in esse adipisicing cillum excepteur. Minim in fugiat amet nostrud qui exercitation ipsum quis elit.\r\n",
+ "registered": "2019-08-31T09:03:08 -02:00",
+ "latitude": -79.74357,
+ "longitude": -162.967401,
+ "tags": [
+ "magna",
+ "ut",
+ "adipisicing",
+ "id",
+ "esse",
+ "occaecat",
+ "laborum"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Reid Mooney"
+ },
+ {
+ "id": 1,
+ "name": "Chambers Hendrix"
+ },
+ {
+ "id": 2,
+ "name": "Aileen Curry"
+ }
+ ],
+ "greeting": "Hello, Branch Norris! You have 3 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f099786039b68c4ac573af2",
+ "index": 12,
+ "guid": "606733b8-d9d6-448d-b50e-c39bb9068ac6",
+ "isActive": false,
+ "balance": "$1,916.71",
+ "picture": "http://placehold.it/32x32",
+ "age": 22,
+ "eyeColor": "brown",
+ "name": "Laverne Knox",
+ "gender": "female",
+ "company": "TURNLING",
+ "email": "laverneknox@turnling.com",
+ "phone": "+1 (852) 503-3387",
+ "address": "685 Norman Avenue, Roosevelt, Guam, 5794",
+ "about": "Enim dolor anim laborum voluptate ex velit. Ipsum voluptate culpa aute proident minim elit ullamco. Mollit esse veniam adipisicing quis quis pariatur eu ut. Qui officia officia occaecat nisi sint tempor sunt qui nostrud ea. Lorem duis quis commodo aliquip ut id eu. Deserunt voluptate sit cupidatat do magna ex quis non exercitation eu commodo velit aliqua. Do laborum mollit ullamco magna incididunt excepteur.\r\n",
+ "registered": "2018-02-25T03:24:56 -01:00",
+ "latitude": 62.94875,
+ "longitude": -30.698582,
+ "tags": [
+ "veniam",
+ "nostrud",
+ "ut",
+ "amet",
+ "do",
+ "ad",
+ "veniam"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Bernard Merritt"
+ },
+ {
+ "id": 1,
+ "name": "Baker Berry"
+ },
+ {
+ "id": 2,
+ "name": "Browning Williamson"
+ }
+ ],
+ "greeting": "Hello, Laverne Knox! You have 4 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09978630a6820f185980be",
+ "index": 13,
+ "guid": "499f7147-72e4-4459-8adf-e5b8621368f6",
+ "isActive": false,
+ "balance": "$1,955.15",
+ "picture": "http://placehold.it/32x32",
+ "age": 26,
+ "eyeColor": "brown",
+ "name": "Cash Owens",
+ "gender": "male",
+ "company": "JIMBIES",
+ "email": "cashowens@jimbies.com",
+ "phone": "+1 (855) 584-3002",
+ "address": "556 Dewitt Avenue, Beaverdale, Palau, 4502",
+ "about": "In nisi aute sint id eu cillum velit magna est amet cupidatat laborum. Duis mollit eu enim eiusmod reprehenderit ut. Aliqua pariatur non officia irure eu elit labore cupidatat dolore do. Fugiat et nostrud occaecat Lorem qui proident sint labore eiusmod nisi non incididunt. Id cillum nostrud eiusmod ad culpa cupidatat nisi velit. Commodo mollit sit voluptate velit qui occaecat minim elit consectetur exercitation labore reprehenderit incididunt veniam.\r\n",
+ "registered": "2018-10-29T09:18:02 -01:00",
+ "latitude": -20.725597,
+ "longitude": -57.459661,
+ "tags": [
+ "consequat",
+ "cupidatat",
+ "culpa",
+ "cillum",
+ "fugiat",
+ "non",
+ "cillum"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Potts Ratliff"
+ },
+ {
+ "id": 1,
+ "name": "Blake Holden"
+ },
+ {
+ "id": 2,
+ "name": "Katie Holman"
+ }
+ ],
+ "greeting": "Hello, Cash Owens! You have 3 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f0997863e243f998a10fe73",
+ "index": 14,
+ "guid": "9d6959e6-66a0-4287-8cf2-d1e5533ccac7",
+ "isActive": true,
+ "balance": "$3,479.09",
+ "picture": "http://placehold.it/32x32",
+ "age": 37,
+ "eyeColor": "brown",
+ "name": "Noel Greer",
+ "gender": "male",
+ "company": "ISOSURE",
+ "email": "noelgreer@isosure.com",
+ "phone": "+1 (960) 470-2938",
+ "address": "307 Congress Street, Brandywine, Northern Mariana Islands, 4433",
+ "about": "Cillum labore ad tempor elit velit occaecat cupidatat aute laboris. Labore proident proident exercitation occaecat laboris pariatur laboris anim incididunt aliquip aliquip deserunt fugiat. Tempor dolore officia velit sit excepteur duis magna dolor eu quis ipsum. Elit minim qui cupidatat tempor proident. Laborum qui Lorem et ex laboris et dolore. Enim labore minim tempor est est velit.\r\n",
+ "registered": "2014-01-13T06:36:48 -01:00",
+ "latitude": -77.685603,
+ "longitude": -87.245279,
+ "tags": [
+ "minim",
+ "id",
+ "minim",
+ "ea",
+ "aute",
+ "laborum",
+ "ad"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Duran Rosales"
+ },
+ {
+ "id": 1,
+ "name": "Jenifer Stephens"
+ },
+ {
+ "id": 2,
+ "name": "Gates Garner"
+ }
+ ],
+ "greeting": "Hello, Noel Greer! You have 10 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f099786676a9b88a4a7c013",
+ "index": 15,
+ "guid": "8d72cf7d-32fa-46df-b094-bd10f0f20dc7",
+ "isActive": true,
+ "balance": "$2,288.59",
+ "picture": "http://placehold.it/32x32",
+ "age": 38,
+ "eyeColor": "blue",
+ "name": "Minnie Terry",
+ "gender": "female",
+ "company": "ROOFORIA",
+ "email": "minnieterry@rooforia.com",
+ "phone": "+1 (902) 451-3882",
+ "address": "760 Williams Avenue, Davenport, Puerto Rico, 3390",
+ "about": "Incididunt adipisicing amet excepteur adipisicing deserunt adipisicing dolore aliquip cillum aliquip. Commodo labore proident non anim. Deserunt elit consectetur ipsum in tempor. Eiusmod ipsum consectetur non aliquip minim occaecat exercitation ex enim aliqua dolore occaecat incididunt. Nulla voluptate sunt elit est ex aliquip quis. Sunt minim nostrud ut veniam.\r\n",
+ "registered": "2017-03-12T02:20:12 -01:00",
+ "latitude": 43.923294,
+ "longitude": -18.187048,
+ "tags": [
+ "labore",
+ "cupidatat",
+ "magna",
+ "voluptate",
+ "culpa",
+ "duis",
+ "voluptate"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Todd Clemons"
+ },
+ {
+ "id": 1,
+ "name": "Monique Shaffer"
+ },
+ {
+ "id": 2,
+ "name": "Malone Wagner"
+ }
+ ],
+ "greeting": "Hello, Minnie Terry! You have 9 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f0997862a5e657a94b7c4f4",
+ "index": 16,
+ "guid": "1df50e8d-8371-4fe9-bba3-41d94629924e",
+ "isActive": false,
+ "balance": "$3,295.57",
+ "picture": "http://placehold.it/32x32",
+ "age": 22,
+ "eyeColor": "blue",
+ "name": "Hodge Sykes",
+ "gender": "male",
+ "company": "COMVOY",
+ "email": "hodgesykes@comvoy.com",
+ "phone": "+1 (850) 534-3601",
+ "address": "181 Aitken Place, Hannasville, Montana, 6905",
+ "about": "Labore ea cillum sunt nostrud aliqua. Cillum laboris culpa ipsum sunt. Excepteur tempor laborum esse veniam ipsum nulla tempor incididunt veniam aute. Culpa anim cillum cupidatat id veniam eu qui consectetur ex non reprehenderit qui adipisicing deserunt. Culpa tempor id reprehenderit tempor cupidatat laboris aute quis aute sunt cupidatat excepteur ut nostrud. Exercitation ea ex sunt sunt exercitation.\r\n",
+ "registered": "2020-03-25T02:00:13 -01:00",
+ "latitude": -16.651672,
+ "longitude": -71.914807,
+ "tags": [
+ "ad",
+ "consectetur",
+ "ex",
+ "irure",
+ "id",
+ "nulla",
+ "minim"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Lott Hogan"
+ },
+ {
+ "id": 1,
+ "name": "Wilkinson Underwood"
+ },
+ {
+ "id": 2,
+ "name": "Celeste Buchanan"
+ }
+ ],
+ "greeting": "Hello, Hodge Sykes! You have 1 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f099786fc2172edb5ed8e8d",
+ "index": 17,
+ "guid": "755eb01c-f4bb-421e-9119-ca2260295670",
+ "isActive": true,
+ "balance": "$3,031.32",
+ "picture": "http://placehold.it/32x32",
+ "age": 25,
+ "eyeColor": "green",
+ "name": "Ellison Rhodes",
+ "gender": "male",
+ "company": "GEEKMOSIS",
+ "email": "ellisonrhodes@geekmosis.com",
+ "phone": "+1 (856) 570-3711",
+ "address": "705 Lott Street, Glenville, Oklahoma, 4509",
+ "about": "Id sunt amet do minim dolore mollit consectetur consequat non excepteur sunt laborum cupidatat cupidatat. Lorem est duis cillum consectetur ut ullamco laborum nostrud mollit do esse dolore mollit non. Aliqua eu velit dolore mollit ipsum culpa id voluptate veniam et. Reprehenderit dolore aute fugiat commodo laboris do tempor anim laboris ad. Sit cillum ex non consequat labore occaecat adipisicing et ut in voluptate et. Ea quis esse quis ipsum ipsum voluptate exercitation consequat culpa est in dolore.\r\n",
+ "registered": "2017-01-27T05:46:29 -01:00",
+ "latitude": 21.662857,
+ "longitude": -104.070679,
+ "tags": [
+ "tempor",
+ "in",
+ "aliquip",
+ "non",
+ "proident",
+ "ut",
+ "eu"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Woodward Obrien"
+ },
+ {
+ "id": 1,
+ "name": "Dora Everett"
+ },
+ {
+ "id": 2,
+ "name": "Sparks Madden"
+ }
+ ],
+ "greeting": "Hello, Ellison Rhodes! You have 7 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09978671dad706761f3514",
+ "index": 18,
+ "guid": "71fd5684-76fa-4e53-9baa-4d35c404b51b",
+ "isActive": false,
+ "balance": "$1,589.84",
+ "picture": "http://placehold.it/32x32",
+ "age": 38,
+ "eyeColor": "brown",
+ "name": "Bentley Cruz",
+ "gender": "male",
+ "company": "UTARA",
+ "email": "bentleycruz@utara.com",
+ "phone": "+1 (820) 527-2028",
+ "address": "459 Meserole Avenue, Alafaya, Mississippi, 4523",
+ "about": "Anim aliquip magna mollit cillum cillum. Commodo in adipisicing laborum pariatur eiusmod. In exercitation incididunt magna labore eiusmod reprehenderit ullamco eu id dolor qui aute sit velit. Minim minim elit veniam deserunt sunt esse deserunt quis veniam. Do laboris ad enim commodo irure Lorem adipisicing ullamco duis sint aliquip cillum aliqua.\r\n",
+ "registered": "2014-11-11T07:00:42 -01:00",
+ "latitude": 56.129358,
+ "longitude": -99.868098,
+ "tags": [
+ "proident",
+ "culpa",
+ "ullamco",
+ "ipsum",
+ "elit",
+ "qui",
+ "quis"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Rocha Duran"
+ },
+ {
+ "id": 1,
+ "name": "Annabelle Santos"
+ },
+ {
+ "id": 2,
+ "name": "Madelyn Browning"
+ }
+ ],
+ "greeting": "Hello, Bentley Cruz! You have 5 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09978610269ee5961f00d1",
+ "index": 19,
+ "guid": "21c628fa-cdc4-4db3-a4dc-788e2dab49cf",
+ "isActive": true,
+ "balance": "$1,192.31",
+ "picture": "http://placehold.it/32x32",
+ "age": 20,
+ "eyeColor": "brown",
+ "name": "Ford Hatfield",
+ "gender": "male",
+ "company": "DUOFLEX",
+ "email": "fordhatfield@duoflex.com",
+ "phone": "+1 (810) 513-2940",
+ "address": "306 Amersfort Place, Bergoo, Missouri, 9991",
+ "about": "Esse consectetur aliqua quis non veniam esse eu aute tempor. Esse aliquip tempor labore velit. Elit aute deserunt deserunt ipsum est ullamco Lorem. Do eiusmod consectetur do anim qui ea occaecat anim commodo enim ipsum tempor elit in.\r\n",
+ "registered": "2018-04-10T08:39:06 -02:00",
+ "latitude": 49.106759,
+ "longitude": 38.342395,
+ "tags": [
+ "pariatur",
+ "laboris",
+ "exercitation",
+ "est",
+ "labore",
+ "ullamco",
+ "in"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Patty Burch"
+ },
+ {
+ "id": 1,
+ "name": "Norma Marks"
+ },
+ {
+ "id": 2,
+ "name": "Sadie Hughes"
+ }
+ ],
+ "greeting": "Hello, Ford Hatfield! You have 4 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09978698225d3e699230ce",
+ "index": 20,
+ "guid": "eee4ec1a-4da0-4354-81e8-1503ae623e4a",
+ "isActive": true,
+ "balance": "$3,876.97",
+ "picture": "http://placehold.it/32x32",
+ "age": 25,
+ "eyeColor": "green",
+ "name": "Dorothy Pope",
+ "gender": "female",
+ "company": "INSOURCE",
+ "email": "dorothypope@insource.com",
+ "phone": "+1 (807) 598-2440",
+ "address": "402 Calder Place, Hoagland, Delaware, 4213",
+ "about": "Sunt nisi incididunt ut dolore mollit officia ullamco tempor quis. Occaecat anim aliquip id pariatur sit pariatur. Consequat magna nostrud ex veniam officia quis ullamco aute consequat mollit laborum in sit aliqua. Eiusmod tempor commodo proident ipsum quis non laborum reprehenderit veniam sint elit. Deserunt enim occaecat do eiusmod mollit laboris esse proident. Aliqua aute officia deserunt do. Enim cillum aute deserunt magna aute incididunt pariatur.\r\n",
+ "registered": "2020-05-04T10:44:35 -02:00",
+ "latitude": -43.784197,
+ "longitude": -128.40362,
+ "tags": [
+ "elit",
+ "voluptate",
+ "sit",
+ "do",
+ "pariatur",
+ "excepteur",
+ "aute"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Harrison Flynn"
+ },
+ {
+ "id": 1,
+ "name": "Gabriela Ashley"
+ },
+ {
+ "id": 2,
+ "name": "Phoebe Mcguire"
+ }
+ ],
+ "greeting": "Hello, Dorothy Pope! You have 2 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f0997860a61a0bc8168bdd5",
+ "index": 21,
+ "guid": "6aa92fb6-9dc9-42af-b7d1-7196940ac79f",
+ "isActive": false,
+ "balance": "$2,640.28",
+ "picture": "http://placehold.it/32x32",
+ "age": 37,
+ "eyeColor": "brown",
+ "name": "Nona Meyers",
+ "gender": "female",
+ "company": "ZEAM",
+ "email": "nonameyers@zeam.com",
+ "phone": "+1 (836) 449-2809",
+ "address": "587 Nevins Street, Kenmar, Washington, 162",
+ "about": "Qui laborum voluptate amet minim nostrud incididunt. Aliqua commodo incididunt nisi enim ipsum minim esse labore consectetur id sunt adipisicing Lorem aute. Sint labore sunt fugiat duis. Non duis ipsum incididunt non consectetur laboris dolore. Dolore ea velit et nostrud aute duis excepteur laboris non commodo ullamco adipisicing. Aliquip eiusmod elit adipisicing eu velit voluptate exercitation occaecat magna culpa ullamco proident duis.\r\n",
+ "registered": "2016-04-13T03:35:43 -02:00",
+ "latitude": 50.425552,
+ "longitude": 68.22109,
+ "tags": [
+ "voluptate",
+ "nisi",
+ "aliqua",
+ "nostrud",
+ "excepteur",
+ "nulla",
+ "culpa"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Megan Galloway"
+ },
+ {
+ "id": 1,
+ "name": "Morrow Lawrence"
+ },
+ {
+ "id": 2,
+ "name": "Goldie Ramirez"
+ }
+ ],
+ "greeting": "Hello, Nona Meyers! You have 7 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f099786918ad6831fae7a36",
+ "index": 22,
+ "guid": "7c8555c5-8550-4ddd-82a7-2ee32ab4a928",
+ "isActive": false,
+ "balance": "$3,740.70",
+ "picture": "http://placehold.it/32x32",
+ "age": 23,
+ "eyeColor": "brown",
+ "name": "Levine Wolfe",
+ "gender": "male",
+ "company": "OTHERSIDE",
+ "email": "levinewolfe@otherside.com",
+ "phone": "+1 (840) 408-3399",
+ "address": "626 Linden Boulevard, Bartonsville, Connecticut, 2607",
+ "about": "Elit magna do non officia ea labore culpa est commodo dolor ad. Commodo voluptate deserunt elit quis. Lorem id aliquip mollit duis eu eu anim aliqua excepteur.\r\n",
+ "registered": "2018-06-27T02:40:59 -02:00",
+ "latitude": 42.271697,
+ "longitude": -160.569715,
+ "tags": [
+ "deserunt",
+ "labore",
+ "consectetur",
+ "voluptate",
+ "velit",
+ "dolore",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Cobb Noel"
+ },
+ {
+ "id": 1,
+ "name": "George Chavez"
+ },
+ {
+ "id": 2,
+ "name": "Lorie Delaney"
+ }
+ ],
+ "greeting": "Hello, Levine Wolfe! You have 4 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f0997861147e7e519f19624",
+ "index": 23,
+ "guid": "55673d63-eb10-40d9-8fa9-a566779f9158",
+ "isActive": false,
+ "balance": "$3,547.23",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "brown",
+ "name": "Lea Stokes",
+ "gender": "female",
+ "company": "WARETEL",
+ "email": "leastokes@waretel.com",
+ "phone": "+1 (835) 584-3403",
+ "address": "736 Veranda Place, Fulford, Georgia, 6554",
+ "about": "Anim officia nulla quis ipsum excepteur velit adipisicing dolor consequat. Tempor voluptate adipisicing laborum mollit enim laboris. Ad quis incididunt dolore irure in Lorem laborum velit enim sunt velit in. Consequat id consequat pariatur adipisicing id esse quis exercitation ad ipsum do anim laborum. Lorem ad labore commodo occaecat pariatur amet anim nisi sunt enim adipisicing voluptate eu veniam. Sunt voluptate nulla sunt sint aute officia voluptate. Do dolore ullamco reprehenderit ex amet et sunt fugiat nisi.\r\n",
+ "registered": "2018-12-29T12:07:20 -01:00",
+ "latitude": -65.648482,
+ "longitude": 166.097321,
+ "tags": [
+ "est",
+ "anim",
+ "adipisicing",
+ "excepteur",
+ "sit",
+ "aliqua",
+ "est"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Jeanne Campbell"
+ },
+ {
+ "id": 1,
+ "name": "Hardin Manning"
+ },
+ {
+ "id": 2,
+ "name": "Young Waters"
+ }
+ ],
+ "greeting": "Hello, Lea Stokes! You have 5 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f0997867b4248cb82bd3744",
+ "index": 24,
+ "guid": "00778745-c54f-45d3-a19b-62303532b56c",
+ "isActive": true,
+ "balance": "$2,568.07",
+ "picture": "http://placehold.it/32x32",
+ "age": 24,
+ "eyeColor": "blue",
+ "name": "Fleming Christian",
+ "gender": "male",
+ "company": "ULTRASURE",
+ "email": "flemingchristian@ultrasure.com",
+ "phone": "+1 (985) 496-2889",
+ "address": "371 Bush Street, Thomasville, Hawaii, 9192",
+ "about": "Fugiat sint Lorem cupidatat qui ad aliqua exercitation. Laboris nisi commodo ad aute ipsum eu in cupidatat aliquip labore exercitation proident sit anim. Aliqua magna labore elit id cillum labore dolor occaecat velit dolore quis sint eu. Labore sunt eiusmod laboris culpa excepteur do qui. Dolor sit ullamco anim irure veniam labore excepteur est ea culpa officia ea. Anim minim tempor ut anim et eu ea. Magna esse ut et in occaecat cupidatat incididunt quis aliqua.\r\n",
+ "registered": "2019-07-19T01:23:50 -02:00",
+ "latitude": -39.481292,
+ "longitude": 139.491332,
+ "tags": [
+ "aute",
+ "velit",
+ "pariatur",
+ "ex",
+ "minim",
+ "irure",
+ "dolor"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Jillian Franks"
+ },
+ {
+ "id": 1,
+ "name": "Mills Joyner"
+ },
+ {
+ "id": 2,
+ "name": "Faulkner Hamilton"
+ }
+ ],
+ "greeting": "Hello, Fleming Christian! You have 9 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f0997869cb565fd7c4a04e4",
+ "index": 25,
+ "guid": "312aa0e8-f540-4410-8b3c-447779fae464",
+ "isActive": true,
+ "balance": "$2,227.71",
+ "picture": "http://placehold.it/32x32",
+ "age": 32,
+ "eyeColor": "green",
+ "name": "Trujillo Britt",
+ "gender": "male",
+ "company": "ENOMEN",
+ "email": "trujillobritt@enomen.com",
+ "phone": "+1 (908) 540-3265",
+ "address": "743 Perry Terrace, Curtice, Tennessee, 3763",
+ "about": "Velit velit nulla aute laboris consectetur pariatur sit quis pariatur amet reprehenderit sit. Veniam consectetur ad ullamco do adipisicing. Quis laboris fugiat non eiusmod magna veniam laborum consectetur velit mollit et consectetur aliqua. Voluptate do consectetur commodo officia sint esse ipsum occaecat anim. Incididunt adipisicing ipsum proident ea proident laboris aliqua voluptate fugiat cupidatat incididunt aliqua. Veniam eu tempor nisi amet deserunt duis id sint excepteur.\r\n",
+ "registered": "2016-05-14T03:55:31 -02:00",
+ "latitude": -54.854451,
+ "longitude": 82.0465,
+ "tags": [
+ "minim",
+ "tempor",
+ "nisi",
+ "officia",
+ "Lorem",
+ "officia",
+ "nisi"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Terrie Patrick"
+ },
+ {
+ "id": 1,
+ "name": "Horn Reynolds"
+ },
+ {
+ "id": 2,
+ "name": "Althea Jackson"
+ }
+ ],
+ "greeting": "Hello, Trujillo Britt! You have 5 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f099786ed44afe1f5bb4839",
+ "index": 26,
+ "guid": "e51e1a52-4d5c-4be0-8a84-1c0dda22dc94",
+ "isActive": false,
+ "balance": "$3,248.93",
+ "picture": "http://placehold.it/32x32",
+ "age": 22,
+ "eyeColor": "green",
+ "name": "Swanson Becker",
+ "gender": "male",
+ "company": "CEDWARD",
+ "email": "swansonbecker@cedward.com",
+ "phone": "+1 (974) 517-3364",
+ "address": "320 Nautilus Avenue, Dellview, Maine, 7835",
+ "about": "Laboris dolor dolore nisi culpa ea ullamco. Anim do ea nisi ullamco aute enim nisi in ut qui. Excepteur consequat ea cillum in ut exercitation minim culpa excepteur ipsum.\r\n",
+ "registered": "2019-12-15T05:21:01 -01:00",
+ "latitude": -84.26969,
+ "longitude": 130.358247,
+ "tags": [
+ "laboris",
+ "laboris",
+ "ex",
+ "ad",
+ "aute",
+ "magna",
+ "nostrud"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Mcfarland Lucas"
+ },
+ {
+ "id": 1,
+ "name": "Cassie Byrd"
+ },
+ {
+ "id": 2,
+ "name": "Bridges Pruitt"
+ }
+ ],
+ "greeting": "Hello, Swanson Becker! You have 8 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f0997868b7a6e9bf2b8a074",
+ "index": 27,
+ "guid": "2ca95e1c-4ad7-4a48-a95b-cebc7adefcdc",
+ "isActive": true,
+ "balance": "$2,605.32",
+ "picture": "http://placehold.it/32x32",
+ "age": 25,
+ "eyeColor": "brown",
+ "name": "Beck Tyler",
+ "gender": "male",
+ "company": "CONFERIA",
+ "email": "becktyler@conferia.com",
+ "phone": "+1 (924) 466-3441",
+ "address": "903 Fleet Walk, Nanafalia, Alaska, 9069",
+ "about": "Deserunt excepteur Lorem officia anim duis quis tempor nulla adipisicing officia aliquip irure occaecat. Consequat labore cillum velit elit aute labore mollit nulla labore culpa enim aute. Culpa mollit et ullamco do quis est. In enim enim nisi id fugiat elit minim in.\r\n",
+ "registered": "2014-02-13T11:34:46 -01:00",
+ "latitude": 18.620349,
+ "longitude": -76.81325,
+ "tags": [
+ "anim",
+ "consectetur",
+ "enim",
+ "dolore",
+ "do",
+ "adipisicing",
+ "reprehenderit"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Hughes Richmond"
+ },
+ {
+ "id": 1,
+ "name": "Carey Klein"
+ },
+ {
+ "id": 2,
+ "name": "Dorthy Carney"
+ }
+ ],
+ "greeting": "Hello, Beck Tyler! You have 9 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09978659b756833a619d79",
+ "index": 28,
+ "guid": "c99a4b63-01a2-4cc5-8bbc-d9c416119e3b",
+ "isActive": true,
+ "balance": "$3,388.56",
+ "picture": "http://placehold.it/32x32",
+ "age": 40,
+ "eyeColor": "brown",
+ "name": "Rachelle Emerson",
+ "gender": "female",
+ "company": "ZENCO",
+ "email": "rachelleemerson@zenco.com",
+ "phone": "+1 (836) 462-2593",
+ "address": "675 Kossuth Place, Goldfield, New York, 3891",
+ "about": "Sunt adipisicing commodo cillum voluptate minim enim aliqua. Ex velit in cupidatat nulla aliqua magna elit. Reprehenderit consequat duis occaecat fugiat id sunt ut tempor incididunt est laborum ad velit proident.\r\n",
+ "registered": "2017-03-13T11:41:34 -01:00",
+ "latitude": 5.822774,
+ "longitude": 40.20469,
+ "tags": [
+ "consectetur",
+ "magna",
+ "fugiat",
+ "consectetur",
+ "eiusmod",
+ "occaecat",
+ "id"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Pittman Small"
+ },
+ {
+ "id": 1,
+ "name": "Lynne Hardin"
+ },
+ {
+ "id": 2,
+ "name": "Christi Hahn"
+ }
+ ],
+ "greeting": "Hello, Rachelle Emerson! You have 6 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f0997866f97c411cd0ee453",
+ "index": 29,
+ "guid": "3c1130d9-e889-4566-a9e0-b0ee3e695a1a",
+ "isActive": false,
+ "balance": "$3,268.59",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "blue",
+ "name": "Stacey Gross",
+ "gender": "female",
+ "company": "ENERVATE",
+ "email": "staceygross@enervate.com",
+ "phone": "+1 (965) 407-2502",
+ "address": "738 Caton Avenue, Rote, Louisiana, 4187",
+ "about": "Nulla sint sint ea ex id ullamco irure pariatur nostrud sint amet. Minim amet nostrud voluptate excepteur ad do occaecat. Fugiat sit incididunt irure et enim. Deserunt quis ut cillum esse elit mollit ut Lorem voluptate. Eu amet nostrud nostrud amet aliqua. Ut id incididunt ullamco excepteur nulla ea ut aliqua esse in exercitation. Esse culpa eu excepteur deserunt aute irure tempor sunt ad anim cupidatat ad.\r\n",
+ "registered": "2015-09-04T05:16:46 -02:00",
+ "latitude": -16.047114,
+ "longitude": -158.870624,
+ "tags": [
+ "ut",
+ "irure",
+ "adipisicing",
+ "aliqua",
+ "cupidatat",
+ "exercitation",
+ "veniam"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Morgan Dixon"
+ },
+ {
+ "id": 1,
+ "name": "Adrienne Morrison"
+ },
+ {
+ "id": 2,
+ "name": "June Deleon"
+ }
+ ],
+ "greeting": "Hello, Stacey Gross! You have 5 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09978639870b30233ee3ed",
+ "index": 30,
+ "guid": "2d48b9a5-841c-4e23-bb9f-a00a167b35ea",
+ "isActive": true,
+ "balance": "$1,949.19",
+ "picture": "http://placehold.it/32x32",
+ "age": 31,
+ "eyeColor": "brown",
+ "name": "Kidd Wilder",
+ "gender": "male",
+ "company": "SENMAO",
+ "email": "kiddwilder@senmao.com",
+ "phone": "+1 (895) 581-3691",
+ "address": "663 Crescent Street, Kylertown, Illinois, 7382",
+ "about": "Laborum laborum exercitation deserunt voluptate nulla dolor aute ut. Culpa officia adipisicing est commodo Lorem est ullamco aliqua irure. Occaecat velit elit nulla ea. Esse exercitation mollit tempor aute ad ad est. Cillum aliqua sit fugiat magna. Consequat nulla aliqua velit excepteur laborum cupidatat deserunt cillum cupidatat. Aliquip quis ipsum et nulla nulla.\r\n",
+ "registered": "2016-05-14T02:33:01 -02:00",
+ "latitude": -62.450575,
+ "longitude": -73.581311,
+ "tags": [
+ "in",
+ "voluptate",
+ "pariatur",
+ "sunt",
+ "ex",
+ "deserunt",
+ "cillum"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Candice Salinas"
+ },
+ {
+ "id": 1,
+ "name": "Gay Mcfarland"
+ },
+ {
+ "id": 2,
+ "name": "Booker Harvey"
+ }
+ ],
+ "greeting": "Hello, Kidd Wilder! You have 8 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f099786f1fb8d1853a233b6",
+ "index": 31,
+ "guid": "df4ca5a3-bbb3-45e9-8f2b-fa409f70bfa7",
+ "isActive": false,
+ "balance": "$2,330.50",
+ "picture": "http://placehold.it/32x32",
+ "age": 40,
+ "eyeColor": "blue",
+ "name": "Henson Sullivan",
+ "gender": "male",
+ "company": "PAPRIKUT",
+ "email": "hensonsullivan@paprikut.com",
+ "phone": "+1 (870) 503-3732",
+ "address": "750 Bowery Street, Fresno, Oregon, 9262",
+ "about": "Voluptate minim occaecat elit labore sit duis nulla veniam nulla et proident. Cillum veniam ex amet cillum officia ut sint velit elit nulla aute sit laboris. Consectetur sint commodo voluptate eiusmod commodo quis et quis aliqua ullamco est aliquip dolor. Magna proident ad ut incididunt quis laboris id sit proident aliquip. Nostrud officia sunt velit sint est excepteur. Cillum eiusmod sunt pariatur consequat.\r\n",
+ "registered": "2016-12-30T09:37:37 -01:00",
+ "latitude": 9.471251,
+ "longitude": 29.130976,
+ "tags": [
+ "laborum",
+ "aute",
+ "quis",
+ "duis",
+ "sit",
+ "mollit",
+ "eiusmod"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Josephine Wong"
+ },
+ {
+ "id": 1,
+ "name": "Juana Lane"
+ },
+ {
+ "id": 2,
+ "name": "Castillo Lara"
+ }
+ ],
+ "greeting": "Hello, Henson Sullivan! You have 6 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f099786a20452e1b963bc21",
+ "index": 32,
+ "guid": "09a1f3e9-2f03-4b86-bdb2-adb30987170e",
+ "isActive": true,
+ "balance": "$3,583.04",
+ "picture": "http://placehold.it/32x32",
+ "age": 22,
+ "eyeColor": "brown",
+ "name": "Virgie Frost",
+ "gender": "female",
+ "company": "FROSNEX",
+ "email": "virgiefrost@frosnex.com",
+ "phone": "+1 (833) 471-3322",
+ "address": "577 Lynch Street, Falmouth, North Carolina, 4958",
+ "about": "Labore ipsum aliqua aliquip nostrud commodo fugiat aliquip et elit tempor esse. Sunt aute ut exercitation id fugiat ut reprehenderit exercitation aute duis laboris sit reprehenderit. Cupidatat cupidatat magna velit aliquip eiusmod aute elit eiusmod eiusmod.\r\n",
+ "registered": "2019-10-30T08:19:01 -01:00",
+ "latitude": -23.345632,
+ "longitude": -102.189865,
+ "tags": [
+ "non",
+ "ad",
+ "Lorem",
+ "sit",
+ "ullamco",
+ "anim",
+ "ad"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Becker Merrill"
+ },
+ {
+ "id": 1,
+ "name": "Roslyn Good"
+ },
+ {
+ "id": 2,
+ "name": "Hopper Ortiz"
+ }
+ ],
+ "greeting": "Hello, Virgie Frost! You have 3 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f099786f2085a2a74df90df",
+ "index": 33,
+ "guid": "a6135ff6-eefa-445f-bbf7-8c1026955650",
+ "isActive": false,
+ "balance": "$3,514.44",
+ "picture": "http://placehold.it/32x32",
+ "age": 32,
+ "eyeColor": "green",
+ "name": "Loraine Boyle",
+ "gender": "female",
+ "company": "VURBO",
+ "email": "loraineboyle@vurbo.com",
+ "phone": "+1 (848) 412-3231",
+ "address": "631 Bennet Court, Lumberton, Vermont, 1046",
+ "about": "Velit nostrud laboris mollit laboris sint. Aliqua quis sint consectetur irure irure exercitation sit enim. Adipisicing aliqua non qui laboris veniam non officia ut qui ipsum dolor. Culpa cupidatat et proident ullamco irure aliqua enim. Aliquip dolore nulla reprehenderit deserunt id excepteur aliquip exercitation in cillum nisi elit.\r\n",
+ "registered": "2015-06-18T04:43:59 -02:00",
+ "latitude": 49.037953,
+ "longitude": -163.512133,
+ "tags": [
+ "adipisicing",
+ "pariatur",
+ "cillum",
+ "culpa",
+ "occaecat",
+ "cillum",
+ "consequat"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Toni Williams"
+ },
+ {
+ "id": 1,
+ "name": "Rosalinda Rocha"
+ },
+ {
+ "id": 2,
+ "name": "Frieda Dawson"
+ }
+ ],
+ "greeting": "Hello, Loraine Boyle! You have 9 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f0997868ea5396ddcae547f",
+ "index": 34,
+ "guid": "3ea4a6c5-1c0c-4f79-9ee7-92f819c7658c",
+ "isActive": true,
+ "balance": "$1,517.71",
+ "picture": "http://placehold.it/32x32",
+ "age": 31,
+ "eyeColor": "blue",
+ "name": "Haney Vaughan",
+ "gender": "male",
+ "company": "ZUVY",
+ "email": "haneyvaughan@zuvy.com",
+ "phone": "+1 (872) 524-2639",
+ "address": "610 Pulaski Street, Axis, New Mexico, 126",
+ "about": "Laborum exercitation occaecat sunt dolore tempor. Ex anim proident tempor do velit elit exercitation et anim id et exercitation ea eiusmod. Aute ullamco ipsum esse elit laborum laborum nostrud culpa. Quis cillum aliquip nulla pariatur incididunt mollit nisi laborum. Eu exercitation dolore quis nostrud reprehenderit voluptate esse dolor pariatur est nisi. Esse esse adipisicing occaecat in est nulla. Et voluptate dolor do do deserunt eu et minim sint nisi proident.\r\n",
+ "registered": "2018-01-21T12:44:37 -01:00",
+ "latitude": -69.756425,
+ "longitude": -169.522929,
+ "tags": [
+ "sunt",
+ "ex",
+ "voluptate",
+ "irure",
+ "nisi",
+ "incididunt",
+ "non"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Tate Cooke"
+ },
+ {
+ "id": 1,
+ "name": "Morales Fleming"
+ },
+ {
+ "id": 2,
+ "name": "Emily Aguilar"
+ }
+ ],
+ "greeting": "Hello, Haney Vaughan! You have 1 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f099786ba79b6c8311428f6",
+ "index": 35,
+ "guid": "433222cf-bbfb-4e17-93f0-c58e41683f5a",
+ "isActive": false,
+ "balance": "$3,409.71",
+ "picture": "http://placehold.it/32x32",
+ "age": 30,
+ "eyeColor": "brown",
+ "name": "Murphy Hays",
+ "gender": "male",
+ "company": "ELPRO",
+ "email": "murphyhays@elpro.com",
+ "phone": "+1 (877) 548-3019",
+ "address": "179 Granite Street, Dargan, North Dakota, 330",
+ "about": "Anim qui laboris reprehenderit adipisicing. Quis laborum enim consequat id. Commodo consectetur fugiat sint voluptate sunt qui enim mollit esse. Cillum mollit id ullamco veniam eu in ex dolore ad. In irure cillum adipisicing dolor qui dolore adipisicing sit Lorem enim eu Lorem veniam. Proident irure quis incididunt irure aute mollit dolore ea. Qui pariatur id ea id ad voluptate do nisi.\r\n",
+ "registered": "2015-02-01T05:50:47 -01:00",
+ "latitude": 46.674413,
+ "longitude": -2.922828,
+ "tags": [
+ "exercitation",
+ "officia",
+ "ipsum",
+ "aute",
+ "adipisicing",
+ "est",
+ "deserunt"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Mcmillan Farmer"
+ },
+ {
+ "id": 1,
+ "name": "Sharron Buck"
+ },
+ {
+ "id": 2,
+ "name": "Cooper Rice"
+ }
+ ],
+ "greeting": "Hello, Murphy Hays! You have 2 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f099786d8fa36679d4920c1",
+ "index": 36,
+ "guid": "554cf895-615e-4fde-8d24-3813635bb2e3",
+ "isActive": true,
+ "balance": "$3,815.03",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "blue",
+ "name": "Terra Cortez",
+ "gender": "female",
+ "company": "SCENTRIC",
+ "email": "terracortez@scentric.com",
+ "phone": "+1 (995) 544-2054",
+ "address": "593 Gerry Street, Shepardsville, Marshall Islands, 8098",
+ "about": "Sint ipsum nostrud dolor ea aute eiusmod nisi. Culpa voluptate sit cupidatat dolore labore velit tempor anim dolor ipsum ipsum tempor commodo. Laborum ad est irure duis dolor consectetur ea anim ex.\r\n",
+ "registered": "2015-04-24T05:28:53 -02:00",
+ "latitude": 13.569564,
+ "longitude": 137.638398,
+ "tags": [
+ "adipisicing",
+ "ad",
+ "Lorem",
+ "non",
+ "culpa",
+ "sunt",
+ "proident"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Manning Henson"
+ },
+ {
+ "id": 1,
+ "name": "Mccall Solomon"
+ },
+ {
+ "id": 2,
+ "name": "Paulette Horne"
+ }
+ ],
+ "greeting": "Hello, Terra Cortez! You have 10 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09978618ea66e0177c75bd",
+ "index": 37,
+ "guid": "593a3f24-5fe2-4272-ad56-de4dff5e8eba",
+ "isActive": true,
+ "balance": "$1,009.78",
+ "picture": "http://placehold.it/32x32",
+ "age": 35,
+ "eyeColor": "blue",
+ "name": "Walker Fuller",
+ "gender": "male",
+ "company": "NIMON",
+ "email": "walkerfuller@nimon.com",
+ "phone": "+1 (814) 453-2045",
+ "address": "265 Meserole Street, Sabillasville, Michigan, 4946",
+ "about": "Ullamco aliquip sunt commodo culpa ullamco aliqua. Veniam et eiusmod adipisicing laboris nulla reprehenderit deserunt non incididunt deserunt excepteur labore ullamco. Magna mollit sint magna amet. Nisi laboris cupidatat elit proident qui Lorem minim nulla ea cillum. Eu nulla enim ad enim reprehenderit commodo dolore ut ea minim nulla tempor proident.\r\n",
+ "registered": "2019-09-08T01:51:10 -02:00",
+ "latitude": -63.870257,
+ "longitude": -37.815484,
+ "tags": [
+ "veniam",
+ "culpa",
+ "enim",
+ "elit",
+ "excepteur",
+ "consequat",
+ "nostrud"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Liliana Walter"
+ },
+ {
+ "id": 1,
+ "name": "Simone Mcdowell"
+ },
+ {
+ "id": 2,
+ "name": "Farley Gallagher"
+ }
+ ],
+ "greeting": "Hello, Walker Fuller! You have 9 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f099786442f6aa6cbcea4ac",
+ "index": 38,
+ "guid": "9183cfd1-45de-4ad8-a334-2eb72210623f",
+ "isActive": true,
+ "balance": "$2,038.02",
+ "picture": "http://placehold.it/32x32",
+ "age": 24,
+ "eyeColor": "green",
+ "name": "Jill Yang",
+ "gender": "female",
+ "company": "VIOCULAR",
+ "email": "jillyang@viocular.com",
+ "phone": "+1 (896) 564-2563",
+ "address": "623 Cass Place, Bentley, American Samoa, 7793",
+ "about": "Dolore ut laborum nulla aliqua velit sint. Anim non sit nulla cillum. Est aliqua ipsum ex irure commodo. Anim dolore elit fugiat occaecat incididunt sit nostrud non ullamco ex cupidatat mollit adipisicing.\r\n",
+ "registered": "2016-12-27T08:09:41 -01:00",
+ "latitude": 87.528438,
+ "longitude": -63.009251,
+ "tags": [
+ "minim",
+ "commodo",
+ "qui",
+ "voluptate",
+ "officia",
+ "excepteur",
+ "minim"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Mcclain Griffin"
+ },
+ {
+ "id": 1,
+ "name": "Reese Carpenter"
+ },
+ {
+ "id": 2,
+ "name": "Franklin Webb"
+ }
+ ],
+ "greeting": "Hello, Jill Yang! You have 2 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f0997868abc25d3251a2a9b",
+ "index": 39,
+ "guid": "c83fa8d1-a889-4b60-bbcf-5dd1d8d48872",
+ "isActive": true,
+ "balance": "$3,480.45",
+ "picture": "http://placehold.it/32x32",
+ "age": 22,
+ "eyeColor": "brown",
+ "name": "Noreen Ryan",
+ "gender": "female",
+ "company": "CYTRAK",
+ "email": "noreenryan@cytrak.com",
+ "phone": "+1 (829) 521-2674",
+ "address": "748 Frost Street, Coalmont, Maryland, 5892",
+ "about": "Qui duis adipisicing nostrud excepteur incididunt elit dolore reprehenderit occaecat non. Sunt nisi nulla ea aliqua ut ipsum dolore do anim elit consequat sint anim. Amet veniam dolore qui eu reprehenderit. Quis nisi ipsum nulla ullamco tempor ad non deserunt ipsum irure id proident id. Est reprehenderit ad adipisicing magna in pariatur ea ex sunt. Ipsum commodo anim laborum occaecat.\r\n",
+ "registered": "2015-05-06T02:22:48 -02:00",
+ "latitude": -81.879329,
+ "longitude": -19.177358,
+ "tags": [
+ "Lorem",
+ "in",
+ "adipisicing",
+ "minim",
+ "nostrud",
+ "cillum",
+ "officia"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Glenna Fulton"
+ },
+ {
+ "id": 1,
+ "name": "Clara Barlow"
+ },
+ {
+ "id": 2,
+ "name": "Vicki Hudson"
+ }
+ ],
+ "greeting": "Hello, Noreen Ryan! You have 7 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f0997861c37b3c0bc146c60",
+ "index": 40,
+ "guid": "575c20b5-89de-46f6-ad79-76bd09123fcd",
+ "isActive": false,
+ "balance": "$1,988.53",
+ "picture": "http://placehold.it/32x32",
+ "age": 29,
+ "eyeColor": "blue",
+ "name": "Adele Chan",
+ "gender": "female",
+ "company": "ZYTREK",
+ "email": "adelechan@zytrek.com",
+ "phone": "+1 (999) 592-3917",
+ "address": "958 Bancroft Place, Balm, Arizona, 6166",
+ "about": "Laborum veniam quis veniam minim est excepteur labore proident incididunt qui ea labore dolore nulla. Enim consectetur voluptate Lorem eiusmod commodo. Eiusmod reprehenderit non laborum ad exercitation consectetur quis. Dolor tempor quis esse Lorem fugiat nulla eu duis qui ad consectetur proident sunt. Et aliquip proident laborum id. Est quis eu sit ut Lorem nisi. Sint occaecat occaecat sint magna dolor dolor.\r\n",
+ "registered": "2014-09-01T06:14:17 -02:00",
+ "latitude": -18.738797,
+ "longitude": 107.913139,
+ "tags": [
+ "laborum",
+ "cupidatat",
+ "excepteur",
+ "magna",
+ "consequat",
+ "esse",
+ "deserunt"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Aisha Mcdonald"
+ },
+ {
+ "id": 1,
+ "name": "Glover Contreras"
+ },
+ {
+ "id": 2,
+ "name": "Ida Barker"
+ }
+ ],
+ "greeting": "Hello, Adele Chan! You have 5 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09978677408e3832787a18",
+ "index": 41,
+ "guid": "cd7f3366-4b90-46c4-909c-2bebf50a041f",
+ "isActive": true,
+ "balance": "$3,523.60",
+ "picture": "http://placehold.it/32x32",
+ "age": 23,
+ "eyeColor": "blue",
+ "name": "Shawna Riggs",
+ "gender": "female",
+ "company": "AQUAZURE",
+ "email": "shawnariggs@aquazure.com",
+ "phone": "+1 (812) 422-2349",
+ "address": "753 Bergen Court, Ladera, Florida, 8720",
+ "about": "Deserunt aliquip consequat et nisi Lorem officia sunt adipisicing deserunt fugiat occaecat. Commodo nisi aliquip ex qui in proident ea officia. Non elit sit ipsum ea tempor duis id. Nostrud veniam reprehenderit non veniam quis Lorem.\r\n",
+ "registered": "2014-09-23T01:28:59 -02:00",
+ "latitude": 29.18221,
+ "longitude": 1.746913,
+ "tags": [
+ "dolore",
+ "nostrud",
+ "nulla",
+ "cillum",
+ "id",
+ "minim",
+ "ea"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Sweet Mcpherson"
+ },
+ {
+ "id": 1,
+ "name": "Stark Carter"
+ },
+ {
+ "id": 2,
+ "name": "Clare Foster"
+ }
+ ],
+ "greeting": "Hello, Shawna Riggs! You have 2 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f099786cd5ed1639c03463d",
+ "index": 42,
+ "guid": "2ecee631-0407-4170-b652-60cdcac0a8df",
+ "isActive": false,
+ "balance": "$3,883.68",
+ "picture": "http://placehold.it/32x32",
+ "age": 40,
+ "eyeColor": "green",
+ "name": "Hester Ware",
+ "gender": "male",
+ "company": "ZAYA",
+ "email": "hesterware@zaya.com",
+ "phone": "+1 (831) 487-3813",
+ "address": "955 Clermont Avenue, Talpa, Arkansas, 8877",
+ "about": "Sit ipsum labore in labore non mollit irure consectetur pariatur amet nostrud occaecat ad. Voluptate labore excepteur laborum consequat ipsum ipsum do dolor labore ex velit. Ipsum enim non sunt aute esse ex et laboris cupidatat irure. Consectetur eiusmod minim non cillum exercitation consectetur in cillum nulla amet amet deserunt anim fugiat. Mollit ipsum ea mollit laboris sint fugiat mollit mollit.\r\n",
+ "registered": "2019-05-12T02:26:59 -02:00",
+ "latitude": -73.53245,
+ "longitude": -82.498624,
+ "tags": [
+ "non",
+ "consequat",
+ "ipsum",
+ "tempor",
+ "pariatur",
+ "elit",
+ "consequat"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Augusta Forbes"
+ },
+ {
+ "id": 1,
+ "name": "Rosalyn Russell"
+ },
+ {
+ "id": 2,
+ "name": "Garza Bernard"
+ }
+ ],
+ "greeting": "Hello, Hester Ware! You have 1 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f099786d1dc90e4ee35e491",
+ "index": 43,
+ "guid": "8e8b82a1-beff-40b2-9297-6fb7cfb12cd8",
+ "isActive": false,
+ "balance": "$1,286.04",
+ "picture": "http://placehold.it/32x32",
+ "age": 26,
+ "eyeColor": "blue",
+ "name": "Cohen Beach",
+ "gender": "male",
+ "company": "HYPLEX",
+ "email": "cohenbeach@hyplex.com",
+ "phone": "+1 (942) 445-2059",
+ "address": "804 Essex Street, Brutus, Iowa, 297",
+ "about": "Ipsum sunt fugiat laboris magna ipsum id. Anim occaecat esse quis nisi eiusmod. Ea ea occaecat reprehenderit consectetur amet aliquip sit do minim sit exercitation do. Occaecat cupidatat cupidatat pariatur magna labore enim sunt fugiat ut culpa. Ullamco consequat Lorem veniam cillum tempor enim do ullamco non incididunt duis culpa qui sit. Deserunt excepteur id id exercitation quis tempor.\r\n",
+ "registered": "2018-01-29T03:01:15 -01:00",
+ "latitude": 45.296654,
+ "longitude": 46.479898,
+ "tags": [
+ "proident",
+ "ea",
+ "veniam",
+ "velit",
+ "dolor",
+ "mollit",
+ "velit"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Lawanda Sanford"
+ },
+ {
+ "id": 1,
+ "name": "Marsh Horton"
+ },
+ {
+ "id": 2,
+ "name": "Underwood Keith"
+ }
+ ],
+ "greeting": "Hello, Cohen Beach! You have 7 unread messages.",
+ "favoriteFruit": "strawberry"
+ }
+ ],
+ "data3": [
+ {
+ "_id": "5f09979cf6ea2db62cc98f36",
+ "index": 0,
+ "guid": "81021b07-ad8c-477d-948d-b732b0287cc6",
+ "isActive": false,
+ "balance": "$3,738.69",
+ "picture": "http://placehold.it/32x32",
+ "age": 26,
+ "eyeColor": "blue",
+ "name": "Callahan Osborn",
+ "gender": "male",
+ "company": "OLYMPIX",
+ "email": "callahanosborn@olympix.com",
+ "phone": "+1 (941) 505-2565",
+ "address": "627 Gaylord Drive, Clayville, Maine, 508",
+ "about": "Ex aliquip deserunt ut adipisicing Lorem fugiat et. Commodo cupidatat eiusmod ad eiusmod ex laborum laborum eiusmod pariatur cupidatat anim consectetur. Exercitation cillum veniam ipsum laboris sit esse et aute consectetur labore do.\r\n",
+ "registered": "2017-02-15T08:30:20 -01:00",
+ "latitude": -57.885941,
+ "longitude": -137.263087,
+ "tags": [
+ "pariatur",
+ "qui",
+ "sint",
+ "dolore",
+ "reprehenderit",
+ "aute",
+ "tempor"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Maude Whitaker"
+ },
+ {
+ "id": 1,
+ "name": "Lee Franco"
+ },
+ {
+ "id": 2,
+ "name": "Kari Reilly"
+ }
+ ],
+ "greeting": "Hello, Callahan Osborn! You have 5 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c144471057309b996",
+ "index": 1,
+ "guid": "212d3055-2a45-4de9-a654-032af5794676",
+ "isActive": true,
+ "balance": "$3,977.57",
+ "picture": "http://placehold.it/32x32",
+ "age": 21,
+ "eyeColor": "green",
+ "name": "Curtis Sargent",
+ "gender": "male",
+ "company": "FURNITECH",
+ "email": "curtissargent@furnitech.com",
+ "phone": "+1 (802) 518-2935",
+ "address": "402 Royce Place, Zarephath, Kansas, 3855",
+ "about": "Dolore occaecat aliqua ut laborum et elit reprehenderit. Do cupidatat officia esse in cupidatat irure est id. Consectetur ad ut dolor magna duis commodo ullamco sint.\r\n",
+ "registered": "2017-01-05T01:08:34 -01:00",
+ "latitude": 30.9722,
+ "longitude": 162.760382,
+ "tags": [
+ "commodo",
+ "sit",
+ "sit",
+ "ad",
+ "nisi",
+ "in",
+ "laborum"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Katina Stone"
+ },
+ {
+ "id": 1,
+ "name": "Alma Chambers"
+ },
+ {
+ "id": 2,
+ "name": "Hopkins Henderson"
+ }
+ ],
+ "greeting": "Hello, Curtis Sargent! You have 7 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09979c50eeb9485b65865c",
+ "index": 2,
+ "guid": "b01d9b88-521e-4bd1-a610-110b56719978",
+ "isActive": false,
+ "balance": "$3,502.45",
+ "picture": "http://placehold.it/32x32",
+ "age": 33,
+ "eyeColor": "green",
+ "name": "Schwartz Chen",
+ "gender": "male",
+ "company": "PREMIANT",
+ "email": "schwartzchen@premiant.com",
+ "phone": "+1 (984) 437-3009",
+ "address": "193 Ridge Court, Carlos, Alaska, 1165",
+ "about": "Do non labore sint voluptate proident. Laborum in duis sint tempor aliquip aliqua. Excepteur dolore incididunt commodo mollit. Minim veniam laborum laborum proident.\r\n",
+ "registered": "2019-11-18T07:30:31 -01:00",
+ "latitude": 39.017379,
+ "longitude": -101.574242,
+ "tags": [
+ "duis",
+ "tempor",
+ "aliqua",
+ "consequat",
+ "consequat",
+ "esse",
+ "nisi"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Wendy Noel"
+ },
+ {
+ "id": 1,
+ "name": "Constance Salas"
+ },
+ {
+ "id": 2,
+ "name": "Bessie Ortega"
+ }
+ ],
+ "greeting": "Hello, Schwartz Chen! You have 2 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979cc809f9837aa4caf8",
+ "index": 3,
+ "guid": "f3c8c03c-6633-4920-98e4-fdf2d9fffeab",
+ "isActive": false,
+ "balance": "$3,904.10",
+ "picture": "http://placehold.it/32x32",
+ "age": 20,
+ "eyeColor": "green",
+ "name": "Everett Norris",
+ "gender": "male",
+ "company": "DATAGEN",
+ "email": "everettnorris@datagen.com",
+ "phone": "+1 (915) 589-2160",
+ "address": "121 Hendrix Street, Stewartville, American Samoa, 5844",
+ "about": "Fugiat fugiat elit in elit magna deserunt. Cillum cillum sit sunt incididunt dolor pariatur. Laboris veniam do sit id dolor sit anim. Labore dolor duis nisi nostrud nisi incididunt dolor elit. Qui dolore eiusmod incididunt proident reprehenderit aliqua amet dolore duis reprehenderit cupidatat non. Aliquip ut esse laboris nulla minim excepteur ullamco laboris eiusmod. Ut officia dolore nisi eiusmod consectetur eiusmod duis.\r\n",
+ "registered": "2014-03-18T10:23:51 -01:00",
+ "latitude": -36.486149,
+ "longitude": -46.860448,
+ "tags": [
+ "reprehenderit",
+ "tempor",
+ "exercitation",
+ "anim",
+ "cupidatat",
+ "ipsum",
+ "dolore"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Walls Reeves"
+ },
+ {
+ "id": 1,
+ "name": "Sheppard Underwood"
+ },
+ {
+ "id": 2,
+ "name": "Jordan Finch"
+ }
+ ],
+ "greeting": "Hello, Everett Norris! You have 3 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09979c4be7c8d4f13dc6e9",
+ "index": 4,
+ "guid": "2e884f28-a2bf-4488-aaa4-2cdf56ea0f63",
+ "isActive": false,
+ "balance": "$1,203.35",
+ "picture": "http://placehold.it/32x32",
+ "age": 38,
+ "eyeColor": "brown",
+ "name": "Laurie Cleveland",
+ "gender": "female",
+ "company": "EXODOC",
+ "email": "lauriecleveland@exodoc.com",
+ "phone": "+1 (800) 500-2137",
+ "address": "199 Fleet Walk, Townsend, Palau, 9613",
+ "about": "Officia in non veniam excepteur non sunt proident labore et. Consectetur occaecat enim proident anim amet anim. Ut culpa quis ullamco amet sit consectetur cillum labore consequat. Culpa enim quis nostrud Lorem ipsum voluptate laborum et. Excepteur id laboris aliquip incididunt ullamco quis et voluptate eu nostrud reprehenderit veniam. Ipsum magna sit ex aliqua ex excepteur sunt exercitation deserunt voluptate voluptate veniam adipisicing ad. Reprehenderit ad duis enim velit in laboris veniam incididunt velit occaecat laborum adipisicing.\r\n",
+ "registered": "2018-12-13T03:58:52 -01:00",
+ "latitude": 48.849514,
+ "longitude": -12.395931,
+ "tags": [
+ "ea",
+ "non",
+ "do",
+ "amet",
+ "fugiat",
+ "consectetur",
+ "consectetur"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Cohen Lynch"
+ },
+ {
+ "id": 1,
+ "name": "Liza Barnes"
+ },
+ {
+ "id": 2,
+ "name": "Althea Cohen"
+ }
+ ],
+ "greeting": "Hello, Laurie Cleveland! You have 7 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c4eccd3b8a2f65b28",
+ "index": 5,
+ "guid": "6adf2052-5eb2-4fa1-963c-928dd788bb46",
+ "isActive": false,
+ "balance": "$3,640.21",
+ "picture": "http://placehold.it/32x32",
+ "age": 21,
+ "eyeColor": "blue",
+ "name": "Wilkins Buchanan",
+ "gender": "male",
+ "company": "SURELOGIC",
+ "email": "wilkinsbuchanan@surelogic.com",
+ "phone": "+1 (832) 500-3235",
+ "address": "569 Kings Hwy, Stevens, Washington, 9388",
+ "about": "Anim nisi voluptate deserunt officia. Id Lorem incididunt mollit duis adipisicing excepteur nulla amet mollit proident veniam. Dolor enim adipisicing aute anim do id sint enim consectetur magna mollit anim esse consequat. Commodo commodo proident amet consequat exercitation enim mollit sunt. Nisi consequat sunt aliquip nisi minim et ut fugiat excepteur.\r\n",
+ "registered": "2018-07-20T04:21:12 -02:00",
+ "latitude": -22.518791,
+ "longitude": 111.446091,
+ "tags": [
+ "veniam",
+ "aliquip",
+ "culpa",
+ "duis",
+ "qui",
+ "elit",
+ "proident"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Davidson Bradshaw"
+ },
+ {
+ "id": 1,
+ "name": "Melanie Dillon"
+ },
+ {
+ "id": 2,
+ "name": "Nichols Benton"
+ }
+ ],
+ "greeting": "Hello, Wilkins Buchanan! You have 6 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c2f2645144a776c62",
+ "index": 6,
+ "guid": "643f8131-f96a-4895-ba21-4b5e92686500",
+ "isActive": true,
+ "balance": "$3,677.27",
+ "picture": "http://placehold.it/32x32",
+ "age": 40,
+ "eyeColor": "brown",
+ "name": "Faith Carney",
+ "gender": "female",
+ "company": "WARETEL",
+ "email": "faithcarney@waretel.com",
+ "phone": "+1 (943) 506-2268",
+ "address": "986 Wolcott Street, Snelling, Delaware, 5687",
+ "about": "Minim tempor esse eu id deserunt. Cupidatat reprehenderit dolore minim nulla ut ea. Velit aliqua pariatur Lorem ut labore id culpa. Deserunt in et fugiat qui deserunt quis velit labore anim in et ad reprehenderit. Dolore magna dolor exercitation laborum ullamco ea ipsum Lorem. Commodo culpa quis ex eiusmod occaecat id dolore veniam fugiat ex pariatur cillum adipisicing do. Proident sit sit quis voluptate cillum elit laborum sit quis labore proident consequat officia eiusmod.\r\n",
+ "registered": "2019-09-22T08:50:48 -02:00",
+ "latitude": -36.539713,
+ "longitude": 158.271249,
+ "tags": [
+ "minim",
+ "ad",
+ "culpa",
+ "laboris",
+ "esse",
+ "tempor",
+ "cillum"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Rosalie Sawyer"
+ },
+ {
+ "id": 1,
+ "name": "Gracie King"
+ },
+ {
+ "id": 2,
+ "name": "Bender Sanford"
+ }
+ ],
+ "greeting": "Hello, Faith Carney! You have 8 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979cf47d2d1549a0fc45",
+ "index": 7,
+ "guid": "7fce5d73-2b41-4225-9fd2-1762513fce07",
+ "isActive": true,
+ "balance": "$2,396.87",
+ "picture": "http://placehold.it/32x32",
+ "age": 25,
+ "eyeColor": "blue",
+ "name": "Rosa Gordon",
+ "gender": "male",
+ "company": "VANTAGE",
+ "email": "rosagordon@vantage.com",
+ "phone": "+1 (860) 448-2953",
+ "address": "387 Stryker Street, Whitehaven, Virgin Islands, 8772",
+ "about": "Enim duis adipisicing pariatur deserunt reprehenderit ad id. Non sit cillum excepteur adipisicing ex quis. Do pariatur commodo nisi et excepteur id.\r\n",
+ "registered": "2020-05-27T11:49:23 -02:00",
+ "latitude": 22.92039,
+ "longitude": -19.076323,
+ "tags": [
+ "culpa",
+ "commodo",
+ "occaecat",
+ "nulla",
+ "nostrud",
+ "incididunt",
+ "deserunt"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Erika Matthews"
+ },
+ {
+ "id": 1,
+ "name": "Alejandra Hayden"
+ },
+ {
+ "id": 2,
+ "name": "Jenna Mccarty"
+ }
+ ],
+ "greeting": "Hello, Rosa Gordon! You have 1 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979cffbf855ade858a15",
+ "index": 8,
+ "guid": "b76c3d79-3367-4507-9e1e-6a50d307656c",
+ "isActive": true,
+ "balance": "$1,967.05",
+ "picture": "http://placehold.it/32x32",
+ "age": 28,
+ "eyeColor": "green",
+ "name": "Berg Sandoval",
+ "gender": "male",
+ "company": "GEEKY",
+ "email": "bergsandoval@geeky.com",
+ "phone": "+1 (868) 503-2703",
+ "address": "134 Pine Street, Nettie, Northern Mariana Islands, 6717",
+ "about": "Cillum magna aliqua magna eiusmod consectetur tempor culpa proident aliqua proident sint nulla consequat consectetur. Ullamco cupidatat qui laborum laborum ullamco excepteur anim ad mollit laborum eu. Qui excepteur ullamco enim ad esse cillum. Minim laborum commodo eiusmod magna nulla cillum. Nostrud eu ut officia in commodo ea. Non eiusmod do sit ad deserunt est consequat cupidatat aute culpa ut ut reprehenderit. Aliquip officia sint esse consequat deserunt dolore veniam eu consectetur veniam cillum enim id.\r\n",
+ "registered": "2018-06-03T07:14:27 -02:00",
+ "latitude": -75.084978,
+ "longitude": 69.341629,
+ "tags": [
+ "pariatur",
+ "aliqua",
+ "laborum",
+ "anim",
+ "duis",
+ "laboris",
+ "nostrud"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Glenna Gallagher"
+ },
+ {
+ "id": 1,
+ "name": "Gates Sanchez"
+ },
+ {
+ "id": 2,
+ "name": "Lyons Tyson"
+ }
+ ],
+ "greeting": "Hello, Berg Sandoval! You have 10 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979cce278d2137302d3f",
+ "index": 9,
+ "guid": "58dd2ac3-e301-4170-8aff-71c7f5e50b48",
+ "isActive": false,
+ "balance": "$1,766.07",
+ "picture": "http://placehold.it/32x32",
+ "age": 35,
+ "eyeColor": "green",
+ "name": "Araceli Wolfe",
+ "gender": "female",
+ "company": "EXOTERIC",
+ "email": "araceliwolfe@exoteric.com",
+ "phone": "+1 (967) 407-3145",
+ "address": "643 Dearborn Court, Lisco, Wyoming, 471",
+ "about": "Voluptate laboris eiusmod laboris fugiat dolore dolor officia Lorem nisi. Deserunt dolore ea exercitation voluptate elit Lorem eu laboris amet officia dolore reprehenderit ex. Esse magna proident consequat commodo eiusmod ipsum nisi deserunt.\r\n",
+ "registered": "2015-02-11T02:22:31 -01:00",
+ "latitude": 18.358575,
+ "longitude": 12.02139,
+ "tags": [
+ "irure",
+ "deserunt",
+ "in",
+ "sint",
+ "ullamco",
+ "aliquip",
+ "nostrud"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Lottie Frederick"
+ },
+ {
+ "id": 1,
+ "name": "Jodi Russell"
+ },
+ {
+ "id": 2,
+ "name": "Sherry Beach"
+ }
+ ],
+ "greeting": "Hello, Araceli Wolfe! You have 5 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979c637a95bb39a10de1",
+ "index": 10,
+ "guid": "f1d469a1-b92f-4554-9e1e-6bdd3cd0e1f7",
+ "isActive": false,
+ "balance": "$3,401.29",
+ "picture": "http://placehold.it/32x32",
+ "age": 26,
+ "eyeColor": "green",
+ "name": "Rivera Duffy",
+ "gender": "male",
+ "company": "SULFAX",
+ "email": "riveraduffy@sulfax.com",
+ "phone": "+1 (904) 456-2021",
+ "address": "969 Flatlands Avenue, Homestead, Iowa, 6523",
+ "about": "Aute deserunt deserunt in eiusmod quis ex aliqua cupidatat do esse commodo amet deserunt officia. Qui magna duis ex elit. Mollit ex nulla id sunt in. Irure ad pariatur incididunt labore laborum duis ea proident consectetur commodo cillum minim. Quis aute pariatur quis voluptate fugiat id culpa minim commodo voluptate proident laborum sit est. Dolor nostrud aliquip deserunt fugiat esse elit in exercitation cupidatat.\r\n",
+ "registered": "2020-02-09T11:59:36 -01:00",
+ "latitude": 45.823145,
+ "longitude": -88.019963,
+ "tags": [
+ "consectetur",
+ "Lorem",
+ "tempor",
+ "id",
+ "anim",
+ "aliqua",
+ "sint"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Young Cobb"
+ },
+ {
+ "id": 1,
+ "name": "Carr Chavez"
+ },
+ {
+ "id": 2,
+ "name": "Erna Bennett"
+ }
+ ],
+ "greeting": "Hello, Rivera Duffy! You have 4 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c1ea104ee1649ea80",
+ "index": 11,
+ "guid": "d4b8c1ea-0029-4893-9f59-8c88644753e1",
+ "isActive": true,
+ "balance": "$2,972.39",
+ "picture": "http://placehold.it/32x32",
+ "age": 25,
+ "eyeColor": "brown",
+ "name": "Moses Landry",
+ "gender": "male",
+ "company": "COMSTRUCT",
+ "email": "moseslandry@comstruct.com",
+ "phone": "+1 (907) 576-2563",
+ "address": "343 Irving Place, Hendersonville, Oklahoma, 5863",
+ "about": "Labore magna est laboris ut occaecat non ullamco id id. Consectetur dolore non pariatur fugiat esse duis officia reprehenderit ea culpa. Duis est labore reprehenderit in dolore irure elit anim aliqua. Enim incididunt cupidatat commodo culpa esse irure nulla ad reprehenderit. Excepteur enim amet proident esse cillum dolor dolor excepteur reprehenderit eiusmod.\r\n",
+ "registered": "2017-02-01T08:55:42 -01:00",
+ "latitude": 41.904453,
+ "longitude": 178.913346,
+ "tags": [
+ "deserunt",
+ "laboris",
+ "qui",
+ "eiusmod",
+ "elit",
+ "adipisicing",
+ "officia"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Hall Dale"
+ },
+ {
+ "id": 1,
+ "name": "Nanette Macdonald"
+ },
+ {
+ "id": 2,
+ "name": "Rachel Carr"
+ }
+ ],
+ "greeting": "Hello, Moses Landry! You have 3 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c47f41949e51faa73",
+ "index": 12,
+ "guid": "c17aa483-6dd9-4b7a-b765-00cf58b4f1e9",
+ "isActive": false,
+ "balance": "$1,913.22",
+ "picture": "http://placehold.it/32x32",
+ "age": 30,
+ "eyeColor": "brown",
+ "name": "Lucia Mathews",
+ "gender": "female",
+ "company": "FOSSIEL",
+ "email": "luciamathews@fossiel.com",
+ "phone": "+1 (984) 477-3504",
+ "address": "526 Dekoven Court, Mapletown, Connecticut, 5190",
+ "about": "Elit eiusmod deserunt incididunt sint mollit voluptate eiusmod deserunt laborum reprehenderit. Cupidatat in minim duis nulla ipsum quis culpa quis eiusmod irure. Non laborum ipsum proident irure velit ex. Ex dolore officia cillum cupidatat. Esse occaecat duis quis laborum aliqua est amet.\r\n",
+ "registered": "2016-06-08T11:30:34 -02:00",
+ "latitude": 12.69882,
+ "longitude": -162.213362,
+ "tags": [
+ "qui",
+ "incididunt",
+ "aliqua",
+ "aliqua",
+ "commodo",
+ "elit",
+ "excepteur"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Lorraine Bryan"
+ },
+ {
+ "id": 1,
+ "name": "Alexis Tyler"
+ },
+ {
+ "id": 2,
+ "name": "Leach Curry"
+ }
+ ],
+ "greeting": "Hello, Lucia Mathews! You have 4 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979c27c54455fa1fc39f",
+ "index": 13,
+ "guid": "106e2fcb-c1cc-4d6e-bdea-83c590b65e55",
+ "isActive": false,
+ "balance": "$3,141.63",
+ "picture": "http://placehold.it/32x32",
+ "age": 27,
+ "eyeColor": "green",
+ "name": "Sheryl Day",
+ "gender": "female",
+ "company": "HELIXO",
+ "email": "sherylday@helixo.com",
+ "phone": "+1 (983) 456-2916",
+ "address": "346 Lawrence Avenue, Maxville, California, 5932",
+ "about": "Tempor ex minim do sunt ullamco exercitation aliquip ad excepteur velit sunt. Ex tempor ullamco mollit excepteur amet qui labore veniam quis eu mollit sint nisi dolore. Fugiat amet nisi nulla labore commodo reprehenderit Lorem. Non qui ipsum ad anim culpa duis non commodo. Irure esse incididunt incididunt non in ex commodo. Nulla ex ad qui occaecat consectetur proident ad exercitation do irure nulla.\r\n",
+ "registered": "2014-06-17T04:47:50 -02:00",
+ "latitude": 14.531566,
+ "longitude": 65.797024,
+ "tags": [
+ "eu",
+ "ad",
+ "tempor",
+ "do",
+ "in",
+ "officia",
+ "do"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Hester Burgess"
+ },
+ {
+ "id": 1,
+ "name": "Courtney Pollard"
+ },
+ {
+ "id": 2,
+ "name": "Sylvia Park"
+ }
+ ],
+ "greeting": "Hello, Sheryl Day! You have 9 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c8f10161f067f5ba5",
+ "index": 14,
+ "guid": "088f1eb5-0123-44db-ada3-291c2f850c99",
+ "isActive": false,
+ "balance": "$2,411.81",
+ "picture": "http://placehold.it/32x32",
+ "age": 38,
+ "eyeColor": "brown",
+ "name": "Mia Stafford",
+ "gender": "female",
+ "company": "AUSTECH",
+ "email": "miastafford@austech.com",
+ "phone": "+1 (962) 585-2181",
+ "address": "957 Monitor Street, Hilltop, Colorado, 3151",
+ "about": "In do officia veniam officia consequat non. Irure duis do nisi pariatur sint commodo. Dolor anim laboris id consequat officia sint pariatur ea cupidatat magna cillum deserunt. Ullamco ullamco Lorem consequat culpa officia fugiat veniam non adipisicing dolor ea anim. Proident non consectetur cillum mollit amet esse reprehenderit nulla aliqua ad quis tempor culpa voluptate. Consectetur esse minim est culpa sint deserunt.\r\n",
+ "registered": "2018-05-31T03:31:37 -02:00",
+ "latitude": 34.61649,
+ "longitude": -49.861388,
+ "tags": [
+ "qui",
+ "voluptate",
+ "voluptate",
+ "velit",
+ "est",
+ "eu",
+ "non"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Leah Garrison"
+ },
+ {
+ "id": 1,
+ "name": "Dotson Bernard"
+ },
+ {
+ "id": 2,
+ "name": "Hartman Mcdaniel"
+ }
+ ],
+ "greeting": "Hello, Mia Stafford! You have 8 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09979c9418f74dc9927026",
+ "index": 15,
+ "guid": "914a2e6a-82fc-4ee1-9142-123b87a45efb",
+ "isActive": true,
+ "balance": "$2,112.26",
+ "picture": "http://placehold.it/32x32",
+ "age": 25,
+ "eyeColor": "green",
+ "name": "Stone Briggs",
+ "gender": "male",
+ "company": "ZAGGLE",
+ "email": "stonebriggs@zaggle.com",
+ "phone": "+1 (938) 570-2481",
+ "address": "914 Ditmas Avenue, Hollins, Maryland, 4163",
+ "about": "Ex commodo Lorem et mollit magna ullamco anim do proident. Lorem aute incididunt ipsum non veniam cupidatat aute laborum qui. Ea commodo veniam non aute mollit commodo tempor commodo eiusmod cillum ut. Incididunt aliqua et reprehenderit duis nulla veniam ipsum eu dolore est ex culpa minim. Lorem adipisicing magna occaecat culpa quis quis. Aliqua deserunt sint cupidatat eiusmod excepteur nulla. Officia laboris adipisicing veniam aliqua laboris incididunt non.\r\n",
+ "registered": "2016-01-19T12:25:19 -01:00",
+ "latitude": -89.353171,
+ "longitude": -20.98036,
+ "tags": [
+ "velit",
+ "deserunt",
+ "officia",
+ "ad",
+ "incididunt",
+ "sint",
+ "deserunt"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Charlene Mccall"
+ },
+ {
+ "id": 1,
+ "name": "Waters Kerr"
+ },
+ {
+ "id": 2,
+ "name": "Beverley Keller"
+ }
+ ],
+ "greeting": "Hello, Stone Briggs! You have 2 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c5d3f0e2575122091",
+ "index": 16,
+ "guid": "f8fdfd5a-5e3e-484b-87d7-8baefd8ed256",
+ "isActive": true,
+ "balance": "$2,786.34",
+ "picture": "http://placehold.it/32x32",
+ "age": 35,
+ "eyeColor": "blue",
+ "name": "Lula Mcdowell",
+ "gender": "female",
+ "company": "FUTURITY",
+ "email": "lulamcdowell@futurity.com",
+ "phone": "+1 (927) 432-3874",
+ "address": "396 Applegate Court, Chase, New Jersey, 7340",
+ "about": "Nostrud ullamco labore in elit et proident qui nulla. Tempor adipisicing aliqua anim deserunt voluptate ipsum aute. Velit eu aliqua enim dolore ex nulla elit laboris mollit Lorem dolore quis labore enim.\r\n",
+ "registered": "2014-01-02T03:28:40 -01:00",
+ "latitude": 66.301275,
+ "longitude": -29.306669,
+ "tags": [
+ "sit",
+ "laboris",
+ "dolor",
+ "consequat",
+ "reprehenderit",
+ "ullamco",
+ "tempor"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Ortega Marsh"
+ },
+ {
+ "id": 1,
+ "name": "Velma Olson"
+ },
+ {
+ "id": 2,
+ "name": "Alvarez Kelly"
+ }
+ ],
+ "greeting": "Hello, Lula Mcdowell! You have 9 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c46122cec66cb55db",
+ "index": 17,
+ "guid": "19c78332-d953-49a5-88aa-0db28a04c14c",
+ "isActive": false,
+ "balance": "$1,579.78",
+ "picture": "http://placehold.it/32x32",
+ "age": 38,
+ "eyeColor": "blue",
+ "name": "Sonya Moon",
+ "gender": "female",
+ "company": "NAMEBOX",
+ "email": "sonyamoon@namebox.com",
+ "phone": "+1 (970) 559-2750",
+ "address": "567 Corbin Place, Rosewood, Ohio, 8402",
+ "about": "Ea deserunt aute nisi officia amet est nulla consectetur labore Lorem excepteur in deserunt. Occaecat labore laborum aliquip labore magna ut nisi aute ad. Duis reprehenderit excepteur in sit. Excepteur sit non ad eiusmod adipisicing in tempor ea consequat fugiat. Minim consectetur ea voluptate laborum quis officia anim mollit deserunt velit enim elit quis. Quis ex cupidatat deserunt esse culpa occaecat non cillum excepteur sint quis duis mollit irure.\r\n",
+ "registered": "2017-07-18T10:46:19 -02:00",
+ "latitude": 49.60981,
+ "longitude": -163.342477,
+ "tags": [
+ "in",
+ "voluptate",
+ "voluptate",
+ "dolore",
+ "sint",
+ "et",
+ "dolore"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Flynn Sykes"
+ },
+ {
+ "id": 1,
+ "name": "Conley Christian"
+ },
+ {
+ "id": 2,
+ "name": "Meredith Whitfield"
+ }
+ ],
+ "greeting": "Hello, Sonya Moon! You have 9 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09979c223d4003deb51391",
+ "index": 18,
+ "guid": "bcf98a85-26fe-4f77-b82c-24a0f7dcce36",
+ "isActive": true,
+ "balance": "$1,368.63",
+ "picture": "http://placehold.it/32x32",
+ "age": 25,
+ "eyeColor": "brown",
+ "name": "Neva Tucker",
+ "gender": "female",
+ "company": "FROLIX",
+ "email": "nevatucker@frolix.com",
+ "phone": "+1 (845) 488-2789",
+ "address": "105 Fleet Place, Longbranch, Florida, 7399",
+ "about": "Eu laboris occaecat id laborum labore deserunt elit laborum nostrud Lorem veniam cillum deserunt laboris. Lorem sit nisi nisi laboris nostrud. Occaecat ea aliqua laboris non magna qui ex enim.\r\n",
+ "registered": "2014-09-12T06:32:15 -02:00",
+ "latitude": 1.710387,
+ "longitude": 157.011674,
+ "tags": [
+ "cupidatat",
+ "esse",
+ "veniam",
+ "et",
+ "ex",
+ "ea",
+ "consequat"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Alicia Leach"
+ },
+ {
+ "id": 1,
+ "name": "Stuart Bishop"
+ },
+ {
+ "id": 2,
+ "name": "Gilbert Rosario"
+ }
+ ],
+ "greeting": "Hello, Neva Tucker! You have 8 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979cfe6abe38a0042efa",
+ "index": 19,
+ "guid": "5fd87dd3-12e5-4c31-888c-7546cd2896cc",
+ "isActive": true,
+ "balance": "$2,233.94",
+ "picture": "http://placehold.it/32x32",
+ "age": 33,
+ "eyeColor": "brown",
+ "name": "Hess Montgomery",
+ "gender": "male",
+ "company": "VALPREAL",
+ "email": "hessmontgomery@valpreal.com",
+ "phone": "+1 (898) 404-2847",
+ "address": "180 Berry Street, Tuttle, Louisiana, 8755",
+ "about": "Aute officia exercitation quis proident commodo. Officia dolor officia magna sunt ipsum deserunt qui aliquip irure dolore cupidatat. Cupidatat culpa nisi cupidatat commodo qui aliquip. Laboris cupidatat eu et pariatur consectetur magna qui amet laboris cillum. Magna dolor minim amet pariatur in adipisicing duis enim do laboris reprehenderit in. Aliquip commodo incididunt amet ipsum nostrud excepteur exercitation labore excepteur dolore commodo irure.\r\n",
+ "registered": "2019-06-21T03:47:52 -02:00",
+ "latitude": 87.355758,
+ "longitude": 69.420984,
+ "tags": [
+ "eiusmod",
+ "quis",
+ "pariatur",
+ "commodo",
+ "duis",
+ "nisi",
+ "laboris"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Valarie Dawson"
+ },
+ {
+ "id": 1,
+ "name": "Salazar Goodwin"
+ },
+ {
+ "id": 2,
+ "name": "Stein Faulkner"
+ }
+ ],
+ "greeting": "Hello, Hess Montgomery! You have 2 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09979ca062980fd4cf0a3a",
+ "index": 20,
+ "guid": "2b0e71d1-bc7f-4291-bf6e-c6d3620afa98",
+ "isActive": true,
+ "balance": "$2,930.71",
+ "picture": "http://placehold.it/32x32",
+ "age": 27,
+ "eyeColor": "green",
+ "name": "Angie Medina",
+ "gender": "female",
+ "company": "KNOWLYSIS",
+ "email": "angiemedina@knowlysis.com",
+ "phone": "+1 (943) 400-2270",
+ "address": "735 Dunham Place, Marbury, Massachusetts, 5005",
+ "about": "Aliquip officia nulla est quis nisi Lorem. Ullamco aute tempor nulla exercitation officia eiusmod proident aliqua nulla commodo consequat officia mollit. Consectetur eu ullamco consectetur ea in laboris Lorem. Et eu reprehenderit sunt sunt eu eu incididunt laborum.\r\n",
+ "registered": "2016-05-04T09:04:13 -02:00",
+ "latitude": -60.308826,
+ "longitude": -98.509423,
+ "tags": [
+ "ad",
+ "nisi",
+ "nisi",
+ "eiusmod",
+ "excepteur",
+ "velit",
+ "dolor"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Eunice Fisher"
+ },
+ {
+ "id": 1,
+ "name": "Flowers Mckay"
+ },
+ {
+ "id": 2,
+ "name": "Owens Drake"
+ }
+ ],
+ "greeting": "Hello, Angie Medina! You have 10 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09979c7a0fa6df5eca8559",
+ "index": 21,
+ "guid": "52efb732-8449-4f5f-a229-612848aaeccd",
+ "isActive": true,
+ "balance": "$2,674.45",
+ "picture": "http://placehold.it/32x32",
+ "age": 22,
+ "eyeColor": "brown",
+ "name": "Bruce Cummings",
+ "gender": "male",
+ "company": "COGENTRY",
+ "email": "brucecummings@cogentry.com",
+ "phone": "+1 (853) 437-3620",
+ "address": "772 Gardner Avenue, Corriganville, Michigan, 3676",
+ "about": "Elit irure duis sint sunt veniam adipisicing. Ex consequat ea laborum voluptate anim mollit enim non nisi duis Lorem. Qui dolor adipisicing ad deserunt eu elit duis id mollit dolor. Elit aute reprehenderit consectetur deserunt nostrud eu quis fugiat aliqua ea culpa. Magna et ullamco mollit culpa aute culpa aliqua eiusmod tempor esse tempor eu. Non reprehenderit non anim elit esse cupidatat culpa est commodo consequat ea dolor culpa ut. Incididunt culpa sunt duis elit do dolore cillum cupidatat et elit.\r\n",
+ "registered": "2018-07-22T04:58:57 -02:00",
+ "latitude": -11.410316,
+ "longitude": 115.312104,
+ "tags": [
+ "cillum",
+ "ipsum",
+ "sint",
+ "irure",
+ "esse",
+ "duis",
+ "enim"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Whitney Velazquez"
+ },
+ {
+ "id": 1,
+ "name": "Yesenia Fitzpatrick"
+ },
+ {
+ "id": 2,
+ "name": "Madden Benson"
+ }
+ ],
+ "greeting": "Hello, Bruce Cummings! You have 3 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09979ca9521e7e3402b732",
+ "index": 22,
+ "guid": "64e785a5-f75f-4d5f-be17-05ead2e463e1",
+ "isActive": true,
+ "balance": "$2,370.21",
+ "picture": "http://placehold.it/32x32",
+ "age": 21,
+ "eyeColor": "blue",
+ "name": "Sheree Miles",
+ "gender": "female",
+ "company": "APEX",
+ "email": "shereemiles@apex.com",
+ "phone": "+1 (943) 578-2911",
+ "address": "724 Croton Loop, Outlook, Indiana, 8407",
+ "about": "Proident labore nulla velit labore. Nulla nostrud Lorem adipisicing Lorem. Adipisicing nostrud irure quis irure ipsum tempor minim Lorem dolore.\r\n",
+ "registered": "2015-07-02T03:15:15 -02:00",
+ "latitude": -21.893864,
+ "longitude": -40.868683,
+ "tags": [
+ "ad",
+ "voluptate",
+ "nostrud",
+ "amet",
+ "Lorem",
+ "incididunt",
+ "eiusmod"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Burgess Guerra"
+ },
+ {
+ "id": 1,
+ "name": "Irwin Stephens"
+ },
+ {
+ "id": 2,
+ "name": "Dominguez Greer"
+ }
+ ],
+ "greeting": "Hello, Sheree Miles! You have 5 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c9dab023e0c08ee8f",
+ "index": 23,
+ "guid": "1289c3f1-9735-4da9-8e09-649c6d4c4854",
+ "isActive": true,
+ "balance": "$2,892.23",
+ "picture": "http://placehold.it/32x32",
+ "age": 22,
+ "eyeColor": "blue",
+ "name": "Elaine Carter",
+ "gender": "female",
+ "company": "AQUACINE",
+ "email": "elainecarter@aquacine.com",
+ "phone": "+1 (838) 519-2506",
+ "address": "381 Schenck Court, Rivereno, Tennessee, 1895",
+ "about": "In fugiat aliquip officia culpa aliquip aliquip duis in. Eiusmod consequat irure nisi dolor elit dolore sunt ipsum nostrud. Nulla aliquip velit occaecat cupidatat dolor. Aute officia deserunt aliquip est officia incididunt pariatur nulla aute aliquip laboris. Sit ut nisi sunt aute. Deserunt et adipisicing consectetur laborum incididunt officia et sint incididunt quis et anim incididunt consequat. Nostrud dolore sit minim voluptate excepteur veniam voluptate proident.\r\n",
+ "registered": "2015-07-30T02:02:12 -02:00",
+ "latitude": 33.765992,
+ "longitude": -83.563736,
+ "tags": [
+ "occaecat",
+ "minim",
+ "adipisicing",
+ "id",
+ "excepteur",
+ "mollit",
+ "irure"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Holder Kelley"
+ },
+ {
+ "id": 1,
+ "name": "Julie Wilder"
+ },
+ {
+ "id": 2,
+ "name": "Tamara Browning"
+ }
+ ],
+ "greeting": "Hello, Elaine Carter! You have 9 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09979c6121d621a800d475",
+ "index": 24,
+ "guid": "b313658a-50f7-459a-bdc8-1dc0ec1b0d25",
+ "isActive": false,
+ "balance": "$2,850.77",
+ "picture": "http://placehold.it/32x32",
+ "age": 38,
+ "eyeColor": "brown",
+ "name": "Mcclain Daugherty",
+ "gender": "male",
+ "company": "MAKINGWAY",
+ "email": "mcclaindaugherty@makingway.com",
+ "phone": "+1 (849) 499-2267",
+ "address": "477 Banker Street, Weeksville, Guam, 1614",
+ "about": "Ut occaecat est laborum Lorem esse sunt dolore tempor culpa consectetur et. Sit eiusmod quis reprehenderit aliqua eu duis esse fugiat velit consequat excepteur mollit veniam aute. Ullamco exercitation non reprehenderit mollit. Cillum occaecat minim adipisicing aute ea aliquip ea quis veniam. Culpa sunt fugiat eu est laboris aliquip elit elit elit.\r\n",
+ "registered": "2015-09-28T12:47:07 -02:00",
+ "latitude": 60.172158,
+ "longitude": 50.172971,
+ "tags": [
+ "id",
+ "sit",
+ "ipsum",
+ "consectetur",
+ "qui",
+ "reprehenderit",
+ "ea"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Mccoy Sosa"
+ },
+ {
+ "id": 1,
+ "name": "Craig Larsen"
+ },
+ {
+ "id": 2,
+ "name": "Waller Snow"
+ }
+ ],
+ "greeting": "Hello, Mcclain Daugherty! You have 2 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979c6f9fd0f1aeee855d",
+ "index": 25,
+ "guid": "bfc65574-c844-44b9-9f35-92e2a4c25af2",
+ "isActive": true,
+ "balance": "$1,619.27",
+ "picture": "http://placehold.it/32x32",
+ "age": 35,
+ "eyeColor": "brown",
+ "name": "Gabriela Pennington",
+ "gender": "female",
+ "company": "ZIORE",
+ "email": "gabrielapennington@ziore.com",
+ "phone": "+1 (878) 440-3814",
+ "address": "614 Seigel Street, Adamstown, Federated States Of Micronesia, 9183",
+ "about": "Esse adipisicing incididunt aute tempor ullamco. Aliqua est magna aliquip eiusmod quis mollit est aute est. Tempor labore dolore nulla proident cillum reprehenderit et dolor nisi officia consequat magna. Adipisicing exercitation quis veniam minim nulla Lorem duis commodo anim elit Lorem laboris deserunt in. Nulla dolor enim non Lorem voluptate ea veniam pariatur magna voluptate labore ad dolore.\r\n",
+ "registered": "2017-06-20T05:37:15 -02:00",
+ "latitude": -3.392098,
+ "longitude": 130.231174,
+ "tags": [
+ "qui",
+ "adipisicing",
+ "proident",
+ "velit",
+ "do",
+ "cillum",
+ "duis"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Evangelina Harrell"
+ },
+ {
+ "id": 1,
+ "name": "Cross Blake"
+ },
+ {
+ "id": 2,
+ "name": "Soto Sanders"
+ }
+ ],
+ "greeting": "Hello, Gabriela Pennington! You have 5 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c164b2803e8a8a372",
+ "index": 26,
+ "guid": "bf6d79ad-0899-43f2-93a1-07a3c96a2552",
+ "isActive": true,
+ "balance": "$3,005.30",
+ "picture": "http://placehold.it/32x32",
+ "age": 20,
+ "eyeColor": "brown",
+ "name": "Naomi Clements",
+ "gender": "female",
+ "company": "FUELTON",
+ "email": "naomiclements@fuelton.com",
+ "phone": "+1 (903) 474-3770",
+ "address": "994 Church Avenue, Summertown, Minnesota, 3375",
+ "about": "Ut reprehenderit nulla dolore commodo et ullamco nulla. In anim culpa aliqua culpa cillum aliqua officia voluptate culpa. Nisi laboris ex deserunt ut occaecat excepteur. Et voluptate ipsum nulla sint. Consequat laborum consequat laboris qui minim consectetur pariatur pariatur ea. Sunt adipisicing tempor Lorem ea qui. Sit laborum tempor eiusmod elit ex.\r\n",
+ "registered": "2016-03-05T01:07:23 -01:00",
+ "latitude": -35.401828,
+ "longitude": 126.426058,
+ "tags": [
+ "pariatur",
+ "non",
+ "cupidatat",
+ "consequat",
+ "irure",
+ "in",
+ "commodo"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Margery Lara"
+ },
+ {
+ "id": 1,
+ "name": "Ross Merritt"
+ },
+ {
+ "id": 2,
+ "name": "Owen Baldwin"
+ }
+ ],
+ "greeting": "Hello, Naomi Clements! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979c032fbcd56fb96110",
+ "index": 27,
+ "guid": "47fc91f7-8bcd-4a43-a315-e556d24c3cbd",
+ "isActive": false,
+ "balance": "$2,978.19",
+ "picture": "http://placehold.it/32x32",
+ "age": 22,
+ "eyeColor": "brown",
+ "name": "Oconnor Cooke",
+ "gender": "male",
+ "company": "INFOTRIPS",
+ "email": "oconnorcooke@infotrips.com",
+ "phone": "+1 (927) 566-3127",
+ "address": "282 Bay Street, Axis, District Of Columbia, 3855",
+ "about": "Tempor esse dolore veniam ipsum ullamco irure elit est incididunt tempor. Ex consectetur labore tempor qui deserunt commodo magna eiusmod irure. Veniam culpa minim est culpa pariatur ipsum quis incididunt minim ex duis elit. Mollit nostrud consequat dolore qui. Ut esse irure nisi elit duis quis occaecat veniam veniam exercitation est. Duis esse pariatur deserunt consectetur excepteur qui anim sit eiusmod id eiusmod. Exercitation sint sunt consectetur aliquip eu do mollit.\r\n",
+ "registered": "2015-12-19T03:20:45 -01:00",
+ "latitude": 54.698186,
+ "longitude": 162.68292,
+ "tags": [
+ "veniam",
+ "dolor",
+ "et",
+ "commodo",
+ "aute",
+ "esse",
+ "proident"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Avery Henson"
+ },
+ {
+ "id": 1,
+ "name": "Villarreal Stanton"
+ },
+ {
+ "id": 2,
+ "name": "Phoebe Barber"
+ }
+ ],
+ "greeting": "Hello, Oconnor Cooke! You have 4 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979caecbc89194cedce3",
+ "index": 28,
+ "guid": "bef0981a-e875-43e1-a330-aa3165566ce1",
+ "isActive": false,
+ "balance": "$1,057.58",
+ "picture": "http://placehold.it/32x32",
+ "age": 22,
+ "eyeColor": "blue",
+ "name": "Kaye Garner",
+ "gender": "female",
+ "company": "ISOPLEX",
+ "email": "kayegarner@isoplex.com",
+ "phone": "+1 (883) 569-3927",
+ "address": "885 Dare Court, Cartwright, Utah, 6180",
+ "about": "Minim consequat in tempor consectetur. Ipsum ut anim consequat enim. Ex consequat consectetur consectetur aliquip reprehenderit qui dolor labore laborum magna deserunt do nisi occaecat. Dolore magna Lorem ullamco duis exercitation occaecat et nulla consequat commodo aliquip occaecat excepteur eu. Laborum qui laborum ad do do do consectetur laboris est. Commodo ullamco minim sunt veniam sunt consequat amet fugiat officia ipsum ut nostrud.\r\n",
+ "registered": "2015-03-17T08:05:45 -01:00",
+ "latitude": -6.95043,
+ "longitude": 29.068387,
+ "tags": [
+ "magna",
+ "incididunt",
+ "velit",
+ "veniam",
+ "ullamco",
+ "exercitation",
+ "tempor"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Russo Butler"
+ },
+ {
+ "id": 1,
+ "name": "Lauren Rosales"
+ },
+ {
+ "id": 2,
+ "name": "Jamie Winters"
+ }
+ ],
+ "greeting": "Hello, Kaye Garner! You have 7 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979c4d9fb73b60382a38",
+ "index": 29,
+ "guid": "a9488a2b-2ff3-468e-aee3-63b79632c7b2",
+ "isActive": false,
+ "balance": "$1,003.16",
+ "picture": "http://placehold.it/32x32",
+ "age": 38,
+ "eyeColor": "blue",
+ "name": "Elsa Meadows",
+ "gender": "female",
+ "company": "VERTIDE",
+ "email": "elsameadows@vertide.com",
+ "phone": "+1 (859) 593-2244",
+ "address": "877 Whitney Avenue, Beyerville, North Carolina, 5533",
+ "about": "Occaecat eu nisi elit sint incididunt id amet sint ex exercitation veniam Lorem. Minim culpa in proident culpa ex exercitation sit in esse pariatur cupidatat. Enim culpa occaecat culpa commodo occaecat excepteur ut ad ex cillum sunt ipsum sunt.\r\n",
+ "registered": "2017-04-18T06:26:27 -02:00",
+ "latitude": -36.819861,
+ "longitude": -155.197481,
+ "tags": [
+ "id",
+ "reprehenderit",
+ "sit",
+ "magna",
+ "veniam",
+ "sit",
+ "do"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Mendoza Wilkinson"
+ },
+ {
+ "id": 1,
+ "name": "Hancock Grant"
+ },
+ {
+ "id": 2,
+ "name": "Bobbie Short"
+ }
+ ],
+ "greeting": "Hello, Elsa Meadows! You have 1 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979cdd7d96ee36653b5a",
+ "index": 30,
+ "guid": "ee630d38-e2fb-4d11-8544-dca0d1e0e2d0",
+ "isActive": false,
+ "balance": "$3,164.19",
+ "picture": "http://placehold.it/32x32",
+ "age": 21,
+ "eyeColor": "blue",
+ "name": "Berta Mcgowan",
+ "gender": "female",
+ "company": "ANARCO",
+ "email": "bertamcgowan@anarco.com",
+ "phone": "+1 (980) 592-3697",
+ "address": "744 Adler Place, Elizaville, North Dakota, 3638",
+ "about": "Nisi veniam do aliquip non eu. Cillum officia aute do et nisi sint quis adipisicing quis tempor. Ut qui laboris do sunt aute non aliquip dolore voluptate consectetur mollit.\r\n",
+ "registered": "2019-07-05T03:23:16 -02:00",
+ "latitude": -75.021708,
+ "longitude": -69.918341,
+ "tags": [
+ "magna",
+ "irure",
+ "laborum",
+ "esse",
+ "occaecat",
+ "eiusmod",
+ "eu"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Kara Weiss"
+ },
+ {
+ "id": 1,
+ "name": "Simone Frost"
+ },
+ {
+ "id": 2,
+ "name": "Quinn Mcclain"
+ }
+ ],
+ "greeting": "Hello, Berta Mcgowan! You have 5 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979ca930f1233cd1cd75",
+ "index": 31,
+ "guid": "f96136a8-d70b-4943-8137-c0762208c3a3",
+ "isActive": false,
+ "balance": "$2,251.23",
+ "picture": "http://placehold.it/32x32",
+ "age": 23,
+ "eyeColor": "green",
+ "name": "Fanny Pitts",
+ "gender": "female",
+ "company": "STELAECOR",
+ "email": "fannypitts@stelaecor.com",
+ "phone": "+1 (969) 428-2197",
+ "address": "993 Jamison Lane, Iola, Arizona, 8941",
+ "about": "Mollit proident cillum dolore cupidatat eu mollit proident sunt reprehenderit. Laboris non laboris amet velit ad do aliquip qui magna. Eu proident deserunt reprehenderit nulla adipisicing Lorem sit dolore adipisicing aliquip est. Lorem elit cillum eiusmod amet eiusmod enim irure tempor excepteur duis. Elit ex ut incididunt ipsum cillum pariatur Lorem ad do.\r\n",
+ "registered": "2017-03-05T10:46:35 -01:00",
+ "latitude": -74.457636,
+ "longitude": -56.203976,
+ "tags": [
+ "exercitation",
+ "laboris",
+ "ea",
+ "ex",
+ "eu",
+ "commodo",
+ "voluptate"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Janine Mcbride"
+ },
+ {
+ "id": 1,
+ "name": "Carla Everett"
+ },
+ {
+ "id": 2,
+ "name": "Latoya Grimes"
+ }
+ ],
+ "greeting": "Hello, Fanny Pitts! You have 3 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09979ca279973cf3c29cfd",
+ "index": 32,
+ "guid": "321d6bac-0a4a-4cc6-913f-9d68f272872c",
+ "isActive": true,
+ "balance": "$1,636.99",
+ "picture": "http://placehold.it/32x32",
+ "age": 35,
+ "eyeColor": "blue",
+ "name": "Anastasia Shaw",
+ "gender": "female",
+ "company": "SNACKTION",
+ "email": "anastasiashaw@snacktion.com",
+ "phone": "+1 (946) 476-2045",
+ "address": "664 Ryerson Street, Healy, South Dakota, 5624",
+ "about": "Elit eu esse dolor laborum ut velit reprehenderit elit enim reprehenderit sint fugiat ad sit. Magna nostrud ullamco quis aliquip veniam mollit pariatur occaecat Lorem do qui. Minim ea anim dolore adipisicing. Irure incididunt reprehenderit velit nisi. Lorem ex aute deserunt nulla veniam officia adipisicing velit ut. Ea veniam exercitation culpa laborum labore in labore cupidatat esse.\r\n",
+ "registered": "2020-06-05T01:40:04 -02:00",
+ "latitude": 47.992012,
+ "longitude": -126.182866,
+ "tags": [
+ "aliqua",
+ "aliqua",
+ "minim",
+ "esse",
+ "deserunt",
+ "consectetur",
+ "dolor"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Imogene White"
+ },
+ {
+ "id": 1,
+ "name": "Lara Richards"
+ },
+ {
+ "id": 2,
+ "name": "Black Simon"
+ }
+ ],
+ "greeting": "Hello, Anastasia Shaw! You have 5 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c302be20a346abcca",
+ "index": 33,
+ "guid": "de32a93d-7aa5-49df-982b-c44611553859",
+ "isActive": false,
+ "balance": "$3,203.32",
+ "picture": "http://placehold.it/32x32",
+ "age": 29,
+ "eyeColor": "brown",
+ "name": "Kathryn Hoover",
+ "gender": "female",
+ "company": "MEDIFAX",
+ "email": "kathrynhoover@medifax.com",
+ "phone": "+1 (898) 513-2405",
+ "address": "696 Crown Street, Manchester, New Mexico, 6731",
+ "about": "Deserunt duis irure ea ex ut aliqua reprehenderit dolor. Officia voluptate eu ullamco cillum labore culpa aute ex nulla. Est ad et occaecat ipsum. Duis in laboris ea dolore elit. Consequat occaecat aliquip do exercitation anim nisi ullamco veniam est culpa mollit.\r\n",
+ "registered": "2016-01-22T10:48:26 -01:00",
+ "latitude": -39.879798,
+ "longitude": 22.51572,
+ "tags": [
+ "incididunt",
+ "magna",
+ "excepteur",
+ "nisi",
+ "dolor",
+ "dolore",
+ "magna"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Hammond Kennedy"
+ },
+ {
+ "id": 1,
+ "name": "Leanne Mcleod"
+ },
+ {
+ "id": 2,
+ "name": "Andrews Alvarado"
+ }
+ ],
+ "greeting": "Hello, Kathryn Hoover! You have 1 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979c20cad39b634f9677",
+ "index": 34,
+ "guid": "26bcec6c-812c-4263-9ab8-47568211c681",
+ "isActive": true,
+ "balance": "$2,265.79",
+ "picture": "http://placehold.it/32x32",
+ "age": 37,
+ "eyeColor": "blue",
+ "name": "Sandy Glass",
+ "gender": "female",
+ "company": "ORBOID",
+ "email": "sandyglass@orboid.com",
+ "phone": "+1 (817) 522-3878",
+ "address": "953 Broome Street, Wells, Puerto Rico, 7287",
+ "about": "Excepteur nisi occaecat officia ipsum Lorem ipsum veniam deserunt officia irure tempor ullamco. Aliquip quis nisi nostrud cupidatat labore aute et aute reprehenderit deserunt dolor proident. Exercitation cupidatat aliquip velit ea. Sit quis adipisicing consectetur eiusmod quis cillum dolore commodo cupidatat nulla laborum minim. Minim irure sint ut nisi consectetur qui tempor sint fugiat eiusmod.\r\n",
+ "registered": "2016-05-02T06:36:59 -02:00",
+ "latitude": 16.166136,
+ "longitude": -107.011056,
+ "tags": [
+ "consequat",
+ "officia",
+ "magna",
+ "aute",
+ "sunt",
+ "ad",
+ "ea"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Levy Hensley"
+ },
+ {
+ "id": 1,
+ "name": "Corinne Jones"
+ },
+ {
+ "id": 2,
+ "name": "Vincent Caldwell"
+ }
+ ],
+ "greeting": "Hello, Sandy Glass! You have 1 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979ccc491ba708d6cad1",
+ "index": 35,
+ "guid": "52434b18-bc47-40f5-8e1b-a96c778eccf6",
+ "isActive": false,
+ "balance": "$2,751.11",
+ "picture": "http://placehold.it/32x32",
+ "age": 23,
+ "eyeColor": "green",
+ "name": "Elsie Lott",
+ "gender": "female",
+ "company": "STROZEN",
+ "email": "elsielott@strozen.com",
+ "phone": "+1 (999) 496-2098",
+ "address": "362 Myrtle Avenue, Winston, Alabama, 2427",
+ "about": "Officia ad aute culpa reprehenderit proident labore eiusmod. Laborum aliquip qui nisi pariatur ullamco eu. Commodo dolore nulla ea esse nisi velit adipisicing anim cupidatat eu nostrud et.\r\n",
+ "registered": "2016-02-12T06:38:06 -01:00",
+ "latitude": -1.763879,
+ "longitude": -66.411889,
+ "tags": [
+ "sit",
+ "velit",
+ "labore",
+ "occaecat",
+ "eu",
+ "do",
+ "non"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "David Riggs"
+ },
+ {
+ "id": 1,
+ "name": "Nicole Schroeder"
+ },
+ {
+ "id": 2,
+ "name": "Paulette Wynn"
+ }
+ ],
+ "greeting": "Hello, Elsie Lott! You have 4 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c54e3c36c875f6673",
+ "index": 36,
+ "guid": "353e757e-b96b-4a95-9caa-79c3a13b7f9f",
+ "isActive": false,
+ "balance": "$1,440.54",
+ "picture": "http://placehold.it/32x32",
+ "age": 31,
+ "eyeColor": "blue",
+ "name": "Kristie Anderson",
+ "gender": "female",
+ "company": "TWIGGERY",
+ "email": "kristieanderson@twiggery.com",
+ "phone": "+1 (872) 558-2312",
+ "address": "794 Manor Court, Lindcove, Missouri, 3012",
+ "about": "Aliquip excepteur ipsum laborum qui est consequat veniam veniam eiusmod. Do nulla sint laborum id nostrud esse enim sit dolor qui laborum est. Ipsum mollit deserunt duis sit pariatur sunt labore ut cillum cillum proident ad. Ut nisi et ullamco exercitation consequat sint pariatur aliquip occaecat do.\r\n",
+ "registered": "2016-03-29T10:03:41 -02:00",
+ "latitude": -60.269059,
+ "longitude": -113.602888,
+ "tags": [
+ "quis",
+ "officia",
+ "Lorem",
+ "commodo",
+ "dolor",
+ "commodo",
+ "est"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Woods Acevedo"
+ },
+ {
+ "id": 1,
+ "name": "Dawn Oneill"
+ },
+ {
+ "id": 2,
+ "name": "Carpenter Velasquez"
+ }
+ ],
+ "greeting": "Hello, Kristie Anderson! You have 10 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979c2911d2416e7a4487",
+ "index": 37,
+ "guid": "bdf5193c-647b-4d13-bd7b-a996ee9c66d3",
+ "isActive": true,
+ "balance": "$2,004.78",
+ "picture": "http://placehold.it/32x32",
+ "age": 40,
+ "eyeColor": "brown",
+ "name": "Clara Diaz",
+ "gender": "female",
+ "company": "RAMEON",
+ "email": "claradiaz@rameon.com",
+ "phone": "+1 (994) 473-3711",
+ "address": "172 Albemarle Terrace, Fairview, New Hampshire, 1624",
+ "about": "Lorem ex reprehenderit amet ut id Lorem sint id velit veniam laboris anim eiusmod ullamco. Et nisi tempor aliquip minim esse eu officia pariatur sunt labore consequat mollit laborum. Ad ullamco enim anim dolor Lorem aliquip deserunt voluptate dolore aliqua ad exercitation aliquip. Dolor ut laborum sint minim pariatur eu duis irure.\r\n",
+ "registered": "2019-01-31T09:49:28 -01:00",
+ "latitude": 38.74068,
+ "longitude": -154.643746,
+ "tags": [
+ "eu",
+ "minim",
+ "magna",
+ "mollit",
+ "reprehenderit",
+ "qui",
+ "veniam"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Cox Moreno"
+ },
+ {
+ "id": 1,
+ "name": "Herman Sheppard"
+ },
+ {
+ "id": 2,
+ "name": "Reynolds Guthrie"
+ }
+ ],
+ "greeting": "Hello, Clara Diaz! You have 5 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c248954eed4c3207e",
+ "index": 38,
+ "guid": "cf69b65a-9f60-49a2-82cf-a9c36f254ef7",
+ "isActive": false,
+ "balance": "$2,805.52",
+ "picture": "http://placehold.it/32x32",
+ "age": 21,
+ "eyeColor": "brown",
+ "name": "Barrett Herrera",
+ "gender": "male",
+ "company": "ZENTRY",
+ "email": "barrettherrera@zentry.com",
+ "phone": "+1 (996) 458-3369",
+ "address": "713 Kent Street, Sexton, Montana, 5767",
+ "about": "Tempor labore eiusmod amet in ipsum laboris ea nisi pariatur esse labore occaecat exercitation do. Magna officia reprehenderit dolore ut eiusmod do irure labore exercitation pariatur in officia excepteur. Et dolor nulla esse ullamco nulla occaecat anim incididunt excepteur est commodo. Esse aliquip mollit nostrud do in sunt commodo magna incididunt sint eiusmod. Incididunt culpa occaecat ex proident ipsum dolore veniam exercitation ex sit occaecat consectetur.\r\n",
+ "registered": "2014-03-30T12:42:31 -01:00",
+ "latitude": -53.824667,
+ "longitude": -101.506152,
+ "tags": [
+ "qui",
+ "quis",
+ "sit",
+ "magna",
+ "qui",
+ "adipisicing",
+ "exercitation"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Florence Stuart"
+ },
+ {
+ "id": 1,
+ "name": "Farrell Cabrera"
+ },
+ {
+ "id": 2,
+ "name": "Sherman Soto"
+ }
+ ],
+ "greeting": "Hello, Barrett Herrera! You have 6 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979c0f909452e7f1b9d5",
+ "index": 39,
+ "guid": "14a60273-f835-4b07-a5a9-7a8bd9511074",
+ "isActive": true,
+ "balance": "$2,687.22",
+ "picture": "http://placehold.it/32x32",
+ "age": 22,
+ "eyeColor": "green",
+ "name": "Hahn Kirby",
+ "gender": "male",
+ "company": "CONFRENZY",
+ "email": "hahnkirby@confrenzy.com",
+ "phone": "+1 (938) 553-2842",
+ "address": "768 Royce Street, Durham, Nevada, 6319",
+ "about": "Sit aute adipisicing dolor magna labore do amet cillum ut aute amet. Aliquip labore ea fugiat sint. Et quis anim Lorem culpa minim occaecat aute mollit ex non quis anim.\r\n",
+ "registered": "2019-09-17T05:29:39 -02:00",
+ "latitude": 37.233836,
+ "longitude": -39.755698,
+ "tags": [
+ "cupidatat",
+ "nulla",
+ "reprehenderit",
+ "Lorem",
+ "minim",
+ "Lorem",
+ "esse"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Hebert Hanson"
+ },
+ {
+ "id": 1,
+ "name": "Bettie Sexton"
+ },
+ {
+ "id": 2,
+ "name": "Oneal Sparks"
+ }
+ ],
+ "greeting": "Hello, Hahn Kirby! You have 3 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979cc22c8ce829b9ff3c",
+ "index": 40,
+ "guid": "280c0791-ed11-4a85-92d9-12260cecf7ea",
+ "isActive": false,
+ "balance": "$1,521.86",
+ "picture": "http://placehold.it/32x32",
+ "age": 33,
+ "eyeColor": "brown",
+ "name": "Shelby Dickerson",
+ "gender": "female",
+ "company": "BUZZWORKS",
+ "email": "shelbydickerson@buzzworks.com",
+ "phone": "+1 (820) 500-2225",
+ "address": "772 Nostrand Avenue, Wolcott, Vermont, 5869",
+ "about": "Sunt occaecat ex nostrud Lorem dolor laborum. Magna quis ad voluptate deserunt ea pariatur incididunt ad ex laborum. Exercitation sint enim mollit proident excepteur do officia consequat proident id nulla quis ipsum. Amet non consectetur enim esse pariatur.\r\n",
+ "registered": "2015-04-13T03:36:39 -02:00",
+ "latitude": 25.531093,
+ "longitude": -167.046372,
+ "tags": [
+ "anim",
+ "Lorem",
+ "commodo",
+ "enim",
+ "anim",
+ "incididunt",
+ "eiusmod"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Leblanc Jefferson"
+ },
+ {
+ "id": 1,
+ "name": "Anne Hodge"
+ },
+ {
+ "id": 2,
+ "name": "Carissa Parsons"
+ }
+ ],
+ "greeting": "Hello, Shelby Dickerson! You have 8 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c42cc01109df300c4",
+ "index": 41,
+ "guid": "1f39c264-f26b-4710-bfc9-53e82804821e",
+ "isActive": true,
+ "balance": "$1,901.99",
+ "picture": "http://placehold.it/32x32",
+ "age": 31,
+ "eyeColor": "green",
+ "name": "Willa Morris",
+ "gender": "female",
+ "company": "GLUKGLUK",
+ "email": "willamorris@glukgluk.com",
+ "phone": "+1 (865) 524-3949",
+ "address": "146 Wyckoff Street, Newcastle, South Carolina, 6086",
+ "about": "Et laboris cupidatat non pariatur proident cupidatat cupidatat consequat occaecat mollit excepteur adipisicing laboris culpa. Dolore deserunt aliquip excepteur consectetur aliquip veniam eiusmod labore occaecat laborum velit adipisicing. Incididunt fugiat mollit aliqua excepteur. Est voluptate deserunt mollit sint aliqua labore nisi quis magna culpa sit quis. Ex exercitation commodo id in velit ea do tempor labore. Aute proident pariatur tempor quis ut tempor minim dolor nulla fugiat consequat. Aliqua occaecat aliquip mollit pariatur laboris.\r\n",
+ "registered": "2015-05-27T05:24:49 -02:00",
+ "latitude": 40.898667,
+ "longitude": 73.758054,
+ "tags": [
+ "est",
+ "sunt",
+ "laborum",
+ "do",
+ "voluptate",
+ "velit",
+ "irure"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Ella Mason"
+ },
+ {
+ "id": 1,
+ "name": "Connie Kent"
+ },
+ {
+ "id": 2,
+ "name": "Dolores Pratt"
+ }
+ ],
+ "greeting": "Hello, Willa Morris! You have 1 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c5879088a44584bbd",
+ "index": 42,
+ "guid": "4ca1cc76-fc38-4a0e-b464-d612059ad964",
+ "isActive": false,
+ "balance": "$2,266.65",
+ "picture": "http://placehold.it/32x32",
+ "age": 34,
+ "eyeColor": "green",
+ "name": "Barron Hartman",
+ "gender": "male",
+ "company": "BLEENDOT",
+ "email": "barronhartman@bleendot.com",
+ "phone": "+1 (921) 500-2496",
+ "address": "772 Mermaid Avenue, Idledale, Virginia, 5418",
+ "about": "Velit dolor velit et et ea ipsum incididunt occaecat. Anim et ad consectetur eu cillum duis excepteur elit. Mollit sint do adipisicing esse nisi sit non. Sint anim officia id irure enim elit. Occaecat est nostrud labore deserunt et nisi ea ea dolor dolore Lorem aliqua. Occaecat in ut deserunt ex Lorem cillum dolore Lorem culpa est. Amet fugiat adipisicing ipsum aute esse duis eu proident commodo esse magna.\r\n",
+ "registered": "2014-11-15T09:17:31 -01:00",
+ "latitude": -52.249531,
+ "longitude": -151.566588,
+ "tags": [
+ "laboris",
+ "aliquip",
+ "quis",
+ "adipisicing",
+ "excepteur",
+ "id",
+ "aliquip"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Lynn Pena"
+ },
+ {
+ "id": 1,
+ "name": "Rosella Atkinson"
+ },
+ {
+ "id": 2,
+ "name": "Welch Willis"
+ }
+ ],
+ "greeting": "Hello, Barron Hartman! You have 5 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09979c9e3d0906341177d7",
+ "index": 43,
+ "guid": "e705a197-b8a6-4a7b-b2f6-a5eef7f2123f",
+ "isActive": false,
+ "balance": "$3,981.33",
+ "picture": "http://placehold.it/32x32",
+ "age": 35,
+ "eyeColor": "green",
+ "name": "Reva Guerrero",
+ "gender": "female",
+ "company": "SOLAREN",
+ "email": "revaguerrero@solaren.com",
+ "phone": "+1 (802) 523-2378",
+ "address": "242 Butler Place, Elfrida, Pennsylvania, 9276",
+ "about": "Do sint sit dolore excepteur id quis ut sint ut. Occaecat adipisicing deserunt velit nisi veniam. Amet non excepteur id do. Culpa eu minim laborum enim cupidatat tempor sint. Aliquip reprehenderit velit mollit dolor dolore. Sint magna fugiat aute occaecat. Lorem duis pariatur anim cupidatat laboris voluptate pariatur cillum.\r\n",
+ "registered": "2015-11-14T03:17:27 -01:00",
+ "latitude": -64.469472,
+ "longitude": -96.989833,
+ "tags": [
+ "dolor",
+ "ex",
+ "do",
+ "labore",
+ "excepteur",
+ "ipsum",
+ "sint"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Marcia Hopper"
+ },
+ {
+ "id": 1,
+ "name": "Harvey Crane"
+ },
+ {
+ "id": 2,
+ "name": "Christi Todd"
+ }
+ ],
+ "greeting": "Hello, Reva Guerrero! You have 3 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979ccc64fe4fbba90e18",
+ "index": 44,
+ "guid": "46749dea-3e43-48a1-b2c4-1bc4001f113e",
+ "isActive": false,
+ "balance": "$2,917.28",
+ "picture": "http://placehold.it/32x32",
+ "age": 40,
+ "eyeColor": "blue",
+ "name": "Larson Mejia",
+ "gender": "male",
+ "company": "DOGTOWN",
+ "email": "larsonmejia@dogtown.com",
+ "phone": "+1 (879) 581-3776",
+ "address": "535 Guernsey Street, Basye, Kentucky, 8411",
+ "about": "Labore eiusmod ullamco ea dolor minim reprehenderit. Cillum eiusmod eu mollit in commodo minim aliquip fugiat officia ea consectetur fugiat nostrud. Aliqua eu ex in et reprehenderit elit nostrud ipsum commodo occaecat non aute. Proident exercitation ipsum minim reprehenderit amet occaecat nulla mollit amet dolore cillum culpa. Reprehenderit id pariatur qui quis. Deserunt Lorem id nostrud commodo fugiat.\r\n",
+ "registered": "2017-04-02T02:16:29 -02:00",
+ "latitude": 64.249374,
+ "longitude": -143.328474,
+ "tags": [
+ "est",
+ "voluptate",
+ "nostrud",
+ "consectetur",
+ "laborum",
+ "irure",
+ "cupidatat"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Mayra Talley"
+ },
+ {
+ "id": 1,
+ "name": "Melissa Church"
+ },
+ {
+ "id": 2,
+ "name": "Tyler Juarez"
+ }
+ ],
+ "greeting": "Hello, Larson Mejia! You have 3 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979cdfd325b3a8a99ccb",
+ "index": 45,
+ "guid": "ac7a0186-11f9-4a2e-b946-2728f6ebd7d8",
+ "isActive": false,
+ "balance": "$1,757.87",
+ "picture": "http://placehold.it/32x32",
+ "age": 29,
+ "eyeColor": "blue",
+ "name": "Terrie Gay",
+ "gender": "female",
+ "company": "MOLTONIC",
+ "email": "terriegay@moltonic.com",
+ "phone": "+1 (961) 465-2390",
+ "address": "590 Crosby Avenue, Sussex, New York, 2123",
+ "about": "Elit officia dolore quis ut incididunt nostrud magna culpa pariatur voluptate laboris. Ad eiusmod aliqua incididunt consectetur. Dolore tempor do voluptate sint ex ipsum minim aliqua qui ad consequat.\r\n",
+ "registered": "2017-04-16T01:15:59 -02:00",
+ "latitude": 10.490488,
+ "longitude": 71.224389,
+ "tags": [
+ "eiusmod",
+ "culpa",
+ "Lorem",
+ "in",
+ "est",
+ "irure",
+ "ullamco"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Maritza Conner"
+ },
+ {
+ "id": 1,
+ "name": "Mcmillan Price"
+ },
+ {
+ "id": 2,
+ "name": "Eugenia Douglas"
+ }
+ ],
+ "greeting": "Hello, Terrie Gay! You have 9 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979cef2084f7241373f0",
+ "index": 46,
+ "guid": "1498a211-b2c6-42a7-a17c-db553c0ca0a1",
+ "isActive": true,
+ "balance": "$3,173.56",
+ "picture": "http://placehold.it/32x32",
+ "age": 24,
+ "eyeColor": "brown",
+ "name": "Marcella Rojas",
+ "gender": "female",
+ "company": "COMTRAK",
+ "email": "marcellarojas@comtrak.com",
+ "phone": "+1 (886) 552-2574",
+ "address": "283 Hewes Street, Walker, Hawaii, 1903",
+ "about": "Adipisicing commodo adipisicing irure voluptate sunt labore exercitation aliquip. Eiusmod tempor commodo nulla do. Quis veniam reprehenderit laborum elit consequat minim sint sint consequat Lorem voluptate. Anim ipsum incididunt consectetur irure ullamco.\r\n",
+ "registered": "2020-06-20T04:09:40 -02:00",
+ "latitude": 70.165576,
+ "longitude": -48.138932,
+ "tags": [
+ "excepteur",
+ "aute",
+ "ut",
+ "proident",
+ "ad",
+ "elit",
+ "non"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Richmond Alexander"
+ },
+ {
+ "id": 1,
+ "name": "Serrano Ferrell"
+ },
+ {
+ "id": 2,
+ "name": "Lucas Moore"
+ }
+ ],
+ "greeting": "Hello, Marcella Rojas! You have 6 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09979c26a1f0164b3ff0d5",
+ "index": 47,
+ "guid": "60779cf1-af30-46ec-bbeb-45db1f6d2dc1",
+ "isActive": true,
+ "balance": "$3,189.88",
+ "picture": "http://placehold.it/32x32",
+ "age": 35,
+ "eyeColor": "brown",
+ "name": "Ruthie Mcgee",
+ "gender": "female",
+ "company": "GYNK",
+ "email": "ruthiemcgee@gynk.com",
+ "phone": "+1 (863) 523-2705",
+ "address": "873 Grand Avenue, Brownsville, Arkansas, 2738",
+ "about": "Mollit irure aliqua ea sit irure magna est pariatur quis labore magna occaecat aliquip cillum. Laboris in duis incididunt reprehenderit incididunt aliquip adipisicing ut ea ea irure. Occaecat in irure mollit non non deserunt nisi cillum. Ullamco exercitation nisi dolor duis occaecat pariatur duis mollit sunt dolore laborum velit voluptate. Ut amet elit dolore ex fugiat non eu cupidatat fugiat ipsum in occaecat. Laboris labore minim commodo quis.\r\n",
+ "registered": "2016-09-05T10:19:12 -02:00",
+ "latitude": 63.890721,
+ "longitude": -69.227713,
+ "tags": [
+ "aliquip",
+ "esse",
+ "minim",
+ "magna",
+ "veniam",
+ "enim",
+ "eiusmod"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Nichole Owen"
+ },
+ {
+ "id": 1,
+ "name": "Dorothy Trujillo"
+ },
+ {
+ "id": 2,
+ "name": "Beatriz Christensen"
+ }
+ ],
+ "greeting": "Hello, Ruthie Mcgee! You have 1 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09979cedb88bcae64871fa",
+ "index": 48,
+ "guid": "7855810b-4ef1-40a7-a0cf-7e98bbe2383a",
+ "isActive": true,
+ "balance": "$3,172.09",
+ "picture": "http://placehold.it/32x32",
+ "age": 39,
+ "eyeColor": "green",
+ "name": "Joann Ray",
+ "gender": "female",
+ "company": "IMAGEFLOW",
+ "email": "joannray@imageflow.com",
+ "phone": "+1 (991) 560-2774",
+ "address": "903 Newton Street, Salunga, Georgia, 656",
+ "about": "Anim nostrud voluptate et aute exercitation aute eiusmod aliqua occaecat aliquip esse commodo. Labore elit culpa duis deserunt ex. Nulla nulla incididunt ea est minim nisi elit labore excepteur anim enim et. Aute aliquip do in nulla. Sunt culpa eu dolor anim sint sunt dolor labore nulla et minim. Veniam laboris in fugiat id nulla cillum esse fugiat.\r\n",
+ "registered": "2016-03-05T02:14:34 -01:00",
+ "latitude": 67.995524,
+ "longitude": 104.720686,
+ "tags": [
+ "voluptate",
+ "est",
+ "ut",
+ "eu",
+ "proident",
+ "anim",
+ "incididunt"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Frye Duke"
+ },
+ {
+ "id": 1,
+ "name": "Shanna Nieves"
+ },
+ {
+ "id": 2,
+ "name": "Karin Pace"
+ }
+ ],
+ "greeting": "Hello, Joann Ray! You have 3 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979cb1d02a95dd612ab9",
+ "index": 49,
+ "guid": "dd183603-5dad-4c67-917a-f85e4a1c5286",
+ "isActive": true,
+ "balance": "$2,165.18",
+ "picture": "http://placehold.it/32x32",
+ "age": 31,
+ "eyeColor": "blue",
+ "name": "Olivia Blankenship",
+ "gender": "female",
+ "company": "NEXGENE",
+ "email": "oliviablankenship@nexgene.com",
+ "phone": "+1 (967) 559-2248",
+ "address": "600 Hamilton Avenue, Edgar, Mississippi, 8803",
+ "about": "Quis occaecat in qui Lorem sunt do. Fugiat duis amet aute qui cillum et mollit esse. Anim ut duis irure fugiat reprehenderit voluptate pariatur mollit commodo labore mollit pariatur. Eiusmod dolore eiusmod eiusmod voluptate eiusmod esse fugiat et commodo sunt ullamco. Duis anim laboris quis officia commodo est culpa elit consequat fugiat laborum irure id dolor. Velit excepteur nostrud sit aliquip Lorem anim sint dolor duis laboris.\r\n",
+ "registered": "2014-02-20T07:46:43 -01:00",
+ "latitude": -1.793631,
+ "longitude": 103.072619,
+ "tags": [
+ "amet",
+ "consectetur",
+ "aliqua",
+ "fugiat",
+ "aliqua",
+ "laboris",
+ "quis"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Anderson Gibbs"
+ },
+ {
+ "id": 1,
+ "name": "Dennis Gilmore"
+ },
+ {
+ "id": 2,
+ "name": "Janie Mcintyre"
+ }
+ ],
+ "greeting": "Hello, Olivia Blankenship! You have 8 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c5cd058ca88eb6d87",
+ "index": 50,
+ "guid": "dabd90bf-1588-466c-9e29-48714bdf8c9f",
+ "isActive": false,
+ "balance": "$2,327.68",
+ "picture": "http://placehold.it/32x32",
+ "age": 34,
+ "eyeColor": "brown",
+ "name": "Melton Mooney",
+ "gender": "male",
+ "company": "VELITY",
+ "email": "meltonmooney@velity.com",
+ "phone": "+1 (939) 418-3729",
+ "address": "660 Locust Avenue, Escondida, Wisconsin, 5106",
+ "about": "Magna amet voluptate non occaecat dolor ad cupidatat. Eiusmod cillum minim irure pariatur incididunt laboris nostrud mollit voluptate. Et officia dolor nisi quis in aute sit. Reprehenderit non ea deserunt magna fugiat Lorem ullamco adipisicing veniam non occaecat. Laboris sunt voluptate dolor minim duis non laborum voluptate aliqua labore. Adipisicing ea cillum enim duis ipsum tempor ut commodo.\r\n",
+ "registered": "2014-03-22T01:29:28 -01:00",
+ "latitude": 83.308642,
+ "longitude": -89.052313,
+ "tags": [
+ "cupidatat",
+ "nisi",
+ "aliqua",
+ "dolor",
+ "excepteur",
+ "nisi",
+ "elit"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Lorie Ware"
+ },
+ {
+ "id": 1,
+ "name": "Brandy Mays"
+ },
+ {
+ "id": 2,
+ "name": "Bass Woodard"
+ }
+ ],
+ "greeting": "Hello, Melton Mooney! You have 6 unread messages.",
+ "favoriteFruit": "apple"
+ },
+ {
+ "_id": "5f09979c037a611f43fdea0f",
+ "index": 51,
+ "guid": "dbc1b405-cbc7-4b3a-9efb-1e7a7f1f261b",
+ "isActive": false,
+ "balance": "$2,834.72",
+ "picture": "http://placehold.it/32x32",
+ "age": 38,
+ "eyeColor": "green",
+ "name": "Helen Cooley",
+ "gender": "female",
+ "company": "BLUEGRAIN",
+ "email": "helencooley@bluegrain.com",
+ "phone": "+1 (819) 470-3117",
+ "address": "794 Ebony Court, Siglerville, Illinois, 6997",
+ "about": "Excepteur in sint laborum fugiat aliqua. Exercitation Lorem incididunt aliqua est proident non dolor non reprehenderit laboris voluptate. Labore Lorem consequat mollit esse elit non.\r\n",
+ "registered": "2014-05-11T05:18:38 -02:00",
+ "latitude": -77.950373,
+ "longitude": 48.686446,
+ "tags": [
+ "excepteur",
+ "duis",
+ "ut",
+ "nisi",
+ "commodo",
+ "cillum",
+ "reprehenderit"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Cooley Malone"
+ },
+ {
+ "id": 1,
+ "name": "Pena Wiley"
+ },
+ {
+ "id": 2,
+ "name": "Chan Lowe"
+ }
+ ],
+ "greeting": "Hello, Helen Cooley! You have 1 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979c0f5630f28965f196",
+ "index": 52,
+ "guid": "6329ae9a-6137-4f12-9295-86886d847a70",
+ "isActive": false,
+ "balance": "$1,659.28",
+ "picture": "http://placehold.it/32x32",
+ "age": 22,
+ "eyeColor": "blue",
+ "name": "Mcclure Raymond",
+ "gender": "male",
+ "company": "SONGLINES",
+ "email": "mcclureraymond@songlines.com",
+ "phone": "+1 (967) 407-3137",
+ "address": "836 Sapphire Street, Nord, Rhode Island, 2874",
+ "about": "Voluptate irure occaecat anim sit eiusmod commodo. Excepteur ipsum tempor sit pariatur qui ad ullamco commodo aliqua. Esse cupidatat commodo labore culpa et non. Veniam enim nostrud enim nisi dolor anim Lorem exercitation. Amet deserunt non culpa sint laborum incididunt adipisicing quis minim in. Irure occaecat elit sit mollit voluptate non ea nulla ea deserunt proident.\r\n",
+ "registered": "2019-03-07T01:48:11 -01:00",
+ "latitude": -36.879918,
+ "longitude": -7.028847,
+ "tags": [
+ "sunt",
+ "ex",
+ "nisi",
+ "mollit",
+ "aliqua",
+ "duis",
+ "sint"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Sloan Hughes"
+ },
+ {
+ "id": 1,
+ "name": "Hays Berg"
+ },
+ {
+ "id": 2,
+ "name": "Mayer Buckley"
+ }
+ ],
+ "greeting": "Hello, Mcclure Raymond! You have 8 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979c983ba6e5477c8f37",
+ "index": 53,
+ "guid": "6b2d326b-2b2c-412b-b5e1-e78cf303445b",
+ "isActive": false,
+ "balance": "$2,512.05",
+ "picture": "http://placehold.it/32x32",
+ "age": 31,
+ "eyeColor": "blue",
+ "name": "Kristine Hood",
+ "gender": "female",
+ "company": "ONTALITY",
+ "email": "kristinehood@ontality.com",
+ "phone": "+1 (867) 405-2818",
+ "address": "316 Cass Place, Bayview, Texas, 4484",
+ "about": "Officia pariatur sint anim duis nisi eu nostrud laborum reprehenderit quis eiusmod ad et. Nisi duis exercitation minim id fugiat elit. Est eu duis cupidatat laborum eiusmod qui excepteur proident culpa anim in amet et occaecat.\r\n",
+ "registered": "2018-09-01T10:03:48 -02:00",
+ "latitude": 70.084949,
+ "longitude": 137.399354,
+ "tags": [
+ "eu",
+ "in",
+ "non",
+ "reprehenderit",
+ "veniam",
+ "amet",
+ "id"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Stacy Aguilar"
+ },
+ {
+ "id": 1,
+ "name": "Susie Branch"
+ },
+ {
+ "id": 2,
+ "name": "Ashley Randolph"
+ }
+ ],
+ "greeting": "Hello, Kristine Hood! You have 3 unread messages.",
+ "favoriteFruit": "banana"
+ },
+ {
+ "_id": "5f09979c1d23a0a5abd0d670",
+ "index": 54,
+ "guid": "80cccbd2-c2a7-4243-96e7-324135a3f369",
+ "isActive": false,
+ "balance": "$3,830.88",
+ "picture": "http://placehold.it/32x32",
+ "age": 23,
+ "eyeColor": "blue",
+ "name": "Bethany Shields",
+ "gender": "female",
+ "company": "CHORIZON",
+ "email": "bethanyshields@chorizon.com",
+ "phone": "+1 (861) 428-2245",
+ "address": "521 Stockholm Street, Seymour, West Virginia, 956",
+ "about": "Adipisicing sit sint exercitation Lorem magna proident minim commodo. Consequat aliquip sint sit tempor irure excepteur sit dolore duis esse adipisicing laboris proident. Occaecat consectetur in minim quis sunt.\r\n",
+ "registered": "2018-08-06T01:32:25 -02:00",
+ "latitude": 83.408235,
+ "longitude": 21.81127,
+ "tags": [
+ "cillum",
+ "cillum",
+ "et",
+ "aliquip",
+ "id",
+ "aliquip",
+ "eu"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Misty Wheeler"
+ },
+ {
+ "id": 1,
+ "name": "Roslyn Barlow"
+ },
+ {
+ "id": 2,
+ "name": "Terry Castillo"
+ }
+ ],
+ "greeting": "Hello, Bethany Shields! You have 2 unread messages.",
+ "favoriteFruit": "strawberry"
+ },
+ {
+ "_id": "5f09979c4b28c0f895924400",
+ "index": 55,
+ "guid": "4346392c-a76f-44a6-988b-b48005cd284a",
+ "isActive": true,
+ "balance": "$3,490.01",
+ "picture": "http://placehold.it/32x32",
+ "age": 29,
+ "eyeColor": "brown",
+ "name": "Shirley Dickson",
+ "gender": "female",
+ "company": "EQUICOM",
+ "email": "shirleydickson@equicom.com",
+ "phone": "+1 (991) 469-3318",
+ "address": "650 Louisiana Avenue, Williamson, Idaho, 182",
+ "about": "Deserunt et aliquip cupidatat qui quis. Minim nulla non minim aliqua quis magna sit fugiat et duis occaecat exercitation Lorem. Ullamco esse esse adipisicing ipsum amet officia tempor deserunt. Est ea ut ipsum duis enim laborum culpa velit Lorem ullamco officia. Exercitation magna laboris occaecat eiusmod. Pariatur laborum non pariatur velit quis consectetur nulla tempor. Ad fugiat qui ea quis velit irure ullamco culpa culpa culpa et.\r\n",
+ "registered": "2020-05-17T10:48:38 -02:00",
+ "latitude": 11.334502,
+ "longitude": 168.912113,
+ "tags": [
+ "esse",
+ "tempor",
+ "magna",
+ "laboris",
+ "esse",
+ "et",
+ "fugiat"
+ ],
+ "friends": [
+ {
+ "id": 0,
+ "name": "Michael Haney"
+ },
+ {
+ "id": 1,
+ "name": "Luisa Bowen"
+ },
+ {
+ "id": 2,
+ "name": "Bernard Cline"
+ }
+ ],
+ "greeting": "Hello, Shirley Dickson! You have 7 unread messages.",
+ "favoriteFruit": "strawberry"
+ }
+ ]
+} \ No newline at end of file
diff --git a/deps/inja/test/data/benchmark/large_template.txt b/deps/inja/test/data/benchmark/large_template.txt
new file mode 100644
index 0000000..2452744
--- /dev/null
+++ b/deps/inja/test/data/benchmark/large_template.txt
@@ -0,0 +1,1733 @@
+Lorem {{ name }}!
+
+{% for v1 in list001 %}{{ v1 }} {% for v2 in list002 %}{{ v2 }} {% for v3 in list003 %}{{ v1 }}
+{{ v3 }} {{name}}\n{% endfor %}{% endfor %}{% endfor %}
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque.
+
+Omnis in aut nobis libero enim. Porro optio ratione. molestiae necessitatibus numquam architecto soluta.
+Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ sort(list001) }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque. \ No newline at end of file
diff --git a/deps/inja/test/data/benchmark/medium_template.txt b/deps/inja/test/data/benchmark/medium_template.txt
new file mode 100644
index 0000000..969147a
--- /dev/null
+++ b/deps/inja/test/data/benchmark/medium_template.txt
@@ -0,0 +1,10 @@
+Lorem {{ name }}!
+
+{% for v1 in list001 %}{{ v1 }} {% for v2 in list002 %}{{ v2 }} {% for v3 in list003 %}{{ v1 }}
+{{ v3 }} {{name}}\n{% endfor %}{% endfor %}{% endfor %}Omnis in aut nobis libero enim. Porro optio ratione
+molestiae necessitatibus numquam architecto soluta. Magnam minus unde quas {{ name }} aspernatur occaecati et
+voluptas cupiditate. Assumenda ut alias quam voluptate aut saepe ullam dignissimos. \n Sequi aut autem nihil
+voluptatem tenetur incidunt. Autem commodi animi rerum. {{ lower(name) }} Mollitia eligendi aut sed rerum veniam.
+Eum et fugit velit sint ratione voluptatem aliquam. Minima sint consectetur natus modi quis. Animi est nesciunt
+cupiditate nostrum iure. Voluptatem accusamus vel corporis. \n Debitis {{ name }} sunt est debitis distinctio ut.
+Provident corrupti nihil velit aut tempora corporis corrupti exercitationem. Praesentium cumque ex est itaque. \ No newline at end of file
diff --git a/deps/inja/test/data/benchmark/small_data.json b/deps/inja/test/data/benchmark/small_data.json
new file mode 100644
index 0000000..292c2e2
--- /dev/null
+++ b/deps/inja/test/data/benchmark/small_data.json
@@ -0,0 +1,6 @@
+{
+ "name": "Peter",
+ "list001": ["lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit", "aliquam", "accumsan"],
+ "list002": ["donec", "in", "egestas", "diam", "aenean", "suscipit", "scelerisque", "efficitur", "integer", "a"],
+ "list003": ["maecenas", "metus", "erat", "vestibulum", "quis", "porta", "in", "consequat", "sed", "justo"]
+} \ No newline at end of file
diff --git a/deps/inja/test/data/error-unknown/data.json b/deps/inja/test/data/error-unknown/data.json
new file mode 100755
index 0000000..c009c75
--- /dev/null
+++ b/deps/inja/test/data/error-unknown/data.json
@@ -0,0 +1,3 @@
+{
+ "name": "Jeff"
+} \ No newline at end of file
diff --git a/deps/inja/test/data/error-unknown/template.txt b/deps/inja/test/data/error-unknown/template.txt
new file mode 100755
index 0000000..17af6d7
--- /dev/null
+++ b/deps/inja/test/data/error-unknown/template.txt
@@ -0,0 +1,6 @@
+
+{% for x ins xarray %}{% for y in yarray %}
+{{x}}-{{y}}
+{% endfor %}{% endfor %}
+
+Hello {{ unknown }}. \ No newline at end of file
diff --git a/deps/inja/test/data/html/data.json b/deps/inja/test/data/html/data.json
new file mode 100644
index 0000000..c5726a5
--- /dev/null
+++ b/deps/inja/test/data/html/data.json
@@ -0,0 +1,12 @@
+{
+ "author": "Pantor",
+ "date": "23/12/2018",
+ "tags": [
+ "test",
+ "templates"
+ ],
+ "views": 123,
+ "title": "Inja works.",
+ "content": "Inja is the best and fastest template engine for C++. Period.",
+ "footer-text": "This is the footer."
+}
diff --git a/deps/inja/test/data/html/footer.txt b/deps/inja/test/data/html/footer.txt
new file mode 100644
index 0000000..31d4bd3
--- /dev/null
+++ b/deps/inja/test/data/html/footer.txt
@@ -0,0 +1,6 @@
+<footer>
+ <div>
+ <h3>About</h3>
+ <p>{{ footer-text }}</p>
+ </div>
+ </footer> \ No newline at end of file
diff --git a/deps/inja/test/data/html/header.txt b/deps/inja/test/data/html/header.txt
new file mode 100644
index 0000000..6b6d6ed
--- /dev/null
+++ b/deps/inja/test/data/html/header.txt
@@ -0,0 +1,3 @@
+<head>
+ <title>{{ title }}</title>
+ </head> \ No newline at end of file
diff --git a/deps/inja/test/data/html/result.txt b/deps/inja/test/data/html/result.txt
new file mode 100644
index 0000000..0e23a41
--- /dev/null
+++ b/deps/inja/test/data/html/result.txt
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Inja works.</title>
+ </head>
+ <body>
+ <h1>Inja works.</h1>
+ <small>Written by Pantor</small>
+
+ <p>Inja is the best and fastest template engine for C++. Period.</p>
+ <small>123 views</small>
+
+ <h5>Tags</h5>
+ <ul>
+ <li>test</li>
+ <li>templates</li>
+ </ul>
+
+ <footer>
+ <div>
+ <h3>About</h3>
+ <p>This is the footer.</p>
+ </div>
+ </footer>
+ </body>
+</html>
diff --git a/deps/inja/test/data/html/template.txt b/deps/inja/test/data/html/template.txt
new file mode 100644
index 0000000..b471e74
--- /dev/null
+++ b/deps/inja/test/data/html/template.txt
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+ {% include "header.txt" %}
+ <body>
+ <h1>{{ title }}</h1>
+ <small>Written by {{ author }}</small>
+
+ <p>{{ content }}</p>
+ <small>{{ views }} views</small>
+
+ <h5>Tags</h5>
+ <ul>
+## for tag in tags
+ <li>{{ tag }}</li>
+## endfor
+ </ul>
+
+ {% include "footer.txt" %}
+ </body>
+</html>
diff --git a/deps/inja/test/data/include.txt b/deps/inja/test/data/include.txt
new file mode 100755
index 0000000..dbcae63
--- /dev/null
+++ b/deps/inja/test/data/include.txt
@@ -0,0 +1 @@
+Answer: {% include "simple.txt" %} \ No newline at end of file
diff --git a/deps/inja/test/data/nested-line/data.json b/deps/inja/test/data/nested-line/data.json
new file mode 100755
index 0000000..f7e4949
--- /dev/null
+++ b/deps/inja/test/data/nested-line/data.json
@@ -0,0 +1,4 @@
+{
+ "xarray": [0, 1],
+ "yarray": [0, 1, 2]
+} \ No newline at end of file
diff --git a/deps/inja/test/data/nested-line/result.txt b/deps/inja/test/data/nested-line/result.txt
new file mode 100755
index 0000000..109ebdb
--- /dev/null
+++ b/deps/inja/test/data/nested-line/result.txt
@@ -0,0 +1,6 @@
+0-0
+0-1
+0-2
+1-0
+1-1
+1-2
diff --git a/deps/inja/test/data/nested-line/template.txt b/deps/inja/test/data/nested-line/template.txt
new file mode 100755
index 0000000..2ad7503
--- /dev/null
+++ b/deps/inja/test/data/nested-line/template.txt
@@ -0,0 +1,5 @@
+## for x in xarray
+## for y in yarray
+{{x}}-{{y}}
+## endfor
+## endfor
diff --git a/deps/inja/test/data/nested-whitespace/data.json b/deps/inja/test/data/nested-whitespace/data.json
new file mode 100755
index 0000000..f7e4949
--- /dev/null
+++ b/deps/inja/test/data/nested-whitespace/data.json
@@ -0,0 +1,4 @@
+{
+ "xarray": [0, 1],
+ "yarray": [0, 1, 2]
+} \ No newline at end of file
diff --git a/deps/inja/test/data/nested-whitespace/result.txt b/deps/inja/test/data/nested-whitespace/result.txt
new file mode 100755
index 0000000..109ebdb
--- /dev/null
+++ b/deps/inja/test/data/nested-whitespace/result.txt
@@ -0,0 +1,6 @@
+0-0
+0-1
+0-2
+1-0
+1-1
+1-2
diff --git a/deps/inja/test/data/nested-whitespace/template.txt b/deps/inja/test/data/nested-whitespace/template.txt
new file mode 100755
index 0000000..254dce2
--- /dev/null
+++ b/deps/inja/test/data/nested-whitespace/template.txt
@@ -0,0 +1,3 @@
+{% for x in xarray %}{% for y in yarray %}
+{{x}}-{{y}}
+{% endfor %}{% endfor %} \ No newline at end of file
diff --git a/deps/inja/test/data/nested/data.json b/deps/inja/test/data/nested/data.json
new file mode 100755
index 0000000..f7e4949
--- /dev/null
+++ b/deps/inja/test/data/nested/data.json
@@ -0,0 +1,4 @@
+{
+ "xarray": [0, 1],
+ "yarray": [0, 1, 2]
+} \ No newline at end of file
diff --git a/deps/inja/test/data/nested/result.txt b/deps/inja/test/data/nested/result.txt
new file mode 100755
index 0000000..d3bee34
--- /dev/null
+++ b/deps/inja/test/data/nested/result.txt
@@ -0,0 +1,12 @@
+
+0-0
+
+0-1
+
+0-2
+
+1-0
+
+1-1
+
+1-2
diff --git a/deps/inja/test/data/nested/template.txt b/deps/inja/test/data/nested/template.txt
new file mode 100755
index 0000000..254dce2
--- /dev/null
+++ b/deps/inja/test/data/nested/template.txt
@@ -0,0 +1,3 @@
+{% for x in xarray %}{% for y in yarray %}
+{{x}}-{{y}}
+{% endfor %}{% endfor %} \ No newline at end of file
diff --git a/deps/inja/test/data/simple-file/data.json b/deps/inja/test/data/simple-file/data.json
new file mode 100755
index 0000000..c009c75
--- /dev/null
+++ b/deps/inja/test/data/simple-file/data.json
@@ -0,0 +1,3 @@
+{
+ "name": "Jeff"
+} \ No newline at end of file
diff --git a/deps/inja/test/data/simple-file/result.txt b/deps/inja/test/data/simple-file/result.txt
new file mode 100755
index 0000000..d6b3f74
--- /dev/null
+++ b/deps/inja/test/data/simple-file/result.txt
@@ -0,0 +1 @@
+Hello Jeff. \ No newline at end of file
diff --git a/deps/inja/test/data/simple-file/template.txt b/deps/inja/test/data/simple-file/template.txt
new file mode 100755
index 0000000..a68f931
--- /dev/null
+++ b/deps/inja/test/data/simple-file/template.txt
@@ -0,0 +1 @@
+Hello {{ name }}. \ No newline at end of file
diff --git a/deps/inja/test/data/simple.txt b/deps/inja/test/data/simple.txt
new file mode 100755
index 0000000..a68f931
--- /dev/null
+++ b/deps/inja/test/data/simple.txt
@@ -0,0 +1 @@
+Hello {{ name }}. \ No newline at end of file
diff --git a/deps/inja/test/test-files.cpp b/deps/inja/test/test-files.cpp
new file mode 100644
index 0000000..74d099a
--- /dev/null
+++ b/deps/inja/test/test-files.cpp
@@ -0,0 +1,79 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+TEST_CASE("loading") {
+ inja::Environment env;
+ json data;
+ data["name"] = "Jeff";
+
+ SUBCASE("Files should be loaded") { CHECK(env.load_file(test_file_directory + "simple.txt") == "Hello {{ name }}."); }
+
+ SUBCASE("Files should be rendered") {
+ CHECK(env.render_file(test_file_directory + "simple.txt", data) == "Hello Jeff.");
+ }
+
+ SUBCASE("File includes should be rendered") {
+ CHECK(env.render_file(test_file_directory + "include.txt", data) == "Answer: Hello Jeff.");
+ }
+
+ SUBCASE("File error should throw") {
+ std::string path(test_file_directory + "does-not-exist");
+
+ std::string file_error_message = "[inja.exception.file_error] failed accessing file at '" + path + "'";
+ CHECK_THROWS_WITH(env.load_file(path), file_error_message.c_str());
+ CHECK_THROWS_WITH(env.load_json(path), file_error_message.c_str());
+ }
+}
+
+TEST_CASE("complete-files") {
+ inja::Environment env {test_file_directory};
+
+ for (std::string test_name : {"simple-file", "nested", "nested-line", "html"}) {
+ SUBCASE(test_name.c_str()) {
+ CHECK(env.render_file_with_json_file(test_name + "/template.txt", test_name + "/data.json") ==
+ env.load_file(test_name + "/result.txt"));
+ }
+ }
+
+ for (std::string test_name : {"error-unknown"}) {
+ SUBCASE(test_name.c_str()) {
+ CHECK_THROWS_WITH(env.render_file_with_json_file(test_name + "/template.txt", test_name + "/data.json"),
+ "[inja.exception.parser_error] (at 2:10) expected 'in', got 'ins'");
+ }
+ }
+}
+
+TEST_CASE("complete-files-whitespace-control") {
+ inja::Environment env {test_file_directory};
+ env.set_trim_blocks(true);
+ env.set_lstrip_blocks(true);
+
+ for (std::string test_name : {"nested-whitespace"}) {
+ SUBCASE(test_name.c_str()) {
+ CHECK(env.render_file_with_json_file(test_name + "/template.txt", test_name + "/data.json") ==
+ env.load_file(test_name + "/result.txt"));
+ }
+ }
+}
+
+TEST_CASE("global-path") {
+ inja::Environment env {test_file_directory, "./"};
+ inja::Environment env_result {"./"};
+ json data;
+ data["name"] = "Jeff";
+
+ SUBCASE("Files should be written") {
+ env.write("simple.txt", data, "global-path-result.txt");
+
+ // Fails repeatedly on windows CI
+ // CHECK(env_result.load_file("global-path-result.txt") == "Hello Jeff.");
+ }
+}
+
+TEST_CASE("include-without-local-files") {
+ inja::Environment env {test_file_directory};
+ env.set_search_included_templates_in_files(false);
+
+ SUBCASE("html") {
+ CHECK_THROWS_WITH(env.render_file_with_json_file("html/template.txt", "html/data.json"), "[inja.exception.render_error] (at 3:14) include '../test/data/html/header.txt' not found");
+ }
+}
diff --git a/deps/inja/test/test-functions.cpp b/deps/inja/test/test-functions.cpp
new file mode 100644
index 0000000..4870205
--- /dev/null
+++ b/deps/inja/test/test-functions.cpp
@@ -0,0 +1,285 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+TEST_CASE("functions") {
+ inja::Environment env;
+
+ json data;
+ data["name"] = "Peter";
+ data["city"] = "New York";
+ data["names"] = {"Jeff", "Seb", "Peter", "Tom"};
+ data["temperature"] = 25.6789;
+ data["brother"]["name"] = "Chris";
+ data["brother"]["daughters"] = {"Maria", "Helen"};
+ data["property"] = "name";
+ data["age"] = 29;
+ data["i"] = 1;
+ data["is_happy"] = true;
+ data["is_sad"] = false;
+ data["vars"] = {2, 3, 4, 0, -1, -2, -3};
+
+ SUBCASE("math") {
+ CHECK(env.render("{{ 1 + 1 }}", data) == "2");
+ CHECK(env.render("{{ 3 - 21 }}", data) == "-18");
+ CHECK(env.render("{{ 1 + 1 * 3 }}", data) == "4");
+ CHECK(env.render("{{ (1 + 1) * 3 }}", data) == "6");
+ CHECK(env.render("{{ 5 / 2 }}", data) == "2.5");
+ CHECK(env.render("{{ 5^3 }}", data) == "125");
+ CHECK(env.render("{{ 5 + 12 + 4 * (4 - (1 + 1))^2 - 75 * 1 }}", data) == "-42");
+ }
+
+ SUBCASE("upper") {
+ CHECK(env.render("{{ upper(name) }}", data) == "PETER");
+ CHECK(env.render("{{ upper( name ) }}", data) == "PETER");
+ CHECK(env.render("{{ upper(city) }}", data) == "NEW YORK");
+ CHECK(env.render("{{ upper(upper(name)) }}", data) == "PETER");
+
+ // CHECK_THROWS_WITH( env.render("{{ upper(5) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be string, but is number" ); CHECK_THROWS_WITH( env.render("{{
+ // upper(true) }}", data), "[inja.exception.json_error] [json.exception.type_error.302] type must be string, but is
+ // boolean" );
+ }
+
+ SUBCASE("lower") {
+ CHECK(env.render("{{ lower(name) }}", data) == "peter");
+ CHECK(env.render("{{ lower(city) }}", data) == "new york");
+ // CHECK_THROWS_WITH( env.render("{{ lower(5.45) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be string, but is number" );
+ }
+
+ SUBCASE("range") {
+ CHECK(env.render("{{ range(2) }}", data) == "[0,1]");
+ CHECK(env.render("{{ range(4) }}", data) == "[0,1,2,3]");
+ // CHECK_THROWS_WITH( env.render("{{ range(name) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be number, but is string" );
+ }
+
+ SUBCASE("length") {
+ CHECK(env.render("{{ length(names) }}", data) == "4"); // Length of array
+ CHECK(env.render("{{ length(name) }}", data) == "5"); // Length of string
+ // CHECK_THROWS_WITH( env.render("{{ length(5) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be array, but is number" );
+ }
+
+ SUBCASE("sort") {
+ CHECK(env.render("{{ sort([3, 2, 1]) }}", data) == "[1,2,3]");
+ CHECK(env.render("{{ sort([\"bob\", \"charlie\", \"alice\"]) }}", data) == "[\"alice\",\"bob\",\"charlie\"]");
+ // CHECK_THROWS_WITH( env.render("{{ sort(5) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be array, but is number" );
+ }
+
+ SUBCASE("at") {
+ CHECK(env.render("{{ at(names, 0) }}", data) == "Jeff");
+ CHECK(env.render("{{ at(names, i) }}", data) == "Seb");
+ // CHECK(env.render("{{ at(names, 45) }}", data) == "Jeff");
+ }
+
+ SUBCASE("first") {
+ CHECK(env.render("{{ first(names) }}", data) == "Jeff");
+ // CHECK_THROWS_WITH( env.render("{{ first(5) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be array, but is number" );
+ }
+
+ SUBCASE("last") {
+ CHECK(env.render("{{ last(names) }}", data) == "Tom");
+ // CHECK_THROWS_WITH( env.render("{{ last(5) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be array, but is number" );
+ }
+
+ SUBCASE("round") {
+ CHECK(env.render("{{ round(4, 0) }}", data) == "4.0");
+ CHECK(env.render("{{ round(temperature, 2) }}", data) == "25.68");
+ // CHECK_THROWS_WITH( env.render("{{ round(name, 2) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be number, but is string" );
+ }
+
+ SUBCASE("divisibleBy") {
+ CHECK(env.render("{{ divisibleBy(50, 5) }}", data) == "true");
+ CHECK(env.render("{{ divisibleBy(12, 3) }}", data) == "true");
+ CHECK(env.render("{{ divisibleBy(11, 3) }}", data) == "false");
+ // CHECK_THROWS_WITH( env.render("{{ divisibleBy(name, 2) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be number, but is string" );
+ }
+
+ SUBCASE("odd") {
+ CHECK(env.render("{{ odd(11) }}", data) == "true");
+ CHECK(env.render("{{ odd(12) }}", data) == "false");
+ // CHECK_THROWS_WITH( env.render("{{ odd(name) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be number, but is string" );
+ }
+
+ SUBCASE("even") {
+ CHECK(env.render("{{ even(11) }}", data) == "false");
+ CHECK(env.render("{{ even(12) }}", data) == "true");
+ // CHECK_THROWS_WITH( env.render("{{ even(name) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be number, but is string" );
+ }
+
+ SUBCASE("max") {
+ CHECK(env.render("{{ max([1, 2, 3]) }}", data) == "3");
+ CHECK(env.render("{{ max([-5.2, 100.2, 2.4]) }}", data) == "100.2");
+ // CHECK_THROWS_WITH( env.render("{{ max(name) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be array, but is string" );
+ }
+
+ SUBCASE("min") {
+ CHECK(env.render("{{ min([1, 2, 3]) }}", data) == "1");
+ CHECK(env.render("{{ min([-5.2, 100.2, 2.4]) }}", data) == "-5.2");
+ // CHECK_THROWS_WITH( env.render("{{ min(name) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be array, but is string" );
+ }
+
+ SUBCASE("float") {
+ CHECK(env.render("{{ float(\"2.2\") == 2.2 }}", data) == "true");
+ CHECK(env.render("{{ float(\"-1.25\") == -1.25 }}", data) == "true");
+ // CHECK_THROWS_WITH( env.render("{{ max(name) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be array, but is string" );
+ }
+
+ SUBCASE("int") {
+ CHECK(env.render("{{ int(\"2\") == 2 }}", data) == "true");
+ CHECK(env.render("{{ int(\"-1.25\") == -1 }}", data) == "true");
+ // CHECK_THROWS_WITH( env.render("{{ max(name) }}", data), "[inja.exception.json_error]
+ // [json.exception.type_error.302] type must be array, but is string" );
+ }
+
+ SUBCASE("default") {
+ CHECK(env.render("{{ default(11, 0) }}", data) == "11");
+ CHECK(env.render("{{ default(nothing, 0) }}", data) == "0");
+ CHECK(env.render("{{ default(name, \"nobody\") }}", data) == "Peter");
+ CHECK(env.render("{{ default(surname, \"nobody\") }}", data) == "nobody");
+ CHECK(env.render("{{ default(surname, \"{{ surname }}\") }}", data) == "{{ surname }}");
+ CHECK_THROWS_WITH(env.render("{{ default(surname, lastname) }}", data),
+ "[inja.exception.render_error] (at 1:21) variable 'lastname' not found");
+ }
+
+ SUBCASE("exists") {
+ CHECK(env.render("{{ exists(\"name\") }}", data) == "true");
+ CHECK(env.render("{{ exists(\"zipcode\") }}", data) == "false");
+ CHECK(env.render("{{ exists(name) }}", data) == "false");
+ CHECK(env.render("{{ exists(property) }}", data) == "true");
+
+ // CHECK(env.render("{{ exists(\"keywords\") and length(keywords) > 0 }}", data) == "false");
+ }
+
+ SUBCASE("existsIn") {
+ CHECK(env.render("{{ existsIn(brother, \"name\") }}", data) == "true");
+ CHECK(env.render("{{ existsIn(brother, \"parents\") }}", data) == "false");
+ CHECK(env.render("{{ existsIn(brother, property) }}", data) == "true");
+ CHECK(env.render("{{ existsIn(brother, name) }}", data) == "false");
+ CHECK_THROWS_WITH(env.render("{{ existsIn(sister, \"lastname\") }}", data),
+ "[inja.exception.render_error] (at 1:13) variable 'sister' not found");
+ CHECK_THROWS_WITH(env.render("{{ existsIn(brother, sister) }}", data),
+ "[inja.exception.render_error] (at 1:22) variable 'sister' not found");
+ }
+
+ SUBCASE("isType") {
+ CHECK(env.render("{{ isBoolean(is_happy) }}", data) == "true");
+ CHECK(env.render("{{ isBoolean(vars) }}", data) == "false");
+ CHECK(env.render("{{ isNumber(age) }}", data) == "true");
+ CHECK(env.render("{{ isNumber(name) }}", data) == "false");
+ CHECK(env.render("{{ isInteger(age) }}", data) == "true");
+ CHECK(env.render("{{ isInteger(is_happy) }}", data) == "false");
+ CHECK(env.render("{{ isFloat(temperature) }}", data) == "true");
+ CHECK(env.render("{{ isFloat(age) }}", data) == "false");
+ CHECK(env.render("{{ isObject(brother) }}", data) == "true");
+ CHECK(env.render("{{ isObject(vars) }}", data) == "false");
+ CHECK(env.render("{{ isArray(vars) }}", data) == "true");
+ CHECK(env.render("{{ isArray(name) }}", data) == "false");
+ CHECK(env.render("{{ isString(name) }}", data) == "true");
+ CHECK(env.render("{{ isString(names) }}", data) == "false");
+ }
+}
+
+TEST_CASE("callbacks") {
+ inja::Environment env;
+ json data;
+ data["age"] = 28;
+
+ env.add_callback("double", 1, [](inja::Arguments &args) {
+ int number = args.at(0)->get<int>();
+ return 2 * number;
+ });
+
+ env.add_callback("half", 1, [](inja::Arguments args) {
+ int number = args.at(0)->get<int>();
+ return number / 2;
+ });
+
+ std::string greet = "Hello";
+ env.add_callback("double-greetings", 0, [greet](inja::Arguments args) { return greet + " " + greet + "!"; });
+
+ env.add_callback("multiply", 2, [](inja::Arguments args) {
+ double number1 = args.at(0)->get<double>();
+ auto number2 = args.at(1)->get<double>();
+ return number1 * number2;
+ });
+
+ env.add_callback("multiply", 3, [](inja::Arguments args) {
+ double number1 = args.at(0)->get<double>();
+ double number2 = args.at(1)->get<double>();
+ double number3 = args.at(2)->get<double>();
+ return number1 * number2 * number3;
+ });
+
+ env.add_callback("length", 1, [](inja::Arguments args) {
+ auto number1 = args.at(0)->get<std::string>();
+ return number1.length();
+ });
+
+ env.add_void_callback("log", 1, [](inja::Arguments args) {
+ int a = 2;
+ });
+
+ env.add_callback("multiply", 0, [](inja::Arguments args) { return 1.0; });
+
+ CHECK(env.render("{{ double(age) }}", data) == "56");
+ CHECK(env.render("{{ half(age) }}", data) == "14");
+ CHECK(env.render("{{ log(age) }}", data) == "");
+ CHECK(env.render("{{ double-greetings }}", data) == "Hello Hello!");
+ CHECK(env.render("{{ double-greetings() }}", data) == "Hello Hello!");
+ CHECK(env.render("{{ multiply(4, 5) }}", data) == "20.0");
+ CHECK(env.render("{{ multiply(length(\"tester\"), 5) }}", data) == "30.0");
+ CHECK(env.render("{{ multiply(5, length(\"t\")) }}", data) == "5.0");
+ CHECK(env.render("{{ multiply(3, 4, 5) }}", data) == "60.0");
+ CHECK(env.render("{{ multiply }}", data) == "1.0");
+
+ SUBCASE("Variadic") {
+ env.add_callback("argmax", [](inja::Arguments& args) {
+ auto result = std::max_element(args.begin(), args.end(), [](const json* a, const json* b) { return *a < *b;});
+ return std::distance(args.begin(), result);
+ });
+
+ CHECK(env.render("{{ argmax(4, 2, 6) }}", data) == "2");
+ CHECK(env.render("{{ argmax(0, 2, 6, 8, 3) }}", data) == "3");
+ }
+}
+
+TEST_CASE("combinations") {
+ inja::Environment env;
+ json data;
+ data["name"] = "Peter";
+ data["city"] = "Brunswick";
+ data["age"] = 29;
+ data["names"] = {"Jeff", "Seb", "Chris"};
+ data["brother"]["name"] = "Chris";
+ data["brother"]["daughters"] = {"Maria", "Helen"};
+ data["brother"]["daughter0"] = {{"name", "Maria"}};
+ data["is_happy"] = true;
+ data["list_of_objects"] = {{{"a", 2}}, {{"b", 3}}, {{"c", 4}}, {{"d", 5}}};
+
+ CHECK(env.render("{% if upper(\"Peter\") == \"PETER\" %}TRUE{% endif %}", data) == "TRUE");
+ CHECK(env.render("{% if lower(upper(name)) == \"peter\" %}TRUE{% endif %}", data) == "TRUE");
+ CHECK(env.render("{% for i in range(4) %}{{ loop.index1 }}{% endfor %}", data) == "1234");
+ CHECK(env.render("{{ upper(last(brother.daughters)) }}", data) == "HELEN");
+ CHECK(env.render("{{ length(name) * 2.5 }}", data) == "12.5");
+ CHECK(env.render("{{ upper(first(sort(brother.daughters)) + \"_test\") }}", data) == "HELEN_TEST");
+ CHECK(env.render("{% for i in range(3) %}{{ at(names, i) }}{% endfor %}", data) == "JeffSebChris");
+ CHECK(env.render("{% if not is_happy or age > 26 %}TRUE{% endif %}", data) == "TRUE");
+ CHECK(env.render("{{ last(list_of_objects).d * 2}}", data) == "10");
+ CHECK(env.render("{{ last(range(5)) * 2 }}", data) == "8");
+ CHECK(env.render("{{ last(range(5 * 2)) }}", data) == "9");
+ CHECK(env.render("{{ last(range(5 * 2)) }}", data) == "9");
+ CHECK(env.render("{{ not true }}", data) == "false");
+ CHECK(env.render("{{ not (true) }}", data) == "false");
+ CHECK(env.render("{{ true or (true or true) }}", data) == "true");
+}
diff --git a/deps/inja/test/test-renderer.cpp b/deps/inja/test/test-renderer.cpp
new file mode 100644
index 0000000..fe38738
--- /dev/null
+++ b/deps/inja/test/test-renderer.cpp
@@ -0,0 +1,274 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+TEST_CASE("types") {
+ inja::Environment env;
+ json data;
+ data["name"] = "Peter";
+ data["city"] = "Brunswick";
+ data["age"] = 29;
+ data["names"] = {"Jeff", "Seb"};
+ data["brother"]["name"] = "Chris";
+ data["brother"]["daughters"] = {"Maria", "Helen"};
+ data["brother"]["daughter0"] = {{"name", "Maria"}};
+ data["is_happy"] = true;
+ data["is_sad"] = false;
+ data["@name"] = "@name";
+ data["$name"] = "$name";
+ data["relatives"]["mother"] = "Maria";
+ data["relatives"]["brother"] = "Chris";
+ data["relatives"]["sister"] = "Jenny";
+ data["vars"] = {2, 3, 4, 0, -1, -2, -3};
+
+ SUBCASE("basic") {
+ CHECK(env.render("", data) == "");
+ CHECK(env.render("Hello World!", data) == "Hello World!");
+ CHECK_THROWS_WITH(env.render("{{ }}", data), "[inja.exception.render_error] (at 1:4) empty expression");
+ CHECK_THROWS_WITH(env.render("{{", data), "[inja.exception.parser_error] (at 1:3) expected expression close, got '<eof>'");
+ }
+
+ SUBCASE("variables") {
+ CHECK(env.render("Hello {{ name }}!", data) == "Hello Peter!");
+ CHECK(env.render("{{ name }}", data) == "Peter");
+ CHECK(env.render("{{name}}", data) == "Peter");
+ CHECK(env.render("{{ name }} is {{ age }} years old.", data) == "Peter is 29 years old.");
+ CHECK(env.render("Hello {{ name }}! I come from {{ city }}.", data) == "Hello Peter! I come from Brunswick.");
+ CHECK(env.render("Hello {{ names.1 }}!", data) == "Hello Seb!");
+ CHECK(env.render("Hello {{ brother.name }}!", data) == "Hello Chris!");
+ CHECK(env.render("Hello {{ brother.daughter0.name }}!", data) == "Hello Maria!");
+ CHECK(env.render("{{ \"{{ no_value }}\" }}", data) == "{{ no_value }}");
+ CHECK(env.render("{{ @name }}", data) == "@name");
+ CHECK(env.render("{{ $name }}", data) == "$name");
+
+ CHECK_THROWS_WITH(env.render("{{unknown}}", data), "[inja.exception.render_error] (at 1:3) variable 'unknown' not found");
+ }
+
+ SUBCASE("comments") {
+ CHECK(env.render("Hello{# This is a comment #}!", data) == "Hello!");
+ CHECK(env.render("{# --- #Todo --- #}", data) == "");
+ }
+
+ SUBCASE("loops") {
+ CHECK(env.render("{% for name in names %}a{% endfor %}", data) == "aa");
+ CHECK(env.render("Hello {% for name in names %}{{ name }} {% endfor %}!", data) == "Hello Jeff Seb !");
+ CHECK(env.render("Hello {% for name in names %}{{ loop.index }}: {{ name }}, {% endfor %}!", data) ==
+ "Hello 0: Jeff, 1: Seb, !");
+ CHECK(env.render("{% for type, name in relatives %}{{ loop.index1 }}: {{ type }}: {{ name }}{% if loop.is_last == "
+ "false %}, {% endif %}{% endfor %}",
+ data) == "1: brother: Chris, 2: mother: Maria, 3: sister: Jenny");
+ CHECK(env.render("{% for v in vars %}{% if v > 0 %}+{% endif %}{% endfor %}", data) == "+++");
+ CHECK(env.render(
+ "{% for name in names %}{{ loop.index }}: {{ name }}{% if not loop.is_last %}, {% endif %}{% endfor %}!",
+ data) == "0: Jeff, 1: Seb!");
+ CHECK(env.render("{% for name in names %}{{ loop.index }}: {{ name }}{% if loop.is_last == false %}, {% endif %}{% "
+ "endfor %}!",
+ data) == "0: Jeff, 1: Seb!");
+
+ CHECK(env.render("{% for name in [] %}a{% endfor %}", data) == "");
+
+ CHECK_THROWS_WITH(env.render("{% for name ins names %}a{% endfor %}", data),
+ "[inja.exception.parser_error] (at 1:13) expected 'in', got 'ins'");
+ CHECK_THROWS_WITH(env.render("{% for name in empty_loop %}a{% endfor %}", data),
+ "[inja.exception.render_error] (at 1:16) variable 'empty_loop' not found");
+ // CHECK_THROWS_WITH( env.render("{% for name in relatives %}{{ name }}{% endfor %}", data),
+ // "[inja.exception.json_error] [json.exception.type_error.302] type must be array, but is object" );
+ }
+
+ SUBCASE("nested loops") {
+ auto ldata = json::parse(R""""(
+{ "outer" : [
+ { "inner" : [
+ { "in2" : [ 1, 2 ] },
+ { "in2" : []},
+ { "in2" : []}
+ ]
+ },
+ { "inner" : [] },
+ { "inner" : [
+ { "in2" : [ 3, 4 ] },
+ { "in2" : [ 5, 6 ] }
+ ]
+ }
+ ]
+}
+)"""");
+
+ CHECK(env.render(R""""(
+{% for o in outer %}{% for i in o.inner %}{{loop.parent.index}}:{{loop.index}}::{{loop.parent.is_last}}
+{% for ii in i.in2%}{{ii}},{%endfor%}
+{%endfor%}{%endfor%}
+)"""",
+ ldata) == "\n0:0::false\n1,2,\n0:1::false\n\n0:2::false\n\n2:0::true\n3,4,\n2:1::true\n5,6,\n\n");
+ }
+
+ SUBCASE("conditionals") {
+ CHECK(env.render("{% if is_happy %}{% endif %}", data) == "");
+ CHECK(env.render("{% if is_happy %}Yeah!{% endif %}", data) == "Yeah!");
+ CHECK(env.render("{% if is_sad %}Yeah!{% endif %}", data) == "");
+ CHECK(env.render("{% if is_sad %}Yeah!{% else %}Nooo...{% endif %}", data) == "Nooo...");
+ CHECK(env.render("{% if age == 29 %}Right{% else %}Wrong{% endif %}", data) == "Right");
+ CHECK(env.render("{% if age > 29 %}Right{% else %}Wrong{% endif %}", data) == "Wrong");
+ CHECK(env.render("{% if age <= 29 %}Right{% else %}Wrong{% endif %}", data) == "Right");
+ CHECK(env.render("{% if age != 28 %}Right{% else %}Wrong{% endif %}", data) == "Right");
+ CHECK(env.render("{% if age >= 30 %}Right{% else %}Wrong{% endif %}", data) == "Wrong");
+ CHECK(env.render("{% if age in [28, 29, 30] %}True{% endif %}", data) == "True");
+ CHECK(env.render("{% if age == 28 %}28{% else if age == 29 %}29{% endif %}", data) == "29");
+ CHECK(env.render("{% if age == 26 %}26{% else if age == 27 %}27{% else if age == 28 %}28{% else %}29{% endif %}",
+ data) == "29");
+ CHECK(env.render("{% if age == 25 %}+{% endif %}{% if age == 29 %}+{% else %}-{% endif %}", data) == "+");
+
+ CHECK_THROWS_WITH(env.render("{% if is_happy %}{% if is_happy %}{% endif %}", data),
+ "[inja.exception.parser_error] (at 1:46) unmatched if");
+ CHECK_THROWS_WITH(env.render("{% if is_happy %}{% else if is_happy %}{% end if %}", data),
+ "[inja.exception.parser_error] (at 1:43) expected statement, got 'end'");
+ }
+
+ SUBCASE("set statements") {
+ CHECK(env.render("{% set predefined=true %}{% if predefined %}a{% endif %}", data) == "a");
+ CHECK(env.render("{% set predefined=false %}{% if predefined %}a{% endif %}", data) == "");
+ CHECK_THROWS_WITH(env.render("{% if predefined %}{% endif %}", data),
+ "[inja.exception.render_error] (at 1:7) variable 'predefined' not found");
+ }
+
+ SUBCASE("line statements") {
+ CHECK(env.render(R""""(## if is_happy
+Yeah!
+## endif)"""",
+ data) == R""""(Yeah!
+)"""");
+
+ CHECK(env.render(R""""(## if is_happy
+## if is_happy
+Yeah!
+## endif
+## endif )"""",
+ data) == R""""(Yeah!
+)"""");
+ }
+}
+
+TEST_CASE("templates") {
+ json data;
+ data["name"] = "Peter";
+ data["city"] = "Brunswick";
+ data["is_happy"] = true;
+
+ SUBCASE("reuse") {
+ inja::Environment env;
+ inja::Template temp = env.parse("{% if is_happy %}{{ name }}{% else %}{{ city }}{% endif %}");
+
+ CHECK(env.render(temp, data) == "Peter");
+
+ data["is_happy"] = false;
+
+ CHECK(env.render(temp, data) == "Brunswick");
+ }
+
+ SUBCASE("include") {
+ inja::Environment env;
+ inja::Template t1 = env.parse("Hello {{ name }}");
+ env.include_template("greeting", t1);
+
+ inja::Template t2 = env.parse("{% include \"greeting\" %}!");
+ CHECK(env.render(t2, data) == "Hello Peter!");
+ CHECK_THROWS_WITH(env.parse("{% include \"does-not-exist\" %}!"),
+ "[inja.exception.file_error] failed accessing file at 'does-not-exist'");
+ }
+
+ SUBCASE("include-in-loop") {
+ json loop_data;
+ loop_data["cities"] = json::array({{{"name", "Munich"}}, {{"name", "New York"}}});
+
+ inja::Environment env;
+ env.include_template("city.tpl", env.parse("{{ loop.index }}:{{ city.name }};"));
+
+ CHECK(env.render("{% for city in cities %}{% include \"city.tpl\" %}{% endfor %}", loop_data) ==
+ "0:Munich;1:New York;");
+ }
+
+ SUBCASE("count variables") {
+ inja::Environment env;
+ inja::Template t1 = env.parse("Hello {{ name }}");
+ inja::Template t2 = env.parse("{% if is_happy %}{{ name }}{% else %}{{ city }}{% endif %}");
+ inja::Template t3 = env.parse("{% if at(name, test) %}{{ name }}{% else %}{{ city }}{{ upper(city) }}{% endif %}");
+
+ CHECK(t1.count_variables() == 1);
+ CHECK(t2.count_variables() == 3);
+ CHECK(t3.count_variables() == 5);
+ }
+
+ SUBCASE("whitespace control") {
+ inja::Environment env;
+ CHECK(env.render("{% if is_happy %}{{ name }}{% endif %}", data) == "Peter");
+ CHECK(env.render(" {% if is_happy %}{{ name }}{% endif %} ", data) == " Peter ");
+ CHECK(env.render(" {% if is_happy %}{{ name }}{% endif %}\n ", data) == " Peter\n ");
+ CHECK(env.render("Test\n {%- if is_happy %}{{ name }}{% endif %} ", data) == "Test\nPeter ");
+ CHECK(env.render(" {%+ if is_happy %}{{ name }}{% endif %}", data) == " Peter");
+ CHECK(env.render(" {%- if is_happy %}{{ name }}{% endif -%} \n ", data) == "Peter");
+
+ CHECK(env.render(" {{- name -}} \n ", data) == "Peter");
+ CHECK(env.render("Test\n {{- name }} ", data) == "Test\nPeter ");
+ CHECK(env.render(" {{ name }}\n ", data) == " Peter\n ");
+
+ // Nothing will be stripped if there are other characters before the start of the block.
+ CHECK(env.render(". {%- if is_happy %}{{ name }}{% endif -%}\n", data) == ". Peter");
+
+ env.set_lstrip_blocks(true);
+ CHECK(env.render(" {% if is_happy %}{{ name }}{% endif %}", data) == "Peter");
+ CHECK(env.render(" {% if is_happy %}{{ name }}{% endif %} ", data) == "Peter ");
+ CHECK(env.render(" {% if is_happy %}{{ name }}{% endif -%} ", data) == "Peter");
+ CHECK(env.render(" {%+ if is_happy %}{{ name }}{% endif %}", data) == " Peter");
+ CHECK(env.render("\n {%+ if is_happy %}{{ name }}{% endif -%} ", data) == "\n Peter");
+ CHECK(env.render("{% if is_happy %}{{ name }}{% endif %}\n", data) == "Peter\n");
+
+ env.set_trim_blocks(true);
+ CHECK(env.render("{% if is_happy %}{{ name }}{% endif %}", data) == "Peter");
+ CHECK(env.render("{% if is_happy %}{{ name }}{% endif %}\n", data) == "Peter");
+ CHECK(env.render("{% if is_happy %}{{ name }}{% endif %} \n.", data) == "Peter.");
+ CHECK(env.render("{%- if is_happy %}{{ name }}{% endif -%} \n.", data) == "Peter.");
+ }
+}
+
+TEST_CASE("other syntax") {
+ json data;
+ data["name"] = "Peter";
+ data["city"] = "Brunswick";
+ data["age"] = 29;
+ data["names"] = {"Jeff", "Seb"};
+ data["brother"]["name"] = "Chris";
+ data["brother"]["daughters"] = {"Maria", "Helen"};
+ data["brother"]["daughter0"] = {{"name", "Maria"}};
+ data["is_happy"] = true;
+
+ SUBCASE("other expression syntax") {
+ inja::Environment env;
+
+ CHECK(env.render("Hello {{ name }}!", data) == "Hello Peter!");
+
+ env.set_expression("(&", "&)");
+
+ CHECK(env.render("Hello {{ name }}!", data) == "Hello {{ name }}!");
+ CHECK(env.render("Hello (& name &)!", data) == "Hello Peter!");
+ }
+
+ SUBCASE("other comment syntax") {
+ inja::Environment env;
+ env.set_comment("(&", "&)");
+
+ CHECK(env.render("Hello {# Test #}", data) == "Hello {# Test #}");
+ CHECK(env.render("Hello (& Test &)", data) == "Hello ");
+ }
+
+ SUBCASE("multiple changes") {
+ inja::Environment env;
+ env.set_line_statement("$$");
+ env.set_expression("<%", "%>");
+
+ std::string string_template = R""""(Hello <%name%>
+$$ if name == "Peter"
+ You really are <%name%>
+$$ endif
+)"""";
+
+ CHECK(env.render(string_template, data) == "Hello Peter\n You really are Peter\n");
+ }
+}
diff --git a/deps/inja/test/test-units.cpp b/deps/inja/test/test-units.cpp
new file mode 100644
index 0000000..95862f2
--- /dev/null
+++ b/deps/inja/test/test-units.cpp
@@ -0,0 +1,51 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+TEST_CASE("source location") {
+ std::string content = R""""(Lorem Ipsum
+ Dolor
+Amid
+Set ().$
+Try this
+
+)"""";
+
+ CHECK(inja::get_source_location(content, 0).line == 1);
+ CHECK(inja::get_source_location(content, 0).column == 1);
+
+ CHECK(inja::get_source_location(content, 10).line == 1);
+ CHECK(inja::get_source_location(content, 10).column == 11);
+
+ CHECK(inja::get_source_location(content, 25).line == 4);
+ CHECK(inja::get_source_location(content, 25).column == 1);
+
+ CHECK(inja::get_source_location(content, 29).line == 4);
+ CHECK(inja::get_source_location(content, 29).column == 5);
+
+ CHECK(inja::get_source_location(content, 43).line == 6);
+ CHECK(inja::get_source_location(content, 43).column == 1);
+}
+
+TEST_CASE("copy environment") {
+ inja::Environment env;
+ env.add_callback("double", 1, [](inja::Arguments &args) {
+ int number = args.at(0)->get<int>();
+ return 2 * number;
+ });
+
+ inja::Template t1 = env.parse("{{ double(2) }}");
+ env.include_template("tpl", t1);
+ std::string test_tpl = "{% include \"tpl\" %}";
+
+ REQUIRE(env.render(test_tpl, json()) == "4");
+
+ inja::Environment copy(env);
+ CHECK(copy.render(test_tpl, json()) == "4");
+
+ // overwrite template in source env
+ inja::Template t2 = env.parse("{{ double(4) }}");
+ env.include_template("tpl", t2);
+ REQUIRE(env.render(test_tpl, json()) == "8");
+
+ // template is unchanged in copy
+ CHECK(copy.render(test_tpl, json()) == "4");
+}
diff --git a/deps/inja/test/test.cpp b/deps/inja/test/test.cpp
new file mode 100644
index 0000000..50161be
--- /dev/null
+++ b/deps/inja/test/test.cpp
@@ -0,0 +1,15 @@
+// Copyright (c) 2020 Pantor. All rights reserved.
+
+#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
+
+#include "doctest/doctest.h"
+#include "inja/inja.hpp"
+
+using json = nlohmann::json;
+
+const std::string test_file_directory {"../test/data/"};
+
+#include "test-files.cpp"
+#include "test-functions.cpp"
+#include "test-renderer.cpp"
+#include "test-units.cpp"
diff --git a/deps/inja/third_party/amalgamate/LICENSE.md b/deps/inja/third_party/amalgamate/LICENSE.md
new file mode 100644
index 0000000..7fe9cf0
--- /dev/null
+++ b/deps/inja/third_party/amalgamate/LICENSE.md
@@ -0,0 +1,27 @@
+amalgamate.py - Amalgamate C source and header files
+Copyright (c) 2012, Erik Edlund <erik.edlund@32767.se>
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name of Erik Edlund, nor the names of its contributors may
+ be used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/deps/inja/third_party/amalgamate/amalgamate.py b/deps/inja/third_party/amalgamate/amalgamate.py
new file mode 100755
index 0000000..138017b
--- /dev/null
+++ b/deps/inja/third_party/amalgamate/amalgamate.py
@@ -0,0 +1,294 @@
+#!/usr/bin/env python
+
+# amalgamate.py - Amalgamate C source and header files.
+# Copyright (c) 2012, Erik Edlund <erik.edlund@32767.se>
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# * Neither the name of Erik Edlund, nor the names of its contributors may
+# be used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+import argparse
+import datetime
+import json
+import os
+import re
+import sys
+
+class Amalgamation(object):
+
+ # Prepends self.source_path to file_path if needed.
+ def actual_path(self, file_path):
+ if not os.path.isabs(file_path):
+ file_path = os.path.join(self.source_path, file_path)
+ return file_path
+
+ # Search included file_path in self.include_paths and
+ # in source_dir if specified.
+ def find_included_file(self, file_path, source_dir):
+ search_dirs = self.include_paths[:]
+ if source_dir:
+ search_dirs.insert(0, source_dir)
+
+ for search_dir in search_dirs:
+ search_path = os.path.join(search_dir, file_path)
+ if os.path.isfile(self.actual_path(search_path)):
+ return search_path
+ return None
+
+ def __init__(self, args):
+ with open(args.config, 'r') as f:
+ config = json.loads(f.read())
+ for key in config:
+ setattr(self, key, config[key])
+
+ self.verbose = args.verbose == "yes"
+ self.prologue = args.prologue
+ self.source_path = args.source_path
+ self.included_files = []
+
+ # Generate the amalgamation and write it to the target file.
+ def generate(self):
+ amalgamation = ""
+
+ if self.prologue:
+ with open(self.prologue, 'r') as f:
+ amalgamation += datetime.datetime.now().strftime(f.read())
+
+ if self.verbose:
+ print("Config:")
+ print(" target = {0}".format(self.target))
+ print(" working_dir = {0}".format(os.getcwd()))
+ print(" include_paths = {0}".format(self.include_paths))
+ print("Creating amalgamation:")
+ for file_path in self.sources:
+ # Do not check the include paths while processing the source
+ # list, all given source paths must be correct.
+ actual_path = self.actual_path(file_path)
+ print(" - processing \"{0}\"".format(file_path))
+ t = TranslationUnit(file_path, self, True)
+ amalgamation += t.content
+
+ with open(self.target, 'w') as f:
+ f.write(amalgamation)
+
+ print("...done!\n")
+ if self.verbose:
+ print("Files processed: {0}".format(self.sources))
+ print("Files included: {0}".format(self.included_files))
+ print("")
+
+class TranslationUnit(object):
+
+ # // C++ comment.
+ cpp_comment_pattern = re.compile(r"//.*?\n")
+
+ # /* C comment. */
+ c_comment_pattern = re.compile(r"/\*.*?\*/", re.S)
+
+ # "complex \"stri\\\ng\" value".
+ string_pattern = re.compile("[^']" r'".*?(?<=[^\\])"', re.S)
+
+ # Handle simple include directives. Support for advanced
+ # directives where macros and defines needs to expanded is
+ # not a concern right now.
+ include_pattern = re.compile(
+ r'#\s*include\s+(<|")(?P<path>.*?)("|>)', re.S)
+
+ # #pragma once
+ pragma_once_pattern = re.compile(r'#\s*pragma\s+once', re.S)
+
+ # Search for pattern in self.content, add the match to
+ # contexts if found and update the index accordingly.
+ def _search_content(self, index, pattern, contexts):
+ match = pattern.search(self.content, index)
+ if match:
+ contexts.append(match)
+ return match.end()
+ return index + 2
+
+ # Return all the skippable contexts, i.e., comments and strings
+ def _find_skippable_contexts(self):
+ # Find contexts in the content in which a found include
+ # directive should not be processed.
+ skippable_contexts = []
+
+ # Walk through the content char by char, and try to grab
+ # skippable contexts using regular expressions when found.
+ i = 1
+ content_len = len(self.content)
+ while i < content_len:
+ j = i - 1
+ current = self.content[i]
+ previous = self.content[j]
+
+ if current == '"':
+ # String value.
+ i = self._search_content(j, self.string_pattern,
+ skippable_contexts)
+ elif current == '*' and previous == '/':
+ # C style comment.
+ i = self._search_content(j, self.c_comment_pattern,
+ skippable_contexts)
+ elif current == '/' and previous == '/':
+ # C++ style comment.
+ i = self._search_content(j, self.cpp_comment_pattern,
+ skippable_contexts)
+ else:
+ # Skip to the next char.
+ i += 1
+
+ return skippable_contexts
+
+ # Returns True if the match is within list of other matches
+ def _is_within(self, match, matches):
+ for m in matches:
+ if match.start() > m.start() and \
+ match.end() < m.end():
+ return True
+ return False
+
+ # Removes pragma once from content
+ def _process_pragma_once(self):
+ content_len = len(self.content)
+ if content_len < len("#include <x>"):
+ return 0
+
+ # Find contexts in the content in which a found include
+ # directive should not be processed.
+ skippable_contexts = self._find_skippable_contexts()
+
+ pragmas = []
+ pragma_once_match = self.pragma_once_pattern.search(self.content)
+ while pragma_once_match:
+ if not self._is_within(pragma_once_match, skippable_contexts):
+ pragmas.append(pragma_once_match)
+
+ pragma_once_match = self.pragma_once_pattern.search(self.content,
+ pragma_once_match.end())
+
+ # Handle all collected pragma once directives.
+ prev_end = 0
+ tmp_content = ''
+ for pragma_match in pragmas:
+ tmp_content += self.content[prev_end:pragma_match.start()]
+ prev_end = pragma_match.end()
+ tmp_content += self.content[prev_end:]
+ self.content = tmp_content
+
+ # Include all trivial #include directives into self.content.
+ def _process_includes(self):
+ content_len = len(self.content)
+ if content_len < len("#include <x>"):
+ return 0
+
+ # Find contexts in the content in which a found include
+ # directive should not be processed.
+ skippable_contexts = self._find_skippable_contexts()
+
+ # Search for include directives in the content, collect those
+ # which should be included into the content.
+ includes = []
+ include_match = self.include_pattern.search(self.content)
+ while include_match:
+ if not self._is_within(include_match, skippable_contexts):
+ include_path = include_match.group("path")
+ search_same_dir = include_match.group(1) == '"'
+ found_included_path = self.amalgamation.find_included_file(
+ include_path, self.file_dir if search_same_dir else None)
+ if found_included_path:
+ includes.append((include_match, found_included_path))
+
+ include_match = self.include_pattern.search(self.content,
+ include_match.end())
+
+ # Handle all collected include directives.
+ prev_end = 0
+ tmp_content = ''
+ for include in includes:
+ include_match, found_included_path = include
+ tmp_content += self.content[prev_end:include_match.start()]
+ tmp_content += "// {0}\n".format(include_match.group(0))
+ if not found_included_path in self.amalgamation.included_files:
+ t = TranslationUnit(found_included_path, self.amalgamation, False)
+ tmp_content += t.content
+ prev_end = include_match.end()
+ tmp_content += self.content[prev_end:]
+ self.content = tmp_content
+
+ return len(includes)
+
+ # Make all content processing
+ def _process(self):
+ if not self.is_root:
+ self._process_pragma_once()
+ self._process_includes()
+
+ def __init__(self, file_path, amalgamation, is_root):
+ self.file_path = file_path
+ self.file_dir = os.path.dirname(file_path)
+ self.amalgamation = amalgamation
+ self.is_root = is_root
+
+ self.amalgamation.included_files.append(self.file_path)
+
+ actual_path = self.amalgamation.actual_path(file_path)
+ if not os.path.isfile(actual_path):
+ raise IOError("File not found: \"{0}\"".format(file_path))
+ with open(actual_path, 'r') as f:
+ self.content = f.read()
+ self._process()
+
+def main():
+ description = "Amalgamate C source and header files."
+ usage = " ".join([
+ "amalgamate.py",
+ "[-v]",
+ "-c path/to/config.json",
+ "-s path/to/source/dir",
+ "[-p path/to/prologue.(c|h)]"
+ ])
+ argsparser = argparse.ArgumentParser(
+ description=description, usage=usage)
+
+ argsparser.add_argument("-v", "--verbose", dest="verbose",
+ choices=["yes", "no"], metavar="", help="be verbose")
+
+ argsparser.add_argument("-c", "--config", dest="config",
+ required=True, metavar="", help="path to a JSON config file")
+
+ argsparser.add_argument("-s", "--source", dest="source_path",
+ required=True, metavar="", help="source code path")
+
+ argsparser.add_argument("-p", "--prologue", dest="prologue",
+ required=False, metavar="", help="path to a C prologue file")
+
+ amalgamation = Amalgamation(argsparser.parse_args())
+ amalgamation.generate()
+
+if __name__ == "__main__":
+ main()
diff --git a/deps/inja/third_party/include/doctest/LICENSE.txt b/deps/inja/third_party/include/doctest/LICENSE.txt
new file mode 100644
index 0000000..6117758
--- /dev/null
+++ b/deps/inja/third_party/include/doctest/LICENSE.txt
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2016-2019 Viktor Kirilov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE. \ No newline at end of file
diff --git a/deps/inja/third_party/include/doctest/doctest.h b/deps/inja/third_party/include/doctest/doctest.h
new file mode 100644
index 0000000..c6bcafe
--- /dev/null
+++ b/deps/inja/third_party/include/doctest/doctest.h
@@ -0,0 +1,5971 @@
+// ====================================================================== lgtm [cpp/missing-header-guard]
+// == DO NOT MODIFY THIS FILE BY HAND - IT IS AUTO GENERATED BY CMAKE! ==
+// ======================================================================
+//
+// doctest.h - the lightest feature-rich C++ single-header testing framework for unit tests and TDD
+//
+// Copyright (c) 2016-2019 Viktor Kirilov
+//
+// Distributed under the MIT Software License
+// See accompanying file LICENSE.txt or copy at
+// https://opensource.org/licenses/MIT
+//
+// The documentation can be found at the library's page:
+// https://github.com/onqtam/doctest/blob/master/doc/markdown/readme.md
+//
+// =================================================================================================
+// =================================================================================================
+// =================================================================================================
+//
+// The library is heavily influenced by Catch - https://github.com/catchorg/Catch2
+// which uses the Boost Software License - Version 1.0
+// see here - https://github.com/catchorg/Catch2/blob/master/LICENSE.txt
+//
+// The concept of subcases (sections in Catch) and expression decomposition are from there.
+// Some parts of the code are taken directly:
+// - stringification - the detection of "ostream& operator<<(ostream&, const T&)" and StringMaker<>
+// - the Approx() helper class for floating point comparison
+// - colors in the console
+// - breaking into a debugger
+// - signal / SEH handling
+// - timer
+// - XmlWriter class - thanks to Phil Nash for allowing the direct reuse (AKA copy/paste)
+//
+// The expression decomposing templates are taken from lest - https://github.com/martinmoene/lest
+// which uses the Boost Software License - Version 1.0
+// see here - https://github.com/martinmoene/lest/blob/master/LICENSE.txt
+//
+// =================================================================================================
+// =================================================================================================
+// =================================================================================================
+
+#ifndef DOCTEST_LIBRARY_INCLUDED
+#define DOCTEST_LIBRARY_INCLUDED
+
+// =================================================================================================
+// == VERSION ======================================================================================
+// =================================================================================================
+
+#define DOCTEST_VERSION_MAJOR 2
+#define DOCTEST_VERSION_MINOR 3
+#define DOCTEST_VERSION_PATCH 7
+#define DOCTEST_VERSION_STR "2.3.7"
+
+#define DOCTEST_VERSION \
+ (DOCTEST_VERSION_MAJOR * 10000 + DOCTEST_VERSION_MINOR * 100 + DOCTEST_VERSION_PATCH)
+
+// =================================================================================================
+// == COMPILER VERSION =============================================================================
+// =================================================================================================
+
+// ideas for the version stuff are taken from here: https://github.com/cxxstuff/cxx_detect
+
+#define DOCTEST_COMPILER(MAJOR, MINOR, PATCH) ((MAJOR)*10000000 + (MINOR)*100000 + (PATCH))
+
+// GCC/Clang and GCC/MSVC are mutually exclusive, but Clang/MSVC are not because of clang-cl...
+#if defined(_MSC_VER) && defined(_MSC_FULL_VER)
+#if _MSC_VER == _MSC_FULL_VER / 10000
+#define DOCTEST_MSVC DOCTEST_COMPILER(_MSC_VER / 100, _MSC_VER % 100, _MSC_FULL_VER % 10000)
+#else // MSVC
+#define DOCTEST_MSVC \
+ DOCTEST_COMPILER(_MSC_VER / 100, (_MSC_FULL_VER / 100000) % 100, _MSC_FULL_VER % 100000)
+#endif // MSVC
+#endif // MSVC
+#if defined(__clang__) && defined(__clang_minor__)
+#define DOCTEST_CLANG DOCTEST_COMPILER(__clang_major__, __clang_minor__, __clang_patchlevel__)
+#elif defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) && \
+ !defined(__INTEL_COMPILER)
+#define DOCTEST_GCC DOCTEST_COMPILER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
+#endif // GCC
+
+#ifndef DOCTEST_MSVC
+#define DOCTEST_MSVC 0
+#endif // DOCTEST_MSVC
+#ifndef DOCTEST_CLANG
+#define DOCTEST_CLANG 0
+#endif // DOCTEST_CLANG
+#ifndef DOCTEST_GCC
+#define DOCTEST_GCC 0
+#endif // DOCTEST_GCC
+
+// =================================================================================================
+// == COMPILER WARNINGS HELPERS ====================================================================
+// =================================================================================================
+
+#if DOCTEST_CLANG
+#define DOCTEST_PRAGMA_TO_STR(x) _Pragma(#x)
+#define DOCTEST_CLANG_SUPPRESS_WARNING_PUSH _Pragma("clang diagnostic push")
+#define DOCTEST_CLANG_SUPPRESS_WARNING(w) DOCTEST_PRAGMA_TO_STR(clang diagnostic ignored w)
+#define DOCTEST_CLANG_SUPPRESS_WARNING_POP _Pragma("clang diagnostic pop")
+#define DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH(w) \
+ DOCTEST_CLANG_SUPPRESS_WARNING_PUSH DOCTEST_CLANG_SUPPRESS_WARNING(w)
+#else // DOCTEST_CLANG
+#define DOCTEST_CLANG_SUPPRESS_WARNING_PUSH
+#define DOCTEST_CLANG_SUPPRESS_WARNING(w)
+#define DOCTEST_CLANG_SUPPRESS_WARNING_POP
+#define DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH(w)
+#endif // DOCTEST_CLANG
+
+#if DOCTEST_GCC
+#define DOCTEST_PRAGMA_TO_STR(x) _Pragma(#x)
+#define DOCTEST_GCC_SUPPRESS_WARNING_PUSH _Pragma("GCC diagnostic push")
+#define DOCTEST_GCC_SUPPRESS_WARNING(w) DOCTEST_PRAGMA_TO_STR(GCC diagnostic ignored w)
+#define DOCTEST_GCC_SUPPRESS_WARNING_POP _Pragma("GCC diagnostic pop")
+#define DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH(w) \
+ DOCTEST_GCC_SUPPRESS_WARNING_PUSH DOCTEST_GCC_SUPPRESS_WARNING(w)
+#else // DOCTEST_GCC
+#define DOCTEST_GCC_SUPPRESS_WARNING_PUSH
+#define DOCTEST_GCC_SUPPRESS_WARNING(w)
+#define DOCTEST_GCC_SUPPRESS_WARNING_POP
+#define DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH(w)
+#endif // DOCTEST_GCC
+
+#if DOCTEST_MSVC
+#define DOCTEST_MSVC_SUPPRESS_WARNING_PUSH __pragma(warning(push))
+#define DOCTEST_MSVC_SUPPRESS_WARNING(w) __pragma(warning(disable : w))
+#define DOCTEST_MSVC_SUPPRESS_WARNING_POP __pragma(warning(pop))
+#define DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(w) \
+ DOCTEST_MSVC_SUPPRESS_WARNING_PUSH DOCTEST_MSVC_SUPPRESS_WARNING(w)
+#else // DOCTEST_MSVC
+#define DOCTEST_MSVC_SUPPRESS_WARNING_PUSH
+#define DOCTEST_MSVC_SUPPRESS_WARNING(w)
+#define DOCTEST_MSVC_SUPPRESS_WARNING_POP
+#define DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(w)
+#endif // DOCTEST_MSVC
+
+// =================================================================================================
+// == COMPILER WARNINGS ============================================================================
+// =================================================================================================
+
+DOCTEST_CLANG_SUPPRESS_WARNING_PUSH
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wunknown-pragmas")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wnon-virtual-dtor")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wweak-vtables")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wpadded")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wdeprecated")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-prototypes")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wunused-local-typedef")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wc++98-compat")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wc++98-compat-pedantic")
+
+DOCTEST_GCC_SUPPRESS_WARNING_PUSH
+DOCTEST_GCC_SUPPRESS_WARNING("-Wunknown-pragmas")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wpragmas")
+DOCTEST_GCC_SUPPRESS_WARNING("-Weffc++")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wstrict-overflow")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wstrict-aliasing")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wctor-dtor-privacy")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-declarations")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wnon-virtual-dtor")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wunused-local-typedefs")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wuseless-cast")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wnoexcept")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wsign-promo")
+
+DOCTEST_MSVC_SUPPRESS_WARNING_PUSH
+DOCTEST_MSVC_SUPPRESS_WARNING(4616) // invalid compiler warning
+DOCTEST_MSVC_SUPPRESS_WARNING(4619) // invalid compiler warning
+DOCTEST_MSVC_SUPPRESS_WARNING(4996) // The compiler encountered a deprecated declaration
+DOCTEST_MSVC_SUPPRESS_WARNING(4706) // assignment within conditional expression
+DOCTEST_MSVC_SUPPRESS_WARNING(4512) // 'class' : assignment operator could not be generated
+DOCTEST_MSVC_SUPPRESS_WARNING(4127) // conditional expression is constant
+DOCTEST_MSVC_SUPPRESS_WARNING(4820) // padding
+DOCTEST_MSVC_SUPPRESS_WARNING(4625) // copy constructor was implicitly defined as deleted
+DOCTEST_MSVC_SUPPRESS_WARNING(4626) // assignment operator was implicitly defined as deleted
+DOCTEST_MSVC_SUPPRESS_WARNING(5027) // move assignment operator was implicitly defined as deleted
+DOCTEST_MSVC_SUPPRESS_WARNING(5026) // move constructor was implicitly defined as deleted
+DOCTEST_MSVC_SUPPRESS_WARNING(4623) // default constructor was implicitly defined as deleted
+DOCTEST_MSVC_SUPPRESS_WARNING(4640) // construction of local static object is not thread-safe
+// static analysis
+DOCTEST_MSVC_SUPPRESS_WARNING(26439) // This kind of function may not throw. Declare it 'noexcept'
+DOCTEST_MSVC_SUPPRESS_WARNING(26495) // Always initialize a member variable
+DOCTEST_MSVC_SUPPRESS_WARNING(26451) // Arithmetic overflow ...
+DOCTEST_MSVC_SUPPRESS_WARNING(26444) // Avoid unnamed objects with custom construction and dtr...
+DOCTEST_MSVC_SUPPRESS_WARNING(26812) // Prefer 'enum class' over 'enum'
+
+// 4548 - expression before comma has no effect; expected expression with side - effect
+// 4265 - class has virtual functions, but destructor is not virtual
+// 4986 - exception specification does not match previous declaration
+// 4350 - behavior change: 'member1' called instead of 'member2'
+// 4668 - 'x' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
+// 4365 - conversion from 'int' to 'unsigned long', signed/unsigned mismatch
+// 4774 - format string expected in argument 'x' is not a string literal
+// 4820 - padding in structs
+
+// only 4 should be disabled globally:
+// - 4514 # unreferenced inline function has been removed
+// - 4571 # SEH related
+// - 4710 # function not inlined
+// - 4711 # function 'x' selected for automatic inline expansion
+
+#define DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN \
+ DOCTEST_MSVC_SUPPRESS_WARNING_PUSH \
+ DOCTEST_MSVC_SUPPRESS_WARNING(4548) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(4265) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(4986) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(4350) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(4668) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(4365) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(4774) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(4820) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(4625) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(4626) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(5027) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(5026) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(4623) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(5039) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(5045) \
+ DOCTEST_MSVC_SUPPRESS_WARNING(5105)
+
+#define DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END DOCTEST_MSVC_SUPPRESS_WARNING_POP
+
+// =================================================================================================
+// == FEATURE DETECTION ============================================================================
+// =================================================================================================
+
+// general compiler feature support table: https://en.cppreference.com/w/cpp/compiler_support
+// MSVC C++11 feature support table: https://msdn.microsoft.com/en-us/library/hh567368.aspx
+// GCC C++11 feature support table: https://gcc.gnu.org/projects/cxx-status.html
+// MSVC version table:
+// https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering
+// MSVC++ 14.2 (16) _MSC_VER == 1920 (Visual Studio 2019)
+// MSVC++ 14.1 (15) _MSC_VER == 1910 (Visual Studio 2017)
+// MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015)
+// MSVC++ 12.0 _MSC_VER == 1800 (Visual Studio 2013)
+// MSVC++ 11.0 _MSC_VER == 1700 (Visual Studio 2012)
+// MSVC++ 10.0 _MSC_VER == 1600 (Visual Studio 2010)
+// MSVC++ 9.0 _MSC_VER == 1500 (Visual Studio 2008)
+// MSVC++ 8.0 _MSC_VER == 1400 (Visual Studio 2005)
+
+#if DOCTEST_MSVC && !defined(DOCTEST_CONFIG_WINDOWS_SEH)
+#define DOCTEST_CONFIG_WINDOWS_SEH
+#endif // MSVC
+#if defined(DOCTEST_CONFIG_NO_WINDOWS_SEH) && defined(DOCTEST_CONFIG_WINDOWS_SEH)
+#undef DOCTEST_CONFIG_WINDOWS_SEH
+#endif // DOCTEST_CONFIG_NO_WINDOWS_SEH
+
+#if !defined(_WIN32) && !defined(__QNX__) && !defined(DOCTEST_CONFIG_POSIX_SIGNALS) && \
+ !defined(__EMSCRIPTEN__)
+#define DOCTEST_CONFIG_POSIX_SIGNALS
+#endif // _WIN32
+#if defined(DOCTEST_CONFIG_NO_POSIX_SIGNALS) && defined(DOCTEST_CONFIG_POSIX_SIGNALS)
+#undef DOCTEST_CONFIG_POSIX_SIGNALS
+#endif // DOCTEST_CONFIG_NO_POSIX_SIGNALS
+
+#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
+#if !defined(__cpp_exceptions) && !defined(__EXCEPTIONS) && !defined(_CPPUNWIND)
+#define DOCTEST_CONFIG_NO_EXCEPTIONS
+#endif // no exceptions
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
+
+#ifdef DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS
+#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
+#define DOCTEST_CONFIG_NO_EXCEPTIONS
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS
+
+#if defined(DOCTEST_CONFIG_NO_EXCEPTIONS) && !defined(DOCTEST_CONFIG_NO_TRY_CATCH_IN_ASSERTS)
+#define DOCTEST_CONFIG_NO_TRY_CATCH_IN_ASSERTS
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS && !DOCTEST_CONFIG_NO_TRY_CATCH_IN_ASSERTS
+
+#if defined(DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN) && !defined(DOCTEST_CONFIG_IMPLEMENT)
+#define DOCTEST_CONFIG_IMPLEMENT
+#endif // DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
+
+#if defined(_WIN32) || defined(__CYGWIN__)
+#if DOCTEST_MSVC
+#define DOCTEST_SYMBOL_EXPORT __declspec(dllexport)
+#define DOCTEST_SYMBOL_IMPORT __declspec(dllimport)
+#else // MSVC
+#define DOCTEST_SYMBOL_EXPORT __attribute__((dllexport))
+#define DOCTEST_SYMBOL_IMPORT __attribute__((dllimport))
+#endif // MSVC
+#else // _WIN32
+#define DOCTEST_SYMBOL_EXPORT __attribute__((visibility("default")))
+#define DOCTEST_SYMBOL_IMPORT
+#endif // _WIN32
+
+#ifdef DOCTEST_CONFIG_IMPLEMENTATION_IN_DLL
+#ifdef DOCTEST_CONFIG_IMPLEMENT
+#define DOCTEST_INTERFACE DOCTEST_SYMBOL_EXPORT
+#else // DOCTEST_CONFIG_IMPLEMENT
+#define DOCTEST_INTERFACE DOCTEST_SYMBOL_IMPORT
+#endif // DOCTEST_CONFIG_IMPLEMENT
+#else // DOCTEST_CONFIG_IMPLEMENTATION_IN_DLL
+#define DOCTEST_INTERFACE
+#endif // DOCTEST_CONFIG_IMPLEMENTATION_IN_DLL
+
+#define DOCTEST_EMPTY
+
+#if DOCTEST_MSVC
+#define DOCTEST_NOINLINE __declspec(noinline)
+#define DOCTEST_UNUSED
+#define DOCTEST_ALIGNMENT(x)
+#else // MSVC
+#define DOCTEST_NOINLINE __attribute__((noinline))
+#define DOCTEST_UNUSED __attribute__((unused))
+#define DOCTEST_ALIGNMENT(x) __attribute__((aligned(x)))
+#endif // MSVC
+
+// =================================================================================================
+// == FEATURE DETECTION END ========================================================================
+// =================================================================================================
+
+// internal macros for string concatenation and anonymous variable name generation
+#define DOCTEST_CAT_IMPL(s1, s2) s1##s2
+#define DOCTEST_CAT(s1, s2) DOCTEST_CAT_IMPL(s1, s2)
+#ifdef __COUNTER__ // not standard and may be missing for some compilers
+#define DOCTEST_ANONYMOUS(x) DOCTEST_CAT(x, __COUNTER__)
+#else // __COUNTER__
+#define DOCTEST_ANONYMOUS(x) DOCTEST_CAT(x, __LINE__)
+#endif // __COUNTER__
+
+#define DOCTEST_TOSTR(x) #x
+
+#ifndef DOCTEST_CONFIG_ASSERTION_PARAMETERS_BY_VALUE
+#define DOCTEST_REF_WRAP(x) x&
+#else // DOCTEST_CONFIG_ASSERTION_PARAMETERS_BY_VALUE
+#define DOCTEST_REF_WRAP(x) x
+#endif // DOCTEST_CONFIG_ASSERTION_PARAMETERS_BY_VALUE
+
+// not using __APPLE__ because... this is how Catch does it
+#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
+#define DOCTEST_PLATFORM_MAC
+#elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED)
+#define DOCTEST_PLATFORM_IPHONE
+#elif defined(_WIN32)
+#define DOCTEST_PLATFORM_WINDOWS
+#else // DOCTEST_PLATFORM
+#define DOCTEST_PLATFORM_LINUX
+#endif // DOCTEST_PLATFORM
+
+#define DOCTEST_GLOBAL_NO_WARNINGS(var) \
+ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wglobal-constructors") \
+ DOCTEST_CLANG_SUPPRESS_WARNING("-Wunused-variable") \
+ static int var DOCTEST_UNUSED // NOLINT(fuchsia-statically-constructed-objects,cert-err58-cpp)
+#define DOCTEST_GLOBAL_NO_WARNINGS_END() DOCTEST_CLANG_SUPPRESS_WARNING_POP
+
+#ifndef DOCTEST_BREAK_INTO_DEBUGGER
+// should probably take a look at https://github.com/scottt/debugbreak
+#ifdef DOCTEST_PLATFORM_MAC
+#define DOCTEST_BREAK_INTO_DEBUGGER() __asm__("int $3\n" : :)
+#elif DOCTEST_MSVC
+#define DOCTEST_BREAK_INTO_DEBUGGER() __debugbreak()
+#elif defined(__MINGW32__)
+DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wredundant-decls")
+extern "C" __declspec(dllimport) void __stdcall DebugBreak();
+DOCTEST_GCC_SUPPRESS_WARNING_POP
+#define DOCTEST_BREAK_INTO_DEBUGGER() ::DebugBreak()
+#else // linux
+#define DOCTEST_BREAK_INTO_DEBUGGER() ((void)0)
+#endif // linux
+#endif // DOCTEST_BREAK_INTO_DEBUGGER
+
+// this is kept here for backwards compatibility since the config option was changed
+#ifdef DOCTEST_CONFIG_USE_IOSFWD
+#define DOCTEST_CONFIG_USE_STD_HEADERS
+#endif // DOCTEST_CONFIG_USE_IOSFWD
+
+#ifdef DOCTEST_CONFIG_USE_STD_HEADERS
+#include <iosfwd>
+#include <cstddef>
+#include <ostream>
+#else // DOCTEST_CONFIG_USE_STD_HEADERS
+
+#if DOCTEST_CLANG
+// to detect if libc++ is being used with clang (the _LIBCPP_VERSION identifier)
+#include <ciso646>
+#endif // clang
+
+#ifdef _LIBCPP_VERSION
+#define DOCTEST_STD_NAMESPACE_BEGIN _LIBCPP_BEGIN_NAMESPACE_STD
+#define DOCTEST_STD_NAMESPACE_END _LIBCPP_END_NAMESPACE_STD
+#else // _LIBCPP_VERSION
+#define DOCTEST_STD_NAMESPACE_BEGIN namespace std {
+#define DOCTEST_STD_NAMESPACE_END }
+#endif // _LIBCPP_VERSION
+
+// Forward declaring 'X' in namespace std is not permitted by the C++ Standard.
+DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4643)
+
+DOCTEST_STD_NAMESPACE_BEGIN // NOLINT (cert-dcl58-cpp)
+typedef decltype(nullptr) nullptr_t;
+template <class charT>
+struct char_traits;
+template <>
+struct char_traits<char>;
+template <class charT, class traits>
+class basic_ostream;
+typedef basic_ostream<char, char_traits<char>> ostream;
+template <class... Types>
+class tuple;
+#if DOCTEST_MSVC >= DOCTEST_COMPILER(19, 20, 0)
+// see this issue on why this is needed: https://github.com/onqtam/doctest/issues/183
+template <class _Ty>
+class allocator;
+template <class _Elem, class _Traits, class _Alloc>
+class basic_string;
+using string = basic_string<char, char_traits<char>, allocator<char>>;
+#endif // VS 2019
+DOCTEST_STD_NAMESPACE_END
+
+DOCTEST_MSVC_SUPPRESS_WARNING_POP
+
+#endif // DOCTEST_CONFIG_USE_STD_HEADERS
+
+#ifdef DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS
+#include <type_traits>
+#endif // DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS
+
+namespace doctest {
+
+DOCTEST_INTERFACE extern bool is_running_in_test;
+
+// A 24 byte string class (can be as small as 17 for x64 and 13 for x86) that can hold strings with length
+// of up to 23 chars on the stack before going on the heap - the last byte of the buffer is used for:
+// - "is small" bit - the highest bit - if "0" then it is small - otherwise its "1" (128)
+// - if small - capacity left before going on the heap - using the lowest 5 bits
+// - if small - 2 bits are left unused - the second and third highest ones
+// - if small - acts as a null terminator if strlen() is 23 (24 including the null terminator)
+// and the "is small" bit remains "0" ("as well as the capacity left") so its OK
+// Idea taken from this lecture about the string implementation of facebook/folly - fbstring
+// https://www.youtube.com/watch?v=kPR8h4-qZdk
+// TODO:
+// - optimizations - like not deleting memory unnecessarily in operator= and etc.
+// - resize/reserve/clear
+// - substr
+// - replace
+// - back/front
+// - iterator stuff
+// - find & friends
+// - push_back/pop_back
+// - assign/insert/erase
+// - relational operators as free functions - taking const char* as one of the params
+class DOCTEST_INTERFACE String
+{
+ static const unsigned len = 24; //!OCLINT avoid private static members
+ static const unsigned last = len - 1; //!OCLINT avoid private static members
+
+ struct view // len should be more than sizeof(view) - because of the final byte for flags
+ {
+ char* ptr;
+ unsigned size;
+ unsigned capacity;
+ };
+
+ union
+ {
+ char buf[len];
+ view data;
+ };
+
+ bool isOnStack() const { return (buf[last] & 128) == 0; }
+ void setOnHeap();
+ void setLast(unsigned in = last);
+
+ void copy(const String& other);
+
+public:
+ String();
+ ~String();
+
+ // cppcheck-suppress noExplicitConstructor
+ String(const char* in);
+ String(const char* in, unsigned in_size);
+
+ String(const String& other);
+ String& operator=(const String& other);
+
+ String& operator+=(const String& other);
+ String operator+(const String& other) const;
+
+ String(String&& other);
+ String& operator=(String&& other);
+
+ char operator[](unsigned i) const;
+ char& operator[](unsigned i);
+
+ // the only functions I'm willing to leave in the interface - available for inlining
+ const char* c_str() const { return const_cast<String*>(this)->c_str(); } // NOLINT
+ char* c_str() {
+ if(isOnStack())
+ return reinterpret_cast<char*>(buf);
+ return data.ptr;
+ }
+
+ unsigned size() const;
+ unsigned capacity() const;
+
+ int compare(const char* other, bool no_case = false) const;
+ int compare(const String& other, bool no_case = false) const;
+};
+
+DOCTEST_INTERFACE bool operator==(const String& lhs, const String& rhs);
+DOCTEST_INTERFACE bool operator!=(const String& lhs, const String& rhs);
+DOCTEST_INTERFACE bool operator<(const String& lhs, const String& rhs);
+DOCTEST_INTERFACE bool operator>(const String& lhs, const String& rhs);
+DOCTEST_INTERFACE bool operator<=(const String& lhs, const String& rhs);
+DOCTEST_INTERFACE bool operator>=(const String& lhs, const String& rhs);
+
+DOCTEST_INTERFACE std::ostream& operator<<(std::ostream& s, const String& in);
+
+namespace Color {
+ enum Enum
+ {
+ None = 0,
+ White,
+ Red,
+ Green,
+ Blue,
+ Cyan,
+ Yellow,
+ Grey,
+
+ Bright = 0x10,
+
+ BrightRed = Bright | Red,
+ BrightGreen = Bright | Green,
+ LightGrey = Bright | Grey,
+ BrightWhite = Bright | White
+ };
+
+ DOCTEST_INTERFACE std::ostream& operator<<(std::ostream& s, Color::Enum code);
+} // namespace Color
+
+namespace assertType {
+ enum Enum
+ {
+ // macro traits
+
+ is_warn = 1,
+ is_check = 2 * is_warn,
+ is_require = 2 * is_check,
+
+ is_normal = 2 * is_require,
+ is_throws = 2 * is_normal,
+ is_throws_as = 2 * is_throws,
+ is_throws_with = 2 * is_throws_as,
+ is_nothrow = 2 * is_throws_with,
+
+ is_false = 2 * is_nothrow,
+ is_unary = 2 * is_false, // not checked anywhere - used just to distinguish the types
+
+ is_eq = 2 * is_unary,
+ is_ne = 2 * is_eq,
+
+ is_lt = 2 * is_ne,
+ is_gt = 2 * is_lt,
+
+ is_ge = 2 * is_gt,
+ is_le = 2 * is_ge,
+
+ // macro types
+
+ DT_WARN = is_normal | is_warn,
+ DT_CHECK = is_normal | is_check,
+ DT_REQUIRE = is_normal | is_require,
+
+ DT_WARN_FALSE = is_normal | is_false | is_warn,
+ DT_CHECK_FALSE = is_normal | is_false | is_check,
+ DT_REQUIRE_FALSE = is_normal | is_false | is_require,
+
+ DT_WARN_THROWS = is_throws | is_warn,
+ DT_CHECK_THROWS = is_throws | is_check,
+ DT_REQUIRE_THROWS = is_throws | is_require,
+
+ DT_WARN_THROWS_AS = is_throws_as | is_warn,
+ DT_CHECK_THROWS_AS = is_throws_as | is_check,
+ DT_REQUIRE_THROWS_AS = is_throws_as | is_require,
+
+ DT_WARN_THROWS_WITH = is_throws_with | is_warn,
+ DT_CHECK_THROWS_WITH = is_throws_with | is_check,
+ DT_REQUIRE_THROWS_WITH = is_throws_with | is_require,
+
+ DT_WARN_THROWS_WITH_AS = is_throws_with | is_throws_as | is_warn,
+ DT_CHECK_THROWS_WITH_AS = is_throws_with | is_throws_as | is_check,
+ DT_REQUIRE_THROWS_WITH_AS = is_throws_with | is_throws_as | is_require,
+
+ DT_WARN_NOTHROW = is_nothrow | is_warn,
+ DT_CHECK_NOTHROW = is_nothrow | is_check,
+ DT_REQUIRE_NOTHROW = is_nothrow | is_require,
+
+ DT_WARN_EQ = is_normal | is_eq | is_warn,
+ DT_CHECK_EQ = is_normal | is_eq | is_check,
+ DT_REQUIRE_EQ = is_normal | is_eq | is_require,
+
+ DT_WARN_NE = is_normal | is_ne | is_warn,
+ DT_CHECK_NE = is_normal | is_ne | is_check,
+ DT_REQUIRE_NE = is_normal | is_ne | is_require,
+
+ DT_WARN_GT = is_normal | is_gt | is_warn,
+ DT_CHECK_GT = is_normal | is_gt | is_check,
+ DT_REQUIRE_GT = is_normal | is_gt | is_require,
+
+ DT_WARN_LT = is_normal | is_lt | is_warn,
+ DT_CHECK_LT = is_normal | is_lt | is_check,
+ DT_REQUIRE_LT = is_normal | is_lt | is_require,
+
+ DT_WARN_GE = is_normal | is_ge | is_warn,
+ DT_CHECK_GE = is_normal | is_ge | is_check,
+ DT_REQUIRE_GE = is_normal | is_ge | is_require,
+
+ DT_WARN_LE = is_normal | is_le | is_warn,
+ DT_CHECK_LE = is_normal | is_le | is_check,
+ DT_REQUIRE_LE = is_normal | is_le | is_require,
+
+ DT_WARN_UNARY = is_normal | is_unary | is_warn,
+ DT_CHECK_UNARY = is_normal | is_unary | is_check,
+ DT_REQUIRE_UNARY = is_normal | is_unary | is_require,
+
+ DT_WARN_UNARY_FALSE = is_normal | is_false | is_unary | is_warn,
+ DT_CHECK_UNARY_FALSE = is_normal | is_false | is_unary | is_check,
+ DT_REQUIRE_UNARY_FALSE = is_normal | is_false | is_unary | is_require,
+ };
+} // namespace assertType
+
+DOCTEST_INTERFACE const char* assertString(assertType::Enum at);
+DOCTEST_INTERFACE const char* failureString(assertType::Enum at);
+DOCTEST_INTERFACE const char* skipPathFromFilename(const char* file);
+
+struct DOCTEST_INTERFACE TestCaseData
+{
+ const char* m_file; // the file in which the test was registered
+ unsigned m_line; // the line where the test was registered
+ const char* m_name; // name of the test case
+ const char* m_test_suite; // the test suite in which the test was added
+ const char* m_description;
+ bool m_skip;
+ bool m_may_fail;
+ bool m_should_fail;
+ int m_expected_failures;
+ double m_timeout;
+};
+
+struct DOCTEST_INTERFACE AssertData
+{
+ // common - for all asserts
+ const TestCaseData* m_test_case;
+ assertType::Enum m_at;
+ const char* m_file;
+ int m_line;
+ const char* m_expr;
+ bool m_failed;
+
+ // exception-related - for all asserts
+ bool m_threw;
+ String m_exception;
+
+ // for normal asserts
+ String m_decomp;
+
+ // for specific exception-related asserts
+ bool m_threw_as;
+ const char* m_exception_type;
+ const char* m_exception_string;
+};
+
+struct DOCTEST_INTERFACE MessageData
+{
+ String m_string;
+ const char* m_file;
+ int m_line;
+ assertType::Enum m_severity;
+};
+
+struct DOCTEST_INTERFACE SubcaseSignature
+{
+ String m_name;
+ const char* m_file;
+ int m_line;
+
+ bool operator<(const SubcaseSignature& other) const;
+};
+
+struct DOCTEST_INTERFACE IContextScope
+{
+ IContextScope();
+ virtual ~IContextScope();
+ virtual void stringify(std::ostream*) const = 0;
+};
+
+struct ContextOptions //!OCLINT too many fields
+{
+ std::ostream* cout; // stdout stream - std::cout by default
+ std::ostream* cerr; // stderr stream - std::cerr by default
+ String binary_name; // the test binary name
+
+ // == parameters from the command line
+ String out; // output filename
+ String order_by; // how tests should be ordered
+ unsigned rand_seed; // the seed for rand ordering
+
+ unsigned first; // the first (matching) test to be executed
+ unsigned last; // the last (matching) test to be executed
+
+ int abort_after; // stop tests after this many failed assertions
+ int subcase_filter_levels; // apply the subcase filters for the first N levels
+
+ bool success; // include successful assertions in output
+ bool case_sensitive; // if filtering should be case sensitive
+ bool exit; // if the program should be exited after the tests are ran/whatever
+ bool duration; // print the time duration of each test case
+ bool no_throw; // to skip exceptions-related assertion macros
+ bool no_exitcode; // if the framework should return 0 as the exitcode
+ bool no_run; // to not run the tests at all (can be done with an "*" exclude)
+ bool no_version; // to not print the version of the framework
+ bool no_colors; // if output to the console should be colorized
+ bool force_colors; // forces the use of colors even when a tty cannot be detected
+ bool no_breaks; // to not break into the debugger
+ bool no_skip; // don't skip test cases which are marked to be skipped
+ bool gnu_file_line; // if line numbers should be surrounded with :x: and not (x):
+ bool no_path_in_filenames; // if the path to files should be removed from the output
+ bool no_line_numbers; // if source code line numbers should be omitted from the output
+ bool no_skipped_summary; // don't print "skipped" in the summary !!! UNDOCUMENTED !!!
+
+ bool help; // to print the help
+ bool version; // to print the version
+ bool count; // if only the count of matching tests is to be retrieved
+ bool list_test_cases; // to list all tests matching the filters
+ bool list_test_suites; // to list all suites matching the filters
+ bool list_reporters; // lists all registered reporters
+};
+
+namespace detail {
+#if defined(DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING) || defined(DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS)
+ template <bool CONDITION, typename TYPE = void>
+ struct enable_if
+ {};
+
+ template <typename TYPE>
+ struct enable_if<true, TYPE>
+ { typedef TYPE type; };
+#endif // DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING) || DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS
+
+ // clang-format off
+ template<class T> struct remove_reference { typedef T type; };
+ template<class T> struct remove_reference<T&> { typedef T type; };
+ template<class T> struct remove_reference<T&&> { typedef T type; };
+
+ template<class T> struct remove_const { typedef T type; };
+ template<class T> struct remove_const<const T> { typedef T type; };
+ // clang-format on
+
+ template <typename T>
+ struct deferred_false
+ // cppcheck-suppress unusedStructMember
+ { static const bool value = false; };
+
+ namespace has_insertion_operator_impl {
+ typedef char no;
+ typedef char yes[2];
+
+ struct any_t
+ {
+ template <typename T>
+ // cppcheck-suppress noExplicitConstructor
+ any_t(const DOCTEST_REF_WRAP(T));
+ };
+
+ yes& testStreamable(std::ostream&);
+ no testStreamable(no);
+
+ no operator<<(const std::ostream&, const any_t&);
+
+ template <typename T>
+ struct has_insertion_operator
+ {
+ static std::ostream& s;
+ static const DOCTEST_REF_WRAP(T) t;
+ static const bool value = sizeof(decltype(testStreamable(s << t))) == sizeof(yes);
+ };
+ } // namespace has_insertion_operator_impl
+
+ template <typename T>
+ struct has_insertion_operator : has_insertion_operator_impl::has_insertion_operator<T>
+ {};
+
+ DOCTEST_INTERFACE void my_memcpy(void* dest, const void* src, unsigned num);
+
+ DOCTEST_INTERFACE std::ostream* getTlsOss(); // returns a thread-local ostringstream
+ DOCTEST_INTERFACE String getTlsOssResult();
+
+ template <bool C>
+ struct StringMakerBase
+ {
+ template <typename T>
+ static String convert(const DOCTEST_REF_WRAP(T)) {
+ return "{?}";
+ }
+ };
+
+ template <>
+ struct StringMakerBase<true>
+ {
+ template <typename T>
+ static String convert(const DOCTEST_REF_WRAP(T) in) {
+ *getTlsOss() << in;
+ return getTlsOssResult();
+ }
+ };
+
+ DOCTEST_INTERFACE String rawMemoryToString(const void* object, unsigned size);
+
+ template <typename T>
+ String rawMemoryToString(const DOCTEST_REF_WRAP(T) object) {
+ return rawMemoryToString(&object, sizeof(object));
+ }
+
+ template <typename T>
+ const char* type_to_string() {
+ return "<>";
+ }
+} // namespace detail
+
+template <typename T>
+struct StringMaker : public detail::StringMakerBase<detail::has_insertion_operator<T>::value>
+{};
+
+template <typename T>
+struct StringMaker<T*>
+{
+ template <typename U>
+ static String convert(U* p) {
+ if(p)
+ return detail::rawMemoryToString(p);
+ return "NULL";
+ }
+};
+
+template <typename R, typename C>
+struct StringMaker<R C::*>
+{
+ static String convert(R C::*p) {
+ if(p)
+ return detail::rawMemoryToString(p);
+ return "NULL";
+ }
+};
+
+template <typename T>
+String toString(const DOCTEST_REF_WRAP(T) value) {
+ return StringMaker<T>::convert(value);
+}
+
+#ifdef DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+DOCTEST_INTERFACE String toString(char* in);
+DOCTEST_INTERFACE String toString(const char* in);
+#endif // DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+DOCTEST_INTERFACE String toString(bool in);
+DOCTEST_INTERFACE String toString(float in);
+DOCTEST_INTERFACE String toString(double in);
+DOCTEST_INTERFACE String toString(double long in);
+
+DOCTEST_INTERFACE String toString(char in);
+DOCTEST_INTERFACE String toString(char signed in);
+DOCTEST_INTERFACE String toString(char unsigned in);
+DOCTEST_INTERFACE String toString(int short in);
+DOCTEST_INTERFACE String toString(int short unsigned in);
+DOCTEST_INTERFACE String toString(int in);
+DOCTEST_INTERFACE String toString(int unsigned in);
+DOCTEST_INTERFACE String toString(int long in);
+DOCTEST_INTERFACE String toString(int long unsigned in);
+DOCTEST_INTERFACE String toString(int long long in);
+DOCTEST_INTERFACE String toString(int long long unsigned in);
+DOCTEST_INTERFACE String toString(std::nullptr_t in);
+
+#if DOCTEST_MSVC >= DOCTEST_COMPILER(19, 20, 0)
+// see this issue on why this is needed: https://github.com/onqtam/doctest/issues/183
+DOCTEST_INTERFACE String toString(const std::string& in);
+#endif // VS 2019
+
+class DOCTEST_INTERFACE Approx
+{
+public:
+ explicit Approx(double value);
+
+ Approx operator()(double value) const;
+
+#ifdef DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS
+ template <typename T>
+ explicit Approx(const T& value,
+ typename detail::enable_if<std::is_constructible<double, T>::value>::type* =
+ static_cast<T*>(nullptr)) {
+ *this = Approx(static_cast<double>(value));
+ }
+#endif // DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS
+
+ Approx& epsilon(double newEpsilon);
+
+#ifdef DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS
+ template <typename T>
+ typename detail::enable_if<std::is_constructible<double, T>::value, Approx&>::type epsilon(
+ const T& newEpsilon) {
+ m_epsilon = static_cast<double>(newEpsilon);
+ return *this;
+ }
+#endif // DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS
+
+ Approx& scale(double newScale);
+
+#ifdef DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS
+ template <typename T>
+ typename detail::enable_if<std::is_constructible<double, T>::value, Approx&>::type scale(
+ const T& newScale) {
+ m_scale = static_cast<double>(newScale);
+ return *this;
+ }
+#endif // DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS
+
+ // clang-format off
+ DOCTEST_INTERFACE friend bool operator==(double lhs, const Approx & rhs);
+ DOCTEST_INTERFACE friend bool operator==(const Approx & lhs, double rhs);
+ DOCTEST_INTERFACE friend bool operator!=(double lhs, const Approx & rhs);
+ DOCTEST_INTERFACE friend bool operator!=(const Approx & lhs, double rhs);
+ DOCTEST_INTERFACE friend bool operator<=(double lhs, const Approx & rhs);
+ DOCTEST_INTERFACE friend bool operator<=(const Approx & lhs, double rhs);
+ DOCTEST_INTERFACE friend bool operator>=(double lhs, const Approx & rhs);
+ DOCTEST_INTERFACE friend bool operator>=(const Approx & lhs, double rhs);
+ DOCTEST_INTERFACE friend bool operator< (double lhs, const Approx & rhs);
+ DOCTEST_INTERFACE friend bool operator< (const Approx & lhs, double rhs);
+ DOCTEST_INTERFACE friend bool operator> (double lhs, const Approx & rhs);
+ DOCTEST_INTERFACE friend bool operator> (const Approx & lhs, double rhs);
+
+ DOCTEST_INTERFACE friend String toString(const Approx& in);
+
+#ifdef DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS
+#define DOCTEST_APPROX_PREFIX \
+ template <typename T> friend typename detail::enable_if<std::is_constructible<double, T>::value, bool>::type
+
+ DOCTEST_APPROX_PREFIX operator==(const T& lhs, const Approx& rhs) { return operator==(double(lhs), rhs); }
+ DOCTEST_APPROX_PREFIX operator==(const Approx& lhs, const T& rhs) { return operator==(rhs, lhs); }
+ DOCTEST_APPROX_PREFIX operator!=(const T& lhs, const Approx& rhs) { return !operator==(lhs, rhs); }
+ DOCTEST_APPROX_PREFIX operator!=(const Approx& lhs, const T& rhs) { return !operator==(rhs, lhs); }
+ DOCTEST_APPROX_PREFIX operator<=(const T& lhs, const Approx& rhs) { return double(lhs) < rhs.m_value || lhs == rhs; }
+ DOCTEST_APPROX_PREFIX operator<=(const Approx& lhs, const T& rhs) { return lhs.m_value < double(rhs) || lhs == rhs; }
+ DOCTEST_APPROX_PREFIX operator>=(const T& lhs, const Approx& rhs) { return double(lhs) > rhs.m_value || lhs == rhs; }
+ DOCTEST_APPROX_PREFIX operator>=(const Approx& lhs, const T& rhs) { return lhs.m_value > double(rhs) || lhs == rhs; }
+ DOCTEST_APPROX_PREFIX operator< (const T& lhs, const Approx& rhs) { return double(lhs) < rhs.m_value && lhs != rhs; }
+ DOCTEST_APPROX_PREFIX operator< (const Approx& lhs, const T& rhs) { return lhs.m_value < double(rhs) && lhs != rhs; }
+ DOCTEST_APPROX_PREFIX operator> (const T& lhs, const Approx& rhs) { return double(lhs) > rhs.m_value && lhs != rhs; }
+ DOCTEST_APPROX_PREFIX operator> (const Approx& lhs, const T& rhs) { return lhs.m_value > double(rhs) && lhs != rhs; }
+#undef DOCTEST_APPROX_PREFIX
+#endif // DOCTEST_CONFIG_INCLUDE_TYPE_TRAITS
+
+ // clang-format on
+
+private:
+ double m_epsilon;
+ double m_scale;
+ double m_value;
+};
+
+DOCTEST_INTERFACE String toString(const Approx& in);
+
+DOCTEST_INTERFACE const ContextOptions* getContextOptions();
+
+#if !defined(DOCTEST_CONFIG_DISABLE)
+
+namespace detail {
+ // clang-format off
+#ifdef DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+ template<class T> struct decay_array { typedef T type; };
+ template<class T, unsigned N> struct decay_array<T[N]> { typedef T* type; };
+ template<class T> struct decay_array<T[]> { typedef T* type; };
+
+ template<class T> struct not_char_pointer { enum { value = 1 }; };
+ template<> struct not_char_pointer<char*> { enum { value = 0 }; };
+ template<> struct not_char_pointer<const char*> { enum { value = 0 }; };
+
+ template<class T> struct can_use_op : public not_char_pointer<typename decay_array<T>::type> {};
+#endif // DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+ // clang-format on
+
+ struct DOCTEST_INTERFACE TestFailureException
+ {
+ };
+
+ DOCTEST_INTERFACE bool checkIfShouldThrow(assertType::Enum at);
+
+#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
+ [[noreturn]]
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
+ DOCTEST_INTERFACE void throwException();
+
+ struct DOCTEST_INTERFACE Subcase
+ {
+ SubcaseSignature m_signature;
+ bool m_entered = false;
+
+ Subcase(const String& name, const char* file, int line);
+ ~Subcase();
+
+ operator bool() const;
+ };
+
+ template <typename L, typename R>
+ String stringifyBinaryExpr(const DOCTEST_REF_WRAP(L) lhs, const char* op,
+ const DOCTEST_REF_WRAP(R) rhs) {
+ return toString(lhs) + op + toString(rhs);
+ }
+
+#define DOCTEST_DO_BINARY_EXPRESSION_COMPARISON(op, op_str, op_macro) \
+ template <typename R> \
+ DOCTEST_NOINLINE Result operator op(const DOCTEST_REF_WRAP(R) rhs) { \
+ bool res = op_macro(lhs, rhs); \
+ if(m_at & assertType::is_false) \
+ res = !res; \
+ if(!res || doctest::getContextOptions()->success) \
+ return Result(res, stringifyBinaryExpr(lhs, op_str, rhs)); \
+ return Result(res); \
+ }
+
+ // more checks could be added - like in Catch:
+ // https://github.com/catchorg/Catch2/pull/1480/files
+ // https://github.com/catchorg/Catch2/pull/1481/files
+#define DOCTEST_FORBIT_EXPRESSION(rt, op) \
+ template <typename R> \
+ rt& operator op(const R&) { \
+ static_assert(deferred_false<R>::value, \
+ "Expression Too Complex Please Rewrite As Binary Comparison!"); \
+ return *this; \
+ }
+
+ struct DOCTEST_INTERFACE Result
+ {
+ bool m_passed;
+ String m_decomp;
+
+ Result(bool passed, const String& decomposition = String());
+
+ // forbidding some expressions based on this table: https://en.cppreference.com/w/cpp/language/operator_precedence
+ DOCTEST_FORBIT_EXPRESSION(Result, &)
+ DOCTEST_FORBIT_EXPRESSION(Result, ^)
+ DOCTEST_FORBIT_EXPRESSION(Result, |)
+ DOCTEST_FORBIT_EXPRESSION(Result, &&)
+ DOCTEST_FORBIT_EXPRESSION(Result, ||)
+ DOCTEST_FORBIT_EXPRESSION(Result, ==)
+ DOCTEST_FORBIT_EXPRESSION(Result, !=)
+ DOCTEST_FORBIT_EXPRESSION(Result, <)
+ DOCTEST_FORBIT_EXPRESSION(Result, >)
+ DOCTEST_FORBIT_EXPRESSION(Result, <=)
+ DOCTEST_FORBIT_EXPRESSION(Result, >=)
+ DOCTEST_FORBIT_EXPRESSION(Result, =)
+ DOCTEST_FORBIT_EXPRESSION(Result, +=)
+ DOCTEST_FORBIT_EXPRESSION(Result, -=)
+ DOCTEST_FORBIT_EXPRESSION(Result, *=)
+ DOCTEST_FORBIT_EXPRESSION(Result, /=)
+ DOCTEST_FORBIT_EXPRESSION(Result, %=)
+ DOCTEST_FORBIT_EXPRESSION(Result, <<=)
+ DOCTEST_FORBIT_EXPRESSION(Result, >>=)
+ DOCTEST_FORBIT_EXPRESSION(Result, &=)
+ DOCTEST_FORBIT_EXPRESSION(Result, ^=)
+ DOCTEST_FORBIT_EXPRESSION(Result, |=)
+ };
+
+#ifndef DOCTEST_CONFIG_NO_COMPARISON_WARNING_SUPPRESSION
+
+ DOCTEST_CLANG_SUPPRESS_WARNING_PUSH
+ DOCTEST_CLANG_SUPPRESS_WARNING("-Wsign-conversion")
+ DOCTEST_CLANG_SUPPRESS_WARNING("-Wsign-compare")
+ //DOCTEST_CLANG_SUPPRESS_WARNING("-Wdouble-promotion")
+ //DOCTEST_CLANG_SUPPRESS_WARNING("-Wconversion")
+ //DOCTEST_CLANG_SUPPRESS_WARNING("-Wfloat-equal")
+
+ DOCTEST_GCC_SUPPRESS_WARNING_PUSH
+ DOCTEST_GCC_SUPPRESS_WARNING("-Wsign-conversion")
+ DOCTEST_GCC_SUPPRESS_WARNING("-Wsign-compare")
+ //DOCTEST_GCC_SUPPRESS_WARNING("-Wdouble-promotion")
+ //DOCTEST_GCC_SUPPRESS_WARNING("-Wconversion")
+ //DOCTEST_GCC_SUPPRESS_WARNING("-Wfloat-equal")
+
+ DOCTEST_MSVC_SUPPRESS_WARNING_PUSH
+ // https://stackoverflow.com/questions/39479163 what's the difference between 4018 and 4389
+ DOCTEST_MSVC_SUPPRESS_WARNING(4388) // signed/unsigned mismatch
+ DOCTEST_MSVC_SUPPRESS_WARNING(4389) // 'operator' : signed/unsigned mismatch
+ DOCTEST_MSVC_SUPPRESS_WARNING(4018) // 'expression' : signed/unsigned mismatch
+ //DOCTEST_MSVC_SUPPRESS_WARNING(4805) // 'operation' : unsafe mix of type 'type' and type 'type' in operation
+
+#endif // DOCTEST_CONFIG_NO_COMPARISON_WARNING_SUPPRESSION
+
+ // clang-format off
+#ifndef DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+#define DOCTEST_COMPARISON_RETURN_TYPE bool
+#else // DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+#define DOCTEST_COMPARISON_RETURN_TYPE typename enable_if<can_use_op<L>::value || can_use_op<R>::value, bool>::type
+ inline bool eq(const char* lhs, const char* rhs) { return String(lhs) == String(rhs); }
+ inline bool ne(const char* lhs, const char* rhs) { return String(lhs) != String(rhs); }
+ inline bool lt(const char* lhs, const char* rhs) { return String(lhs) < String(rhs); }
+ inline bool gt(const char* lhs, const char* rhs) { return String(lhs) > String(rhs); }
+ inline bool le(const char* lhs, const char* rhs) { return String(lhs) <= String(rhs); }
+ inline bool ge(const char* lhs, const char* rhs) { return String(lhs) >= String(rhs); }
+#endif // DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+ // clang-format on
+
+#define DOCTEST_RELATIONAL_OP(name, op) \
+ template <typename L, typename R> \
+ DOCTEST_COMPARISON_RETURN_TYPE name(const DOCTEST_REF_WRAP(L) lhs, \
+ const DOCTEST_REF_WRAP(R) rhs) { \
+ return lhs op rhs; \
+ }
+
+ DOCTEST_RELATIONAL_OP(eq, ==)
+ DOCTEST_RELATIONAL_OP(ne, !=)
+ DOCTEST_RELATIONAL_OP(lt, <)
+ DOCTEST_RELATIONAL_OP(gt, >)
+ DOCTEST_RELATIONAL_OP(le, <=)
+ DOCTEST_RELATIONAL_OP(ge, >=)
+
+#ifndef DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+#define DOCTEST_CMP_EQ(l, r) l == r
+#define DOCTEST_CMP_NE(l, r) l != r
+#define DOCTEST_CMP_GT(l, r) l > r
+#define DOCTEST_CMP_LT(l, r) l < r
+#define DOCTEST_CMP_GE(l, r) l >= r
+#define DOCTEST_CMP_LE(l, r) l <= r
+#else // DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+#define DOCTEST_CMP_EQ(l, r) eq(l, r)
+#define DOCTEST_CMP_NE(l, r) ne(l, r)
+#define DOCTEST_CMP_GT(l, r) gt(l, r)
+#define DOCTEST_CMP_LT(l, r) lt(l, r)
+#define DOCTEST_CMP_GE(l, r) ge(l, r)
+#define DOCTEST_CMP_LE(l, r) le(l, r)
+#endif // DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+
+ template <typename L>
+ // cppcheck-suppress copyCtorAndEqOperator
+ struct Expression_lhs
+ {
+ L lhs;
+ assertType::Enum m_at;
+
+ explicit Expression_lhs(L in, assertType::Enum at)
+ : lhs(in)
+ , m_at(at) {}
+
+ DOCTEST_NOINLINE operator Result() {
+ bool res = !!lhs;
+ if(m_at & assertType::is_false) //!OCLINT bitwise operator in conditional
+ res = !res;
+
+ if(!res || getContextOptions()->success)
+ return Result(res, toString(lhs));
+ return Result(res);
+ }
+
+ // clang-format off
+ DOCTEST_DO_BINARY_EXPRESSION_COMPARISON(==, " == ", DOCTEST_CMP_EQ) //!OCLINT bitwise operator in conditional
+ DOCTEST_DO_BINARY_EXPRESSION_COMPARISON(!=, " != ", DOCTEST_CMP_NE) //!OCLINT bitwise operator in conditional
+ DOCTEST_DO_BINARY_EXPRESSION_COMPARISON(>, " > ", DOCTEST_CMP_GT) //!OCLINT bitwise operator in conditional
+ DOCTEST_DO_BINARY_EXPRESSION_COMPARISON(<, " < ", DOCTEST_CMP_LT) //!OCLINT bitwise operator in conditional
+ DOCTEST_DO_BINARY_EXPRESSION_COMPARISON(>=, " >= ", DOCTEST_CMP_GE) //!OCLINT bitwise operator in conditional
+ DOCTEST_DO_BINARY_EXPRESSION_COMPARISON(<=, " <= ", DOCTEST_CMP_LE) //!OCLINT bitwise operator in conditional
+ // clang-format on
+
+ // forbidding some expressions based on this table: https://en.cppreference.com/w/cpp/language/operator_precedence
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, &)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, ^)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, |)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, &&)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, ||)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, =)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, +=)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, -=)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, *=)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, /=)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, %=)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, <<=)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, >>=)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, &=)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, ^=)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, |=)
+ // these 2 are unfortunate because they should be allowed - they have higher precedence over the comparisons, but the
+ // ExpressionDecomposer class uses the left shift operator to capture the left operand of the binary expression...
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, <<)
+ DOCTEST_FORBIT_EXPRESSION(Expression_lhs, >>)
+ };
+
+#ifndef DOCTEST_CONFIG_NO_COMPARISON_WARNING_SUPPRESSION
+
+ DOCTEST_CLANG_SUPPRESS_WARNING_POP
+ DOCTEST_MSVC_SUPPRESS_WARNING_POP
+ DOCTEST_GCC_SUPPRESS_WARNING_POP
+
+#endif // DOCTEST_CONFIG_NO_COMPARISON_WARNING_SUPPRESSION
+
+ struct DOCTEST_INTERFACE ExpressionDecomposer
+ {
+ assertType::Enum m_at;
+
+ ExpressionDecomposer(assertType::Enum at);
+
+ // The right operator for capturing expressions is "<=" instead of "<<" (based on the operator precedence table)
+ // but then there will be warnings from GCC about "-Wparentheses" and since "_Pragma()" is problematic this will stay for now...
+ // https://github.com/catchorg/Catch2/issues/870
+ // https://github.com/catchorg/Catch2/issues/565
+ template <typename L>
+ Expression_lhs<const DOCTEST_REF_WRAP(L)> operator<<(const DOCTEST_REF_WRAP(L) operand) {
+ return Expression_lhs<const DOCTEST_REF_WRAP(L)>(operand, m_at);
+ }
+ };
+
+ struct DOCTEST_INTERFACE TestSuite
+ {
+ const char* m_test_suite;
+ const char* m_description;
+ bool m_skip;
+ bool m_may_fail;
+ bool m_should_fail;
+ int m_expected_failures;
+ double m_timeout;
+
+ TestSuite& operator*(const char* in);
+
+ template <typename T>
+ TestSuite& operator*(const T& in) {
+ in.fill(*this);
+ return *this;
+ }
+ };
+
+ typedef void (*funcType)();
+
+ struct DOCTEST_INTERFACE TestCase : public TestCaseData
+ {
+ funcType m_test; // a function pointer to the test case
+
+ const char* m_type; // for templated test cases - gets appended to the real name
+ int m_template_id; // an ID used to distinguish between the different versions of a templated test case
+ String m_full_name; // contains the name (only for templated test cases!) + the template type
+
+ TestCase(funcType test, const char* file, unsigned line, const TestSuite& test_suite,
+ const char* type = "", int template_id = -1);
+
+ TestCase(const TestCase& other);
+
+ DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(26434) // hides a non-virtual function
+ TestCase& operator=(const TestCase& other);
+ DOCTEST_MSVC_SUPPRESS_WARNING_POP
+
+ TestCase& operator*(const char* in);
+
+ template <typename T>
+ TestCase& operator*(const T& in) {
+ in.fill(*this);
+ return *this;
+ }
+
+ bool operator<(const TestCase& other) const;
+ };
+
+ // forward declarations of functions used by the macros
+ DOCTEST_INTERFACE int regTest(const TestCase& tc);
+ DOCTEST_INTERFACE int setTestSuite(const TestSuite& ts);
+ DOCTEST_INTERFACE bool isDebuggerActive();
+
+ template<typename T>
+ int instantiationHelper(const T&) { return 0; }
+
+ namespace binaryAssertComparison {
+ enum Enum
+ {
+ eq = 0,
+ ne,
+ gt,
+ lt,
+ ge,
+ le
+ };
+ } // namespace binaryAssertComparison
+
+ // clang-format off
+ template <int, class L, class R> struct RelationalComparator { bool operator()(const DOCTEST_REF_WRAP(L), const DOCTEST_REF_WRAP(R) ) const { return false; } };
+
+#define DOCTEST_BINARY_RELATIONAL_OP(n, op) \
+ template <class L, class R> struct RelationalComparator<n, L, R> { bool operator()(const DOCTEST_REF_WRAP(L) lhs, const DOCTEST_REF_WRAP(R) rhs) const { return op(lhs, rhs); } };
+ // clang-format on
+
+ DOCTEST_BINARY_RELATIONAL_OP(0, eq)
+ DOCTEST_BINARY_RELATIONAL_OP(1, ne)
+ DOCTEST_BINARY_RELATIONAL_OP(2, gt)
+ DOCTEST_BINARY_RELATIONAL_OP(3, lt)
+ DOCTEST_BINARY_RELATIONAL_OP(4, ge)
+ DOCTEST_BINARY_RELATIONAL_OP(5, le)
+
+ struct DOCTEST_INTERFACE ResultBuilder : public AssertData
+ {
+ ResultBuilder(assertType::Enum at, const char* file, int line, const char* expr,
+ const char* exception_type = "", const char* exception_string = "");
+
+ void setResult(const Result& res);
+
+ template <int comparison, typename L, typename R>
+ DOCTEST_NOINLINE void binary_assert(const DOCTEST_REF_WRAP(L) lhs,
+ const DOCTEST_REF_WRAP(R) rhs) {
+ m_failed = !RelationalComparator<comparison, L, R>()(lhs, rhs);
+ if(m_failed || getContextOptions()->success)
+ m_decomp = stringifyBinaryExpr(lhs, ", ", rhs);
+ }
+
+ template <typename L>
+ DOCTEST_NOINLINE void unary_assert(const DOCTEST_REF_WRAP(L) val) {
+ m_failed = !val;
+
+ if(m_at & assertType::is_false) //!OCLINT bitwise operator in conditional
+ m_failed = !m_failed;
+
+ if(m_failed || getContextOptions()->success)
+ m_decomp = toString(val);
+ }
+
+ void translateException();
+
+ bool log();
+ void react() const;
+ };
+
+ namespace assertAction {
+ enum Enum
+ {
+ nothing = 0,
+ dbgbreak = 1,
+ shouldthrow = 2
+ };
+ } // namespace assertAction
+
+ DOCTEST_INTERFACE void failed_out_of_a_testing_context(const AssertData& ad);
+
+ DOCTEST_INTERFACE void decomp_assert(assertType::Enum at, const char* file, int line,
+ const char* expr, Result result);
+
+#define DOCTEST_ASSERT_OUT_OF_TESTS(decomp) \
+ do { \
+ if(!is_running_in_test) { \
+ if(failed) { \
+ ResultBuilder rb(at, file, line, expr); \
+ rb.m_failed = failed; \
+ rb.m_decomp = decomp; \
+ failed_out_of_a_testing_context(rb); \
+ if(isDebuggerActive() && !getContextOptions()->no_breaks) \
+ DOCTEST_BREAK_INTO_DEBUGGER(); \
+ if(checkIfShouldThrow(at)) \
+ throwException(); \
+ } \
+ return; \
+ } \
+ } while(false)
+
+#define DOCTEST_ASSERT_IN_TESTS(decomp) \
+ ResultBuilder rb(at, file, line, expr); \
+ rb.m_failed = failed; \
+ if(rb.m_failed || getContextOptions()->success) \
+ rb.m_decomp = decomp; \
+ if(rb.log()) \
+ DOCTEST_BREAK_INTO_DEBUGGER(); \
+ if(rb.m_failed && checkIfShouldThrow(at)) \
+ throwException()
+
+ template <int comparison, typename L, typename R>
+ DOCTEST_NOINLINE void binary_assert(assertType::Enum at, const char* file, int line,
+ const char* expr, const DOCTEST_REF_WRAP(L) lhs,
+ const DOCTEST_REF_WRAP(R) rhs) {
+ bool failed = !RelationalComparator<comparison, L, R>()(lhs, rhs);
+
+ // ###################################################################################
+ // IF THE DEBUGGER BREAKS HERE - GO 1 LEVEL UP IN THE CALLSTACK FOR THE FAILING ASSERT
+ // THIS IS THE EFFECT OF HAVING 'DOCTEST_CONFIG_SUPER_FAST_ASSERTS' DEFINED
+ // ###################################################################################
+ DOCTEST_ASSERT_OUT_OF_TESTS(stringifyBinaryExpr(lhs, ", ", rhs));
+ DOCTEST_ASSERT_IN_TESTS(stringifyBinaryExpr(lhs, ", ", rhs));
+ }
+
+ template <typename L>
+ DOCTEST_NOINLINE void unary_assert(assertType::Enum at, const char* file, int line,
+ const char* expr, const DOCTEST_REF_WRAP(L) val) {
+ bool failed = !val;
+
+ if(at & assertType::is_false) //!OCLINT bitwise operator in conditional
+ failed = !failed;
+
+ // ###################################################################################
+ // IF THE DEBUGGER BREAKS HERE - GO 1 LEVEL UP IN THE CALLSTACK FOR THE FAILING ASSERT
+ // THIS IS THE EFFECT OF HAVING 'DOCTEST_CONFIG_SUPER_FAST_ASSERTS' DEFINED
+ // ###################################################################################
+ DOCTEST_ASSERT_OUT_OF_TESTS(toString(val));
+ DOCTEST_ASSERT_IN_TESTS(toString(val));
+ }
+
+ struct DOCTEST_INTERFACE IExceptionTranslator
+ {
+ IExceptionTranslator();
+ virtual ~IExceptionTranslator();
+ virtual bool translate(String&) const = 0;
+ };
+
+ template <typename T>
+ class ExceptionTranslator : public IExceptionTranslator //!OCLINT destructor of virtual class
+ {
+ public:
+ explicit ExceptionTranslator(String (*translateFunction)(T))
+ : m_translateFunction(translateFunction) {}
+
+ bool translate(String& res) const override {
+#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
+ try {
+ throw; // lgtm [cpp/rethrow-no-exception]
+ // cppcheck-suppress catchExceptionByValue
+ } catch(T ex) { // NOLINT
+ res = m_translateFunction(ex); //!OCLINT parameter reassignment
+ return true;
+ } catch(...) {} //!OCLINT - empty catch statement
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
+ ((void)res); // to silence -Wunused-parameter
+ return false;
+ }
+
+ private:
+ String (*m_translateFunction)(T);
+ };
+
+ DOCTEST_INTERFACE void registerExceptionTranslatorImpl(const IExceptionTranslator* et);
+
+ template <bool C>
+ struct StringStreamBase
+ {
+ template <typename T>
+ static void convert(std::ostream* s, const T& in) {
+ *s << toString(in);
+ }
+
+ // always treat char* as a string in this context - no matter
+ // if DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING is defined
+ static void convert(std::ostream* s, const char* in) { *s << String(in); }
+ };
+
+ template <>
+ struct StringStreamBase<true>
+ {
+ template <typename T>
+ static void convert(std::ostream* s, const T& in) {
+ *s << in;
+ }
+ };
+
+ template <typename T>
+ struct StringStream : public StringStreamBase<has_insertion_operator<T>::value>
+ {};
+
+ template <typename T>
+ void toStream(std::ostream* s, const T& value) {
+ StringStream<T>::convert(s, value);
+ }
+
+#ifdef DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+ DOCTEST_INTERFACE void toStream(std::ostream* s, char* in);
+ DOCTEST_INTERFACE void toStream(std::ostream* s, const char* in);
+#endif // DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+ DOCTEST_INTERFACE void toStream(std::ostream* s, bool in);
+ DOCTEST_INTERFACE void toStream(std::ostream* s, float in);
+ DOCTEST_INTERFACE void toStream(std::ostream* s, double in);
+ DOCTEST_INTERFACE void toStream(std::ostream* s, double long in);
+
+ DOCTEST_INTERFACE void toStream(std::ostream* s, char in);
+ DOCTEST_INTERFACE void toStream(std::ostream* s, char signed in);
+ DOCTEST_INTERFACE void toStream(std::ostream* s, char unsigned in);
+ DOCTEST_INTERFACE void toStream(std::ostream* s, int short in);
+ DOCTEST_INTERFACE void toStream(std::ostream* s, int short unsigned in);
+ DOCTEST_INTERFACE void toStream(std::ostream* s, int in);
+ DOCTEST_INTERFACE void toStream(std::ostream* s, int unsigned in);
+ DOCTEST_INTERFACE void toStream(std::ostream* s, int long in);
+ DOCTEST_INTERFACE void toStream(std::ostream* s, int long unsigned in);
+ DOCTEST_INTERFACE void toStream(std::ostream* s, int long long in);
+ DOCTEST_INTERFACE void toStream(std::ostream* s, int long long unsigned in);
+
+ // ContextScope base class used to allow implementing methods of ContextScope
+ // that don't depend on the template parameter in doctest.cpp.
+ class DOCTEST_INTERFACE ContextScopeBase : public IContextScope {
+ protected:
+ ContextScopeBase();
+
+ void destroy();
+ };
+
+ template <typename L> class ContextScope : public ContextScopeBase
+ {
+ const L &lambda_;
+
+ public:
+ explicit ContextScope(const L &lambda) : lambda_(lambda) {}
+
+ ContextScope(ContextScope &&other) : lambda_(other.lambda_) {}
+
+ void stringify(std::ostream* s) const override { lambda_(s); }
+
+ ~ContextScope() override { destroy(); }
+ };
+
+ struct DOCTEST_INTERFACE MessageBuilder : public MessageData
+ {
+ std::ostream* m_stream;
+
+ MessageBuilder(const char* file, int line, assertType::Enum severity);
+ MessageBuilder() = delete;
+ ~MessageBuilder();
+
+ template <typename T>
+ MessageBuilder& operator<<(const T& in) {
+ toStream(m_stream, in);
+ return *this;
+ }
+
+ bool log();
+ void react();
+ };
+
+ template <typename L>
+ ContextScope<L> MakeContextScope(const L &lambda) {
+ return ContextScope<L>(lambda);
+ }
+} // namespace detail
+
+#define DOCTEST_DEFINE_DECORATOR(name, type, def) \
+ struct name \
+ { \
+ type data; \
+ name(type in = def) \
+ : data(in) {} \
+ void fill(detail::TestCase& state) const { state.DOCTEST_CAT(m_, name) = data; } \
+ void fill(detail::TestSuite& state) const { state.DOCTEST_CAT(m_, name) = data; } \
+ }
+
+DOCTEST_DEFINE_DECORATOR(test_suite, const char*, "");
+DOCTEST_DEFINE_DECORATOR(description, const char*, "");
+DOCTEST_DEFINE_DECORATOR(skip, bool, true);
+DOCTEST_DEFINE_DECORATOR(timeout, double, 0);
+DOCTEST_DEFINE_DECORATOR(may_fail, bool, true);
+DOCTEST_DEFINE_DECORATOR(should_fail, bool, true);
+DOCTEST_DEFINE_DECORATOR(expected_failures, int, 0);
+
+template <typename T>
+int registerExceptionTranslator(String (*translateFunction)(T)) {
+ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wexit-time-destructors")
+ static detail::ExceptionTranslator<T> exceptionTranslator(translateFunction);
+ DOCTEST_CLANG_SUPPRESS_WARNING_POP
+ detail::registerExceptionTranslatorImpl(&exceptionTranslator);
+ return 0;
+}
+
+} // namespace doctest
+
+// in a separate namespace outside of doctest because the DOCTEST_TEST_SUITE macro
+// introduces an anonymous namespace in which getCurrentTestSuite gets overridden
+namespace doctest_detail_test_suite_ns {
+DOCTEST_INTERFACE doctest::detail::TestSuite& getCurrentTestSuite();
+} // namespace doctest_detail_test_suite_ns
+
+namespace doctest {
+#else // DOCTEST_CONFIG_DISABLE
+template <typename T>
+int registerExceptionTranslator(String (*)(T)) {
+ return 0;
+}
+#endif // DOCTEST_CONFIG_DISABLE
+
+namespace detail {
+ typedef void (*assert_handler)(const AssertData&);
+ struct ContextState;
+} // namespace detail
+
+class DOCTEST_INTERFACE Context
+{
+ detail::ContextState* p;
+
+ void parseArgs(int argc, const char* const* argv, bool withDefaults = false);
+
+public:
+ explicit Context(int argc = 0, const char* const* argv = nullptr);
+
+ ~Context();
+
+ void applyCommandLine(int argc, const char* const* argv);
+
+ void addFilter(const char* filter, const char* value);
+ void clearFilters();
+ void setOption(const char* option, int value);
+ void setOption(const char* option, const char* value);
+
+ bool shouldExit();
+
+ void setAsDefaultForAssertsOutOfTestCases();
+
+ void setAssertHandler(detail::assert_handler ah);
+
+ int run();
+};
+
+namespace TestCaseFailureReason {
+ enum Enum
+ {
+ None = 0,
+ AssertFailure = 1, // an assertion has failed in the test case
+ Exception = 2, // test case threw an exception
+ Crash = 4, // a crash...
+ TooManyFailedAsserts = 8, // the abort-after option
+ Timeout = 16, // see the timeout decorator
+ ShouldHaveFailedButDidnt = 32, // see the should_fail decorator
+ ShouldHaveFailedAndDid = 64, // see the should_fail decorator
+ DidntFailExactlyNumTimes = 128, // see the expected_failures decorator
+ FailedExactlyNumTimes = 256, // see the expected_failures decorator
+ CouldHaveFailedAndDid = 512 // see the may_fail decorator
+ };
+} // namespace TestCaseFailureReason
+
+struct DOCTEST_INTERFACE CurrentTestCaseStats
+{
+ int numAssertsCurrentTest;
+ int numAssertsFailedCurrentTest;
+ double seconds;
+ int failure_flags; // use TestCaseFailureReason::Enum
+};
+
+struct DOCTEST_INTERFACE TestCaseException
+{
+ String error_string;
+ bool is_crash;
+};
+
+struct DOCTEST_INTERFACE TestRunStats
+{
+ unsigned numTestCases;
+ unsigned numTestCasesPassingFilters;
+ unsigned numTestSuitesPassingFilters;
+ unsigned numTestCasesFailed;
+ int numAsserts;
+ int numAssertsFailed;
+};
+
+struct QueryData
+{
+ const TestRunStats* run_stats = nullptr;
+ const TestCaseData** data = nullptr;
+ unsigned num_data = 0;
+};
+
+struct DOCTEST_INTERFACE IReporter
+{
+ // The constructor has to accept "const ContextOptions&" as a single argument
+ // which has most of the options for the run + a pointer to the stdout stream
+ // Reporter(const ContextOptions& in)
+
+ // called when a query should be reported (listing test cases, printing the version, etc.)
+ virtual void report_query(const QueryData&) = 0;
+
+ // called when the whole test run starts
+ virtual void test_run_start() = 0;
+ // called when the whole test run ends (caching a pointer to the input doesn't make sense here)
+ virtual void test_run_end(const TestRunStats&) = 0;
+
+ // called when a test case is started (safe to cache a pointer to the input)
+ virtual void test_case_start(const TestCaseData&) = 0;
+ // called when a test case is reentered because of unfinished subcases (safe to cache a pointer to the input)
+ virtual void test_case_reenter(const TestCaseData&) = 0;
+ // called when a test case has ended
+ virtual void test_case_end(const CurrentTestCaseStats&) = 0;
+
+ // called when an exception is thrown from the test case (or it crashes)
+ virtual void test_case_exception(const TestCaseException&) = 0;
+
+ // called whenever a subcase is entered (don't cache pointers to the input)
+ virtual void subcase_start(const SubcaseSignature&) = 0;
+ // called whenever a subcase is exited (don't cache pointers to the input)
+ virtual void subcase_end() = 0;
+
+ // called for each assert (don't cache pointers to the input)
+ virtual void log_assert(const AssertData&) = 0;
+ // called for each message (don't cache pointers to the input)
+ virtual void log_message(const MessageData&) = 0;
+
+ // called when a test case is skipped either because it doesn't pass the filters, has a skip decorator
+ // or isn't in the execution range (between first and last) (safe to cache a pointer to the input)
+ virtual void test_case_skipped(const TestCaseData&) = 0;
+
+ // doctest will not be managing the lifetimes of reporters given to it but this would still be nice to have
+ virtual ~IReporter();
+
+ // can obtain all currently active contexts and stringify them if one wishes to do so
+ static int get_num_active_contexts();
+ static const IContextScope* const* get_active_contexts();
+
+ // can iterate through contexts which have been stringified automatically in their destructors when an exception has been thrown
+ static int get_num_stringified_contexts();
+ static const String* get_stringified_contexts();
+};
+
+namespace detail {
+ typedef IReporter* (*reporterCreatorFunc)(const ContextOptions&);
+
+ DOCTEST_INTERFACE void registerReporterImpl(const char* name, int prio, reporterCreatorFunc c, bool isReporter);
+
+ template <typename Reporter>
+ IReporter* reporterCreator(const ContextOptions& o) {
+ return new Reporter(o);
+ }
+} // namespace detail
+
+template <typename Reporter>
+int registerReporter(const char* name, int priority, bool isReporter) {
+ detail::registerReporterImpl(name, priority, detail::reporterCreator<Reporter>, isReporter);
+ return 0;
+}
+} // namespace doctest
+
+// if registering is not disabled
+#if !defined(DOCTEST_CONFIG_DISABLE)
+
+// common code in asserts - for convenience
+#define DOCTEST_ASSERT_LOG_AND_REACT(b) \
+ if(b.log()) \
+ DOCTEST_BREAK_INTO_DEBUGGER(); \
+ b.react()
+
+#ifdef DOCTEST_CONFIG_NO_TRY_CATCH_IN_ASSERTS
+#define DOCTEST_WRAP_IN_TRY(x) x;
+#else // DOCTEST_CONFIG_NO_TRY_CATCH_IN_ASSERTS
+#define DOCTEST_WRAP_IN_TRY(x) \
+ try { \
+ x; \
+ } catch(...) { _DOCTEST_RB.translateException(); }
+#endif // DOCTEST_CONFIG_NO_TRY_CATCH_IN_ASSERTS
+
+#ifdef DOCTEST_CONFIG_VOID_CAST_EXPRESSIONS
+#define DOCTEST_CAST_TO_VOID(x) \
+ DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wuseless-cast") \
+ static_cast<void>(x); \
+ DOCTEST_GCC_SUPPRESS_WARNING_POP
+#else // DOCTEST_CONFIG_VOID_CAST_EXPRESSIONS
+#define DOCTEST_CAST_TO_VOID(x) x;
+#endif // DOCTEST_CONFIG_VOID_CAST_EXPRESSIONS
+
+// registers the test by initializing a dummy var with a function
+#define DOCTEST_REGISTER_FUNCTION(global_prefix, f, decorators) \
+ global_prefix DOCTEST_GLOBAL_NO_WARNINGS(DOCTEST_ANONYMOUS(_DOCTEST_ANON_VAR_)) = \
+ doctest::detail::regTest( \
+ doctest::detail::TestCase( \
+ f, __FILE__, __LINE__, \
+ doctest_detail_test_suite_ns::getCurrentTestSuite()) * \
+ decorators); \
+ DOCTEST_GLOBAL_NO_WARNINGS_END()
+
+#define DOCTEST_IMPLEMENT_FIXTURE(der, base, func, decorators) \
+ namespace { \
+ struct der : public base \
+ { \
+ void f(); \
+ }; \
+ static void func() { \
+ der v; \
+ v.f(); \
+ } \
+ DOCTEST_REGISTER_FUNCTION(DOCTEST_EMPTY, func, decorators) \
+ } \
+ inline DOCTEST_NOINLINE void der::f()
+
+#define DOCTEST_CREATE_AND_REGISTER_FUNCTION(f, decorators) \
+ static void f(); \
+ DOCTEST_REGISTER_FUNCTION(DOCTEST_EMPTY, f, decorators) \
+ static void f()
+
+#define DOCTEST_CREATE_AND_REGISTER_FUNCTION_IN_CLASS(f, proxy, decorators) \
+ static doctest::detail::funcType proxy() { return f; } \
+ DOCTEST_REGISTER_FUNCTION(inline const, proxy(), decorators) \
+ static void f()
+
+// for registering tests
+#define DOCTEST_TEST_CASE(decorators) \
+ DOCTEST_CREATE_AND_REGISTER_FUNCTION(DOCTEST_ANONYMOUS(_DOCTEST_ANON_FUNC_), decorators)
+
+// for registering tests in classes - requires C++17 for inline variables!
+#if __cplusplus >= 201703L || (DOCTEST_MSVC >= DOCTEST_COMPILER(19, 12, 0) && _MSVC_LANG >= 201703L)
+#define DOCTEST_TEST_CASE_CLASS(decorators) \
+ DOCTEST_CREATE_AND_REGISTER_FUNCTION_IN_CLASS(DOCTEST_ANONYMOUS(_DOCTEST_ANON_FUNC_), \
+ DOCTEST_ANONYMOUS(_DOCTEST_ANON_PROXY_), \
+ decorators)
+#else // DOCTEST_TEST_CASE_CLASS
+#define DOCTEST_TEST_CASE_CLASS(...) \
+ TEST_CASES_CAN_BE_REGISTERED_IN_CLASSES_ONLY_IN_CPP17_MODE_OR_WITH_VS_2017_OR_NEWER
+#endif // DOCTEST_TEST_CASE_CLASS
+
+// for registering tests with a fixture
+#define DOCTEST_TEST_CASE_FIXTURE(c, decorators) \
+ DOCTEST_IMPLEMENT_FIXTURE(DOCTEST_ANONYMOUS(_DOCTEST_ANON_CLASS_), c, \
+ DOCTEST_ANONYMOUS(_DOCTEST_ANON_FUNC_), decorators)
+
+// for converting types to strings without the <typeinfo> header and demangling
+#define DOCTEST_TYPE_TO_STRING_IMPL(...) \
+ template <> \
+ inline const char* type_to_string<__VA_ARGS__>() { \
+ return "<" #__VA_ARGS__ ">"; \
+ }
+#define DOCTEST_TYPE_TO_STRING(...) \
+ namespace doctest { namespace detail { \
+ DOCTEST_TYPE_TO_STRING_IMPL(__VA_ARGS__) \
+ } \
+ } \
+ typedef int DOCTEST_ANONYMOUS(_DOCTEST_ANON_FOR_SEMICOLON_)
+
+#define DOCTEST_TEST_CASE_TEMPLATE_DEFINE_IMPL(dec, T, iter, func) \
+ template <typename T> \
+ static void func(); \
+ namespace { \
+ template <typename Tuple> \
+ struct iter; \
+ template <typename Type, typename... Rest> \
+ struct iter<std::tuple<Type, Rest...>> \
+ { \
+ iter(const char* file, unsigned line, int index) { \
+ doctest::detail::regTest(doctest::detail::TestCase(func<Type>, file, line, \
+ doctest_detail_test_suite_ns::getCurrentTestSuite(), \
+ doctest::detail::type_to_string<Type>(), \
+ int(line) * 1000 + index) \
+ * dec); \
+ iter<std::tuple<Rest...>>(file, line, index + 1); \
+ } \
+ }; \
+ template <> \
+ struct iter<std::tuple<>> \
+ { \
+ iter(const char*, unsigned, int) {} \
+ }; \
+ } \
+ template <typename T> \
+ static void func()
+
+#define DOCTEST_TEST_CASE_TEMPLATE_DEFINE(dec, T, id) \
+ DOCTEST_TEST_CASE_TEMPLATE_DEFINE_IMPL(dec, T, DOCTEST_CAT(id, ITERATOR), \
+ DOCTEST_ANONYMOUS(_DOCTEST_ANON_TMP_))
+
+#define DOCTEST_TEST_CASE_TEMPLATE_INSTANTIATE_IMPL(id, anon, ...) \
+ DOCTEST_GLOBAL_NO_WARNINGS(DOCTEST_CAT(anon, DUMMY)) = \
+ doctest::detail::instantiationHelper(DOCTEST_CAT(id, ITERATOR)<__VA_ARGS__>(__FILE__, __LINE__, 0));\
+ DOCTEST_GLOBAL_NO_WARNINGS_END()
+
+#define DOCTEST_TEST_CASE_TEMPLATE_INVOKE(id, ...) \
+ DOCTEST_TEST_CASE_TEMPLATE_INSTANTIATE_IMPL(id, DOCTEST_ANONYMOUS(_DOCTEST_ANON_TMP_), std::tuple<__VA_ARGS__>) \
+ typedef int DOCTEST_ANONYMOUS(_DOCTEST_ANON_FOR_SEMICOLON_)
+
+#define DOCTEST_TEST_CASE_TEMPLATE_APPLY(id, ...) \
+ DOCTEST_TEST_CASE_TEMPLATE_INSTANTIATE_IMPL(id, DOCTEST_ANONYMOUS(_DOCTEST_ANON_TMP_), __VA_ARGS__) \
+ typedef int DOCTEST_ANONYMOUS(_DOCTEST_ANON_FOR_SEMICOLON_)
+
+#define DOCTEST_TEST_CASE_TEMPLATE_IMPL(dec, T, anon, ...) \
+ DOCTEST_TEST_CASE_TEMPLATE_DEFINE_IMPL(dec, T, DOCTEST_CAT(anon, ITERATOR), anon); \
+ DOCTEST_TEST_CASE_TEMPLATE_INSTANTIATE_IMPL(anon, anon, std::tuple<__VA_ARGS__>) \
+ template <typename T> \
+ static void anon()
+
+#define DOCTEST_TEST_CASE_TEMPLATE(dec, T, ...) \
+ DOCTEST_TEST_CASE_TEMPLATE_IMPL(dec, T, DOCTEST_ANONYMOUS(_DOCTEST_ANON_TMP_), __VA_ARGS__)
+
+// for subcases
+#define DOCTEST_SUBCASE(name) \
+ if(const doctest::detail::Subcase & DOCTEST_ANONYMOUS(_DOCTEST_ANON_SUBCASE_) DOCTEST_UNUSED = \
+ doctest::detail::Subcase(name, __FILE__, __LINE__))
+
+// for grouping tests in test suites by using code blocks
+#define DOCTEST_TEST_SUITE_IMPL(decorators, ns_name) \
+ namespace ns_name { namespace doctest_detail_test_suite_ns { \
+ static DOCTEST_NOINLINE doctest::detail::TestSuite& getCurrentTestSuite() { \
+ DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4640) \
+ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wexit-time-destructors") \
+ static doctest::detail::TestSuite data; \
+ static bool inited = false; \
+ DOCTEST_MSVC_SUPPRESS_WARNING_POP \
+ DOCTEST_CLANG_SUPPRESS_WARNING_POP \
+ if(!inited) { \
+ data* decorators; \
+ inited = true; \
+ } \
+ return data; \
+ } \
+ } \
+ } \
+ namespace ns_name
+
+#define DOCTEST_TEST_SUITE(decorators) \
+ DOCTEST_TEST_SUITE_IMPL(decorators, DOCTEST_ANONYMOUS(_DOCTEST_ANON_SUITE_))
+
+// for starting a testsuite block
+#define DOCTEST_TEST_SUITE_BEGIN(decorators) \
+ DOCTEST_GLOBAL_NO_WARNINGS(DOCTEST_ANONYMOUS(_DOCTEST_ANON_VAR_)) = \
+ doctest::detail::setTestSuite(doctest::detail::TestSuite() * decorators); \
+ DOCTEST_GLOBAL_NO_WARNINGS_END() \
+ typedef int DOCTEST_ANONYMOUS(_DOCTEST_ANON_FOR_SEMICOLON_)
+
+// for ending a testsuite block
+#define DOCTEST_TEST_SUITE_END \
+ DOCTEST_GLOBAL_NO_WARNINGS(DOCTEST_ANONYMOUS(_DOCTEST_ANON_VAR_)) = \
+ doctest::detail::setTestSuite(doctest::detail::TestSuite() * ""); \
+ DOCTEST_GLOBAL_NO_WARNINGS_END() \
+ typedef int DOCTEST_ANONYMOUS(_DOCTEST_ANON_FOR_SEMICOLON_)
+
+// for registering exception translators
+#define DOCTEST_REGISTER_EXCEPTION_TRANSLATOR_IMPL(translatorName, signature) \
+ inline doctest::String translatorName(signature); \
+ DOCTEST_GLOBAL_NO_WARNINGS(DOCTEST_ANONYMOUS(_DOCTEST_ANON_TRANSLATOR_)) = \
+ doctest::registerExceptionTranslator(translatorName); \
+ DOCTEST_GLOBAL_NO_WARNINGS_END() \
+ doctest::String translatorName(signature)
+
+#define DOCTEST_REGISTER_EXCEPTION_TRANSLATOR(signature) \
+ DOCTEST_REGISTER_EXCEPTION_TRANSLATOR_IMPL(DOCTEST_ANONYMOUS(_DOCTEST_ANON_TRANSLATOR_), \
+ signature)
+
+// for registering reporters
+#define DOCTEST_REGISTER_REPORTER(name, priority, reporter) \
+ DOCTEST_GLOBAL_NO_WARNINGS(DOCTEST_ANONYMOUS(_DOCTEST_ANON_REPORTER_)) = \
+ doctest::registerReporter<reporter>(name, priority, true); \
+ DOCTEST_GLOBAL_NO_WARNINGS_END() typedef int DOCTEST_ANONYMOUS(_DOCTEST_ANON_FOR_SEMICOLON_)
+
+// for registering listeners
+#define DOCTEST_REGISTER_LISTENER(name, priority, reporter) \
+ DOCTEST_GLOBAL_NO_WARNINGS(DOCTEST_ANONYMOUS(_DOCTEST_ANON_REPORTER_)) = \
+ doctest::registerReporter<reporter>(name, priority, false); \
+ DOCTEST_GLOBAL_NO_WARNINGS_END() typedef int DOCTEST_ANONYMOUS(_DOCTEST_ANON_FOR_SEMICOLON_)
+
+// for logging
+#define DOCTEST_INFO(expression) \
+ DOCTEST_INFO_IMPL(DOCTEST_ANONYMOUS(_DOCTEST_CAPTURE_), DOCTEST_ANONYMOUS(_DOCTEST_CAPTURE_), \
+ DOCTEST_ANONYMOUS(_DOCTEST_CAPTURE_), expression)
+
+#define DOCTEST_INFO_IMPL(lambda_name, mb_name, s_name, expression) \
+ DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4626) \
+ auto lambda_name = [&](std::ostream* s_name) { \
+ doctest::detail::MessageBuilder mb_name(__FILE__, __LINE__, doctest::assertType::is_warn); \
+ mb_name.m_stream = s_name; \
+ mb_name << expression; \
+ }; \
+ DOCTEST_MSVC_SUPPRESS_WARNING_POP \
+ auto DOCTEST_ANONYMOUS(_DOCTEST_CAPTURE_) = doctest::detail::MakeContextScope(lambda_name)
+
+#define DOCTEST_CAPTURE(x) DOCTEST_INFO(#x " := " << x)
+
+#define DOCTEST_ADD_AT_IMPL(type, file, line, mb, x) \
+ do { \
+ doctest::detail::MessageBuilder mb(file, line, doctest::assertType::type); \
+ mb << x; \
+ DOCTEST_ASSERT_LOG_AND_REACT(mb); \
+ } while((void)0, 0)
+
+// clang-format off
+#define DOCTEST_ADD_MESSAGE_AT(file, line, x) DOCTEST_ADD_AT_IMPL(is_warn, file, line, DOCTEST_ANONYMOUS(_DOCTEST_MESSAGE_), x)
+#define DOCTEST_ADD_FAIL_CHECK_AT(file, line, x) DOCTEST_ADD_AT_IMPL(is_check, file, line, DOCTEST_ANONYMOUS(_DOCTEST_MESSAGE_), x)
+#define DOCTEST_ADD_FAIL_AT(file, line, x) DOCTEST_ADD_AT_IMPL(is_require, file, line, DOCTEST_ANONYMOUS(_DOCTEST_MESSAGE_), x)
+// clang-format on
+
+#define DOCTEST_MESSAGE(x) DOCTEST_ADD_MESSAGE_AT(__FILE__, __LINE__, x)
+#define DOCTEST_FAIL_CHECK(x) DOCTEST_ADD_FAIL_CHECK_AT(__FILE__, __LINE__, x)
+#define DOCTEST_FAIL(x) DOCTEST_ADD_FAIL_AT(__FILE__, __LINE__, x)
+
+#define DOCTEST_TO_LVALUE(...) __VA_ARGS__ // Not removed to keep backwards compatibility.
+
+#ifndef DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
+#define DOCTEST_ASSERT_IMPLEMENT_2(assert_type, ...) \
+ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Woverloaded-shift-op-parentheses") \
+ doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
+ __LINE__, #__VA_ARGS__); \
+ DOCTEST_WRAP_IN_TRY(_DOCTEST_RB.setResult( \
+ doctest::detail::ExpressionDecomposer(doctest::assertType::assert_type) \
+ << __VA_ARGS__)) \
+ DOCTEST_ASSERT_LOG_AND_REACT(_DOCTEST_RB) \
+ DOCTEST_CLANG_SUPPRESS_WARNING_POP
+
+#define DOCTEST_ASSERT_IMPLEMENT_1(assert_type, ...) \
+ do { \
+ DOCTEST_ASSERT_IMPLEMENT_2(assert_type, __VA_ARGS__); \
+ } while((void)0, 0)
+
+#else // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
+// necessary for <ASSERT>_MESSAGE
+#define DOCTEST_ASSERT_IMPLEMENT_2 DOCTEST_ASSERT_IMPLEMENT_1
+
+#define DOCTEST_ASSERT_IMPLEMENT_1(assert_type, ...) \
+ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Woverloaded-shift-op-parentheses") \
+ doctest::detail::decomp_assert( \
+ doctest::assertType::assert_type, __FILE__, __LINE__, #__VA_ARGS__, \
+ doctest::detail::ExpressionDecomposer(doctest::assertType::assert_type) \
+ << __VA_ARGS__) DOCTEST_CLANG_SUPPRESS_WARNING_POP
+
+#endif // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
+#define DOCTEST_WARN(...) DOCTEST_ASSERT_IMPLEMENT_1(DT_WARN, __VA_ARGS__)
+#define DOCTEST_CHECK(...) DOCTEST_ASSERT_IMPLEMENT_1(DT_CHECK, __VA_ARGS__)
+#define DOCTEST_REQUIRE(...) DOCTEST_ASSERT_IMPLEMENT_1(DT_REQUIRE, __VA_ARGS__)
+#define DOCTEST_WARN_FALSE(...) DOCTEST_ASSERT_IMPLEMENT_1(DT_WARN_FALSE, __VA_ARGS__)
+#define DOCTEST_CHECK_FALSE(...) DOCTEST_ASSERT_IMPLEMENT_1(DT_CHECK_FALSE, __VA_ARGS__)
+#define DOCTEST_REQUIRE_FALSE(...) DOCTEST_ASSERT_IMPLEMENT_1(DT_REQUIRE_FALSE, __VA_ARGS__)
+
+// clang-format off
+#define DOCTEST_WARN_MESSAGE(cond, msg) do { DOCTEST_INFO(msg); DOCTEST_ASSERT_IMPLEMENT_2(DT_WARN, cond); } while((void)0, 0)
+#define DOCTEST_CHECK_MESSAGE(cond, msg) do { DOCTEST_INFO(msg); DOCTEST_ASSERT_IMPLEMENT_2(DT_CHECK, cond); } while((void)0, 0)
+#define DOCTEST_REQUIRE_MESSAGE(cond, msg) do { DOCTEST_INFO(msg); DOCTEST_ASSERT_IMPLEMENT_2(DT_REQUIRE, cond); } while((void)0, 0)
+#define DOCTEST_WARN_FALSE_MESSAGE(cond, msg) do { DOCTEST_INFO(msg); DOCTEST_ASSERT_IMPLEMENT_2(DT_WARN_FALSE, cond); } while((void)0, 0)
+#define DOCTEST_CHECK_FALSE_MESSAGE(cond, msg) do { DOCTEST_INFO(msg); DOCTEST_ASSERT_IMPLEMENT_2(DT_CHECK_FALSE, cond); } while((void)0, 0)
+#define DOCTEST_REQUIRE_FALSE_MESSAGE(cond, msg) do { DOCTEST_INFO(msg); DOCTEST_ASSERT_IMPLEMENT_2(DT_REQUIRE_FALSE, cond); } while((void)0, 0)
+// clang-format on
+
+#define DOCTEST_ASSERT_THROWS_AS(expr, assert_type, message, ...) \
+ do { \
+ if(!doctest::getContextOptions()->no_throw) { \
+ doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
+ __LINE__, #expr, #__VA_ARGS__, message); \
+ try { \
+ DOCTEST_CAST_TO_VOID(expr) \
+ } catch(const doctest::detail::remove_const< \
+ doctest::detail::remove_reference<__VA_ARGS__>::type>::type&) { \
+ _DOCTEST_RB.translateException(); \
+ _DOCTEST_RB.m_threw_as = true; \
+ } catch(...) { _DOCTEST_RB.translateException(); } \
+ DOCTEST_ASSERT_LOG_AND_REACT(_DOCTEST_RB); \
+ } \
+ } while((void)0, 0)
+
+#define DOCTEST_ASSERT_THROWS_WITH(expr, assert_type, ...) \
+ do { \
+ if(!doctest::getContextOptions()->no_throw) { \
+ doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
+ __LINE__, #expr, "", __VA_ARGS__); \
+ try { \
+ DOCTEST_CAST_TO_VOID(expr) \
+ } catch(...) { _DOCTEST_RB.translateException(); } \
+ DOCTEST_ASSERT_LOG_AND_REACT(_DOCTEST_RB); \
+ } \
+ } while((void)0, 0)
+
+#define DOCTEST_ASSERT_NOTHROW(expr, assert_type) \
+ do { \
+ doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
+ __LINE__, #expr); \
+ try { \
+ DOCTEST_CAST_TO_VOID(expr) \
+ } catch(...) { _DOCTEST_RB.translateException(); } \
+ DOCTEST_ASSERT_LOG_AND_REACT(_DOCTEST_RB); \
+ } while((void)0, 0)
+
+// clang-format off
+#define DOCTEST_WARN_THROWS(expr) DOCTEST_ASSERT_THROWS_WITH(expr, DT_WARN_THROWS, "")
+#define DOCTEST_CHECK_THROWS(expr) DOCTEST_ASSERT_THROWS_WITH(expr, DT_CHECK_THROWS, "")
+#define DOCTEST_REQUIRE_THROWS(expr) DOCTEST_ASSERT_THROWS_WITH(expr, DT_REQUIRE_THROWS, "")
+
+#define DOCTEST_WARN_THROWS_AS(expr, ...) DOCTEST_ASSERT_THROWS_AS(expr, DT_WARN_THROWS_AS, "", __VA_ARGS__)
+#define DOCTEST_CHECK_THROWS_AS(expr, ...) DOCTEST_ASSERT_THROWS_AS(expr, DT_CHECK_THROWS_AS, "", __VA_ARGS__)
+#define DOCTEST_REQUIRE_THROWS_AS(expr, ...) DOCTEST_ASSERT_THROWS_AS(expr, DT_REQUIRE_THROWS_AS, "", __VA_ARGS__)
+
+#define DOCTEST_WARN_THROWS_WITH(expr, ...) DOCTEST_ASSERT_THROWS_WITH(expr, DT_WARN_THROWS_WITH, __VA_ARGS__)
+#define DOCTEST_CHECK_THROWS_WITH(expr, ...) DOCTEST_ASSERT_THROWS_WITH(expr, DT_CHECK_THROWS_WITH, __VA_ARGS__)
+#define DOCTEST_REQUIRE_THROWS_WITH(expr, ...) DOCTEST_ASSERT_THROWS_WITH(expr, DT_REQUIRE_THROWS_WITH, __VA_ARGS__)
+
+#define DOCTEST_WARN_THROWS_WITH_AS(expr, message, ...) DOCTEST_ASSERT_THROWS_AS(expr, DT_WARN_THROWS_WITH_AS, message, __VA_ARGS__)
+#define DOCTEST_CHECK_THROWS_WITH_AS(expr, message, ...) DOCTEST_ASSERT_THROWS_AS(expr, DT_CHECK_THROWS_WITH_AS, message, __VA_ARGS__)
+#define DOCTEST_REQUIRE_THROWS_WITH_AS(expr, message, ...) DOCTEST_ASSERT_THROWS_AS(expr, DT_REQUIRE_THROWS_WITH_AS, message, __VA_ARGS__)
+
+#define DOCTEST_WARN_NOTHROW(expr) DOCTEST_ASSERT_NOTHROW(expr, DT_WARN_NOTHROW)
+#define DOCTEST_CHECK_NOTHROW(expr) DOCTEST_ASSERT_NOTHROW(expr, DT_CHECK_NOTHROW)
+#define DOCTEST_REQUIRE_NOTHROW(expr) DOCTEST_ASSERT_NOTHROW(expr, DT_REQUIRE_NOTHROW)
+
+#define DOCTEST_WARN_THROWS_MESSAGE(expr, msg) do { DOCTEST_INFO(msg); DOCTEST_WARN_THROWS(expr); } while((void)0, 0)
+#define DOCTEST_CHECK_THROWS_MESSAGE(expr, msg) do { DOCTEST_INFO(msg); DOCTEST_CHECK_THROWS(expr); } while((void)0, 0)
+#define DOCTEST_REQUIRE_THROWS_MESSAGE(expr, msg) do { DOCTEST_INFO(msg); DOCTEST_REQUIRE_THROWS(expr); } while((void)0, 0)
+#define DOCTEST_WARN_THROWS_AS_MESSAGE(expr, ex, msg) do { DOCTEST_INFO(msg); DOCTEST_WARN_THROWS_AS(expr, ex); } while((void)0, 0)
+#define DOCTEST_CHECK_THROWS_AS_MESSAGE(expr, ex, msg) do { DOCTEST_INFO(msg); DOCTEST_CHECK_THROWS_AS(expr, ex); } while((void)0, 0)
+#define DOCTEST_REQUIRE_THROWS_AS_MESSAGE(expr, ex, msg) do { DOCTEST_INFO(msg); DOCTEST_REQUIRE_THROWS_AS(expr, ex); } while((void)0, 0)
+#define DOCTEST_WARN_THROWS_WITH_MESSAGE(expr, with, msg) do { DOCTEST_INFO(msg); DOCTEST_WARN_THROWS_WITH(expr, with); } while((void)0, 0)
+#define DOCTEST_CHECK_THROWS_WITH_MESSAGE(expr, with, msg) do { DOCTEST_INFO(msg); DOCTEST_CHECK_THROWS_WITH(expr, with); } while((void)0, 0)
+#define DOCTEST_REQUIRE_THROWS_WITH_MESSAGE(expr, with, msg) do { DOCTEST_INFO(msg); DOCTEST_REQUIRE_THROWS_WITH(expr, with); } while((void)0, 0)
+#define DOCTEST_WARN_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) do { DOCTEST_INFO(msg); DOCTEST_WARN_THROWS_WITH_AS(expr, with, ex); } while((void)0, 0)
+#define DOCTEST_CHECK_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) do { DOCTEST_INFO(msg); DOCTEST_CHECK_THROWS_WITH_AS(expr, with, ex); } while((void)0, 0)
+#define DOCTEST_REQUIRE_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) do { DOCTEST_INFO(msg); DOCTEST_REQUIRE_THROWS_WITH_AS(expr, with, ex); } while((void)0, 0)
+#define DOCTEST_WARN_NOTHROW_MESSAGE(expr, msg) do { DOCTEST_INFO(msg); DOCTEST_WARN_NOTHROW(expr); } while((void)0, 0)
+#define DOCTEST_CHECK_NOTHROW_MESSAGE(expr, msg) do { DOCTEST_INFO(msg); DOCTEST_CHECK_NOTHROW(expr); } while((void)0, 0)
+#define DOCTEST_REQUIRE_NOTHROW_MESSAGE(expr, msg) do { DOCTEST_INFO(msg); DOCTEST_REQUIRE_NOTHROW(expr); } while((void)0, 0)
+// clang-format on
+
+#ifndef DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
+#define DOCTEST_BINARY_ASSERT(assert_type, comp, ...) \
+ do { \
+ doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
+ __LINE__, #__VA_ARGS__); \
+ DOCTEST_WRAP_IN_TRY( \
+ _DOCTEST_RB.binary_assert<doctest::detail::binaryAssertComparison::comp>( \
+ __VA_ARGS__)) \
+ DOCTEST_ASSERT_LOG_AND_REACT(_DOCTEST_RB); \
+ } while((void)0, 0)
+
+#define DOCTEST_UNARY_ASSERT(assert_type, ...) \
+ do { \
+ doctest::detail::ResultBuilder _DOCTEST_RB(doctest::assertType::assert_type, __FILE__, \
+ __LINE__, #__VA_ARGS__); \
+ DOCTEST_WRAP_IN_TRY(_DOCTEST_RB.unary_assert(__VA_ARGS__)) \
+ DOCTEST_ASSERT_LOG_AND_REACT(_DOCTEST_RB); \
+ } while((void)0, 0)
+
+#else // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
+#define DOCTEST_BINARY_ASSERT(assert_type, comparison, ...) \
+ doctest::detail::binary_assert<doctest::detail::binaryAssertComparison::comparison>( \
+ doctest::assertType::assert_type, __FILE__, __LINE__, #__VA_ARGS__, __VA_ARGS__)
+
+#define DOCTEST_UNARY_ASSERT(assert_type, ...) \
+ doctest::detail::unary_assert(doctest::assertType::assert_type, __FILE__, __LINE__, \
+ #__VA_ARGS__, __VA_ARGS__)
+
+#endif // DOCTEST_CONFIG_SUPER_FAST_ASSERTS
+
+#define DOCTEST_WARN_EQ(...) DOCTEST_BINARY_ASSERT(DT_WARN_EQ, eq, __VA_ARGS__)
+#define DOCTEST_CHECK_EQ(...) DOCTEST_BINARY_ASSERT(DT_CHECK_EQ, eq, __VA_ARGS__)
+#define DOCTEST_REQUIRE_EQ(...) DOCTEST_BINARY_ASSERT(DT_REQUIRE_EQ, eq, __VA_ARGS__)
+#define DOCTEST_WARN_NE(...) DOCTEST_BINARY_ASSERT(DT_WARN_NE, ne, __VA_ARGS__)
+#define DOCTEST_CHECK_NE(...) DOCTEST_BINARY_ASSERT(DT_CHECK_NE, ne, __VA_ARGS__)
+#define DOCTEST_REQUIRE_NE(...) DOCTEST_BINARY_ASSERT(DT_REQUIRE_NE, ne, __VA_ARGS__)
+#define DOCTEST_WARN_GT(...) DOCTEST_BINARY_ASSERT(DT_WARN_GT, gt, __VA_ARGS__)
+#define DOCTEST_CHECK_GT(...) DOCTEST_BINARY_ASSERT(DT_CHECK_GT, gt, __VA_ARGS__)
+#define DOCTEST_REQUIRE_GT(...) DOCTEST_BINARY_ASSERT(DT_REQUIRE_GT, gt, __VA_ARGS__)
+#define DOCTEST_WARN_LT(...) DOCTEST_BINARY_ASSERT(DT_WARN_LT, lt, __VA_ARGS__)
+#define DOCTEST_CHECK_LT(...) DOCTEST_BINARY_ASSERT(DT_CHECK_LT, lt, __VA_ARGS__)
+#define DOCTEST_REQUIRE_LT(...) DOCTEST_BINARY_ASSERT(DT_REQUIRE_LT, lt, __VA_ARGS__)
+#define DOCTEST_WARN_GE(...) DOCTEST_BINARY_ASSERT(DT_WARN_GE, ge, __VA_ARGS__)
+#define DOCTEST_CHECK_GE(...) DOCTEST_BINARY_ASSERT(DT_CHECK_GE, ge, __VA_ARGS__)
+#define DOCTEST_REQUIRE_GE(...) DOCTEST_BINARY_ASSERT(DT_REQUIRE_GE, ge, __VA_ARGS__)
+#define DOCTEST_WARN_LE(...) DOCTEST_BINARY_ASSERT(DT_WARN_LE, le, __VA_ARGS__)
+#define DOCTEST_CHECK_LE(...) DOCTEST_BINARY_ASSERT(DT_CHECK_LE, le, __VA_ARGS__)
+#define DOCTEST_REQUIRE_LE(...) DOCTEST_BINARY_ASSERT(DT_REQUIRE_LE, le, __VA_ARGS__)
+
+#define DOCTEST_WARN_UNARY(...) DOCTEST_UNARY_ASSERT(DT_WARN_UNARY, __VA_ARGS__)
+#define DOCTEST_CHECK_UNARY(...) DOCTEST_UNARY_ASSERT(DT_CHECK_UNARY, __VA_ARGS__)
+#define DOCTEST_REQUIRE_UNARY(...) DOCTEST_UNARY_ASSERT(DT_REQUIRE_UNARY, __VA_ARGS__)
+#define DOCTEST_WARN_UNARY_FALSE(...) DOCTEST_UNARY_ASSERT(DT_WARN_UNARY_FALSE, __VA_ARGS__)
+#define DOCTEST_CHECK_UNARY_FALSE(...) DOCTEST_UNARY_ASSERT(DT_CHECK_UNARY_FALSE, __VA_ARGS__)
+#define DOCTEST_REQUIRE_UNARY_FALSE(...) DOCTEST_UNARY_ASSERT(DT_REQUIRE_UNARY_FALSE, __VA_ARGS__)
+
+#ifdef DOCTEST_CONFIG_NO_EXCEPTIONS
+
+#undef DOCTEST_WARN_THROWS
+#undef DOCTEST_CHECK_THROWS
+#undef DOCTEST_REQUIRE_THROWS
+#undef DOCTEST_WARN_THROWS_AS
+#undef DOCTEST_CHECK_THROWS_AS
+#undef DOCTEST_REQUIRE_THROWS_AS
+#undef DOCTEST_WARN_THROWS_WITH
+#undef DOCTEST_CHECK_THROWS_WITH
+#undef DOCTEST_REQUIRE_THROWS_WITH
+#undef DOCTEST_WARN_THROWS_WITH_AS
+#undef DOCTEST_CHECK_THROWS_WITH_AS
+#undef DOCTEST_REQUIRE_THROWS_WITH_AS
+#undef DOCTEST_WARN_NOTHROW
+#undef DOCTEST_CHECK_NOTHROW
+#undef DOCTEST_REQUIRE_NOTHROW
+
+#undef DOCTEST_WARN_THROWS_MESSAGE
+#undef DOCTEST_CHECK_THROWS_MESSAGE
+#undef DOCTEST_REQUIRE_THROWS_MESSAGE
+#undef DOCTEST_WARN_THROWS_AS_MESSAGE
+#undef DOCTEST_CHECK_THROWS_AS_MESSAGE
+#undef DOCTEST_REQUIRE_THROWS_AS_MESSAGE
+#undef DOCTEST_WARN_THROWS_WITH_MESSAGE
+#undef DOCTEST_CHECK_THROWS_WITH_MESSAGE
+#undef DOCTEST_REQUIRE_THROWS_WITH_MESSAGE
+#undef DOCTEST_WARN_THROWS_WITH_AS_MESSAGE
+#undef DOCTEST_CHECK_THROWS_WITH_AS_MESSAGE
+#undef DOCTEST_REQUIRE_THROWS_WITH_AS_MESSAGE
+#undef DOCTEST_WARN_NOTHROW_MESSAGE
+#undef DOCTEST_CHECK_NOTHROW_MESSAGE
+#undef DOCTEST_REQUIRE_NOTHROW_MESSAGE
+
+#ifdef DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS
+
+#define DOCTEST_WARN_THROWS(expr) ((void)0)
+#define DOCTEST_CHECK_THROWS(expr) ((void)0)
+#define DOCTEST_REQUIRE_THROWS(expr) ((void)0)
+#define DOCTEST_WARN_THROWS_AS(expr, ...) ((void)0)
+#define DOCTEST_CHECK_THROWS_AS(expr, ...) ((void)0)
+#define DOCTEST_REQUIRE_THROWS_AS(expr, ...) ((void)0)
+#define DOCTEST_WARN_THROWS_WITH(expr, ...) ((void)0)
+#define DOCTEST_CHECK_THROWS_WITH(expr, ...) ((void)0)
+#define DOCTEST_REQUIRE_THROWS_WITH(expr, ...) ((void)0)
+#define DOCTEST_WARN_THROWS_WITH_AS(expr, with, ...) ((void)0)
+#define DOCTEST_CHECK_THROWS_WITH_AS(expr, with, ...) ((void)0)
+#define DOCTEST_REQUIRE_THROWS_WITH_AS(expr, with, ...) ((void)0)
+#define DOCTEST_WARN_NOTHROW(expr) ((void)0)
+#define DOCTEST_CHECK_NOTHROW(expr) ((void)0)
+#define DOCTEST_REQUIRE_NOTHROW(expr) ((void)0)
+
+#define DOCTEST_WARN_THROWS_MESSAGE(expr, msg) ((void)0)
+#define DOCTEST_CHECK_THROWS_MESSAGE(expr, msg) ((void)0)
+#define DOCTEST_REQUIRE_THROWS_MESSAGE(expr, msg) ((void)0)
+#define DOCTEST_WARN_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0)
+#define DOCTEST_CHECK_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0)
+#define DOCTEST_REQUIRE_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0)
+#define DOCTEST_WARN_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0)
+#define DOCTEST_CHECK_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0)
+#define DOCTEST_REQUIRE_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0)
+#define DOCTEST_WARN_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) ((void)0)
+#define DOCTEST_CHECK_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) ((void)0)
+#define DOCTEST_REQUIRE_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) ((void)0)
+#define DOCTEST_WARN_NOTHROW_MESSAGE(expr, msg) ((void)0)
+#define DOCTEST_CHECK_NOTHROW_MESSAGE(expr, msg) ((void)0)
+#define DOCTEST_REQUIRE_NOTHROW_MESSAGE(expr, msg) ((void)0)
+
+#else // DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS
+
+#undef DOCTEST_REQUIRE
+#undef DOCTEST_REQUIRE_FALSE
+#undef DOCTEST_REQUIRE_MESSAGE
+#undef DOCTEST_REQUIRE_FALSE_MESSAGE
+#undef DOCTEST_REQUIRE_EQ
+#undef DOCTEST_REQUIRE_NE
+#undef DOCTEST_REQUIRE_GT
+#undef DOCTEST_REQUIRE_LT
+#undef DOCTEST_REQUIRE_GE
+#undef DOCTEST_REQUIRE_LE
+#undef DOCTEST_REQUIRE_UNARY
+#undef DOCTEST_REQUIRE_UNARY_FALSE
+
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS
+
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
+
+// =================================================================================================
+// == WHAT FOLLOWS IS VERSIONS OF THE MACROS THAT DO NOT DO ANY REGISTERING! ==
+// == THIS CAN BE ENABLED BY DEFINING DOCTEST_CONFIG_DISABLE GLOBALLY! ==
+// =================================================================================================
+#else // DOCTEST_CONFIG_DISABLE
+
+#define DOCTEST_IMPLEMENT_FIXTURE(der, base, func, name) \
+ namespace { \
+ template <typename DOCTEST_UNUSED_TEMPLATE_TYPE> \
+ struct der : public base \
+ { void f(); }; \
+ } \
+ template <typename DOCTEST_UNUSED_TEMPLATE_TYPE> \
+ inline void der<DOCTEST_UNUSED_TEMPLATE_TYPE>::f()
+
+#define DOCTEST_CREATE_AND_REGISTER_FUNCTION(f, name) \
+ template <typename DOCTEST_UNUSED_TEMPLATE_TYPE> \
+ static inline void f()
+
+// for registering tests
+#define DOCTEST_TEST_CASE(name) \
+ DOCTEST_CREATE_AND_REGISTER_FUNCTION(DOCTEST_ANONYMOUS(_DOCTEST_ANON_FUNC_), name)
+
+// for registering tests in classes
+#define DOCTEST_TEST_CASE_CLASS(name) \
+ DOCTEST_CREATE_AND_REGISTER_FUNCTION(DOCTEST_ANONYMOUS(_DOCTEST_ANON_FUNC_), name)
+
+// for registering tests with a fixture
+#define DOCTEST_TEST_CASE_FIXTURE(x, name) \
+ DOCTEST_IMPLEMENT_FIXTURE(DOCTEST_ANONYMOUS(_DOCTEST_ANON_CLASS_), x, \
+ DOCTEST_ANONYMOUS(_DOCTEST_ANON_FUNC_), name)
+
+// for converting types to strings without the <typeinfo> header and demangling
+#define DOCTEST_TYPE_TO_STRING(...) typedef int DOCTEST_ANONYMOUS(_DOCTEST_ANON_FOR_SEMICOLON_)
+#define DOCTEST_TYPE_TO_STRING_IMPL(...)
+
+// for typed tests
+#define DOCTEST_TEST_CASE_TEMPLATE(name, type, ...) \
+ template <typename type> \
+ inline void DOCTEST_ANONYMOUS(_DOCTEST_ANON_TMP_)()
+
+#define DOCTEST_TEST_CASE_TEMPLATE_DEFINE(name, type, id) \
+ template <typename type> \
+ inline void DOCTEST_ANONYMOUS(_DOCTEST_ANON_TMP_)()
+
+#define DOCTEST_TEST_CASE_TEMPLATE_INVOKE(id, ...) \
+ typedef int DOCTEST_ANONYMOUS(_DOCTEST_ANON_FOR_SEMICOLON_)
+
+#define DOCTEST_TEST_CASE_TEMPLATE_APPLY(id, ...) \
+ typedef int DOCTEST_ANONYMOUS(_DOCTEST_ANON_FOR_SEMICOLON_)
+
+// for subcases
+#define DOCTEST_SUBCASE(name)
+
+// for a testsuite block
+#define DOCTEST_TEST_SUITE(name) namespace
+
+// for starting a testsuite block
+#define DOCTEST_TEST_SUITE_BEGIN(name) typedef int DOCTEST_ANONYMOUS(_DOCTEST_ANON_FOR_SEMICOLON_)
+
+// for ending a testsuite block
+#define DOCTEST_TEST_SUITE_END typedef int DOCTEST_ANONYMOUS(_DOCTEST_ANON_FOR_SEMICOLON_)
+
+#define DOCTEST_REGISTER_EXCEPTION_TRANSLATOR(signature) \
+ template <typename DOCTEST_UNUSED_TEMPLATE_TYPE> \
+ static inline doctest::String DOCTEST_ANONYMOUS(_DOCTEST_ANON_TRANSLATOR_)(signature)
+
+#define DOCTEST_REGISTER_REPORTER(name, priority, reporter)
+#define DOCTEST_REGISTER_LISTENER(name, priority, reporter)
+
+#define DOCTEST_INFO(x) ((void)0)
+#define DOCTEST_CAPTURE(x) ((void)0)
+#define DOCTEST_ADD_MESSAGE_AT(file, line, x) ((void)0)
+#define DOCTEST_ADD_FAIL_CHECK_AT(file, line, x) ((void)0)
+#define DOCTEST_ADD_FAIL_AT(file, line, x) ((void)0)
+#define DOCTEST_MESSAGE(x) ((void)0)
+#define DOCTEST_FAIL_CHECK(x) ((void)0)
+#define DOCTEST_FAIL(x) ((void)0)
+
+#define DOCTEST_WARN(...) ((void)0)
+#define DOCTEST_CHECK(...) ((void)0)
+#define DOCTEST_REQUIRE(...) ((void)0)
+#define DOCTEST_WARN_FALSE(...) ((void)0)
+#define DOCTEST_CHECK_FALSE(...) ((void)0)
+#define DOCTEST_REQUIRE_FALSE(...) ((void)0)
+
+#define DOCTEST_WARN_MESSAGE(cond, msg) ((void)0)
+#define DOCTEST_CHECK_MESSAGE(cond, msg) ((void)0)
+#define DOCTEST_REQUIRE_MESSAGE(cond, msg) ((void)0)
+#define DOCTEST_WARN_FALSE_MESSAGE(cond, msg) ((void)0)
+#define DOCTEST_CHECK_FALSE_MESSAGE(cond, msg) ((void)0)
+#define DOCTEST_REQUIRE_FALSE_MESSAGE(cond, msg) ((void)0)
+
+#define DOCTEST_WARN_THROWS(expr) ((void)0)
+#define DOCTEST_CHECK_THROWS(expr) ((void)0)
+#define DOCTEST_REQUIRE_THROWS(expr) ((void)0)
+#define DOCTEST_WARN_THROWS_AS(expr, ...) ((void)0)
+#define DOCTEST_CHECK_THROWS_AS(expr, ...) ((void)0)
+#define DOCTEST_REQUIRE_THROWS_AS(expr, ...) ((void)0)
+#define DOCTEST_WARN_THROWS_WITH(expr, ...) ((void)0)
+#define DOCTEST_CHECK_THROWS_WITH(expr, ...) ((void)0)
+#define DOCTEST_REQUIRE_THROWS_WITH(expr, ...) ((void)0)
+#define DOCTEST_WARN_THROWS_WITH_AS(expr, with, ...) ((void)0)
+#define DOCTEST_CHECK_THROWS_WITH_AS(expr, with, ...) ((void)0)
+#define DOCTEST_REQUIRE_THROWS_WITH_AS(expr, with, ...) ((void)0)
+#define DOCTEST_WARN_NOTHROW(expr) ((void)0)
+#define DOCTEST_CHECK_NOTHROW(expr) ((void)0)
+#define DOCTEST_REQUIRE_NOTHROW(expr) ((void)0)
+
+#define DOCTEST_WARN_THROWS_MESSAGE(expr, msg) ((void)0)
+#define DOCTEST_CHECK_THROWS_MESSAGE(expr, msg) ((void)0)
+#define DOCTEST_REQUIRE_THROWS_MESSAGE(expr, msg) ((void)0)
+#define DOCTEST_WARN_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0)
+#define DOCTEST_CHECK_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0)
+#define DOCTEST_REQUIRE_THROWS_AS_MESSAGE(expr, ex, msg) ((void)0)
+#define DOCTEST_WARN_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0)
+#define DOCTEST_CHECK_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0)
+#define DOCTEST_REQUIRE_THROWS_WITH_MESSAGE(expr, with, msg) ((void)0)
+#define DOCTEST_WARN_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) ((void)0)
+#define DOCTEST_CHECK_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) ((void)0)
+#define DOCTEST_REQUIRE_THROWS_WITH_AS_MESSAGE(expr, with, ex, msg) ((void)0)
+#define DOCTEST_WARN_NOTHROW_MESSAGE(expr, msg) ((void)0)
+#define DOCTEST_CHECK_NOTHROW_MESSAGE(expr, msg) ((void)0)
+#define DOCTEST_REQUIRE_NOTHROW_MESSAGE(expr, msg) ((void)0)
+
+#define DOCTEST_WARN_EQ(...) ((void)0)
+#define DOCTEST_CHECK_EQ(...) ((void)0)
+#define DOCTEST_REQUIRE_EQ(...) ((void)0)
+#define DOCTEST_WARN_NE(...) ((void)0)
+#define DOCTEST_CHECK_NE(...) ((void)0)
+#define DOCTEST_REQUIRE_NE(...) ((void)0)
+#define DOCTEST_WARN_GT(...) ((void)0)
+#define DOCTEST_CHECK_GT(...) ((void)0)
+#define DOCTEST_REQUIRE_GT(...) ((void)0)
+#define DOCTEST_WARN_LT(...) ((void)0)
+#define DOCTEST_CHECK_LT(...) ((void)0)
+#define DOCTEST_REQUIRE_LT(...) ((void)0)
+#define DOCTEST_WARN_GE(...) ((void)0)
+#define DOCTEST_CHECK_GE(...) ((void)0)
+#define DOCTEST_REQUIRE_GE(...) ((void)0)
+#define DOCTEST_WARN_LE(...) ((void)0)
+#define DOCTEST_CHECK_LE(...) ((void)0)
+#define DOCTEST_REQUIRE_LE(...) ((void)0)
+
+#define DOCTEST_WARN_UNARY(...) ((void)0)
+#define DOCTEST_CHECK_UNARY(...) ((void)0)
+#define DOCTEST_REQUIRE_UNARY(...) ((void)0)
+#define DOCTEST_WARN_UNARY_FALSE(...) ((void)0)
+#define DOCTEST_CHECK_UNARY_FALSE(...) ((void)0)
+#define DOCTEST_REQUIRE_UNARY_FALSE(...) ((void)0)
+
+#endif // DOCTEST_CONFIG_DISABLE
+
+// clang-format off
+// KEPT FOR BACKWARDS COMPATIBILITY - FORWARDING TO THE RIGHT MACROS
+#define DOCTEST_FAST_WARN_EQ DOCTEST_WARN_EQ
+#define DOCTEST_FAST_CHECK_EQ DOCTEST_CHECK_EQ
+#define DOCTEST_FAST_REQUIRE_EQ DOCTEST_REQUIRE_EQ
+#define DOCTEST_FAST_WARN_NE DOCTEST_WARN_NE
+#define DOCTEST_FAST_CHECK_NE DOCTEST_CHECK_NE
+#define DOCTEST_FAST_REQUIRE_NE DOCTEST_REQUIRE_NE
+#define DOCTEST_FAST_WARN_GT DOCTEST_WARN_GT
+#define DOCTEST_FAST_CHECK_GT DOCTEST_CHECK_GT
+#define DOCTEST_FAST_REQUIRE_GT DOCTEST_REQUIRE_GT
+#define DOCTEST_FAST_WARN_LT DOCTEST_WARN_LT
+#define DOCTEST_FAST_CHECK_LT DOCTEST_CHECK_LT
+#define DOCTEST_FAST_REQUIRE_LT DOCTEST_REQUIRE_LT
+#define DOCTEST_FAST_WARN_GE DOCTEST_WARN_GE
+#define DOCTEST_FAST_CHECK_GE DOCTEST_CHECK_GE
+#define DOCTEST_FAST_REQUIRE_GE DOCTEST_REQUIRE_GE
+#define DOCTEST_FAST_WARN_LE DOCTEST_WARN_LE
+#define DOCTEST_FAST_CHECK_LE DOCTEST_CHECK_LE
+#define DOCTEST_FAST_REQUIRE_LE DOCTEST_REQUIRE_LE
+
+#define DOCTEST_FAST_WARN_UNARY DOCTEST_WARN_UNARY
+#define DOCTEST_FAST_CHECK_UNARY DOCTEST_CHECK_UNARY
+#define DOCTEST_FAST_REQUIRE_UNARY DOCTEST_REQUIRE_UNARY
+#define DOCTEST_FAST_WARN_UNARY_FALSE DOCTEST_WARN_UNARY_FALSE
+#define DOCTEST_FAST_CHECK_UNARY_FALSE DOCTEST_CHECK_UNARY_FALSE
+#define DOCTEST_FAST_REQUIRE_UNARY_FALSE DOCTEST_REQUIRE_UNARY_FALSE
+
+#define DOCTEST_TEST_CASE_TEMPLATE_INSTANTIATE DOCTEST_TEST_CASE_TEMPLATE_INVOKE
+// clang-format on
+
+// BDD style macros
+// clang-format off
+#define DOCTEST_SCENARIO(name) DOCTEST_TEST_CASE(" Scenario: " name)
+#define DOCTEST_SCENARIO_CLASS(name) DOCTEST_TEST_CASE_CLASS(" Scenario: " name)
+#define DOCTEST_SCENARIO_TEMPLATE(name, T, ...) DOCTEST_TEST_CASE_TEMPLATE(" Scenario: " name, T, __VA_ARGS__)
+#define DOCTEST_SCENARIO_TEMPLATE_DEFINE(name, T, id) DOCTEST_TEST_CASE_TEMPLATE_DEFINE(" Scenario: " name, T, id)
+
+#define DOCTEST_GIVEN(name) DOCTEST_SUBCASE(" Given: " name)
+#define DOCTEST_WHEN(name) DOCTEST_SUBCASE(" When: " name)
+#define DOCTEST_AND_WHEN(name) DOCTEST_SUBCASE("And when: " name)
+#define DOCTEST_THEN(name) DOCTEST_SUBCASE(" Then: " name)
+#define DOCTEST_AND_THEN(name) DOCTEST_SUBCASE(" And: " name)
+// clang-format on
+
+// == SHORT VERSIONS OF THE MACROS
+#if !defined(DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES)
+
+#define TEST_CASE DOCTEST_TEST_CASE
+#define TEST_CASE_CLASS DOCTEST_TEST_CASE_CLASS
+#define TEST_CASE_FIXTURE DOCTEST_TEST_CASE_FIXTURE
+#define TYPE_TO_STRING DOCTEST_TYPE_TO_STRING
+#define TEST_CASE_TEMPLATE DOCTEST_TEST_CASE_TEMPLATE
+#define TEST_CASE_TEMPLATE_DEFINE DOCTEST_TEST_CASE_TEMPLATE_DEFINE
+#define TEST_CASE_TEMPLATE_INVOKE DOCTEST_TEST_CASE_TEMPLATE_INVOKE
+#define TEST_CASE_TEMPLATE_APPLY DOCTEST_TEST_CASE_TEMPLATE_APPLY
+#define SUBCASE DOCTEST_SUBCASE
+#define TEST_SUITE DOCTEST_TEST_SUITE
+#define TEST_SUITE_BEGIN DOCTEST_TEST_SUITE_BEGIN
+#define TEST_SUITE_END DOCTEST_TEST_SUITE_END
+#define REGISTER_EXCEPTION_TRANSLATOR DOCTEST_REGISTER_EXCEPTION_TRANSLATOR
+#define REGISTER_REPORTER DOCTEST_REGISTER_REPORTER
+#define REGISTER_LISTENER DOCTEST_REGISTER_LISTENER
+#define INFO DOCTEST_INFO
+#define CAPTURE DOCTEST_CAPTURE
+#define ADD_MESSAGE_AT DOCTEST_ADD_MESSAGE_AT
+#define ADD_FAIL_CHECK_AT DOCTEST_ADD_FAIL_CHECK_AT
+#define ADD_FAIL_AT DOCTEST_ADD_FAIL_AT
+#define MESSAGE DOCTEST_MESSAGE
+#define FAIL_CHECK DOCTEST_FAIL_CHECK
+#define FAIL DOCTEST_FAIL
+#define TO_LVALUE DOCTEST_TO_LVALUE
+
+#define WARN DOCTEST_WARN
+#define WARN_FALSE DOCTEST_WARN_FALSE
+#define WARN_THROWS DOCTEST_WARN_THROWS
+#define WARN_THROWS_AS DOCTEST_WARN_THROWS_AS
+#define WARN_THROWS_WITH DOCTEST_WARN_THROWS_WITH
+#define WARN_THROWS_WITH_AS DOCTEST_WARN_THROWS_WITH_AS
+#define WARN_NOTHROW DOCTEST_WARN_NOTHROW
+#define CHECK DOCTEST_CHECK
+#define CHECK_FALSE DOCTEST_CHECK_FALSE
+#define CHECK_THROWS DOCTEST_CHECK_THROWS
+#define CHECK_THROWS_AS DOCTEST_CHECK_THROWS_AS
+#define CHECK_THROWS_WITH DOCTEST_CHECK_THROWS_WITH
+#define CHECK_THROWS_WITH_AS DOCTEST_CHECK_THROWS_WITH_AS
+#define CHECK_NOTHROW DOCTEST_CHECK_NOTHROW
+#define REQUIRE DOCTEST_REQUIRE
+#define REQUIRE_FALSE DOCTEST_REQUIRE_FALSE
+#define REQUIRE_THROWS DOCTEST_REQUIRE_THROWS
+#define REQUIRE_THROWS_AS DOCTEST_REQUIRE_THROWS_AS
+#define REQUIRE_THROWS_WITH DOCTEST_REQUIRE_THROWS_WITH
+#define REQUIRE_THROWS_WITH_AS DOCTEST_REQUIRE_THROWS_WITH_AS
+#define REQUIRE_NOTHROW DOCTEST_REQUIRE_NOTHROW
+
+#define WARN_MESSAGE DOCTEST_WARN_MESSAGE
+#define WARN_FALSE_MESSAGE DOCTEST_WARN_FALSE_MESSAGE
+#define WARN_THROWS_MESSAGE DOCTEST_WARN_THROWS_MESSAGE
+#define WARN_THROWS_AS_MESSAGE DOCTEST_WARN_THROWS_AS_MESSAGE
+#define WARN_THROWS_WITH_MESSAGE DOCTEST_WARN_THROWS_WITH_MESSAGE
+#define WARN_THROWS_WITH_AS_MESSAGE DOCTEST_WARN_THROWS_WITH_AS_MESSAGE
+#define WARN_NOTHROW_MESSAGE DOCTEST_WARN_NOTHROW_MESSAGE
+#define CHECK_MESSAGE DOCTEST_CHECK_MESSAGE
+#define CHECK_FALSE_MESSAGE DOCTEST_CHECK_FALSE_MESSAGE
+#define CHECK_THROWS_MESSAGE DOCTEST_CHECK_THROWS_MESSAGE
+#define CHECK_THROWS_AS_MESSAGE DOCTEST_CHECK_THROWS_AS_MESSAGE
+#define CHECK_THROWS_WITH_MESSAGE DOCTEST_CHECK_THROWS_WITH_MESSAGE
+#define CHECK_THROWS_WITH_AS_MESSAGE DOCTEST_CHECK_THROWS_WITH_AS_MESSAGE
+#define CHECK_NOTHROW_MESSAGE DOCTEST_CHECK_NOTHROW_MESSAGE
+#define REQUIRE_MESSAGE DOCTEST_REQUIRE_MESSAGE
+#define REQUIRE_FALSE_MESSAGE DOCTEST_REQUIRE_FALSE_MESSAGE
+#define REQUIRE_THROWS_MESSAGE DOCTEST_REQUIRE_THROWS_MESSAGE
+#define REQUIRE_THROWS_AS_MESSAGE DOCTEST_REQUIRE_THROWS_AS_MESSAGE
+#define REQUIRE_THROWS_WITH_MESSAGE DOCTEST_REQUIRE_THROWS_WITH_MESSAGE
+#define REQUIRE_THROWS_WITH_AS_MESSAGE DOCTEST_REQUIRE_THROWS_WITH_AS_MESSAGE
+#define REQUIRE_NOTHROW_MESSAGE DOCTEST_REQUIRE_NOTHROW_MESSAGE
+
+#define SCENARIO DOCTEST_SCENARIO
+#define SCENARIO_CLASS DOCTEST_SCENARIO_CLASS
+#define SCENARIO_TEMPLATE DOCTEST_SCENARIO_TEMPLATE
+#define SCENARIO_TEMPLATE_DEFINE DOCTEST_SCENARIO_TEMPLATE_DEFINE
+#define GIVEN DOCTEST_GIVEN
+#define WHEN DOCTEST_WHEN
+#define AND_WHEN DOCTEST_AND_WHEN
+#define THEN DOCTEST_THEN
+#define AND_THEN DOCTEST_AND_THEN
+
+#define WARN_EQ DOCTEST_WARN_EQ
+#define CHECK_EQ DOCTEST_CHECK_EQ
+#define REQUIRE_EQ DOCTEST_REQUIRE_EQ
+#define WARN_NE DOCTEST_WARN_NE
+#define CHECK_NE DOCTEST_CHECK_NE
+#define REQUIRE_NE DOCTEST_REQUIRE_NE
+#define WARN_GT DOCTEST_WARN_GT
+#define CHECK_GT DOCTEST_CHECK_GT
+#define REQUIRE_GT DOCTEST_REQUIRE_GT
+#define WARN_LT DOCTEST_WARN_LT
+#define CHECK_LT DOCTEST_CHECK_LT
+#define REQUIRE_LT DOCTEST_REQUIRE_LT
+#define WARN_GE DOCTEST_WARN_GE
+#define CHECK_GE DOCTEST_CHECK_GE
+#define REQUIRE_GE DOCTEST_REQUIRE_GE
+#define WARN_LE DOCTEST_WARN_LE
+#define CHECK_LE DOCTEST_CHECK_LE
+#define REQUIRE_LE DOCTEST_REQUIRE_LE
+#define WARN_UNARY DOCTEST_WARN_UNARY
+#define CHECK_UNARY DOCTEST_CHECK_UNARY
+#define REQUIRE_UNARY DOCTEST_REQUIRE_UNARY
+#define WARN_UNARY_FALSE DOCTEST_WARN_UNARY_FALSE
+#define CHECK_UNARY_FALSE DOCTEST_CHECK_UNARY_FALSE
+#define REQUIRE_UNARY_FALSE DOCTEST_REQUIRE_UNARY_FALSE
+
+// KEPT FOR BACKWARDS COMPATIBILITY
+#define FAST_WARN_EQ DOCTEST_FAST_WARN_EQ
+#define FAST_CHECK_EQ DOCTEST_FAST_CHECK_EQ
+#define FAST_REQUIRE_EQ DOCTEST_FAST_REQUIRE_EQ
+#define FAST_WARN_NE DOCTEST_FAST_WARN_NE
+#define FAST_CHECK_NE DOCTEST_FAST_CHECK_NE
+#define FAST_REQUIRE_NE DOCTEST_FAST_REQUIRE_NE
+#define FAST_WARN_GT DOCTEST_FAST_WARN_GT
+#define FAST_CHECK_GT DOCTEST_FAST_CHECK_GT
+#define FAST_REQUIRE_GT DOCTEST_FAST_REQUIRE_GT
+#define FAST_WARN_LT DOCTEST_FAST_WARN_LT
+#define FAST_CHECK_LT DOCTEST_FAST_CHECK_LT
+#define FAST_REQUIRE_LT DOCTEST_FAST_REQUIRE_LT
+#define FAST_WARN_GE DOCTEST_FAST_WARN_GE
+#define FAST_CHECK_GE DOCTEST_FAST_CHECK_GE
+#define FAST_REQUIRE_GE DOCTEST_FAST_REQUIRE_GE
+#define FAST_WARN_LE DOCTEST_FAST_WARN_LE
+#define FAST_CHECK_LE DOCTEST_FAST_CHECK_LE
+#define FAST_REQUIRE_LE DOCTEST_FAST_REQUIRE_LE
+
+#define FAST_WARN_UNARY DOCTEST_FAST_WARN_UNARY
+#define FAST_CHECK_UNARY DOCTEST_FAST_CHECK_UNARY
+#define FAST_REQUIRE_UNARY DOCTEST_FAST_REQUIRE_UNARY
+#define FAST_WARN_UNARY_FALSE DOCTEST_FAST_WARN_UNARY_FALSE
+#define FAST_CHECK_UNARY_FALSE DOCTEST_FAST_CHECK_UNARY_FALSE
+#define FAST_REQUIRE_UNARY_FALSE DOCTEST_FAST_REQUIRE_UNARY_FALSE
+
+#define TEST_CASE_TEMPLATE_INSTANTIATE DOCTEST_TEST_CASE_TEMPLATE_INSTANTIATE
+
+#endif // DOCTEST_CONFIG_NO_SHORT_MACRO_NAMES
+
+#if !defined(DOCTEST_CONFIG_DISABLE)
+
+// this is here to clear the 'current test suite' for the current translation unit - at the top
+DOCTEST_TEST_SUITE_END();
+
+// add stringification for primitive/fundamental types
+namespace doctest { namespace detail {
+ DOCTEST_TYPE_TO_STRING_IMPL(bool)
+ DOCTEST_TYPE_TO_STRING_IMPL(float)
+ DOCTEST_TYPE_TO_STRING_IMPL(double)
+ DOCTEST_TYPE_TO_STRING_IMPL(long double)
+ DOCTEST_TYPE_TO_STRING_IMPL(char)
+ DOCTEST_TYPE_TO_STRING_IMPL(signed char)
+ DOCTEST_TYPE_TO_STRING_IMPL(unsigned char)
+#if !DOCTEST_MSVC || defined(_NATIVE_WCHAR_T_DEFINED)
+ DOCTEST_TYPE_TO_STRING_IMPL(wchar_t)
+#endif // not MSVC or wchar_t support enabled
+ DOCTEST_TYPE_TO_STRING_IMPL(short int)
+ DOCTEST_TYPE_TO_STRING_IMPL(unsigned short int)
+ DOCTEST_TYPE_TO_STRING_IMPL(int)
+ DOCTEST_TYPE_TO_STRING_IMPL(unsigned int)
+ DOCTEST_TYPE_TO_STRING_IMPL(long int)
+ DOCTEST_TYPE_TO_STRING_IMPL(unsigned long int)
+ DOCTEST_TYPE_TO_STRING_IMPL(long long int)
+ DOCTEST_TYPE_TO_STRING_IMPL(unsigned long long int)
+}} // namespace doctest::detail
+
+#endif // DOCTEST_CONFIG_DISABLE
+
+DOCTEST_CLANG_SUPPRESS_WARNING_POP
+DOCTEST_MSVC_SUPPRESS_WARNING_POP
+DOCTEST_GCC_SUPPRESS_WARNING_POP
+
+#endif // DOCTEST_LIBRARY_INCLUDED
+
+#ifndef DOCTEST_SINGLE_HEADER
+#define DOCTEST_SINGLE_HEADER
+#endif // DOCTEST_SINGLE_HEADER
+
+#if defined(DOCTEST_CONFIG_IMPLEMENT) || !defined(DOCTEST_SINGLE_HEADER)
+
+#ifndef DOCTEST_SINGLE_HEADER
+#include "doctest_fwd.h"
+#endif // DOCTEST_SINGLE_HEADER
+
+DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wunused-macros")
+
+#ifndef DOCTEST_LIBRARY_IMPLEMENTATION
+#define DOCTEST_LIBRARY_IMPLEMENTATION
+
+DOCTEST_CLANG_SUPPRESS_WARNING_POP
+
+DOCTEST_CLANG_SUPPRESS_WARNING_PUSH
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wunknown-pragmas")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wpadded")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wweak-vtables")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wglobal-constructors")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wexit-time-destructors")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-prototypes")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wsign-conversion")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wshorten-64-to-32")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-variable-declarations")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wswitch")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wswitch-enum")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wcovered-switch-default")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-noreturn")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wunused-local-typedef")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wdisabled-macro-expansion")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-braces")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-field-initializers")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wc++98-compat")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wc++98-compat-pedantic")
+DOCTEST_CLANG_SUPPRESS_WARNING("-Wunused-member-function")
+
+DOCTEST_GCC_SUPPRESS_WARNING_PUSH
+DOCTEST_GCC_SUPPRESS_WARNING("-Wunknown-pragmas")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wpragmas")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wconversion")
+DOCTEST_GCC_SUPPRESS_WARNING("-Weffc++")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wsign-conversion")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wstrict-overflow")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wstrict-aliasing")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-field-initializers")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-braces")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-declarations")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wswitch")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wswitch-enum")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wswitch-default")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wunsafe-loop-optimizations")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wold-style-cast")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wunused-local-typedefs")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wuseless-cast")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wunused-function")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wmultiple-inheritance")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wnoexcept")
+DOCTEST_GCC_SUPPRESS_WARNING("-Wsuggest-attribute")
+
+DOCTEST_MSVC_SUPPRESS_WARNING_PUSH
+DOCTEST_MSVC_SUPPRESS_WARNING(4616) // invalid compiler warning
+DOCTEST_MSVC_SUPPRESS_WARNING(4619) // invalid compiler warning
+DOCTEST_MSVC_SUPPRESS_WARNING(4996) // The compiler encountered a deprecated declaration
+DOCTEST_MSVC_SUPPRESS_WARNING(4267) // 'var' : conversion from 'x' to 'y', possible loss of data
+DOCTEST_MSVC_SUPPRESS_WARNING(4706) // assignment within conditional expression
+DOCTEST_MSVC_SUPPRESS_WARNING(4512) // 'class' : assignment operator could not be generated
+DOCTEST_MSVC_SUPPRESS_WARNING(4127) // conditional expression is constant
+DOCTEST_MSVC_SUPPRESS_WARNING(4530) // C++ exception handler used, but unwind semantics not enabled
+DOCTEST_MSVC_SUPPRESS_WARNING(4577) // 'noexcept' used with no exception handling mode specified
+DOCTEST_MSVC_SUPPRESS_WARNING(4774) // format string expected in argument is not a string literal
+DOCTEST_MSVC_SUPPRESS_WARNING(4365) // conversion from 'int' to 'unsigned', signed/unsigned mismatch
+DOCTEST_MSVC_SUPPRESS_WARNING(4820) // padding in structs
+DOCTEST_MSVC_SUPPRESS_WARNING(4640) // construction of local static object is not thread-safe
+DOCTEST_MSVC_SUPPRESS_WARNING(5039) // pointer to potentially throwing function passed to extern C
+DOCTEST_MSVC_SUPPRESS_WARNING(5045) // Spectre mitigation stuff
+DOCTEST_MSVC_SUPPRESS_WARNING(4626) // assignment operator was implicitly defined as deleted
+DOCTEST_MSVC_SUPPRESS_WARNING(5027) // move assignment operator was implicitly defined as deleted
+DOCTEST_MSVC_SUPPRESS_WARNING(5026) // move constructor was implicitly defined as deleted
+DOCTEST_MSVC_SUPPRESS_WARNING(4625) // copy constructor was implicitly defined as deleted
+DOCTEST_MSVC_SUPPRESS_WARNING(4800) // forcing value to bool 'true' or 'false' (performance warning)
+// static analysis
+DOCTEST_MSVC_SUPPRESS_WARNING(26439) // This kind of function may not throw. Declare it 'noexcept'
+DOCTEST_MSVC_SUPPRESS_WARNING(26495) // Always initialize a member variable
+DOCTEST_MSVC_SUPPRESS_WARNING(26451) // Arithmetic overflow ...
+DOCTEST_MSVC_SUPPRESS_WARNING(26444) // Avoid unnamed objects with custom construction and dtor...
+DOCTEST_MSVC_SUPPRESS_WARNING(26812) // Prefer 'enum class' over 'enum'
+
+DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN
+
+// required includes - will go only in one translation unit!
+#include <ctime>
+#include <cmath>
+#include <climits>
+// borland (Embarcadero) compiler requires math.h and not cmath - https://github.com/onqtam/doctest/pull/37
+#ifdef __BORLANDC__
+#include <math.h>
+#endif // __BORLANDC__
+#include <new>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <limits>
+#include <utility>
+#include <fstream>
+#include <sstream>
+#include <iostream>
+#include <algorithm>
+#include <iomanip>
+#include <vector>
+#include <atomic>
+#include <mutex>
+#include <set>
+#include <map>
+#include <exception>
+#include <stdexcept>
+#ifdef DOCTEST_CONFIG_POSIX_SIGNALS
+#include <csignal>
+#endif // DOCTEST_CONFIG_POSIX_SIGNALS
+#include <cfloat>
+#include <cctype>
+#include <cstdint>
+
+#ifdef DOCTEST_PLATFORM_MAC
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/sysctl.h>
+#endif // DOCTEST_PLATFORM_MAC
+
+#ifdef DOCTEST_PLATFORM_WINDOWS
+
+// defines for a leaner windows.h
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif // WIN32_LEAN_AND_MEAN
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif // NOMINMAX
+
+// not sure what AfxWin.h is for - here I do what Catch does
+#ifdef __AFXDLL
+#include <AfxWin.h>
+#else
+#include <Windows.h>
+#endif
+#include <io.h>
+
+#else // DOCTEST_PLATFORM_WINDOWS
+
+#include <sys/time.h>
+#include <unistd.h>
+
+#endif // DOCTEST_PLATFORM_WINDOWS
+
+DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END
+
+// counts the number of elements in a C array
+#define DOCTEST_COUNTOF(x) (sizeof(x) / sizeof(x[0]))
+
+#ifdef DOCTEST_CONFIG_DISABLE
+#define DOCTEST_BRANCH_ON_DISABLED(if_disabled, if_not_disabled) if_disabled
+#else // DOCTEST_CONFIG_DISABLE
+#define DOCTEST_BRANCH_ON_DISABLED(if_disabled, if_not_disabled) if_not_disabled
+#endif // DOCTEST_CONFIG_DISABLE
+
+#ifndef DOCTEST_CONFIG_OPTIONS_PREFIX
+#define DOCTEST_CONFIG_OPTIONS_PREFIX "dt-"
+#endif
+
+#ifndef DOCTEST_THREAD_LOCAL
+#define DOCTEST_THREAD_LOCAL thread_local
+#endif
+
+#ifdef DOCTEST_CONFIG_NO_UNPREFIXED_OPTIONS
+#define DOCTEST_OPTIONS_PREFIX_DISPLAY DOCTEST_CONFIG_OPTIONS_PREFIX
+#else
+#define DOCTEST_OPTIONS_PREFIX_DISPLAY ""
+#endif
+
+namespace doctest {
+
+bool is_running_in_test = false;
+
+namespace {
+ using namespace detail;
+ // case insensitive strcmp
+ int stricmp(const char* a, const char* b) {
+ for(;; a++, b++) {
+ const int d = tolower(*a) - tolower(*b);
+ if(d != 0 || !*a)
+ return d;
+ }
+ }
+
+ template <typename T>
+ String fpToString(T value, int precision) {
+ std::ostringstream oss;
+ oss << std::setprecision(precision) << std::fixed << value;
+ std::string d = oss.str();
+ size_t i = d.find_last_not_of('0');
+ if(i != std::string::npos && i != d.size() - 1) {
+ if(d[i] == '.')
+ i++;
+ d = d.substr(0, i + 1);
+ }
+ return d.c_str();
+ }
+
+ struct Endianness
+ {
+ enum Arch
+ {
+ Big,
+ Little
+ };
+
+ static Arch which() {
+ int x = 1;
+ // casting any data pointer to char* is allowed
+ auto ptr = reinterpret_cast<char*>(&x);
+ if(*ptr)
+ return Little;
+ return Big;
+ }
+ };
+} // namespace
+
+namespace detail {
+ void my_memcpy(void* dest, const void* src, unsigned num) { memcpy(dest, src, num); }
+
+ String rawMemoryToString(const void* object, unsigned size) {
+ // Reverse order for little endian architectures
+ int i = 0, end = static_cast<int>(size), inc = 1;
+ if(Endianness::which() == Endianness::Little) {
+ i = end - 1;
+ end = inc = -1;
+ }
+
+ unsigned const char* bytes = static_cast<unsigned const char*>(object);
+ std::ostringstream oss;
+ oss << "0x" << std::setfill('0') << std::hex;
+ for(; i != end; i += inc)
+ oss << std::setw(2) << static_cast<unsigned>(bytes[i]);
+ return oss.str().c_str();
+ }
+
+ DOCTEST_THREAD_LOCAL std::ostringstream g_oss; // NOLINT(cert-err58-cpp)
+
+ std::ostream* getTlsOss() {
+ g_oss.clear(); // there shouldn't be anything worth clearing in the flags
+ g_oss.str(""); // the slow way of resetting a string stream
+ //g_oss.seekp(0); // optimal reset - as seen here: https://stackoverflow.com/a/624291/3162383
+ return &g_oss;
+ }
+
+ String getTlsOssResult() {
+ //g_oss << std::ends; // needed - as shown here: https://stackoverflow.com/a/624291/3162383
+ return g_oss.str().c_str();
+ }
+
+#ifndef DOCTEST_CONFIG_DISABLE
+
+namespace timer_large_integer
+{
+
+#if defined(DOCTEST_PLATFORM_WINDOWS)
+ typedef ULONGLONG type;
+#else // DOCTEST_PLATFORM_WINDOWS
+ using namespace std;
+ typedef uint64_t type;
+#endif // DOCTEST_PLATFORM_WINDOWS
+}
+
+typedef timer_large_integer::type ticks_t;
+
+#ifdef DOCTEST_CONFIG_GETCURRENTTICKS
+ ticks_t getCurrentTicks() { return DOCTEST_CONFIG_GETCURRENTTICKS(); }
+#elif defined(DOCTEST_PLATFORM_WINDOWS)
+ ticks_t getCurrentTicks() {
+ static LARGE_INTEGER hz = {0}, hzo = {0};
+ if(!hz.QuadPart) {
+ QueryPerformanceFrequency(&hz);
+ QueryPerformanceCounter(&hzo);
+ }
+ LARGE_INTEGER t;
+ QueryPerformanceCounter(&t);
+ return ((t.QuadPart - hzo.QuadPart) * LONGLONG(1000000)) / hz.QuadPart;
+ }
+#else // DOCTEST_PLATFORM_WINDOWS
+ ticks_t getCurrentTicks() {
+ timeval t;
+ gettimeofday(&t, nullptr);
+ return static_cast<ticks_t>(t.tv_sec) * 1000000 + static_cast<ticks_t>(t.tv_usec);
+ }
+#endif // DOCTEST_PLATFORM_WINDOWS
+
+ struct Timer
+ {
+ void start() { m_ticks = getCurrentTicks(); }
+ unsigned int getElapsedMicroseconds() const {
+ return static_cast<unsigned int>(getCurrentTicks() - m_ticks);
+ }
+ //unsigned int getElapsedMilliseconds() const {
+ // return static_cast<unsigned int>(getElapsedMicroseconds() / 1000);
+ //}
+ double getElapsedSeconds() const { return (getCurrentTicks() - m_ticks) / 1000000.0; }
+
+ private:
+ ticks_t m_ticks = 0;
+ };
+
+ // this holds both parameters from the command line and runtime data for tests
+ struct ContextState : ContextOptions, TestRunStats, CurrentTestCaseStats
+ {
+ std::atomic<int> numAssertsCurrentTest_atomic;
+ std::atomic<int> numAssertsFailedCurrentTest_atomic;
+
+ std::vector<std::vector<String>> filters = decltype(filters)(9); // 9 different filters
+
+ std::vector<IReporter*> reporters_currently_used;
+
+ const TestCase* currentTest = nullptr;
+
+ assert_handler ah = nullptr;
+
+ Timer timer;
+
+ std::vector<String> stringifiedContexts; // logging from INFO() due to an exception
+
+ // stuff for subcases
+ std::vector<SubcaseSignature> subcasesStack;
+ std::set<decltype(subcasesStack)> subcasesPassed;
+ int subcasesCurrentMaxLevel;
+ bool should_reenter;
+ std::atomic<bool> shouldLogCurrentException;
+
+ void resetRunData() {
+ numTestCases = 0;
+ numTestCasesPassingFilters = 0;
+ numTestSuitesPassingFilters = 0;
+ numTestCasesFailed = 0;
+ numAsserts = 0;
+ numAssertsFailed = 0;
+ numAssertsCurrentTest = 0;
+ numAssertsFailedCurrentTest = 0;
+ }
+
+ void finalizeTestCaseData() {
+ seconds = timer.getElapsedSeconds();
+
+ // update the non-atomic counters
+ numAsserts += numAssertsCurrentTest_atomic;
+ numAssertsFailed += numAssertsFailedCurrentTest_atomic;
+ numAssertsCurrentTest = numAssertsCurrentTest_atomic;
+ numAssertsFailedCurrentTest = numAssertsFailedCurrentTest_atomic;
+
+ if(numAssertsFailedCurrentTest)
+ failure_flags |= TestCaseFailureReason::AssertFailure;
+
+ if(Approx(currentTest->m_timeout).epsilon(DBL_EPSILON) != 0 &&
+ Approx(seconds).epsilon(DBL_EPSILON) > currentTest->m_timeout)
+ failure_flags |= TestCaseFailureReason::Timeout;
+
+ if(currentTest->m_should_fail) {
+ if(failure_flags) {
+ failure_flags |= TestCaseFailureReason::ShouldHaveFailedAndDid;
+ } else {
+ failure_flags |= TestCaseFailureReason::ShouldHaveFailedButDidnt;
+ }
+ } else if(failure_flags && currentTest->m_may_fail) {
+ failure_flags |= TestCaseFailureReason::CouldHaveFailedAndDid;
+ } else if(currentTest->m_expected_failures > 0) {
+ if(numAssertsFailedCurrentTest == currentTest->m_expected_failures) {
+ failure_flags |= TestCaseFailureReason::FailedExactlyNumTimes;
+ } else {
+ failure_flags |= TestCaseFailureReason::DidntFailExactlyNumTimes;
+ }
+ }
+
+ bool ok_to_fail = (TestCaseFailureReason::ShouldHaveFailedAndDid & failure_flags) ||
+ (TestCaseFailureReason::CouldHaveFailedAndDid & failure_flags) ||
+ (TestCaseFailureReason::FailedExactlyNumTimes & failure_flags);
+
+ // if any subcase has failed - the whole test case has failed
+ if(failure_flags && !ok_to_fail)
+ numTestCasesFailed++;
+ }
+ };
+
+ ContextState* g_cs = nullptr;
+
+ // used to avoid locks for the debug output
+ // TODO: figure out if this is indeed necessary/correct - seems like either there still
+ // could be a race or that there wouldn't be a race even if using the context directly
+ DOCTEST_THREAD_LOCAL bool g_no_colors;
+
+#endif // DOCTEST_CONFIG_DISABLE
+} // namespace detail
+
+void String::setOnHeap() { *reinterpret_cast<unsigned char*>(&buf[last]) = 128; }
+void String::setLast(unsigned in) { buf[last] = char(in); }
+
+void String::copy(const String& other) {
+ using namespace std;
+ if(other.isOnStack()) {
+ memcpy(buf, other.buf, len);
+ } else {
+ setOnHeap();
+ data.size = other.data.size;
+ data.capacity = data.size + 1;
+ data.ptr = new char[data.capacity];
+ memcpy(data.ptr, other.data.ptr, data.size + 1);
+ }
+}
+
+String::String() {
+ buf[0] = '\0';
+ setLast();
+}
+
+String::~String() {
+ if(!isOnStack())
+ delete[] data.ptr;
+}
+
+String::String(const char* in)
+ : String(in, strlen(in)) {}
+
+String::String(const char* in, unsigned in_size) {
+ using namespace std;
+ if(in_size <= last) {
+ memcpy(buf, in, in_size + 1);
+ setLast(last - in_size);
+ } else {
+ setOnHeap();
+ data.size = in_size;
+ data.capacity = data.size + 1;
+ data.ptr = new char[data.capacity];
+ memcpy(data.ptr, in, in_size + 1);
+ }
+}
+
+String::String(const String& other) { copy(other); }
+
+String& String::operator=(const String& other) {
+ if(this != &other) {
+ if(!isOnStack())
+ delete[] data.ptr;
+
+ copy(other);
+ }
+
+ return *this;
+}
+
+String& String::operator+=(const String& other) {
+ const unsigned my_old_size = size();
+ const unsigned other_size = other.size();
+ const unsigned total_size = my_old_size + other_size;
+ using namespace std;
+ if(isOnStack()) {
+ if(total_size < len) {
+ // append to the current stack space
+ memcpy(buf + my_old_size, other.c_str(), other_size + 1);
+ setLast(last - total_size);
+ } else {
+ // alloc new chunk
+ char* temp = new char[total_size + 1];
+ // copy current data to new location before writing in the union
+ memcpy(temp, buf, my_old_size); // skip the +1 ('\0') for speed
+ // update data in union
+ setOnHeap();
+ data.size = total_size;
+ data.capacity = data.size + 1;
+ data.ptr = temp;
+ // transfer the rest of the data
+ memcpy(data.ptr + my_old_size, other.c_str(), other_size + 1);
+ }
+ } else {
+ if(data.capacity > total_size) {
+ // append to the current heap block
+ data.size = total_size;
+ memcpy(data.ptr + my_old_size, other.c_str(), other_size + 1);
+ } else {
+ // resize
+ data.capacity *= 2;
+ if(data.capacity <= total_size)
+ data.capacity = total_size + 1;
+ // alloc new chunk
+ char* temp = new char[data.capacity];
+ // copy current data to new location before releasing it
+ memcpy(temp, data.ptr, my_old_size); // skip the +1 ('\0') for speed
+ // release old chunk
+ delete[] data.ptr;
+ // update the rest of the union members
+ data.size = total_size;
+ data.ptr = temp;
+ // transfer the rest of the data
+ memcpy(data.ptr + my_old_size, other.c_str(), other_size + 1);
+ }
+ }
+
+ return *this;
+}
+
+String String::operator+(const String& other) const { return String(*this) += other; }
+
+String::String(String&& other) {
+ using namespace std;
+ memcpy(buf, other.buf, len);
+ other.buf[0] = '\0';
+ other.setLast();
+}
+
+String& String::operator=(String&& other) {
+ using namespace std;
+ if(this != &other) {
+ if(!isOnStack())
+ delete[] data.ptr;
+ memcpy(buf, other.buf, len);
+ other.buf[0] = '\0';
+ other.setLast();
+ }
+ return *this;
+}
+
+char String::operator[](unsigned i) const {
+ return const_cast<String*>(this)->operator[](i); // NOLINT
+}
+
+char& String::operator[](unsigned i) {
+ if(isOnStack())
+ return reinterpret_cast<char*>(buf)[i];
+ return data.ptr[i];
+}
+
+DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wmaybe-uninitialized")
+unsigned String::size() const {
+ if(isOnStack())
+ return last - (unsigned(buf[last]) & 31); // using "last" would work only if "len" is 32
+ return data.size;
+}
+DOCTEST_GCC_SUPPRESS_WARNING_POP
+
+unsigned String::capacity() const {
+ if(isOnStack())
+ return len;
+ return data.capacity;
+}
+
+int String::compare(const char* other, bool no_case) const {
+ if(no_case)
+ return doctest::stricmp(c_str(), other);
+ return std::strcmp(c_str(), other);
+}
+
+int String::compare(const String& other, bool no_case) const {
+ return compare(other.c_str(), no_case);
+}
+
+// clang-format off
+bool operator==(const String& lhs, const String& rhs) { return lhs.compare(rhs) == 0; }
+bool operator!=(const String& lhs, const String& rhs) { return lhs.compare(rhs) != 0; }
+bool operator< (const String& lhs, const String& rhs) { return lhs.compare(rhs) < 0; }
+bool operator> (const String& lhs, const String& rhs) { return lhs.compare(rhs) > 0; }
+bool operator<=(const String& lhs, const String& rhs) { return (lhs != rhs) ? lhs.compare(rhs) < 0 : true; }
+bool operator>=(const String& lhs, const String& rhs) { return (lhs != rhs) ? lhs.compare(rhs) > 0 : true; }
+// clang-format on
+
+std::ostream& operator<<(std::ostream& s, const String& in) { return s << in.c_str(); }
+
+namespace {
+ void color_to_stream(std::ostream&, Color::Enum) DOCTEST_BRANCH_ON_DISABLED({}, ;)
+} // namespace
+
+namespace Color {
+ std::ostream& operator<<(std::ostream& s, Color::Enum code) {
+ color_to_stream(s, code);
+ return s;
+ }
+} // namespace Color
+
+// clang-format off
+const char* assertString(assertType::Enum at) {
+ DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4062) // enum 'x' in switch of enum 'y' is not handled
+ switch(at) { //!OCLINT missing default in switch statements
+ case assertType::DT_WARN : return "WARN";
+ case assertType::DT_CHECK : return "CHECK";
+ case assertType::DT_REQUIRE : return "REQUIRE";
+
+ case assertType::DT_WARN_FALSE : return "WARN_FALSE";
+ case assertType::DT_CHECK_FALSE : return "CHECK_FALSE";
+ case assertType::DT_REQUIRE_FALSE : return "REQUIRE_FALSE";
+
+ case assertType::DT_WARN_THROWS : return "WARN_THROWS";
+ case assertType::DT_CHECK_THROWS : return "CHECK_THROWS";
+ case assertType::DT_REQUIRE_THROWS : return "REQUIRE_THROWS";
+
+ case assertType::DT_WARN_THROWS_AS : return "WARN_THROWS_AS";
+ case assertType::DT_CHECK_THROWS_AS : return "CHECK_THROWS_AS";
+ case assertType::DT_REQUIRE_THROWS_AS : return "REQUIRE_THROWS_AS";
+
+ case assertType::DT_WARN_THROWS_WITH : return "WARN_THROWS_WITH";
+ case assertType::DT_CHECK_THROWS_WITH : return "CHECK_THROWS_WITH";
+ case assertType::DT_REQUIRE_THROWS_WITH : return "REQUIRE_THROWS_WITH";
+
+ case assertType::DT_WARN_THROWS_WITH_AS : return "WARN_THROWS_WITH_AS";
+ case assertType::DT_CHECK_THROWS_WITH_AS : return "CHECK_THROWS_WITH_AS";
+ case assertType::DT_REQUIRE_THROWS_WITH_AS : return "REQUIRE_THROWS_WITH_AS";
+
+ case assertType::DT_WARN_NOTHROW : return "WARN_NOTHROW";
+ case assertType::DT_CHECK_NOTHROW : return "CHECK_NOTHROW";
+ case assertType::DT_REQUIRE_NOTHROW : return "REQUIRE_NOTHROW";
+
+ case assertType::DT_WARN_EQ : return "WARN_EQ";
+ case assertType::DT_CHECK_EQ : return "CHECK_EQ";
+ case assertType::DT_REQUIRE_EQ : return "REQUIRE_EQ";
+ case assertType::DT_WARN_NE : return "WARN_NE";
+ case assertType::DT_CHECK_NE : return "CHECK_NE";
+ case assertType::DT_REQUIRE_NE : return "REQUIRE_NE";
+ case assertType::DT_WARN_GT : return "WARN_GT";
+ case assertType::DT_CHECK_GT : return "CHECK_GT";
+ case assertType::DT_REQUIRE_GT : return "REQUIRE_GT";
+ case assertType::DT_WARN_LT : return "WARN_LT";
+ case assertType::DT_CHECK_LT : return "CHECK_LT";
+ case assertType::DT_REQUIRE_LT : return "REQUIRE_LT";
+ case assertType::DT_WARN_GE : return "WARN_GE";
+ case assertType::DT_CHECK_GE : return "CHECK_GE";
+ case assertType::DT_REQUIRE_GE : return "REQUIRE_GE";
+ case assertType::DT_WARN_LE : return "WARN_LE";
+ case assertType::DT_CHECK_LE : return "CHECK_LE";
+ case assertType::DT_REQUIRE_LE : return "REQUIRE_LE";
+
+ case assertType::DT_WARN_UNARY : return "WARN_UNARY";
+ case assertType::DT_CHECK_UNARY : return "CHECK_UNARY";
+ case assertType::DT_REQUIRE_UNARY : return "REQUIRE_UNARY";
+ case assertType::DT_WARN_UNARY_FALSE : return "WARN_UNARY_FALSE";
+ case assertType::DT_CHECK_UNARY_FALSE : return "CHECK_UNARY_FALSE";
+ case assertType::DT_REQUIRE_UNARY_FALSE : return "REQUIRE_UNARY_FALSE";
+ }
+ DOCTEST_MSVC_SUPPRESS_WARNING_POP
+ return "";
+}
+// clang-format on
+
+const char* failureString(assertType::Enum at) {
+ if(at & assertType::is_warn) //!OCLINT bitwise operator in conditional
+ return "WARNING";
+ if(at & assertType::is_check) //!OCLINT bitwise operator in conditional
+ return "ERROR";
+ if(at & assertType::is_require) //!OCLINT bitwise operator in conditional
+ return "FATAL ERROR";
+ return "";
+}
+
+DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wnull-dereference")
+DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wnull-dereference")
+// depending on the current options this will remove the path of filenames
+const char* skipPathFromFilename(const char* file) {
+ if(getContextOptions()->no_path_in_filenames) {
+ auto back = std::strrchr(file, '\\');
+ auto forward = std::strrchr(file, '/');
+ if(back || forward) {
+ if(back > forward)
+ forward = back;
+ return forward + 1;
+ }
+ }
+ return file;
+}
+DOCTEST_CLANG_SUPPRESS_WARNING_POP
+DOCTEST_GCC_SUPPRESS_WARNING_POP
+
+bool SubcaseSignature::operator<(const SubcaseSignature& other) const {
+ if(m_line != other.m_line)
+ return m_line < other.m_line;
+ if(std::strcmp(m_file, other.m_file) != 0)
+ return std::strcmp(m_file, other.m_file) < 0;
+ return m_name.compare(other.m_name) < 0;
+}
+
+IContextScope::IContextScope() = default;
+IContextScope::~IContextScope() = default;
+
+#ifdef DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+String toString(char* in) { return toString(static_cast<const char*>(in)); }
+String toString(const char* in) { return String("\"") + (in ? in : "{null string}") + "\""; }
+#endif // DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+String toString(bool in) { return in ? "true" : "false"; }
+String toString(float in) { return fpToString(in, 5) + "f"; }
+String toString(double in) { return fpToString(in, 10); }
+String toString(double long in) { return fpToString(in, 15); }
+
+#define DOCTEST_TO_STRING_OVERLOAD(type, fmt) \
+ String toString(type in) { \
+ char buf[64]; \
+ std::sprintf(buf, fmt, in); \
+ return buf; \
+ }
+
+DOCTEST_TO_STRING_OVERLOAD(char, "%d")
+DOCTEST_TO_STRING_OVERLOAD(char signed, "%d")
+DOCTEST_TO_STRING_OVERLOAD(char unsigned, "%u")
+DOCTEST_TO_STRING_OVERLOAD(int short, "%d")
+DOCTEST_TO_STRING_OVERLOAD(int short unsigned, "%u")
+DOCTEST_TO_STRING_OVERLOAD(int, "%d")
+DOCTEST_TO_STRING_OVERLOAD(unsigned, "%u")
+DOCTEST_TO_STRING_OVERLOAD(int long, "%ld")
+DOCTEST_TO_STRING_OVERLOAD(int long unsigned, "%lu")
+DOCTEST_TO_STRING_OVERLOAD(int long long, "%lld")
+DOCTEST_TO_STRING_OVERLOAD(int long long unsigned, "%llu")
+
+String toString(std::nullptr_t) { return "NULL"; }
+
+#if DOCTEST_MSVC >= DOCTEST_COMPILER(19, 20, 0)
+// see this issue on why this is needed: https://github.com/onqtam/doctest/issues/183
+String toString(const std::string& in) { return in.c_str(); }
+#endif // VS 2019
+
+Approx::Approx(double value)
+ : m_epsilon(static_cast<double>(std::numeric_limits<float>::epsilon()) * 100)
+ , m_scale(1.0)
+ , m_value(value) {}
+
+Approx Approx::operator()(double value) const {
+ Approx approx(value);
+ approx.epsilon(m_epsilon);
+ approx.scale(m_scale);
+ return approx;
+}
+
+Approx& Approx::epsilon(double newEpsilon) {
+ m_epsilon = newEpsilon;
+ return *this;
+}
+Approx& Approx::scale(double newScale) {
+ m_scale = newScale;
+ return *this;
+}
+
+bool operator==(double lhs, const Approx& rhs) {
+ // Thanks to Richard Harris for his help refining this formula
+ return std::fabs(lhs - rhs.m_value) <
+ rhs.m_epsilon * (rhs.m_scale + std::max<double>(std::fabs(lhs), std::fabs(rhs.m_value)));
+}
+bool operator==(const Approx& lhs, double rhs) { return operator==(rhs, lhs); }
+bool operator!=(double lhs, const Approx& rhs) { return !operator==(lhs, rhs); }
+bool operator!=(const Approx& lhs, double rhs) { return !operator==(rhs, lhs); }
+bool operator<=(double lhs, const Approx& rhs) { return lhs < rhs.m_value || lhs == rhs; }
+bool operator<=(const Approx& lhs, double rhs) { return lhs.m_value < rhs || lhs == rhs; }
+bool operator>=(double lhs, const Approx& rhs) { return lhs > rhs.m_value || lhs == rhs; }
+bool operator>=(const Approx& lhs, double rhs) { return lhs.m_value > rhs || lhs == rhs; }
+bool operator<(double lhs, const Approx& rhs) { return lhs < rhs.m_value && lhs != rhs; }
+bool operator<(const Approx& lhs, double rhs) { return lhs.m_value < rhs && lhs != rhs; }
+bool operator>(double lhs, const Approx& rhs) { return lhs > rhs.m_value && lhs != rhs; }
+bool operator>(const Approx& lhs, double rhs) { return lhs.m_value > rhs && lhs != rhs; }
+
+String toString(const Approx& in) {
+ return String("Approx( ") + doctest::toString(in.m_value) + " )";
+}
+const ContextOptions* getContextOptions() { return DOCTEST_BRANCH_ON_DISABLED(nullptr, g_cs); }
+
+} // namespace doctest
+
+#ifdef DOCTEST_CONFIG_DISABLE
+namespace doctest {
+Context::Context(int, const char* const*) {}
+Context::~Context() = default;
+void Context::applyCommandLine(int, const char* const*) {}
+void Context::addFilter(const char*, const char*) {}
+void Context::clearFilters() {}
+void Context::setOption(const char*, int) {}
+void Context::setOption(const char*, const char*) {}
+bool Context::shouldExit() { return false; }
+void Context::setAsDefaultForAssertsOutOfTestCases() {}
+void Context::setAssertHandler(detail::assert_handler) {}
+int Context::run() { return 0; }
+
+IReporter::~IReporter() = default;
+
+int IReporter::get_num_active_contexts() { return 0; }
+const IContextScope* const* IReporter::get_active_contexts() { return nullptr; }
+int IReporter::get_num_stringified_contexts() { return 0; }
+const String* IReporter::get_stringified_contexts() { return nullptr; }
+
+int registerReporter(const char*, int, IReporter*) { return 0; }
+
+} // namespace doctest
+#else // DOCTEST_CONFIG_DISABLE
+
+#if !defined(DOCTEST_CONFIG_COLORS_NONE)
+#if !defined(DOCTEST_CONFIG_COLORS_WINDOWS) && !defined(DOCTEST_CONFIG_COLORS_ANSI)
+#ifdef DOCTEST_PLATFORM_WINDOWS
+#define DOCTEST_CONFIG_COLORS_WINDOWS
+#else // linux
+#define DOCTEST_CONFIG_COLORS_ANSI
+#endif // platform
+#endif // DOCTEST_CONFIG_COLORS_WINDOWS && DOCTEST_CONFIG_COLORS_ANSI
+#endif // DOCTEST_CONFIG_COLORS_NONE
+
+namespace doctest_detail_test_suite_ns {
+// holds the current test suite
+doctest::detail::TestSuite& getCurrentTestSuite() {
+ static doctest::detail::TestSuite data;
+ return data;
+}
+} // namespace doctest_detail_test_suite_ns
+
+namespace doctest {
+namespace {
+ // the int (priority) is part of the key for automatic sorting - sadly one can register a
+ // reporter with a duplicate name and a different priority but hopefully that won't happen often :|
+ typedef std::map<std::pair<int, String>, reporterCreatorFunc> reporterMap;
+
+ reporterMap& getReporters() {
+ static reporterMap data;
+ return data;
+ }
+ reporterMap& getListeners() {
+ static reporterMap data;
+ return data;
+ }
+} // namespace
+namespace detail {
+#define DOCTEST_ITERATE_THROUGH_REPORTERS(function, ...) \
+ for(auto& curr_rep : g_cs->reporters_currently_used) \
+ curr_rep->function(__VA_ARGS__)
+
+ bool checkIfShouldThrow(assertType::Enum at) {
+ if(at & assertType::is_require) //!OCLINT bitwise operator in conditional
+ return true;
+
+ if((at & assertType::is_check) //!OCLINT bitwise operator in conditional
+ && getContextOptions()->abort_after > 0 &&
+ (g_cs->numAssertsFailed + g_cs->numAssertsFailedCurrentTest_atomic) >=
+ getContextOptions()->abort_after)
+ return true;
+
+ return false;
+ }
+
+#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
+ [[noreturn]] void throwException() {
+ g_cs->shouldLogCurrentException = false;
+ throw TestFailureException();
+ } // NOLINT(cert-err60-cpp)
+#else // DOCTEST_CONFIG_NO_EXCEPTIONS
+ void throwException() {}
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
+} // namespace detail
+
+namespace {
+ using namespace detail;
+ // matching of a string against a wildcard mask (case sensitivity configurable) taken from
+ // https://www.codeproject.com/Articles/1088/Wildcard-string-compare-globbing
+ int wildcmp(const char* str, const char* wild, bool caseSensitive) {
+ const char* cp = nullptr;
+ const char* mp = nullptr;
+
+ while((*str) && (*wild != '*')) {
+ if((caseSensitive ? (*wild != *str) : (tolower(*wild) != tolower(*str))) &&
+ (*wild != '?')) {
+ return 0;
+ }
+ wild++;
+ str++;
+ }
+
+ while(*str) {
+ if(*wild == '*') {
+ if(!*++wild) {
+ return 1;
+ }
+ mp = wild;
+ cp = str + 1;
+ } else if((caseSensitive ? (*wild == *str) : (tolower(*wild) == tolower(*str))) ||
+ (*wild == '?')) {
+ wild++;
+ str++;
+ } else {
+ wild = mp; //!OCLINT parameter reassignment
+ str = cp++; //!OCLINT parameter reassignment
+ }
+ }
+
+ while(*wild == '*') {
+ wild++;
+ }
+ return !*wild;
+ }
+
+ //// C string hash function (djb2) - taken from http://www.cse.yorku.ca/~oz/hash.html
+ //unsigned hashStr(unsigned const char* str) {
+ // unsigned long hash = 5381;
+ // char c;
+ // while((c = *str++))
+ // hash = ((hash << 5) + hash) + c; // hash * 33 + c
+ // return hash;
+ //}
+
+ // checks if the name matches any of the filters (and can be configured what to do when empty)
+ bool matchesAny(const char* name, const std::vector<String>& filters, bool matchEmpty,
+ bool caseSensitive) {
+ if(filters.empty() && matchEmpty)
+ return true;
+ for(auto& curr : filters)
+ if(wildcmp(name, curr.c_str(), caseSensitive))
+ return true;
+ return false;
+ }
+} // namespace
+namespace detail {
+
+ Subcase::Subcase(const String& name, const char* file, int line)
+ : m_signature({name, file, line}) {
+ ContextState* s = g_cs;
+
+ // check subcase filters
+ if(s->subcasesStack.size() < size_t(s->subcase_filter_levels)) {
+ if(!matchesAny(m_signature.m_name.c_str(), s->filters[6], true, s->case_sensitive))
+ return;
+ if(matchesAny(m_signature.m_name.c_str(), s->filters[7], false, s->case_sensitive))
+ return;
+ }
+
+ // if a Subcase on the same level has already been entered
+ if(s->subcasesStack.size() < size_t(s->subcasesCurrentMaxLevel)) {
+ s->should_reenter = true;
+ return;
+ }
+
+ // push the current signature to the stack so we can check if the
+ // current stack + the current new subcase have been traversed
+ s->subcasesStack.push_back(m_signature);
+ if(s->subcasesPassed.count(s->subcasesStack) != 0) {
+ // pop - revert to previous stack since we've already passed this
+ s->subcasesStack.pop_back();
+ return;
+ }
+
+ s->subcasesCurrentMaxLevel = s->subcasesStack.size();
+ m_entered = true;
+
+ DOCTEST_ITERATE_THROUGH_REPORTERS(subcase_start, m_signature);
+ }
+
+ DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4996) // std::uncaught_exception is deprecated in C++17
+ DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations")
+ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations")
+
+ Subcase::~Subcase() {
+ if(m_entered) {
+ // only mark the subcase stack as passed if no subcases have been skipped
+ if(g_cs->should_reenter == false)
+ g_cs->subcasesPassed.insert(g_cs->subcasesStack);
+ g_cs->subcasesStack.pop_back();
+
+#if __cplusplus >= 201703L && defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411
+ if(std::uncaught_exceptions() > 0
+#else
+ if(std::uncaught_exception()
+#endif
+ && g_cs->shouldLogCurrentException) {
+ DOCTEST_ITERATE_THROUGH_REPORTERS(
+ test_case_exception, {"exception thrown in subcase - will translate later "
+ "when the whole test case has been exited (cannot "
+ "translate while there is an active exception)",
+ false});
+ g_cs->shouldLogCurrentException = false;
+ }
+ DOCTEST_ITERATE_THROUGH_REPORTERS(subcase_end, DOCTEST_EMPTY);
+ }
+ }
+
+ DOCTEST_CLANG_SUPPRESS_WARNING_POP
+ DOCTEST_GCC_SUPPRESS_WARNING_POP
+ DOCTEST_MSVC_SUPPRESS_WARNING_POP
+
+ Subcase::operator bool() const { return m_entered; }
+
+ Result::Result(bool passed, const String& decomposition)
+ : m_passed(passed)
+ , m_decomp(decomposition) {}
+
+ ExpressionDecomposer::ExpressionDecomposer(assertType::Enum at)
+ : m_at(at) {}
+
+ TestSuite& TestSuite::operator*(const char* in) {
+ m_test_suite = in;
+ // clear state
+ m_description = nullptr;
+ m_skip = false;
+ m_may_fail = false;
+ m_should_fail = false;
+ m_expected_failures = 0;
+ m_timeout = 0;
+ return *this;
+ }
+
+ TestCase::TestCase(funcType test, const char* file, unsigned line, const TestSuite& test_suite,
+ const char* type, int template_id) {
+ m_file = file;
+ m_line = line;
+ m_name = nullptr; // will be later overridden in operator*
+ m_test_suite = test_suite.m_test_suite;
+ m_description = test_suite.m_description;
+ m_skip = test_suite.m_skip;
+ m_may_fail = test_suite.m_may_fail;
+ m_should_fail = test_suite.m_should_fail;
+ m_expected_failures = test_suite.m_expected_failures;
+ m_timeout = test_suite.m_timeout;
+
+ m_test = test;
+ m_type = type;
+ m_template_id = template_id;
+ }
+
+ TestCase::TestCase(const TestCase& other)
+ : TestCaseData() {
+ *this = other;
+ }
+
+ DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(26434) // hides a non-virtual function
+ DOCTEST_MSVC_SUPPRESS_WARNING(26437) // Do not slice
+ TestCase& TestCase::operator=(const TestCase& other) {
+ static_cast<TestCaseData&>(*this) = static_cast<const TestCaseData&>(other);
+
+ m_test = other.m_test;
+ m_type = other.m_type;
+ m_template_id = other.m_template_id;
+ m_full_name = other.m_full_name;
+
+ if(m_template_id != -1)
+ m_name = m_full_name.c_str();
+ return *this;
+ }
+ DOCTEST_MSVC_SUPPRESS_WARNING_POP
+
+ TestCase& TestCase::operator*(const char* in) {
+ m_name = in;
+ // make a new name with an appended type for templated test case
+ if(m_template_id != -1) {
+ m_full_name = String(m_name) + m_type;
+ // redirect the name to point to the newly constructed full name
+ m_name = m_full_name.c_str();
+ }
+ return *this;
+ }
+
+ bool TestCase::operator<(const TestCase& other) const {
+ if(m_line != other.m_line)
+ return m_line < other.m_line;
+ const int file_cmp = std::strcmp(m_file, other.m_file);
+ if(file_cmp != 0)
+ return file_cmp < 0;
+ return m_template_id < other.m_template_id;
+ }
+} // namespace detail
+namespace {
+ using namespace detail;
+ // for sorting tests by file/line
+ bool fileOrderComparator(const TestCase* lhs, const TestCase* rhs) {
+#if DOCTEST_MSVC
+ // this is needed because MSVC gives different case for drive letters
+ // for __FILE__ when evaluated in a header and a source file
+ const int res = doctest::stricmp(lhs->m_file, rhs->m_file);
+#else // MSVC
+ const int res = std::strcmp(lhs->m_file, rhs->m_file);
+#endif // MSVC
+ if(res != 0)
+ return res < 0;
+ if(lhs->m_line != rhs->m_line)
+ return lhs->m_line < rhs->m_line;
+ return lhs->m_template_id < rhs->m_template_id;
+ }
+
+ // for sorting tests by suite/file/line
+ bool suiteOrderComparator(const TestCase* lhs, const TestCase* rhs) {
+ const int res = std::strcmp(lhs->m_test_suite, rhs->m_test_suite);
+ if(res != 0)
+ return res < 0;
+ return fileOrderComparator(lhs, rhs);
+ }
+
+ // for sorting tests by name/suite/file/line
+ bool nameOrderComparator(const TestCase* lhs, const TestCase* rhs) {
+ const int res = std::strcmp(lhs->m_name, rhs->m_name);
+ if(res != 0)
+ return res < 0;
+ return suiteOrderComparator(lhs, rhs);
+ }
+
+ // all the registered tests
+ std::set<TestCase>& getRegisteredTests() {
+ static std::set<TestCase> data;
+ return data;
+ }
+
+#ifdef DOCTEST_CONFIG_COLORS_WINDOWS
+ HANDLE g_stdoutHandle;
+ WORD g_origFgAttrs;
+ WORD g_origBgAttrs;
+ bool g_attrsInitted = false;
+
+ int colors_init() {
+ if(!g_attrsInitted) {
+ g_stdoutHandle = GetStdHandle(STD_OUTPUT_HANDLE);
+ g_attrsInitted = true;
+ CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
+ GetConsoleScreenBufferInfo(g_stdoutHandle, &csbiInfo);
+ g_origFgAttrs = csbiInfo.wAttributes & ~(BACKGROUND_GREEN | BACKGROUND_RED |
+ BACKGROUND_BLUE | BACKGROUND_INTENSITY);
+ g_origBgAttrs = csbiInfo.wAttributes & ~(FOREGROUND_GREEN | FOREGROUND_RED |
+ FOREGROUND_BLUE | FOREGROUND_INTENSITY);
+ }
+ return 0;
+ }
+
+ int dumy_init_console_colors = colors_init();
+#endif // DOCTEST_CONFIG_COLORS_WINDOWS
+
+ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations")
+ void color_to_stream(std::ostream& s, Color::Enum code) {
+ ((void)s); // for DOCTEST_CONFIG_COLORS_NONE or DOCTEST_CONFIG_COLORS_WINDOWS
+ ((void)code); // for DOCTEST_CONFIG_COLORS_NONE
+#ifdef DOCTEST_CONFIG_COLORS_ANSI
+ if(g_no_colors ||
+ (isatty(STDOUT_FILENO) == false && getContextOptions()->force_colors == false))
+ return;
+
+ auto col = "";
+ // clang-format off
+ switch(code) { //!OCLINT missing break in switch statement / unnecessary default statement in covered switch statement
+ case Color::Red: col = "[0;31m"; break;
+ case Color::Green: col = "[0;32m"; break;
+ case Color::Blue: col = "[0;34m"; break;
+ case Color::Cyan: col = "[0;36m"; break;
+ case Color::Yellow: col = "[0;33m"; break;
+ case Color::Grey: col = "[1;30m"; break;
+ case Color::LightGrey: col = "[0;37m"; break;
+ case Color::BrightRed: col = "[1;31m"; break;
+ case Color::BrightGreen: col = "[1;32m"; break;
+ case Color::BrightWhite: col = "[1;37m"; break;
+ case Color::Bright: // invalid
+ case Color::None:
+ case Color::White:
+ default: col = "[0m";
+ }
+ // clang-format on
+ s << "\033" << col;
+#endif // DOCTEST_CONFIG_COLORS_ANSI
+
+#ifdef DOCTEST_CONFIG_COLORS_WINDOWS
+ if(g_no_colors ||
+ (isatty(fileno(stdout)) == false && getContextOptions()->force_colors == false))
+ return;
+
+#define DOCTEST_SET_ATTR(x) SetConsoleTextAttribute(g_stdoutHandle, x | g_origBgAttrs)
+
+ // clang-format off
+ switch (code) {
+ case Color::White: DOCTEST_SET_ATTR(FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE); break;
+ case Color::Red: DOCTEST_SET_ATTR(FOREGROUND_RED); break;
+ case Color::Green: DOCTEST_SET_ATTR(FOREGROUND_GREEN); break;
+ case Color::Blue: DOCTEST_SET_ATTR(FOREGROUND_BLUE); break;
+ case Color::Cyan: DOCTEST_SET_ATTR(FOREGROUND_BLUE | FOREGROUND_GREEN); break;
+ case Color::Yellow: DOCTEST_SET_ATTR(FOREGROUND_RED | FOREGROUND_GREEN); break;
+ case Color::Grey: DOCTEST_SET_ATTR(0); break;
+ case Color::LightGrey: DOCTEST_SET_ATTR(FOREGROUND_INTENSITY); break;
+ case Color::BrightRed: DOCTEST_SET_ATTR(FOREGROUND_INTENSITY | FOREGROUND_RED); break;
+ case Color::BrightGreen: DOCTEST_SET_ATTR(FOREGROUND_INTENSITY | FOREGROUND_GREEN); break;
+ case Color::BrightWhite: DOCTEST_SET_ATTR(FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE); break;
+ case Color::None:
+ case Color::Bright: // invalid
+ default: DOCTEST_SET_ATTR(g_origFgAttrs);
+ }
+ // clang-format on
+#endif // DOCTEST_CONFIG_COLORS_WINDOWS
+ }
+ DOCTEST_CLANG_SUPPRESS_WARNING_POP
+
+ std::vector<const IExceptionTranslator*>& getExceptionTranslators() {
+ static std::vector<const IExceptionTranslator*> data;
+ return data;
+ }
+
+ String translateActiveException() {
+#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
+ String res;
+ auto& translators = getExceptionTranslators();
+ for(auto& curr : translators)
+ if(curr->translate(res))
+ return res;
+ // clang-format off
+ DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wcatch-value")
+ try {
+ throw;
+ } catch(std::exception& ex) {
+ return ex.what();
+ } catch(std::string& msg) {
+ return msg.c_str();
+ } catch(const char* msg) {
+ return msg;
+ } catch(...) {
+ return "unknown exception";
+ }
+ DOCTEST_GCC_SUPPRESS_WARNING_POP
+// clang-format on
+#else // DOCTEST_CONFIG_NO_EXCEPTIONS
+ return "";
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
+ }
+} // namespace
+
+namespace detail {
+ // used by the macros for registering tests
+ int regTest(const TestCase& tc) {
+ getRegisteredTests().insert(tc);
+ return 0;
+ }
+
+ // sets the current test suite
+ int setTestSuite(const TestSuite& ts) {
+ doctest_detail_test_suite_ns::getCurrentTestSuite() = ts;
+ return 0;
+ }
+
+#ifdef DOCTEST_IS_DEBUGGER_ACTIVE
+ bool isDebuggerActive() { return DOCTEST_IS_DEBUGGER_ACTIVE(); }
+#else // DOCTEST_IS_DEBUGGER_ACTIVE
+#ifdef DOCTEST_PLATFORM_MAC
+ // The following function is taken directly from the following technical note:
+ // https://developer.apple.com/library/archive/qa/qa1361/_index.html
+ // Returns true if the current process is being debugged (either
+ // running under the debugger or has a debugger attached post facto).
+ bool isDebuggerActive() {
+ int mib[4];
+ kinfo_proc info;
+ size_t size;
+ // Initialize the flags so that, if sysctl fails for some bizarre
+ // reason, we get a predictable result.
+ info.kp_proc.p_flag = 0;
+ // Initialize mib, which tells sysctl the info we want, in this case
+ // we're looking for information about a specific process ID.
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PID;
+ mib[3] = getpid();
+ // Call sysctl.
+ size = sizeof(info);
+ if(sysctl(mib, DOCTEST_COUNTOF(mib), &info, &size, 0, 0) != 0) {
+ std::cerr << "\nCall to sysctl failed - unable to determine if debugger is active **\n";
+ return false;
+ }
+ // We're being debugged if the P_TRACED flag is set.
+ return ((info.kp_proc.p_flag & P_TRACED) != 0);
+ }
+#elif DOCTEST_MSVC || defined(__MINGW32__)
+ bool isDebuggerActive() { return ::IsDebuggerPresent() != 0; }
+#else
+ bool isDebuggerActive() { return false; }
+#endif // Platform
+#endif // DOCTEST_IS_DEBUGGER_ACTIVE
+
+ void registerExceptionTranslatorImpl(const IExceptionTranslator* et) {
+ if(std::find(getExceptionTranslators().begin(), getExceptionTranslators().end(), et) ==
+ getExceptionTranslators().end())
+ getExceptionTranslators().push_back(et);
+ }
+
+#ifdef DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+ void toStream(std::ostream* s, char* in) { *s << in; }
+ void toStream(std::ostream* s, const char* in) { *s << in; }
+#endif // DOCTEST_CONFIG_TREAT_CHAR_STAR_AS_STRING
+ void toStream(std::ostream* s, bool in) { *s << std::boolalpha << in << std::noboolalpha; }
+ void toStream(std::ostream* s, float in) { *s << in; }
+ void toStream(std::ostream* s, double in) { *s << in; }
+ void toStream(std::ostream* s, double long in) { *s << in; }
+
+ void toStream(std::ostream* s, char in) { *s << in; }
+ void toStream(std::ostream* s, char signed in) { *s << in; }
+ void toStream(std::ostream* s, char unsigned in) { *s << in; }
+ void toStream(std::ostream* s, int short in) { *s << in; }
+ void toStream(std::ostream* s, int short unsigned in) { *s << in; }
+ void toStream(std::ostream* s, int in) { *s << in; }
+ void toStream(std::ostream* s, int unsigned in) { *s << in; }
+ void toStream(std::ostream* s, int long in) { *s << in; }
+ void toStream(std::ostream* s, int long unsigned in) { *s << in; }
+ void toStream(std::ostream* s, int long long in) { *s << in; }
+ void toStream(std::ostream* s, int long long unsigned in) { *s << in; }
+
+ DOCTEST_THREAD_LOCAL std::vector<IContextScope*> g_infoContexts; // for logging with INFO()
+
+ ContextScopeBase::ContextScopeBase() {
+ g_infoContexts.push_back(this);
+ }
+
+ DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4996) // std::uncaught_exception is deprecated in C++17
+ DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations")
+ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations")
+
+ // destroy cannot be inlined into the destructor because that would mean calling stringify after
+ // ContextScope has been destroyed (base class destructors run after derived class destructors).
+ // Instead, ContextScope calls this method directly from its destructor.
+ void ContextScopeBase::destroy() {
+#if __cplusplus >= 201703L && defined(__cpp_lib_uncaught_exceptions) && __cpp_lib_uncaught_exceptions >= 201411
+ if(std::uncaught_exceptions() > 0) {
+#else
+ if(std::uncaught_exception()) {
+#endif
+ std::ostringstream s;
+ this->stringify(&s);
+ g_cs->stringifiedContexts.push_back(s.str().c_str());
+ }
+ g_infoContexts.pop_back();
+ }
+
+ DOCTEST_CLANG_SUPPRESS_WARNING_POP
+ DOCTEST_GCC_SUPPRESS_WARNING_POP
+ DOCTEST_MSVC_SUPPRESS_WARNING_POP
+} // namespace detail
+namespace {
+ using namespace detail;
+
+ std::ostream& file_line_to_stream(std::ostream& s, const char* file, int line,
+ const char* tail = "") {
+ const auto opt = getContextOptions();
+ s << Color::LightGrey << skipPathFromFilename(file) << (opt->gnu_file_line ? ":" : "(")
+ << (opt->no_line_numbers ? 0 : line) // 0 or the real num depending on the option
+ << (opt->gnu_file_line ? ":" : "):") << tail;
+ return s;
+ }
+
+#if !defined(DOCTEST_CONFIG_POSIX_SIGNALS) && !defined(DOCTEST_CONFIG_WINDOWS_SEH)
+ struct FatalConditionHandler
+ {
+ void reset() {}
+ };
+#else // DOCTEST_CONFIG_POSIX_SIGNALS || DOCTEST_CONFIG_WINDOWS_SEH
+
+ void reportFatal(const std::string&);
+
+#ifdef DOCTEST_PLATFORM_WINDOWS
+
+ struct SignalDefs
+ {
+ DWORD id;
+ const char* name;
+ };
+ // There is no 1-1 mapping between signals and windows exceptions.
+ // Windows can easily distinguish between SO and SigSegV,
+ // but SigInt, SigTerm, etc are handled differently.
+ SignalDefs signalDefs[] = {
+ {EXCEPTION_ILLEGAL_INSTRUCTION, "SIGILL - Illegal instruction signal"},
+ {EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow"},
+ {EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal"},
+ {EXCEPTION_INT_DIVIDE_BY_ZERO, "Divide by zero error"},
+ };
+
+ struct FatalConditionHandler
+ {
+ static LONG CALLBACK handleException(PEXCEPTION_POINTERS ExceptionInfo) {
+ for(size_t i = 0; i < DOCTEST_COUNTOF(signalDefs); ++i) {
+ if(ExceptionInfo->ExceptionRecord->ExceptionCode == signalDefs[i].id) {
+ reportFatal(signalDefs[i].name);
+ break;
+ }
+ }
+ // If its not an exception we care about, pass it along.
+ // This stops us from eating debugger breaks etc.
+ return EXCEPTION_CONTINUE_SEARCH;
+ }
+
+ FatalConditionHandler() {
+ isSet = true;
+ // 32k seems enough for doctest to handle stack overflow,
+ // but the value was found experimentally, so there is no strong guarantee
+ guaranteeSize = 32 * 1024;
+ // Register an unhandled exception filter
+ previousTop = SetUnhandledExceptionFilter(handleException);
+ // Pass in guarantee size to be filled
+ SetThreadStackGuarantee(&guaranteeSize);
+ }
+
+ static void reset() {
+ if(isSet) {
+ // Unregister handler and restore the old guarantee
+ SetUnhandledExceptionFilter(previousTop);
+ SetThreadStackGuarantee(&guaranteeSize);
+ previousTop = nullptr;
+ isSet = false;
+ }
+ }
+
+ ~FatalConditionHandler() { reset(); }
+
+ private:
+ static bool isSet;
+ static ULONG guaranteeSize;
+ static LPTOP_LEVEL_EXCEPTION_FILTER previousTop;
+ };
+
+ bool FatalConditionHandler::isSet = false;
+ ULONG FatalConditionHandler::guaranteeSize = 0;
+ LPTOP_LEVEL_EXCEPTION_FILTER FatalConditionHandler::previousTop = nullptr;
+
+#else // DOCTEST_PLATFORM_WINDOWS
+
+ struct SignalDefs
+ {
+ int id;
+ const char* name;
+ };
+ SignalDefs signalDefs[] = {{SIGINT, "SIGINT - Terminal interrupt signal"},
+ {SIGILL, "SIGILL - Illegal instruction signal"},
+ {SIGFPE, "SIGFPE - Floating point error signal"},
+ {SIGSEGV, "SIGSEGV - Segmentation violation signal"},
+ {SIGTERM, "SIGTERM - Termination request signal"},
+ {SIGABRT, "SIGABRT - Abort (abnormal termination) signal"}};
+
+ struct FatalConditionHandler
+ {
+ static bool isSet;
+ static struct sigaction oldSigActions[DOCTEST_COUNTOF(signalDefs)];
+ static stack_t oldSigStack;
+ static char altStackMem[4 * SIGSTKSZ];
+
+ static void handleSignal(int sig) {
+ const char* name = "<unknown signal>";
+ for(std::size_t i = 0; i < DOCTEST_COUNTOF(signalDefs); ++i) {
+ SignalDefs& def = signalDefs[i];
+ if(sig == def.id) {
+ name = def.name;
+ break;
+ }
+ }
+ reset();
+ reportFatal(name);
+ raise(sig);
+ }
+
+ FatalConditionHandler() {
+ isSet = true;
+ stack_t sigStack;
+ sigStack.ss_sp = altStackMem;
+ sigStack.ss_size = sizeof(altStackMem);
+ sigStack.ss_flags = 0;
+ sigaltstack(&sigStack, &oldSigStack);
+ struct sigaction sa = {};
+ sa.sa_handler = handleSignal; // NOLINT
+ sa.sa_flags = SA_ONSTACK;
+ for(std::size_t i = 0; i < DOCTEST_COUNTOF(signalDefs); ++i) {
+ sigaction(signalDefs[i].id, &sa, &oldSigActions[i]);
+ }
+ }
+
+ ~FatalConditionHandler() { reset(); }
+ static void reset() {
+ if(isSet) {
+ // Set signals back to previous values -- hopefully nobody overwrote them in the meantime
+ for(std::size_t i = 0; i < DOCTEST_COUNTOF(signalDefs); ++i) {
+ sigaction(signalDefs[i].id, &oldSigActions[i], nullptr);
+ }
+ // Return the old stack
+ sigaltstack(&oldSigStack, nullptr);
+ isSet = false;
+ }
+ }
+ };
+
+ bool FatalConditionHandler::isSet = false;
+ struct sigaction FatalConditionHandler::oldSigActions[DOCTEST_COUNTOF(signalDefs)] = {};
+ stack_t FatalConditionHandler::oldSigStack = {};
+ char FatalConditionHandler::altStackMem[] = {};
+
+#endif // DOCTEST_PLATFORM_WINDOWS
+#endif // DOCTEST_CONFIG_POSIX_SIGNALS || DOCTEST_CONFIG_WINDOWS_SEH
+
+} // namespace
+
+namespace {
+ using namespace detail;
+
+#ifdef DOCTEST_PLATFORM_WINDOWS
+#define DOCTEST_OUTPUT_DEBUG_STRING(text) ::OutputDebugStringA(text)
+#else
+ // TODO: integration with XCode and other IDEs
+#define DOCTEST_OUTPUT_DEBUG_STRING(text) // NOLINT(clang-diagnostic-unused-macros)
+#endif // Platform
+
+ void addAssert(assertType::Enum at) {
+ if((at & assertType::is_warn) == 0) //!OCLINT bitwise operator in conditional
+ g_cs->numAssertsCurrentTest_atomic++;
+ }
+
+ void addFailedAssert(assertType::Enum at) {
+ if((at & assertType::is_warn) == 0) //!OCLINT bitwise operator in conditional
+ g_cs->numAssertsFailedCurrentTest_atomic++;
+ }
+
+#if defined(DOCTEST_CONFIG_POSIX_SIGNALS) || defined(DOCTEST_CONFIG_WINDOWS_SEH)
+ void reportFatal(const std::string& message) {
+ g_cs->failure_flags |= TestCaseFailureReason::Crash;
+
+ DOCTEST_ITERATE_THROUGH_REPORTERS(test_case_exception, {message.c_str(), true});
+
+ while(g_cs->subcasesStack.size()) {
+ g_cs->subcasesStack.pop_back();
+ DOCTEST_ITERATE_THROUGH_REPORTERS(subcase_end, DOCTEST_EMPTY);
+ }
+
+ g_cs->finalizeTestCaseData();
+
+ DOCTEST_ITERATE_THROUGH_REPORTERS(test_case_end, *g_cs);
+
+ DOCTEST_ITERATE_THROUGH_REPORTERS(test_run_end, *g_cs);
+ }
+#endif // DOCTEST_CONFIG_POSIX_SIGNALS || DOCTEST_CONFIG_WINDOWS_SEH
+} // namespace
+namespace detail {
+
+ ResultBuilder::ResultBuilder(assertType::Enum at, const char* file, int line, const char* expr,
+ const char* exception_type, const char* exception_string) {
+ m_test_case = g_cs->currentTest;
+ m_at = at;
+ m_file = file;
+ m_line = line;
+ m_expr = expr;
+ m_failed = true;
+ m_threw = false;
+ m_threw_as = false;
+ m_exception_type = exception_type;
+ m_exception_string = exception_string;
+#if DOCTEST_MSVC
+ if(m_expr[0] == ' ') // this happens when variadic macros are disabled under MSVC
+ ++m_expr;
+#endif // MSVC
+ }
+
+ void ResultBuilder::setResult(const Result& res) {
+ m_decomp = res.m_decomp;
+ m_failed = !res.m_passed;
+ }
+
+ void ResultBuilder::translateException() {
+ m_threw = true;
+ m_exception = translateActiveException();
+ }
+
+ bool ResultBuilder::log() {
+ if(m_at & assertType::is_throws) { //!OCLINT bitwise operator in conditional
+ m_failed = !m_threw;
+ } else if((m_at & assertType::is_throws_as) && (m_at & assertType::is_throws_with)) { //!OCLINT
+ m_failed = !m_threw_as || (m_exception != m_exception_string);
+ } else if(m_at & assertType::is_throws_as) { //!OCLINT bitwise operator in conditional
+ m_failed = !m_threw_as;
+ } else if(m_at & assertType::is_throws_with) { //!OCLINT bitwise operator in conditional
+ m_failed = m_exception != m_exception_string;
+ } else if(m_at & assertType::is_nothrow) { //!OCLINT bitwise operator in conditional
+ m_failed = m_threw;
+ }
+
+ if(m_exception.size())
+ m_exception = String("\"") + m_exception + "\"";
+
+ if(is_running_in_test) {
+ addAssert(m_at);
+ DOCTEST_ITERATE_THROUGH_REPORTERS(log_assert, *this);
+
+ if(m_failed)
+ addFailedAssert(m_at);
+ } else if(m_failed) {
+ failed_out_of_a_testing_context(*this);
+ }
+
+ return m_failed && isDebuggerActive() &&
+ !getContextOptions()->no_breaks; // break into debugger
+ }
+
+ void ResultBuilder::react() const {
+ if(m_failed && checkIfShouldThrow(m_at))
+ throwException();
+ }
+
+ void failed_out_of_a_testing_context(const AssertData& ad) {
+ if(g_cs->ah)
+ g_cs->ah(ad);
+ else
+ std::abort();
+ }
+
+ void decomp_assert(assertType::Enum at, const char* file, int line, const char* expr,
+ Result result) {
+ bool failed = !result.m_passed;
+
+ // ###################################################################################
+ // IF THE DEBUGGER BREAKS HERE - GO 1 LEVEL UP IN THE CALLSTACK FOR THE FAILING ASSERT
+ // THIS IS THE EFFECT OF HAVING 'DOCTEST_CONFIG_SUPER_FAST_ASSERTS' DEFINED
+ // ###################################################################################
+ DOCTEST_ASSERT_OUT_OF_TESTS(result.m_decomp);
+ DOCTEST_ASSERT_IN_TESTS(result.m_decomp);
+ }
+
+ MessageBuilder::MessageBuilder(const char* file, int line, assertType::Enum severity) {
+ m_stream = getTlsOss();
+ m_file = file;
+ m_line = line;
+ m_severity = severity;
+ }
+
+ IExceptionTranslator::IExceptionTranslator() = default;
+ IExceptionTranslator::~IExceptionTranslator() = default;
+
+ bool MessageBuilder::log() {
+ m_string = getTlsOssResult();
+ DOCTEST_ITERATE_THROUGH_REPORTERS(log_message, *this);
+
+ const bool isWarn = m_severity & assertType::is_warn;
+
+ // warn is just a message in this context so we don't treat it as an assert
+ if(!isWarn) {
+ addAssert(m_severity);
+ addFailedAssert(m_severity);
+ }
+
+ return isDebuggerActive() && !getContextOptions()->no_breaks && !isWarn; // break
+ }
+
+ void MessageBuilder::react() {
+ if(m_severity & assertType::is_require) //!OCLINT bitwise operator in conditional
+ throwException();
+ }
+
+ MessageBuilder::~MessageBuilder() = default;
+} // namespace detail
+namespace {
+ using namespace detail;
+
+ template <typename Ex>
+ [[noreturn]] void throw_exception(Ex const& e) {
+#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
+ throw e;
+#else // DOCTEST_CONFIG_NO_EXCEPTIONS
+ std::cerr << "doctest will terminate because it needed to throw an exception.\n"
+ << "The message was: " << e.what() << '\n';
+ std::terminate();
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
+ }
+
+#define DOCTEST_INTERNAL_ERROR(msg) \
+ throw_exception(std::logic_error( \
+ __FILE__ ":" DOCTEST_TOSTR(__LINE__) ": Internal doctest error: " msg))
+
+ // clang-format off
+
+// =================================================================================================
+// The following code has been taken verbatim from Catch2/include/internal/catch_xmlwriter.h/cpp
+// This is done so cherry-picking bug fixes is trivial - even the style/formatting is untouched.
+// =================================================================================================
+
+ class XmlEncode {
+ public:
+ enum ForWhat { ForTextNodes, ForAttributes };
+
+ XmlEncode( std::string const& str, ForWhat forWhat = ForTextNodes );
+
+ void encodeTo( std::ostream& os ) const;
+
+ friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode );
+
+ private:
+ std::string m_str;
+ ForWhat m_forWhat;
+ };
+
+ class XmlWriter {
+ public:
+
+ class ScopedElement {
+ public:
+ ScopedElement( XmlWriter* writer );
+
+ ScopedElement( ScopedElement&& other ) noexcept;
+ ScopedElement& operator=( ScopedElement&& other ) noexcept;
+
+ ~ScopedElement();
+
+ ScopedElement& writeText( std::string const& text, bool indent = true );
+
+ template<typename T>
+ ScopedElement& writeAttribute( std::string const& name, T const& attribute ) {
+ m_writer->writeAttribute( name, attribute );
+ return *this;
+ }
+
+ private:
+ mutable XmlWriter* m_writer = nullptr;
+ };
+
+ XmlWriter( std::ostream& os = std::cout );
+ ~XmlWriter();
+
+ XmlWriter( XmlWriter const& ) = delete;
+ XmlWriter& operator=( XmlWriter const& ) = delete;
+
+ XmlWriter& startElement( std::string const& name );
+
+ ScopedElement scopedElement( std::string const& name );
+
+ XmlWriter& endElement();
+
+ XmlWriter& writeAttribute( std::string const& name, std::string const& attribute );
+
+ XmlWriter& writeAttribute( std::string const& name, const char* attribute );
+
+ XmlWriter& writeAttribute( std::string const& name, bool attribute );
+
+ template<typename T>
+ XmlWriter& writeAttribute( std::string const& name, T const& attribute ) {
+ std::stringstream rss;
+ rss << attribute;
+ return writeAttribute( name, rss.str() );
+ }
+
+ XmlWriter& writeText( std::string const& text, bool indent = true );
+
+ //XmlWriter& writeComment( std::string const& text );
+
+ //void writeStylesheetRef( std::string const& url );
+
+ //XmlWriter& writeBlankLine();
+
+ void ensureTagClosed();
+
+ private:
+
+ void writeDeclaration();
+
+ void newlineIfNecessary();
+
+ bool m_tagIsOpen = false;
+ bool m_needsNewline = false;
+ std::vector<std::string> m_tags;
+ std::string m_indent;
+ std::ostream& m_os;
+ };
+
+// =================================================================================================
+// The following code has been taken verbatim from Catch2/include/internal/catch_xmlwriter.h/cpp
+// This is done so cherry-picking bug fixes is trivial - even the style/formatting is untouched.
+// =================================================================================================
+
+using uchar = unsigned char;
+
+namespace {
+
+ size_t trailingBytes(unsigned char c) {
+ if ((c & 0xE0) == 0xC0) {
+ return 2;
+ }
+ if ((c & 0xF0) == 0xE0) {
+ return 3;
+ }
+ if ((c & 0xF8) == 0xF0) {
+ return 4;
+ }
+ DOCTEST_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered");
+ }
+
+ uint32_t headerValue(unsigned char c) {
+ if ((c & 0xE0) == 0xC0) {
+ return c & 0x1F;
+ }
+ if ((c & 0xF0) == 0xE0) {
+ return c & 0x0F;
+ }
+ if ((c & 0xF8) == 0xF0) {
+ return c & 0x07;
+ }
+ DOCTEST_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered");
+ }
+
+ void hexEscapeChar(std::ostream& os, unsigned char c) {
+ std::ios_base::fmtflags f(os.flags());
+ os << "\\x"
+ << std::uppercase << std::hex << std::setfill('0') << std::setw(2)
+ << static_cast<int>(c);
+ os.flags(f);
+ }
+
+} // anonymous namespace
+
+ XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat )
+ : m_str( str ),
+ m_forWhat( forWhat )
+ {}
+
+ void XmlEncode::encodeTo( std::ostream& os ) const {
+ // Apostrophe escaping not necessary if we always use " to write attributes
+ // (see: https://www.w3.org/TR/xml/#syntax)
+
+ for( std::size_t idx = 0; idx < m_str.size(); ++ idx ) {
+ uchar c = m_str[idx];
+ switch (c) {
+ case '<': os << "&lt;"; break;
+ case '&': os << "&amp;"; break;
+
+ case '>':
+ // See: https://www.w3.org/TR/xml/#syntax
+ if (idx > 2 && m_str[idx - 1] == ']' && m_str[idx - 2] == ']')
+ os << "&gt;";
+ else
+ os << c;
+ break;
+
+ case '\"':
+ if (m_forWhat == ForAttributes)
+ os << "&quot;";
+ else
+ os << c;
+ break;
+
+ default:
+ // Check for control characters and invalid utf-8
+
+ // Escape control characters in standard ascii
+ // see https://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0
+ if (c < 0x09 || (c > 0x0D && c < 0x20) || c == 0x7F) {
+ hexEscapeChar(os, c);
+ break;
+ }
+
+ // Plain ASCII: Write it to stream
+ if (c < 0x7F) {
+ os << c;
+ break;
+ }
+
+ // UTF-8 territory
+ // Check if the encoding is valid and if it is not, hex escape bytes.
+ // Important: We do not check the exact decoded values for validity, only the encoding format
+ // First check that this bytes is a valid lead byte:
+ // This means that it is not encoded as 1111 1XXX
+ // Or as 10XX XXXX
+ if (c < 0xC0 ||
+ c >= 0xF8) {
+ hexEscapeChar(os, c);
+ break;
+ }
+
+ auto encBytes = trailingBytes(c);
+ // Are there enough bytes left to avoid accessing out-of-bounds memory?
+ if (idx + encBytes - 1 >= m_str.size()) {
+ hexEscapeChar(os, c);
+ break;
+ }
+ // The header is valid, check data
+ // The next encBytes bytes must together be a valid utf-8
+ // This means: bitpattern 10XX XXXX and the extracted value is sane (ish)
+ bool valid = true;
+ uint32_t value = headerValue(c);
+ for (std::size_t n = 1; n < encBytes; ++n) {
+ uchar nc = m_str[idx + n];
+ valid &= ((nc & 0xC0) == 0x80);
+ value = (value << 6) | (nc & 0x3F);
+ }
+
+ if (
+ // Wrong bit pattern of following bytes
+ (!valid) ||
+ // Overlong encodings
+ (value < 0x80) ||
+ ( value < 0x800 && encBytes > 2) || // removed "0x80 <= value &&" because redundant
+ (0x800 < value && value < 0x10000 && encBytes > 3) ||
+ // Encoded value out of range
+ (value >= 0x110000)
+ ) {
+ hexEscapeChar(os, c);
+ break;
+ }
+
+ // If we got here, this is in fact a valid(ish) utf-8 sequence
+ for (std::size_t n = 0; n < encBytes; ++n) {
+ os << m_str[idx + n];
+ }
+ idx += encBytes - 1;
+ break;
+ }
+ }
+ }
+
+ std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) {
+ xmlEncode.encodeTo( os );
+ return os;
+ }
+
+ XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer )
+ : m_writer( writer )
+ {}
+
+ XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept
+ : m_writer( other.m_writer ){
+ other.m_writer = nullptr;
+ }
+ XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept {
+ if ( m_writer ) {
+ m_writer->endElement();
+ }
+ m_writer = other.m_writer;
+ other.m_writer = nullptr;
+ return *this;
+ }
+
+
+ XmlWriter::ScopedElement::~ScopedElement() {
+ if( m_writer )
+ m_writer->endElement();
+ }
+
+ XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, bool indent ) {
+ m_writer->writeText( text, indent );
+ return *this;
+ }
+
+ XmlWriter::XmlWriter( std::ostream& os ) : m_os( os )
+ {
+ writeDeclaration();
+ }
+
+ XmlWriter::~XmlWriter() {
+ while( !m_tags.empty() )
+ endElement();
+ }
+
+ XmlWriter& XmlWriter::startElement( std::string const& name ) {
+ ensureTagClosed();
+ newlineIfNecessary();
+ m_os << m_indent << '<' << name;
+ m_tags.push_back( name );
+ m_indent += " ";
+ m_tagIsOpen = true;
+ return *this;
+ }
+
+ XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name ) {
+ ScopedElement scoped( this );
+ startElement( name );
+ return scoped;
+ }
+
+ XmlWriter& XmlWriter::endElement() {
+ newlineIfNecessary();
+ m_indent = m_indent.substr( 0, m_indent.size()-2 );
+ if( m_tagIsOpen ) {
+ m_os << "/>";
+ m_tagIsOpen = false;
+ }
+ else {
+ m_os << m_indent << "</" << m_tags.back() << ">";
+ }
+ m_os << std::endl;
+ m_tags.pop_back();
+ return *this;
+ }
+
+ XmlWriter& XmlWriter::writeAttribute( std::string const& name, std::string const& attribute ) {
+ if( !name.empty() && !attribute.empty() )
+ m_os << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"';
+ return *this;
+ }
+
+ XmlWriter& XmlWriter::writeAttribute( std::string const& name, const char* attribute ) {
+ if( !name.empty() && attribute && attribute[0] != '\0' )
+ m_os << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"';
+ return *this;
+ }
+
+ XmlWriter& XmlWriter::writeAttribute( std::string const& name, bool attribute ) {
+ m_os << ' ' << name << "=\"" << ( attribute ? "true" : "false" ) << '"';
+ return *this;
+ }
+
+ XmlWriter& XmlWriter::writeText( std::string const& text, bool indent ) {
+ if( !text.empty() ){
+ bool tagWasOpen = m_tagIsOpen;
+ ensureTagClosed();
+ if( tagWasOpen && indent )
+ m_os << m_indent;
+ m_os << XmlEncode( text );
+ m_needsNewline = true;
+ }
+ return *this;
+ }
+
+ //XmlWriter& XmlWriter::writeComment( std::string const& text ) {
+ // ensureTagClosed();
+ // m_os << m_indent << "<!--" << text << "-->";
+ // m_needsNewline = true;
+ // return *this;
+ //}
+
+ //void XmlWriter::writeStylesheetRef( std::string const& url ) {
+ // m_os << "<?xml-stylesheet type=\"text/xsl\" href=\"" << url << "\"?>\n";
+ //}
+
+ //XmlWriter& XmlWriter::writeBlankLine() {
+ // ensureTagClosed();
+ // m_os << '\n';
+ // return *this;
+ //}
+
+ void XmlWriter::ensureTagClosed() {
+ if( m_tagIsOpen ) {
+ m_os << ">" << std::endl;
+ m_tagIsOpen = false;
+ }
+ }
+
+ void XmlWriter::writeDeclaration() {
+ m_os << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+ }
+
+ void XmlWriter::newlineIfNecessary() {
+ if( m_needsNewline ) {
+ m_os << std::endl;
+ m_needsNewline = false;
+ }
+ }
+
+// =================================================================================================
+// End of copy-pasted code from Catch
+// =================================================================================================
+
+ // clang-format on
+
+ struct XmlReporter : public IReporter
+ {
+ XmlWriter xml;
+ std::mutex mutex;
+
+ // caching pointers/references to objects of these types - safe to do
+ const ContextOptions& opt;
+ const TestCaseData* tc = nullptr;
+
+ XmlReporter(const ContextOptions& co)
+ : xml(*co.cout)
+ , opt(co) {}
+
+ void log_contexts() {
+ int num_contexts = get_num_active_contexts();
+ if(num_contexts) {
+ auto contexts = get_active_contexts();
+ std::stringstream ss;
+ for(int i = 0; i < num_contexts; ++i) {
+ contexts[i]->stringify(&ss);
+ xml.scopedElement("Info").writeText(ss.str());
+ ss.str("");
+ }
+ }
+ }
+
+ unsigned line(unsigned l) const { return opt.no_line_numbers ? 0 : l; }
+
+ void test_case_start_impl(const TestCaseData& in) {
+ bool open_ts_tag = false;
+ if(tc != nullptr) { // we have already opened a test suite
+ if(std::strcmp(tc->m_test_suite, in.m_test_suite) != 0) {
+ xml.endElement();
+ open_ts_tag = true;
+ }
+ }
+ else {
+ open_ts_tag = true; // first test case ==> first test suite
+ }
+
+ if(open_ts_tag) {
+ xml.startElement("TestSuite");
+ xml.writeAttribute("name", in.m_test_suite);
+ }
+
+ tc = &in;
+ xml.startElement("TestCase")
+ .writeAttribute("name", in.m_name)
+ .writeAttribute("filename", skipPathFromFilename(in.m_file))
+ .writeAttribute("line", line(in.m_line))
+ .writeAttribute("description", in.m_description);
+
+ if(Approx(in.m_timeout) != 0)
+ xml.writeAttribute("timeout", in.m_timeout);
+ if(in.m_may_fail)
+ xml.writeAttribute("may_fail", true);
+ if(in.m_should_fail)
+ xml.writeAttribute("should_fail", true);
+ }
+
+ // =========================================================================================
+ // WHAT FOLLOWS ARE OVERRIDES OF THE VIRTUAL METHODS OF THE REPORTER INTERFACE
+ // =========================================================================================
+
+ void report_query(const QueryData& in) override {
+ test_run_start();
+ if(opt.list_reporters) {
+ for(auto& curr : getListeners())
+ xml.scopedElement("Listener")
+ .writeAttribute("priority", curr.first.first)
+ .writeAttribute("name", curr.first.second);
+ for(auto& curr : getReporters())
+ xml.scopedElement("Reporter")
+ .writeAttribute("priority", curr.first.first)
+ .writeAttribute("name", curr.first.second);
+ } else if(opt.count || opt.list_test_cases) {
+ for(unsigned i = 0; i < in.num_data; ++i) {
+ xml.scopedElement("TestCase").writeAttribute("name", in.data[i]->m_name)
+ .writeAttribute("testsuite", in.data[i]->m_test_suite)
+ .writeAttribute("filename", skipPathFromFilename(in.data[i]->m_file))
+ .writeAttribute("line", line(in.data[i]->m_line));
+ }
+ xml.scopedElement("OverallResultsTestCases")
+ .writeAttribute("unskipped", in.run_stats->numTestCasesPassingFilters);
+ } else if(opt.list_test_suites) {
+ for(unsigned i = 0; i < in.num_data; ++i)
+ xml.scopedElement("TestSuite").writeAttribute("name", in.data[i]->m_test_suite);
+ xml.scopedElement("OverallResultsTestCases")
+ .writeAttribute("unskipped", in.run_stats->numTestCasesPassingFilters);
+ xml.scopedElement("OverallResultsTestSuites")
+ .writeAttribute("unskipped", in.run_stats->numTestSuitesPassingFilters);
+ }
+ xml.endElement();
+ }
+
+ void test_run_start() override {
+ // remove .exe extension - mainly to have the same output on UNIX and Windows
+ std::string binary_name = skipPathFromFilename(opt.binary_name.c_str());
+#ifdef DOCTEST_PLATFORM_WINDOWS
+ if(binary_name.rfind(".exe") != std::string::npos)
+ binary_name = binary_name.substr(0, binary_name.length() - 4);
+#endif // DOCTEST_PLATFORM_WINDOWS
+
+ xml.startElement("doctest").writeAttribute("binary", binary_name);
+ if(opt.no_version == false)
+ xml.writeAttribute("version", DOCTEST_VERSION_STR);
+
+ // only the consequential ones (TODO: filters)
+ xml.scopedElement("Options")
+ .writeAttribute("order_by", opt.order_by.c_str())
+ .writeAttribute("rand_seed", opt.rand_seed)
+ .writeAttribute("first", opt.first)
+ .writeAttribute("last", opt.last)
+ .writeAttribute("abort_after", opt.abort_after)
+ .writeAttribute("subcase_filter_levels", opt.subcase_filter_levels)
+ .writeAttribute("case_sensitive", opt.case_sensitive)
+ .writeAttribute("no_throw", opt.no_throw)
+ .writeAttribute("no_skip", opt.no_skip);
+ }
+
+ void test_run_end(const TestRunStats& p) override {
+ if(tc) // the TestSuite tag - only if there has been at least 1 test case
+ xml.endElement();
+
+ xml.scopedElement("OverallResultsAsserts")
+ .writeAttribute("successes", p.numAsserts - p.numAssertsFailed)
+ .writeAttribute("failures", p.numAssertsFailed);
+
+ xml.startElement("OverallResultsTestCases")
+ .writeAttribute("successes",
+ p.numTestCasesPassingFilters - p.numTestCasesFailed)
+ .writeAttribute("failures", p.numTestCasesFailed);
+ if(opt.no_skipped_summary == false)
+ xml.writeAttribute("skipped", p.numTestCases - p.numTestCasesPassingFilters);
+ xml.endElement();
+
+ xml.endElement();
+ }
+
+ void test_case_start(const TestCaseData& in) override {
+ test_case_start_impl(in);
+ xml.ensureTagClosed();
+ }
+
+ void test_case_reenter(const TestCaseData&) override {}
+
+ void test_case_end(const CurrentTestCaseStats& st) override {
+ xml.startElement("OverallResultsAsserts")
+ .writeAttribute("successes",
+ st.numAssertsCurrentTest - st.numAssertsFailedCurrentTest)
+ .writeAttribute("failures", st.numAssertsFailedCurrentTest);
+ if(opt.duration)
+ xml.writeAttribute("duration", st.seconds);
+ if(tc->m_expected_failures)
+ xml.writeAttribute("expected_failures", tc->m_expected_failures);
+ xml.endElement();
+
+ xml.endElement();
+ }
+
+ void test_case_exception(const TestCaseException& e) override {
+ std::lock_guard<std::mutex> lock(mutex);
+
+ xml.scopedElement("Exception")
+ .writeAttribute("crash", e.is_crash)
+ .writeText(e.error_string.c_str());
+ }
+
+ void subcase_start(const SubcaseSignature& in) override {
+ std::lock_guard<std::mutex> lock(mutex);
+
+ xml.startElement("SubCase")
+ .writeAttribute("name", in.m_name)
+ .writeAttribute("filename", skipPathFromFilename(in.m_file))
+ .writeAttribute("line", line(in.m_line));
+ xml.ensureTagClosed();
+ }
+
+ void subcase_end() override { xml.endElement(); }
+
+ void log_assert(const AssertData& rb) override {
+ if(!rb.m_failed && !opt.success)
+ return;
+
+ std::lock_guard<std::mutex> lock(mutex);
+
+ xml.startElement("Expression")
+ .writeAttribute("success", !rb.m_failed)
+ .writeAttribute("type", assertString(rb.m_at))
+ .writeAttribute("filename", skipPathFromFilename(rb.m_file))
+ .writeAttribute("line", line(rb.m_line));
+
+ xml.scopedElement("Original").writeText(rb.m_expr);
+
+ if(rb.m_threw)
+ xml.scopedElement("Exception").writeText(rb.m_exception.c_str());
+
+ if(rb.m_at & assertType::is_throws_as)
+ xml.scopedElement("ExpectedException").writeText(rb.m_exception_type);
+ if(rb.m_at & assertType::is_throws_with)
+ xml.scopedElement("ExpectedExceptionString").writeText(rb.m_exception_string);
+ if((rb.m_at & assertType::is_normal) && !rb.m_threw)
+ xml.scopedElement("Expanded").writeText(rb.m_decomp.c_str());
+
+ log_contexts();
+
+ xml.endElement();
+ }
+
+ void log_message(const MessageData& mb) override {
+ std::lock_guard<std::mutex> lock(mutex);
+
+ xml.startElement("Message")
+ .writeAttribute("type", failureString(mb.m_severity))
+ .writeAttribute("filename", skipPathFromFilename(mb.m_file))
+ .writeAttribute("line", line(mb.m_line));
+
+ xml.scopedElement("Text").writeText(mb.m_string.c_str());
+
+ log_contexts();
+
+ xml.endElement();
+ }
+
+ void test_case_skipped(const TestCaseData& in) override {
+ if(opt.no_skipped_summary == false) {
+ test_case_start_impl(in);
+ xml.writeAttribute("skipped", "true");
+ xml.endElement();
+ }
+ }
+ };
+
+ DOCTEST_REGISTER_REPORTER("xml", 0, XmlReporter);
+
+ struct Whitespace
+ {
+ int nrSpaces;
+ explicit Whitespace(int nr)
+ : nrSpaces(nr) {}
+ };
+
+ std::ostream& operator<<(std::ostream& out, const Whitespace& ws) {
+ if(ws.nrSpaces != 0)
+ out << std::setw(ws.nrSpaces) << ' ';
+ return out;
+ }
+
+ struct ConsoleReporter : public IReporter
+ {
+ std::ostream& s;
+ bool hasLoggedCurrentTestStart;
+ std::vector<SubcaseSignature> subcasesStack;
+ std::mutex mutex;
+
+ // caching pointers/references to objects of these types - safe to do
+ const ContextOptions& opt;
+ const TestCaseData* tc;
+
+ ConsoleReporter(const ContextOptions& co)
+ : s(*co.cout)
+ , opt(co) {}
+
+ ConsoleReporter(const ContextOptions& co, std::ostream& ostr)
+ : s(ostr)
+ , opt(co) {}
+
+ // =========================================================================================
+ // WHAT FOLLOWS ARE HELPERS USED BY THE OVERRIDES OF THE VIRTUAL METHODS OF THE INTERFACE
+ // =========================================================================================
+
+ void separator_to_stream() {
+ s << Color::Yellow
+ << "==============================================================================="
+ "\n";
+ }
+
+ const char* getSuccessOrFailString(bool success, assertType::Enum at,
+ const char* success_str) {
+ if(success)
+ return success_str;
+ return failureString(at);
+ }
+
+ Color::Enum getSuccessOrFailColor(bool success, assertType::Enum at) {
+ return success ? Color::BrightGreen :
+ (at & assertType::is_warn) ? Color::Yellow : Color::Red;
+ }
+
+ void successOrFailColoredStringToStream(bool success, assertType::Enum at,
+ const char* success_str = "SUCCESS") {
+ s << getSuccessOrFailColor(success, at)
+ << getSuccessOrFailString(success, at, success_str) << ": ";
+ }
+
+ void log_contexts() {
+ int num_contexts = get_num_active_contexts();
+ if(num_contexts) {
+ auto contexts = get_active_contexts();
+
+ s << Color::None << " logged: ";
+ for(int i = 0; i < num_contexts; ++i) {
+ s << (i == 0 ? "" : " ");
+ contexts[i]->stringify(&s);
+ s << "\n";
+ }
+ }
+
+ s << "\n";
+ }
+
+ void logTestStart() {
+ if(hasLoggedCurrentTestStart)
+ return;
+
+ separator_to_stream();
+ file_line_to_stream(s, tc->m_file, tc->m_line, "\n");
+ if(tc->m_description)
+ s << Color::Yellow << "DESCRIPTION: " << Color::None << tc->m_description << "\n";
+ if(tc->m_test_suite && tc->m_test_suite[0] != '\0')
+ s << Color::Yellow << "TEST SUITE: " << Color::None << tc->m_test_suite << "\n";
+ if(strncmp(tc->m_name, " Scenario:", 11) != 0)
+ s << Color::None << "TEST CASE: ";
+ s << Color::None << tc->m_name << "\n";
+
+ for(auto& curr : subcasesStack)
+ if(curr.m_name[0] != '\0')
+ s << " " << curr.m_name << "\n";
+
+ s << "\n";
+
+ hasLoggedCurrentTestStart = true;
+ }
+
+ void printVersion() {
+ if(opt.no_version == false)
+ s << Color::Cyan << "[doctest] " << Color::None << "doctest version is \""
+ << DOCTEST_VERSION_STR << "\"\n";
+ }
+
+ void printIntro() {
+ printVersion();
+ s << Color::Cyan << "[doctest] " << Color::None
+ << "run with \"--" DOCTEST_OPTIONS_PREFIX_DISPLAY "help\" for options\n";
+ }
+
+ void printHelp() {
+ int sizePrefixDisplay = static_cast<int>(strlen(DOCTEST_OPTIONS_PREFIX_DISPLAY));
+ printVersion();
+ // clang-format off
+ s << Color::Cyan << "[doctest]\n" << Color::None;
+ s << Color::Cyan << "[doctest] " << Color::None;
+ s << "boolean values: \"1/on/yes/true\" or \"0/off/no/false\"\n";
+ s << Color::Cyan << "[doctest] " << Color::None;
+ s << "filter values: \"str1,str2,str3\" (comma separated strings)\n";
+ s << Color::Cyan << "[doctest]\n" << Color::None;
+ s << Color::Cyan << "[doctest] " << Color::None;
+ s << "filters use wildcards for matching strings\n";
+ s << Color::Cyan << "[doctest] " << Color::None;
+ s << "something passes a filter if any of the strings in a filter matches\n";
+#ifndef DOCTEST_CONFIG_NO_UNPREFIXED_OPTIONS
+ s << Color::Cyan << "[doctest]\n" << Color::None;
+ s << Color::Cyan << "[doctest] " << Color::None;
+ s << "ALL FLAGS, OPTIONS AND FILTERS ALSO AVAILABLE WITH A \"" DOCTEST_CONFIG_OPTIONS_PREFIX "\" PREFIX!!!\n";
+#endif
+ s << Color::Cyan << "[doctest]\n" << Color::None;
+ s << Color::Cyan << "[doctest] " << Color::None;
+ s << "Query flags - the program quits after them. Available:\n\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "?, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "help, -" DOCTEST_OPTIONS_PREFIX_DISPLAY "h "
+ << Whitespace(sizePrefixDisplay*0) << "prints this message\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "v, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "version "
+ << Whitespace(sizePrefixDisplay*1) << "prints the version\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "c, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "count "
+ << Whitespace(sizePrefixDisplay*1) << "prints the number of matching tests\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "ltc, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "list-test-cases "
+ << Whitespace(sizePrefixDisplay*1) << "lists all matching tests by name\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "lts, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "list-test-suites "
+ << Whitespace(sizePrefixDisplay*1) << "lists all matching test suites\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "lr, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "list-reporters "
+ << Whitespace(sizePrefixDisplay*1) << "lists all registered reporters\n\n";
+ // ================================================================================== << 79
+ s << Color::Cyan << "[doctest] " << Color::None;
+ s << "The available <int>/<string> options/filters are:\n\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "tc, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "test-case=<filters> "
+ << Whitespace(sizePrefixDisplay*1) << "filters tests by their name\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "tce, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "test-case-exclude=<filters> "
+ << Whitespace(sizePrefixDisplay*1) << "filters OUT tests by their name\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "sf, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "source-file=<filters> "
+ << Whitespace(sizePrefixDisplay*1) << "filters tests by their file\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "sfe, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "source-file-exclude=<filters> "
+ << Whitespace(sizePrefixDisplay*1) << "filters OUT tests by their file\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "ts, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "test-suite=<filters> "
+ << Whitespace(sizePrefixDisplay*1) << "filters tests by their test suite\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "tse, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "test-suite-exclude=<filters> "
+ << Whitespace(sizePrefixDisplay*1) << "filters OUT tests by their test suite\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "sc, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "subcase=<filters> "
+ << Whitespace(sizePrefixDisplay*1) << "filters subcases by their name\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "sce, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "subcase-exclude=<filters> "
+ << Whitespace(sizePrefixDisplay*1) << "filters OUT subcases by their name\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "r, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "reporters=<filters> "
+ << Whitespace(sizePrefixDisplay*1) << "reporters to use (console is default)\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "o, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "out=<string> "
+ << Whitespace(sizePrefixDisplay*1) << "output filename\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "ob, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "order-by=<string> "
+ << Whitespace(sizePrefixDisplay*1) << "how the tests should be ordered\n";
+ s << Whitespace(sizePrefixDisplay*3) << " <string> - by [file/suite/name/rand]\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "rs, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "rand-seed=<int> "
+ << Whitespace(sizePrefixDisplay*1) << "seed for random ordering\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "f, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "first=<int> "
+ << Whitespace(sizePrefixDisplay*1) << "the first test passing the filters to\n";
+ s << Whitespace(sizePrefixDisplay*3) << " execute - for range-based execution\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "l, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "last=<int> "
+ << Whitespace(sizePrefixDisplay*1) << "the last test passing the filters to\n";
+ s << Whitespace(sizePrefixDisplay*3) << " execute - for range-based execution\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "aa, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "abort-after=<int> "
+ << Whitespace(sizePrefixDisplay*1) << "stop after <int> failed assertions\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "scfl,--" DOCTEST_OPTIONS_PREFIX_DISPLAY "subcase-filter-levels=<int> "
+ << Whitespace(sizePrefixDisplay*1) << "apply filters for the first <int> levels\n";
+ s << Color::Cyan << "\n[doctest] " << Color::None;
+ s << "Bool options - can be used like flags and true is assumed. Available:\n\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "s, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "success=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << "include successful assertions in output\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "cs, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "case-sensitive=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << "filters being treated as case sensitive\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "e, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "exit=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << "exits after the tests finish\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "d, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "duration=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << "prints the time duration of each test\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "nt, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "no-throw=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << "skips exceptions-related assert checks\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "ne, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "no-exitcode=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << "returns (or exits) always with success\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "nr, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "no-run=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << "skips all runtime doctest operations\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "nv, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "no-version=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << "omit the framework version in the output\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "nc, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "no-colors=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << "disables colors in output\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "fc, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "force-colors=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << "use colors even when not in a tty\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "nb, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "no-breaks=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << "disables breakpoints in debuggers\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "ns, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "no-skip=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << "don't skip test cases marked as skip\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "gfl, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "gnu-file-line=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << ":n: vs (n): for line numbers in output\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "npf, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "no-path-filenames=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << "only filenames and no paths in output\n";
+ s << " -" DOCTEST_OPTIONS_PREFIX_DISPLAY "nln, --" DOCTEST_OPTIONS_PREFIX_DISPLAY "no-line-numbers=<bool> "
+ << Whitespace(sizePrefixDisplay*1) << "0 instead of real line numbers in output\n";
+ // ================================================================================== << 79
+ // clang-format on
+
+ s << Color::Cyan << "\n[doctest] " << Color::None;
+ s << "for more information visit the project documentation\n\n";
+ }
+
+ void printRegisteredReporters() {
+ printVersion();
+ auto printReporters = [this] (const reporterMap& reporters, const char* type) {
+ if(reporters.size()) {
+ s << Color::Cyan << "[doctest] " << Color::None << "listing all registered " << type << "\n";
+ for(auto& curr : reporters)
+ s << "priority: " << std::setw(5) << curr.first.first
+ << " name: " << curr.first.second << "\n";
+ }
+ };
+ printReporters(getListeners(), "listeners");
+ printReporters(getReporters(), "reporters");
+ }
+
+ void list_query_results() {
+ separator_to_stream();
+ if(opt.count || opt.list_test_cases) {
+ s << Color::Cyan << "[doctest] " << Color::None
+ << "unskipped test cases passing the current filters: "
+ << g_cs->numTestCasesPassingFilters << "\n";
+ } else if(opt.list_test_suites) {
+ s << Color::Cyan << "[doctest] " << Color::None
+ << "unskipped test cases passing the current filters: "
+ << g_cs->numTestCasesPassingFilters << "\n";
+ s << Color::Cyan << "[doctest] " << Color::None
+ << "test suites with unskipped test cases passing the current filters: "
+ << g_cs->numTestSuitesPassingFilters << "\n";
+ }
+ }
+
+ // =========================================================================================
+ // WHAT FOLLOWS ARE OVERRIDES OF THE VIRTUAL METHODS OF THE REPORTER INTERFACE
+ // =========================================================================================
+
+ void report_query(const QueryData& in) override {
+ if(opt.version) {
+ printVersion();
+ } else if(opt.help) {
+ printHelp();
+ } else if(opt.list_reporters) {
+ printRegisteredReporters();
+ } else if(opt.count || opt.list_test_cases) {
+ if(opt.list_test_cases) {
+ s << Color::Cyan << "[doctest] " << Color::None
+ << "listing all test case names\n";
+ separator_to_stream();
+ }
+
+ for(unsigned i = 0; i < in.num_data; ++i)
+ s << Color::None << in.data[i]->m_name << "\n";
+
+ separator_to_stream();
+
+ s << Color::Cyan << "[doctest] " << Color::None
+ << "unskipped test cases passing the current filters: "
+ << g_cs->numTestCasesPassingFilters << "\n";
+
+ } else if(opt.list_test_suites) {
+ s << Color::Cyan << "[doctest] " << Color::None << "listing all test suites\n";
+ separator_to_stream();
+
+ for(unsigned i = 0; i < in.num_data; ++i)
+ s << Color::None << in.data[i]->m_test_suite << "\n";
+
+ separator_to_stream();
+
+ s << Color::Cyan << "[doctest] " << Color::None
+ << "unskipped test cases passing the current filters: "
+ << g_cs->numTestCasesPassingFilters << "\n";
+ s << Color::Cyan << "[doctest] " << Color::None
+ << "test suites with unskipped test cases passing the current filters: "
+ << g_cs->numTestSuitesPassingFilters << "\n";
+ }
+ }
+
+ void test_run_start() override { printIntro(); }
+
+ void test_run_end(const TestRunStats& p) override {
+ separator_to_stream();
+ s << std::dec;
+
+ const bool anythingFailed = p.numTestCasesFailed > 0 || p.numAssertsFailed > 0;
+ s << Color::Cyan << "[doctest] " << Color::None << "test cases: " << std::setw(6)
+ << p.numTestCasesPassingFilters << " | "
+ << ((p.numTestCasesPassingFilters == 0 || anythingFailed) ? Color::None :
+ Color::Green)
+ << std::setw(6) << p.numTestCasesPassingFilters - p.numTestCasesFailed << " passed"
+ << Color::None << " | " << (p.numTestCasesFailed > 0 ? Color::Red : Color::None)
+ << std::setw(6) << p.numTestCasesFailed << " failed" << Color::None << " | ";
+ if(opt.no_skipped_summary == false) {
+ const int numSkipped = p.numTestCases - p.numTestCasesPassingFilters;
+ s << (numSkipped == 0 ? Color::None : Color::Yellow) << std::setw(6) << numSkipped
+ << " skipped" << Color::None;
+ }
+ s << "\n";
+ s << Color::Cyan << "[doctest] " << Color::None << "assertions: " << std::setw(6)
+ << p.numAsserts << " | "
+ << ((p.numAsserts == 0 || anythingFailed) ? Color::None : Color::Green)
+ << std::setw(6) << (p.numAsserts - p.numAssertsFailed) << " passed" << Color::None
+ << " | " << (p.numAssertsFailed > 0 ? Color::Red : Color::None) << std::setw(6)
+ << p.numAssertsFailed << " failed" << Color::None << " |\n";
+ s << Color::Cyan << "[doctest] " << Color::None
+ << "Status: " << (p.numTestCasesFailed > 0 ? Color::Red : Color::Green)
+ << ((p.numTestCasesFailed > 0) ? "FAILURE!" : "SUCCESS!") << Color::None << std::endl;
+ }
+
+ void test_case_start(const TestCaseData& in) override {
+ hasLoggedCurrentTestStart = false;
+ tc = &in;
+ }
+
+ void test_case_reenter(const TestCaseData&) override {}
+
+ void test_case_end(const CurrentTestCaseStats& st) override {
+ // log the preamble of the test case only if there is something
+ // else to print - something other than that an assert has failed
+ if(opt.duration ||
+ (st.failure_flags && st.failure_flags != TestCaseFailureReason::AssertFailure))
+ logTestStart();
+
+ if(opt.duration)
+ s << Color::None << std::setprecision(6) << std::fixed << st.seconds
+ << " s: " << tc->m_name << "\n";
+
+ if(st.failure_flags & TestCaseFailureReason::Timeout)
+ s << Color::Red << "Test case exceeded time limit of " << std::setprecision(6)
+ << std::fixed << tc->m_timeout << "!\n";
+
+ if(st.failure_flags & TestCaseFailureReason::ShouldHaveFailedButDidnt) {
+ s << Color::Red << "Should have failed but didn't! Marking it as failed!\n";
+ } else if(st.failure_flags & TestCaseFailureReason::ShouldHaveFailedAndDid) {
+ s << Color::Yellow << "Failed as expected so marking it as not failed\n";
+ } else if(st.failure_flags & TestCaseFailureReason::CouldHaveFailedAndDid) {
+ s << Color::Yellow << "Allowed to fail so marking it as not failed\n";
+ } else if(st.failure_flags & TestCaseFailureReason::DidntFailExactlyNumTimes) {
+ s << Color::Red << "Didn't fail exactly " << tc->m_expected_failures
+ << " times so marking it as failed!\n";
+ } else if(st.failure_flags & TestCaseFailureReason::FailedExactlyNumTimes) {
+ s << Color::Yellow << "Failed exactly " << tc->m_expected_failures
+ << " times as expected so marking it as not failed!\n";
+ }
+ if(st.failure_flags & TestCaseFailureReason::TooManyFailedAsserts) {
+ s << Color::Red << "Aborting - too many failed asserts!\n";
+ }
+ s << Color::None; // lgtm [cpp/useless-expression]
+ }
+
+ void test_case_exception(const TestCaseException& e) override {
+ logTestStart();
+
+ file_line_to_stream(s, tc->m_file, tc->m_line, " ");
+ successOrFailColoredStringToStream(false, e.is_crash ? assertType::is_require :
+ assertType::is_check);
+ s << Color::Red << (e.is_crash ? "test case CRASHED: " : "test case THREW exception: ")
+ << Color::Cyan << e.error_string << "\n";
+
+ int num_stringified_contexts = get_num_stringified_contexts();
+ if(num_stringified_contexts) {
+ auto stringified_contexts = get_stringified_contexts();
+ s << Color::None << " logged: ";
+ for(int i = num_stringified_contexts; i > 0; --i) {
+ s << (i == num_stringified_contexts ? "" : " ")
+ << stringified_contexts[i - 1] << "\n";
+ }
+ }
+ s << "\n" << Color::None;
+ }
+
+ void subcase_start(const SubcaseSignature& subc) override {
+ std::lock_guard<std::mutex> lock(mutex);
+ subcasesStack.push_back(subc);
+ hasLoggedCurrentTestStart = false;
+ }
+
+ void subcase_end() override {
+ std::lock_guard<std::mutex> lock(mutex);
+ subcasesStack.pop_back();
+ hasLoggedCurrentTestStart = false;
+ }
+
+ void log_assert(const AssertData& rb) override {
+ if(!rb.m_failed && !opt.success)
+ return;
+
+ std::lock_guard<std::mutex> lock(mutex);
+
+ logTestStart();
+
+ file_line_to_stream(s, rb.m_file, rb.m_line, " ");
+ successOrFailColoredStringToStream(!rb.m_failed, rb.m_at);
+ if((rb.m_at & (assertType::is_throws_as | assertType::is_throws_with)) ==
+ 0) //!OCLINT bitwise operator in conditional
+ s << Color::Cyan << assertString(rb.m_at) << "( " << rb.m_expr << " ) "
+ << Color::None;
+
+ if(rb.m_at & assertType::is_throws) { //!OCLINT bitwise operator in conditional
+ s << (rb.m_threw ? "threw as expected!" : "did NOT throw at all!") << "\n";
+ } else if((rb.m_at & assertType::is_throws_as) &&
+ (rb.m_at & assertType::is_throws_with)) { //!OCLINT
+ s << Color::Cyan << assertString(rb.m_at) << "( " << rb.m_expr << ", \""
+ << rb.m_exception_string << "\", " << rb.m_exception_type << " ) " << Color::None;
+ if(rb.m_threw) {
+ if(!rb.m_failed) {
+ s << "threw as expected!\n";
+ } else {
+ s << "threw a DIFFERENT exception! (contents: " << rb.m_exception << ")\n";
+ }
+ } else {
+ s << "did NOT throw at all!\n";
+ }
+ } else if(rb.m_at &
+ assertType::is_throws_as) { //!OCLINT bitwise operator in conditional
+ s << Color::Cyan << assertString(rb.m_at) << "( " << rb.m_expr << ", "
+ << rb.m_exception_type << " ) " << Color::None
+ << (rb.m_threw ? (rb.m_threw_as ? "threw as expected!" :
+ "threw a DIFFERENT exception: ") :
+ "did NOT throw at all!")
+ << Color::Cyan << rb.m_exception << "\n";
+ } else if(rb.m_at &
+ assertType::is_throws_with) { //!OCLINT bitwise operator in conditional
+ s << Color::Cyan << assertString(rb.m_at) << "( " << rb.m_expr << ", \""
+ << rb.m_exception_string << "\" ) " << Color::None
+ << (rb.m_threw ? (!rb.m_failed ? "threw as expected!" :
+ "threw a DIFFERENT exception: ") :
+ "did NOT throw at all!")
+ << Color::Cyan << rb.m_exception << "\n";
+ } else if(rb.m_at & assertType::is_nothrow) { //!OCLINT bitwise operator in conditional
+ s << (rb.m_threw ? "THREW exception: " : "didn't throw!") << Color::Cyan
+ << rb.m_exception << "\n";
+ } else {
+ s << (rb.m_threw ? "THREW exception: " :
+ (!rb.m_failed ? "is correct!\n" : "is NOT correct!\n"));
+ if(rb.m_threw)
+ s << rb.m_exception << "\n";
+ else
+ s << " values: " << assertString(rb.m_at) << "( " << rb.m_decomp << " )\n";
+ }
+
+ log_contexts();
+ }
+
+ void log_message(const MessageData& mb) override {
+ std::lock_guard<std::mutex> lock(mutex);
+
+ logTestStart();
+
+ file_line_to_stream(s, mb.m_file, mb.m_line, " ");
+ s << getSuccessOrFailColor(false, mb.m_severity)
+ << getSuccessOrFailString(mb.m_severity & assertType::is_warn, mb.m_severity,
+ "MESSAGE") << ": ";
+ s << Color::None << mb.m_string << "\n";
+ log_contexts();
+ }
+
+ void test_case_skipped(const TestCaseData&) override {}
+ };
+
+ DOCTEST_REGISTER_REPORTER("console", 0, ConsoleReporter);
+
+#ifdef DOCTEST_PLATFORM_WINDOWS
+ struct DebugOutputWindowReporter : public ConsoleReporter
+ {
+ DOCTEST_THREAD_LOCAL static std::ostringstream oss;
+
+ DebugOutputWindowReporter(const ContextOptions& co)
+ : ConsoleReporter(co, oss) {}
+
+#define DOCTEST_DEBUG_OUTPUT_REPORTER_OVERRIDE(func, type, arg) \
+ void func(type arg) override { \
+ bool with_col = g_no_colors; \
+ g_no_colors = false; \
+ ConsoleReporter::func(arg); \
+ DOCTEST_OUTPUT_DEBUG_STRING(oss.str().c_str()); \
+ oss.str(""); \
+ g_no_colors = with_col; \
+ }
+
+ DOCTEST_DEBUG_OUTPUT_REPORTER_OVERRIDE(test_run_start, DOCTEST_EMPTY, DOCTEST_EMPTY)
+ DOCTEST_DEBUG_OUTPUT_REPORTER_OVERRIDE(test_run_end, const TestRunStats&, in)
+ DOCTEST_DEBUG_OUTPUT_REPORTER_OVERRIDE(test_case_start, const TestCaseData&, in)
+ DOCTEST_DEBUG_OUTPUT_REPORTER_OVERRIDE(test_case_reenter, const TestCaseData&, in)
+ DOCTEST_DEBUG_OUTPUT_REPORTER_OVERRIDE(test_case_end, const CurrentTestCaseStats&, in)
+ DOCTEST_DEBUG_OUTPUT_REPORTER_OVERRIDE(test_case_exception, const TestCaseException&, in)
+ DOCTEST_DEBUG_OUTPUT_REPORTER_OVERRIDE(subcase_start, const SubcaseSignature&, in)
+ DOCTEST_DEBUG_OUTPUT_REPORTER_OVERRIDE(subcase_end, DOCTEST_EMPTY, DOCTEST_EMPTY)
+ DOCTEST_DEBUG_OUTPUT_REPORTER_OVERRIDE(log_assert, const AssertData&, in)
+ DOCTEST_DEBUG_OUTPUT_REPORTER_OVERRIDE(log_message, const MessageData&, in)
+ DOCTEST_DEBUG_OUTPUT_REPORTER_OVERRIDE(test_case_skipped, const TestCaseData&, in)
+ };
+
+ DOCTEST_THREAD_LOCAL std::ostringstream DebugOutputWindowReporter::oss;
+#endif // DOCTEST_PLATFORM_WINDOWS
+
+ // the implementation of parseOption()
+ bool parseOptionImpl(int argc, const char* const* argv, const char* pattern, String* value) {
+ // going from the end to the beginning and stopping on the first occurrence from the end
+ for(int i = argc; i > 0; --i) {
+ auto index = i - 1;
+ auto temp = std::strstr(argv[index], pattern);
+ if(temp && (value || strlen(temp) == strlen(pattern))) { //!OCLINT prefer early exits and continue
+ // eliminate matches in which the chars before the option are not '-'
+ bool noBadCharsFound = true;
+ auto curr = argv[index];
+ while(curr != temp) {
+ if(*curr++ != '-') {
+ noBadCharsFound = false;
+ break;
+ }
+ }
+ if(noBadCharsFound && argv[index][0] == '-') {
+ if(value) {
+ // parsing the value of an option
+ temp += strlen(pattern);
+ const unsigned len = strlen(temp);
+ if(len) {
+ *value = temp;
+ return true;
+ }
+ } else {
+ // just a flag - no value
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ // parses an option and returns the string after the '=' character
+ bool parseOption(int argc, const char* const* argv, const char* pattern, String* value = nullptr,
+ const String& defaultVal = String()) {
+ if(value)
+ *value = defaultVal;
+#ifndef DOCTEST_CONFIG_NO_UNPREFIXED_OPTIONS
+ // offset (normally 3 for "dt-") to skip prefix
+ if(parseOptionImpl(argc, argv, pattern + strlen(DOCTEST_CONFIG_OPTIONS_PREFIX), value))
+ return true;
+#endif // DOCTEST_CONFIG_NO_UNPREFIXED_OPTIONS
+ return parseOptionImpl(argc, argv, pattern, value);
+ }
+
+ // locates a flag on the command line
+ bool parseFlag(int argc, const char* const* argv, const char* pattern) {
+ return parseOption(argc, argv, pattern);
+ }
+
+ // parses a comma separated list of words after a pattern in one of the arguments in argv
+ bool parseCommaSepArgs(int argc, const char* const* argv, const char* pattern,
+ std::vector<String>& res) {
+ String filtersString;
+ if(parseOption(argc, argv, pattern, &filtersString)) {
+ // tokenize with "," as a separator
+ // cppcheck-suppress strtokCalled
+ DOCTEST_CLANG_SUPPRESS_WARNING_WITH_PUSH("-Wdeprecated-declarations")
+ auto pch = std::strtok(filtersString.c_str(), ","); // modifies the string
+ while(pch != nullptr) {
+ if(strlen(pch))
+ res.push_back(pch);
+ // uses the strtok() internal state to go to the next token
+ // cppcheck-suppress strtokCalled
+ pch = std::strtok(nullptr, ",");
+ }
+ DOCTEST_CLANG_SUPPRESS_WARNING_POP
+ return true;
+ }
+ return false;
+ }
+
+ enum optionType
+ {
+ option_bool,
+ option_int
+ };
+
+ // parses an int/bool option from the command line
+ bool parseIntOption(int argc, const char* const* argv, const char* pattern, optionType type,
+ int& res) {
+ String parsedValue;
+ if(!parseOption(argc, argv, pattern, &parsedValue))
+ return false;
+
+ if(type == 0) {
+ // boolean
+ const char positive[][5] = {"1", "true", "on", "yes"}; // 5 - strlen("true") + 1
+ const char negative[][6] = {"0", "false", "off", "no"}; // 6 - strlen("false") + 1
+
+ // if the value matches any of the positive/negative possibilities
+ for(unsigned i = 0; i < 4; i++) {
+ if(parsedValue.compare(positive[i], true) == 0) {
+ res = 1; //!OCLINT parameter reassignment
+ return true;
+ }
+ if(parsedValue.compare(negative[i], true) == 0) {
+ res = 0; //!OCLINT parameter reassignment
+ return true;
+ }
+ }
+ } else {
+ // integer
+ // TODO: change this to use std::stoi or something else! currently it uses undefined behavior - assumes '0' on failed parse...
+ int theInt = std::atoi(parsedValue.c_str()); // NOLINT
+ if(theInt != 0) {
+ res = theInt; //!OCLINT parameter reassignment
+ return true;
+ }
+ }
+ return false;
+ }
+} // namespace
+
+Context::Context(int argc, const char* const* argv)
+ : p(new detail::ContextState) {
+ parseArgs(argc, argv, true);
+ if(argc)
+ p->binary_name = argv[0];
+}
+
+Context::~Context() {
+ if(g_cs == p)
+ g_cs = nullptr;
+ delete p;
+}
+
+void Context::applyCommandLine(int argc, const char* const* argv) {
+ parseArgs(argc, argv);
+ if(argc)
+ p->binary_name = argv[0];
+}
+
+// parses args
+void Context::parseArgs(int argc, const char* const* argv, bool withDefaults) {
+ using namespace detail;
+
+ // clang-format off
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "source-file=", p->filters[0]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "sf=", p->filters[0]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "source-file-exclude=",p->filters[1]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "sfe=", p->filters[1]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "test-suite=", p->filters[2]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "ts=", p->filters[2]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "test-suite-exclude=", p->filters[3]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "tse=", p->filters[3]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "test-case=", p->filters[4]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "tc=", p->filters[4]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "test-case-exclude=", p->filters[5]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "tce=", p->filters[5]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "subcase=", p->filters[6]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "sc=", p->filters[6]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "subcase-exclude=", p->filters[7]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "sce=", p->filters[7]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "reporters=", p->filters[8]);
+ parseCommaSepArgs(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "r=", p->filters[8]);
+ // clang-format on
+
+ int intRes = 0;
+ String strRes;
+
+#define DOCTEST_PARSE_AS_BOOL_OR_FLAG(name, sname, var, default) \
+ if(parseIntOption(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX name "=", option_bool, intRes) || \
+ parseIntOption(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX sname "=", option_bool, intRes)) \
+ p->var = !!intRes; \
+ else if(parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX name) || \
+ parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX sname)) \
+ p->var = true; \
+ else if(withDefaults) \
+ p->var = default
+
+#define DOCTEST_PARSE_INT_OPTION(name, sname, var, default) \
+ if(parseIntOption(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX name "=", option_int, intRes) || \
+ parseIntOption(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX sname "=", option_int, intRes)) \
+ p->var = intRes; \
+ else if(withDefaults) \
+ p->var = default
+
+#define DOCTEST_PARSE_STR_OPTION(name, sname, var, default) \
+ if(parseOption(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX name "=", &strRes, default) || \
+ parseOption(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX sname "=", &strRes, default) || \
+ withDefaults) \
+ p->var = strRes
+
+ // clang-format off
+ DOCTEST_PARSE_STR_OPTION("out", "o", out, "");
+ DOCTEST_PARSE_STR_OPTION("order-by", "ob", order_by, "file");
+ DOCTEST_PARSE_INT_OPTION("rand-seed", "rs", rand_seed, 0);
+
+ DOCTEST_PARSE_INT_OPTION("first", "f", first, 0);
+ DOCTEST_PARSE_INT_OPTION("last", "l", last, UINT_MAX);
+
+ DOCTEST_PARSE_INT_OPTION("abort-after", "aa", abort_after, 0);
+ DOCTEST_PARSE_INT_OPTION("subcase-filter-levels", "scfl", subcase_filter_levels, INT_MAX);
+
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("success", "s", success, false);
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("case-sensitive", "cs", case_sensitive, false);
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("exit", "e", exit, false);
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("duration", "d", duration, false);
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-throw", "nt", no_throw, false);
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-exitcode", "ne", no_exitcode, false);
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-run", "nr", no_run, false);
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-version", "nv", no_version, false);
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-colors", "nc", no_colors, false);
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("force-colors", "fc", force_colors, false);
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-breaks", "nb", no_breaks, false);
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-skip", "ns", no_skip, false);
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("gnu-file-line", "gfl", gnu_file_line, !bool(DOCTEST_MSVC));
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-path-filenames", "npf", no_path_in_filenames, false);
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-line-numbers", "nln", no_line_numbers, false);
+ DOCTEST_PARSE_AS_BOOL_OR_FLAG("no-skipped-summary", "nss", no_skipped_summary, false);
+ // clang-format on
+
+ if(withDefaults) {
+ p->help = false;
+ p->version = false;
+ p->count = false;
+ p->list_test_cases = false;
+ p->list_test_suites = false;
+ p->list_reporters = false;
+ }
+ if(parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "help") ||
+ parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "h") ||
+ parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "?")) {
+ p->help = true;
+ p->exit = true;
+ }
+ if(parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "version") ||
+ parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "v")) {
+ p->version = true;
+ p->exit = true;
+ }
+ if(parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "count") ||
+ parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "c")) {
+ p->count = true;
+ p->exit = true;
+ }
+ if(parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "list-test-cases") ||
+ parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "ltc")) {
+ p->list_test_cases = true;
+ p->exit = true;
+ }
+ if(parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "list-test-suites") ||
+ parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "lts")) {
+ p->list_test_suites = true;
+ p->exit = true;
+ }
+ if(parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "list-reporters") ||
+ parseFlag(argc, argv, DOCTEST_CONFIG_OPTIONS_PREFIX "lr")) {
+ p->list_reporters = true;
+ p->exit = true;
+ }
+}
+
+// allows the user to add procedurally to the filters from the command line
+void Context::addFilter(const char* filter, const char* value) { setOption(filter, value); }
+
+// allows the user to clear all filters from the command line
+void Context::clearFilters() {
+ for(auto& curr : p->filters)
+ curr.clear();
+}
+
+// allows the user to override procedurally the int/bool options from the command line
+void Context::setOption(const char* option, int value) {
+ setOption(option, toString(value).c_str());
+}
+
+// allows the user to override procedurally the string options from the command line
+void Context::setOption(const char* option, const char* value) {
+ auto argv = String("-") + option + "=" + value;
+ auto lvalue = argv.c_str();
+ parseArgs(1, &lvalue);
+}
+
+// users should query this in their main() and exit the program if true
+bool Context::shouldExit() { return p->exit; }
+
+void Context::setAsDefaultForAssertsOutOfTestCases() { g_cs = p; }
+
+void Context::setAssertHandler(detail::assert_handler ah) { p->ah = ah; }
+
+// the main function that does all the filtering and test running
+int Context::run() {
+ using namespace detail;
+
+ // save the old context state in case such was setup - for using asserts out of a testing context
+ auto old_cs = g_cs;
+ // this is the current contest
+ g_cs = p;
+ is_running_in_test = true;
+
+ g_no_colors = p->no_colors;
+ p->resetRunData();
+
+ // stdout by default
+ p->cout = &std::cout;
+ p->cerr = &std::cerr;
+
+ // or to a file if specified
+ std::fstream fstr;
+ if(p->out.size()) {
+ fstr.open(p->out.c_str(), std::fstream::out);
+ p->cout = &fstr;
+ }
+
+ auto cleanup_and_return = [&]() {
+ if(fstr.is_open())
+ fstr.close();
+
+ // restore context
+ g_cs = old_cs;
+ is_running_in_test = false;
+
+ // we have to free the reporters which were allocated when the run started
+ for(auto& curr : p->reporters_currently_used)
+ delete curr;
+ p->reporters_currently_used.clear();
+
+ if(p->numTestCasesFailed && !p->no_exitcode)
+ return EXIT_FAILURE;
+ return EXIT_SUCCESS;
+ };
+
+ // setup default reporter if none is given through the command line
+ if(p->filters[8].empty())
+ p->filters[8].push_back("console");
+
+ // check to see if any of the registered reporters has been selected
+ for(auto& curr : getReporters()) {
+ if(matchesAny(curr.first.second.c_str(), p->filters[8], false, p->case_sensitive))
+ p->reporters_currently_used.push_back(curr.second(*g_cs));
+ }
+
+ // TODO: check if there is nothing in reporters_currently_used
+
+ // prepend all listeners
+ for(auto& curr : getListeners())
+ p->reporters_currently_used.insert(p->reporters_currently_used.begin(), curr.second(*g_cs));
+
+#ifdef DOCTEST_PLATFORM_WINDOWS
+ if(isDebuggerActive())
+ p->reporters_currently_used.push_back(new DebugOutputWindowReporter(*g_cs));
+#endif // DOCTEST_PLATFORM_WINDOWS
+
+ // handle version, help and no_run
+ if(p->no_run || p->version || p->help || p->list_reporters) {
+ DOCTEST_ITERATE_THROUGH_REPORTERS(report_query, QueryData());
+
+ return cleanup_and_return();
+ }
+
+ std::vector<const TestCase*> testArray;
+ for(auto& curr : getRegisteredTests())
+ testArray.push_back(&curr);
+ p->numTestCases = testArray.size();
+
+ // sort the collected records
+ if(!testArray.empty()) {
+ if(p->order_by.compare("file", true) == 0) {
+ std::sort(testArray.begin(), testArray.end(), fileOrderComparator);
+ } else if(p->order_by.compare("suite", true) == 0) {
+ std::sort(testArray.begin(), testArray.end(), suiteOrderComparator);
+ } else if(p->order_by.compare("name", true) == 0) {
+ std::sort(testArray.begin(), testArray.end(), nameOrderComparator);
+ } else if(p->order_by.compare("rand", true) == 0) {
+ std::srand(p->rand_seed);
+
+ // random_shuffle implementation
+ const auto first = &testArray[0];
+ for(size_t i = testArray.size() - 1; i > 0; --i) {
+ int idxToSwap = std::rand() % (i + 1); // NOLINT
+
+ const auto temp = first[i];
+
+ first[i] = first[idxToSwap];
+ first[idxToSwap] = temp;
+ }
+ }
+ }
+
+ std::set<String> testSuitesPassingFilt;
+
+ bool query_mode = p->count || p->list_test_cases || p->list_test_suites;
+ std::vector<const TestCaseData*> queryResults;
+
+ if(!query_mode)
+ DOCTEST_ITERATE_THROUGH_REPORTERS(test_run_start, DOCTEST_EMPTY);
+
+ // invoke the registered functions if they match the filter criteria (or just count them)
+ for(auto& curr : testArray) {
+ const auto& tc = *curr;
+
+ bool skip_me = false;
+ if(tc.m_skip && !p->no_skip)
+ skip_me = true;
+
+ if(!matchesAny(tc.m_file, p->filters[0], true, p->case_sensitive))
+ skip_me = true;
+ if(matchesAny(tc.m_file, p->filters[1], false, p->case_sensitive))
+ skip_me = true;
+ if(!matchesAny(tc.m_test_suite, p->filters[2], true, p->case_sensitive))
+ skip_me = true;
+ if(matchesAny(tc.m_test_suite, p->filters[3], false, p->case_sensitive))
+ skip_me = true;
+ if(!matchesAny(tc.m_name, p->filters[4], true, p->case_sensitive))
+ skip_me = true;
+ if(matchesAny(tc.m_name, p->filters[5], false, p->case_sensitive))
+ skip_me = true;
+
+ if(!skip_me)
+ p->numTestCasesPassingFilters++;
+
+ // skip the test if it is not in the execution range
+ if((p->last < p->numTestCasesPassingFilters && p->first <= p->last) ||
+ (p->first > p->numTestCasesPassingFilters))
+ skip_me = true;
+
+ if(skip_me) {
+ if(!query_mode)
+ DOCTEST_ITERATE_THROUGH_REPORTERS(test_case_skipped, tc);
+ continue;
+ }
+
+ // do not execute the test if we are to only count the number of filter passing tests
+ if(p->count)
+ continue;
+
+ // print the name of the test and don't execute it
+ if(p->list_test_cases) {
+ queryResults.push_back(&tc);
+ continue;
+ }
+
+ // print the name of the test suite if not done already and don't execute it
+ if(p->list_test_suites) {
+ if((testSuitesPassingFilt.count(tc.m_test_suite) == 0) && tc.m_test_suite[0] != '\0') {
+ queryResults.push_back(&tc);
+ testSuitesPassingFilt.insert(tc.m_test_suite);
+ p->numTestSuitesPassingFilters++;
+ }
+ continue;
+ }
+
+ // execute the test if it passes all the filtering
+ {
+ p->currentTest = &tc;
+
+ p->failure_flags = TestCaseFailureReason::None;
+ p->seconds = 0;
+
+ // reset atomic counters
+ p->numAssertsFailedCurrentTest_atomic = 0;
+ p->numAssertsCurrentTest_atomic = 0;
+
+ p->subcasesPassed.clear();
+
+ DOCTEST_ITERATE_THROUGH_REPORTERS(test_case_start, tc);
+
+ p->timer.start();
+
+ bool run_test = true;
+
+ do {
+ // reset some of the fields for subcases (except for the set of fully passed ones)
+ p->should_reenter = false;
+ p->subcasesCurrentMaxLevel = 0;
+ p->subcasesStack.clear();
+
+ p->shouldLogCurrentException = true;
+
+ // reset stuff for logging with INFO()
+ p->stringifiedContexts.clear();
+
+#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
+ try {
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
+ FatalConditionHandler fatalConditionHandler; // Handle signals
+ // execute the test
+ tc.m_test();
+ fatalConditionHandler.reset();
+#ifndef DOCTEST_CONFIG_NO_EXCEPTIONS
+ } catch(const TestFailureException&) {
+ p->failure_flags |= TestCaseFailureReason::AssertFailure;
+ } catch(...) {
+ DOCTEST_ITERATE_THROUGH_REPORTERS(test_case_exception,
+ {translateActiveException(), false});
+ p->failure_flags |= TestCaseFailureReason::Exception;
+ }
+#endif // DOCTEST_CONFIG_NO_EXCEPTIONS
+
+ // exit this loop if enough assertions have failed - even if there are more subcases
+ if(p->abort_after > 0 &&
+ p->numAssertsFailed + p->numAssertsFailedCurrentTest_atomic >= p->abort_after) {
+ run_test = false;
+ p->failure_flags |= TestCaseFailureReason::TooManyFailedAsserts;
+ }
+
+ if(p->should_reenter && run_test)
+ DOCTEST_ITERATE_THROUGH_REPORTERS(test_case_reenter, tc);
+ if(!p->should_reenter)
+ run_test = false;
+ } while(run_test);
+
+ p->finalizeTestCaseData();
+
+ DOCTEST_ITERATE_THROUGH_REPORTERS(test_case_end, *g_cs);
+
+ p->currentTest = nullptr;
+
+ // stop executing tests if enough assertions have failed
+ if(p->abort_after > 0 && p->numAssertsFailed >= p->abort_after)
+ break;
+ }
+ }
+
+ if(!query_mode) {
+ DOCTEST_ITERATE_THROUGH_REPORTERS(test_run_end, *g_cs);
+ } else {
+ QueryData qdata;
+ qdata.run_stats = g_cs;
+ qdata.data = queryResults.data();
+ qdata.num_data = unsigned(queryResults.size());
+ DOCTEST_ITERATE_THROUGH_REPORTERS(report_query, qdata);
+ }
+
+ // see these issues on the reasoning for this:
+ // - https://github.com/onqtam/doctest/issues/143#issuecomment-414418903
+ // - https://github.com/onqtam/doctest/issues/126
+ auto DOCTEST_FIX_FOR_MACOS_LIBCPP_IOSFWD_STRING_LINK_ERRORS = []() DOCTEST_NOINLINE
+ { std::cout << std::string(); };
+ DOCTEST_FIX_FOR_MACOS_LIBCPP_IOSFWD_STRING_LINK_ERRORS();
+
+ return cleanup_and_return();
+}
+
+IReporter::~IReporter() = default;
+
+int IReporter::get_num_active_contexts() { return detail::g_infoContexts.size(); }
+const IContextScope* const* IReporter::get_active_contexts() {
+ return get_num_active_contexts() ? &detail::g_infoContexts[0] : nullptr;
+}
+
+int IReporter::get_num_stringified_contexts() { return detail::g_cs->stringifiedContexts.size(); }
+const String* IReporter::get_stringified_contexts() {
+ return get_num_stringified_contexts() ? &detail::g_cs->stringifiedContexts[0] : nullptr;
+}
+
+namespace detail {
+ void registerReporterImpl(const char* name, int priority, reporterCreatorFunc c, bool isReporter) {
+ if(isReporter)
+ getReporters().insert(reporterMap::value_type(reporterMap::key_type(priority, name), c));
+ else
+ getListeners().insert(reporterMap::value_type(reporterMap::key_type(priority, name), c));
+ }
+} // namespace detail
+
+} // namespace doctest
+
+#endif // DOCTEST_CONFIG_DISABLE
+
+#ifdef DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
+DOCTEST_MSVC_SUPPRESS_WARNING_WITH_PUSH(4007) // 'function' : must be 'attribute' - see issue #182
+int main(int argc, char** argv) { return doctest::Context(argc, argv).run(); }
+DOCTEST_MSVC_SUPPRESS_WARNING_POP
+#endif // DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
+
+DOCTEST_CLANG_SUPPRESS_WARNING_POP
+DOCTEST_MSVC_SUPPRESS_WARNING_POP
+DOCTEST_GCC_SUPPRESS_WARNING_POP
+
+#endif // DOCTEST_LIBRARY_IMPLEMENTATION
+#endif // DOCTEST_CONFIG_IMPLEMENT
diff --git a/deps/inja/third_party/include/hayai/LICENSE.md b/deps/inja/third_party/include/hayai/LICENSE.md
new file mode 100755
index 0000000..1ace0da
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/LICENSE.md
@@ -0,0 +1,21 @@
+Copyright (c) 2011 - Nick Bruun.
+
+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. If you meet (any of) the author(s), you're encouraged to buy them a beer,
+ a drink or whatever is suited to the situation, given that you like the
+ software.
+4. This notice may not be removed or altered from any source
+ distribution.
diff --git a/deps/inja/third_party/include/hayai/hayai.hpp b/deps/inja/third_party/include/hayai/hayai.hpp
new file mode 100755
index 0000000..0396751
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai.hpp
@@ -0,0 +1,136 @@
+#ifndef __HAYAI
+#define __HAYAI
+
+#include "hayai_benchmarker.hpp"
+#include "hayai_test.hpp"
+#include "hayai_default_test_factory.hpp"
+#include "hayai_fixture.hpp"
+#include "hayai_console_outputter.hpp"
+#include "hayai_json_outputter.hpp"
+#include "hayai_junit_xml_outputter.hpp"
+
+
+#define HAYAI_VERSION "1.0.1"
+
+
+#define BENCHMARK_CLASS_NAME_(fixture_name, benchmark_name) \
+ fixture_name ## _ ## benchmark_name ## _Benchmark
+
+#define BENCHMARK_(fixture_name, \
+ benchmark_name, \
+ fixture_class_name, \
+ runs, \
+ iterations) \
+ class BENCHMARK_CLASS_NAME_(fixture_name, benchmark_name) \
+ : public fixture_class_name \
+ { \
+ public: \
+ BENCHMARK_CLASS_NAME_(fixture_name, benchmark_name)() \
+ { \
+ \
+ } \
+ protected: \
+ virtual void TestBody(); \
+ private: \
+ static const ::hayai::TestDescriptor* _descriptor; \
+ }; \
+ \
+ const ::hayai::TestDescriptor* \
+ BENCHMARK_CLASS_NAME_(fixture_name, benchmark_name)::_descriptor = \
+ ::hayai::Benchmarker::Instance().RegisterTest( \
+ #fixture_name, \
+ #benchmark_name, \
+ runs, \
+ iterations, \
+ new ::hayai::TestFactoryDefault< \
+ BENCHMARK_CLASS_NAME_(fixture_name, benchmark_name) \
+ >(), \
+ ::hayai::TestParametersDescriptor()); \
+ \
+ void BENCHMARK_CLASS_NAME_(fixture_name, benchmark_name)::TestBody()
+
+#define BENCHMARK_F(fixture_name, \
+ benchmark_name, \
+ runs, \
+ iterations) \
+ BENCHMARK_(fixture_name, \
+ benchmark_name, \
+ fixture_name, \
+ runs, \
+ iterations)
+
+#define BENCHMARK(fixture_name, \
+ benchmark_name, \
+ runs, \
+ iterations) \
+ BENCHMARK_(fixture_name, \
+ benchmark_name, \
+ ::hayai::Test, \
+ runs, \
+ iterations)
+
+// Parametrized benchmarks.
+#define BENCHMARK_P_(fixture_name, \
+ benchmark_name, \
+ fixture_class_name, \
+ runs, \
+ iterations, \
+ arguments) \
+ class BENCHMARK_CLASS_NAME_(fixture_name, benchmark_name) \
+ : public fixture_class_name { \
+ public: \
+ BENCHMARK_CLASS_NAME_(fixture_name, benchmark_name) () {} \
+ virtual ~ BENCHMARK_CLASS_NAME_(fixture_name, benchmark_name) () {} \
+ static const std::size_t _runs = runs; \
+ static const std::size_t _iterations = iterations; \
+ static const char* _argumentsDeclaration() { return #arguments; } \
+ protected: \
+ inline void TestPayload arguments; \
+ }; \
+ void BENCHMARK_CLASS_NAME_(fixture_name, benchmark_name)::TestPayload arguments
+
+#define BENCHMARK_P(fixture_name, \
+ benchmark_name, \
+ runs, \
+ iterations, \
+ arguments) \
+ BENCHMARK_P_(fixture_name, \
+ benchmark_name, \
+ hayai::Fixture, \
+ runs, \
+ iterations, \
+ arguments)
+
+#define BENCHMARK_P_F(fixture_name, benchmark_name, runs, iterations, arguments) \
+ BENCHMARK_P_(fixture_name, benchmark_name, fixture_name, runs, iterations, arguments)
+
+#define BENCHMARK_P_CLASS_NAME_(fixture_name, benchmark_name, id) \
+ fixture_name ## _ ## benchmark_name ## _Benchmark_ ## id
+
+#define BENCHMARK_P_INSTANCE1(fixture_name, benchmark_name, arguments, id) \
+ class BENCHMARK_P_CLASS_NAME_(fixture_name, benchmark_name, id): \
+ public BENCHMARK_CLASS_NAME_(fixture_name, benchmark_name) { \
+ protected: \
+ virtual void TestBody() { this->TestPayload arguments; } \
+ private: \
+ static const ::hayai::TestDescriptor* _descriptor; \
+ }; \
+ const ::hayai::TestDescriptor* BENCHMARK_P_CLASS_NAME_(fixture_name, benchmark_name, id)::_descriptor = \
+ ::hayai::Benchmarker::Instance().RegisterTest( \
+ #fixture_name, #benchmark_name, \
+ BENCHMARK_CLASS_NAME_(fixture_name, benchmark_name)::_runs, \
+ BENCHMARK_CLASS_NAME_(fixture_name, benchmark_name)::_iterations, \
+ new ::hayai::TestFactoryDefault< BENCHMARK_P_CLASS_NAME_(fixture_name, benchmark_name, id) >(), \
+ ::hayai::TestParametersDescriptor(BENCHMARK_CLASS_NAME_(fixture_name, benchmark_name)::_argumentsDeclaration(), #arguments))
+
+#if defined(__COUNTER__)
+# define BENCHMARK_P_ID_ __COUNTER__
+#else
+# define BENCHMARK_P_ID_ __LINE__
+#endif
+
+#define BENCHMARK_P_INSTANCE(fixture_name, benchmark_name, arguments) \
+ BENCHMARK_P_INSTANCE1(fixture_name, benchmark_name, arguments, BENCHMARK_P_ID_)
+
+
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_benchmarker.hpp b/deps/inja/third_party/include/hayai/hayai_benchmarker.hpp
new file mode 100755
index 0000000..33f005c
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_benchmarker.hpp
@@ -0,0 +1,552 @@
+#ifndef __HAYAI_BENCHMARKER
+#define __HAYAI_BENCHMARKER
+#include <algorithm>
+#include <vector>
+#include <limits>
+#include <iomanip>
+#if __cplusplus > 201100L
+#include <random>
+#endif
+#include <string>
+#include <cstring>
+
+#include "hayai_test_factory.hpp"
+#include "hayai_test_descriptor.hpp"
+#include "hayai_test_result.hpp"
+#include "hayai_console_outputter.hpp"
+
+
+namespace hayai
+{
+ /// Benchmarking execution controller singleton.
+ class Benchmarker
+ {
+ public:
+ /// Get the singleton instance of @ref Benchmarker.
+
+ /// @returns a reference to the singleton instance of the
+ /// benchmarker execution controller.
+ static Benchmarker& Instance()
+ {
+ static Benchmarker singleton;
+ return singleton;
+ }
+
+
+ /// Register a test with the benchmarker instance.
+
+ /// @param fixtureName Name of the fixture.
+ /// @param testName Name of the test.
+ /// @param runs Number of runs for the test.
+ /// @param iterations Number of iterations per run.
+ /// @param testFactory Test factory implementation for the test.
+ /// @returns a pointer to a @ref TestDescriptor instance
+ /// representing the given test.
+ static TestDescriptor* RegisterTest(
+ const char* fixtureName,
+ const char* testName,
+ std::size_t runs,
+ std::size_t iterations,
+ TestFactory* testFactory,
+ TestParametersDescriptor parameters
+ )
+ {
+ // Determine if the test has been disabled.
+ static const char* disabledPrefix = "DISABLED_";
+ bool isDisabled = ((::strlen(testName) >= 9) &&
+ (!::memcmp(testName, disabledPrefix, 9)));
+
+ if (isDisabled)
+ testName += 9;
+
+ // Add the descriptor.
+ TestDescriptor* descriptor = new TestDescriptor(fixtureName,
+ testName,
+ runs,
+ iterations,
+ testFactory,
+ parameters,
+ isDisabled);
+
+ Instance()._tests.push_back(descriptor);
+
+ return descriptor;
+ }
+
+
+ /// Add an outputter.
+
+ /// @param outputter Outputter. The caller must ensure that the
+ /// outputter remains in existence for the entire benchmark run.
+ static void AddOutputter(Outputter& outputter)
+ {
+ Instance()._outputters.push_back(&outputter);
+ }
+
+
+ /// Apply a pattern filter to the tests.
+
+ /// --gtest_filter-compatible pattern:
+ ///
+ /// https://code.google.com/p/googletest/wiki/AdvancedGuide
+ ///
+ /// @param pattern Filter pattern compatible with gtest.
+ static void ApplyPatternFilter(const char* pattern)
+ {
+ Benchmarker& instance = Instance();
+
+ // Split the filter at '-' if it exists.
+ const char* const dash = strchr(pattern, '-');
+
+ std::string positive;
+ std::string negative;
+
+ if (dash == NULL)
+ positive = pattern;
+ else
+ {
+ positive = std::string(pattern, dash);
+ negative = std::string(dash + 1);
+ if (positive.empty())
+ positive = "*";
+ }
+
+ // Iterate across all tests and test them against the patterns.
+ std::size_t index = 0;
+ while (index < instance._tests.size())
+ {
+ TestDescriptor* desc = instance._tests[index];
+
+ if ((!FilterMatchesString(positive.c_str(),
+ desc->CanonicalName)) ||
+ (FilterMatchesString(negative.c_str(),
+ desc->CanonicalName)))
+ {
+ instance._tests.erase(
+ instance._tests.begin() +
+ std::vector<TestDescriptor*>::difference_type(index)
+ );
+ delete desc;
+ }
+ else
+ ++index;
+ }
+ }
+
+
+ /// Run all benchmarking tests.
+ static void RunAllTests()
+ {
+ ConsoleOutputter defaultOutputter;
+ std::vector<Outputter*> defaultOutputters;
+ defaultOutputters.push_back(&defaultOutputter);
+
+ Benchmarker& instance = Instance();
+ std::vector<Outputter*>& outputters =
+ (instance._outputters.empty() ?
+ defaultOutputters :
+ instance._outputters);
+
+ // Get the tests for execution.
+ std::vector<TestDescriptor*> tests = instance.GetTests();
+
+ const std::size_t totalCount = tests.size();
+ std::size_t disabledCount = 0;
+
+ std::vector<TestDescriptor*>::const_iterator testsIt =
+ tests.begin();
+
+ while (testsIt != tests.end())
+ {
+ if ((*testsIt)->IsDisabled)
+ ++disabledCount;
+ ++testsIt;
+ }
+
+ const std::size_t enabledCount = totalCount - disabledCount;
+
+ // Calibrate the tests.
+ const CalibrationModel calibrationModel = GetCalibrationModel();
+
+ // Begin output.
+ for (std::size_t outputterIndex = 0;
+ outputterIndex < outputters.size();
+ outputterIndex++)
+ outputters[outputterIndex]->Begin(enabledCount, disabledCount);
+
+ // Run through all the tests in ascending order.
+ std::size_t index = 0;
+
+ while (index < tests.size())
+ {
+ // Get the test descriptor.
+ TestDescriptor* descriptor = tests[index++];
+
+ // Check if test matches include filters
+ if (instance._include.size() > 0)
+ {
+ bool included = false;
+ std::string name =
+ descriptor->FixtureName + "." +
+ descriptor->TestName;
+
+ for (std::size_t i = 0; i < instance._include.size(); i++)
+ {
+ if (name.find(instance._include[i]) !=
+ std::string::npos)
+ {
+ included = true;
+ break;
+ }
+ }
+
+ if (!included)
+ continue;
+ }
+
+ // Check if test is not disabled.
+ if (descriptor->IsDisabled)
+ {
+ for (std::size_t outputterIndex = 0;
+ outputterIndex < outputters.size();
+ outputterIndex++)
+ outputters[outputterIndex]->SkipDisabledTest(
+ descriptor->FixtureName,
+ descriptor->TestName,
+ descriptor->Parameters,
+ descriptor->Runs,
+ descriptor->Iterations
+ );
+
+ continue;
+ }
+
+ // Describe the beginning of the run.
+ for (std::size_t outputterIndex = 0;
+ outputterIndex < outputters.size();
+ outputterIndex++)
+ outputters[outputterIndex]->BeginTest(
+ descriptor->FixtureName,
+ descriptor->TestName,
+ descriptor->Parameters,
+ descriptor->Runs,
+ descriptor->Iterations
+ );
+
+ // Execute each individual run.
+ std::vector<uint64_t> runTimes(descriptor->Runs);
+ uint64_t overheadCalibration =
+ calibrationModel.GetCalibration(descriptor->Iterations);
+
+ std::size_t run = 0;
+ while (run < descriptor->Runs)
+ {
+ // Construct a test instance.
+ Test* test = descriptor->Factory->CreateTest();
+
+ // Run the test.
+ uint64_t time = test->Run(descriptor->Iterations);
+
+ // Store the test time.
+ runTimes[run] = (time > overheadCalibration ?
+ time - overheadCalibration :
+ 0);
+
+ // Dispose of the test instance.
+ delete test;
+
+ ++run;
+ }
+
+ // Calculate the test result.
+ TestResult testResult(runTimes, descriptor->Iterations);
+
+ // Describe the end of the run.
+ for (std::size_t outputterIndex = 0;
+ outputterIndex < outputters.size();
+ outputterIndex++)
+ outputters[outputterIndex]->EndTest(
+ descriptor->FixtureName,
+ descriptor->TestName,
+ descriptor->Parameters,
+ testResult
+ );
+
+ }
+
+ // End output.
+ for (std::size_t outputterIndex = 0;
+ outputterIndex < outputters.size();
+ outputterIndex++)
+ outputters[outputterIndex]->End(enabledCount,
+ disabledCount);
+ }
+
+
+ /// List tests.
+ static std::vector<const TestDescriptor*> ListTests()
+ {
+ std::vector<const TestDescriptor*> tests;
+ Benchmarker& instance = Instance();
+
+ std::size_t index = 0;
+ while (index < instance._tests.size())
+ tests.push_back(instance._tests[index++]);
+
+ return tests;
+ }
+
+
+ /// Shuffle tests.
+
+ /// Randomly shuffles the order of tests.
+ static void ShuffleTests()
+ {
+ Benchmarker& instance = Instance();
+#if __cplusplus > 201100L
+ std::random_device rd;
+ std::mt19937 g(rd());
+ std::shuffle(instance._tests.begin(),
+ instance._tests.end(),
+ g);
+#else
+ std::random_shuffle(instance._tests.begin(),
+ instance._tests.end());
+#endif
+ }
+ private:
+ /// Calibration model.
+
+ /// Describes a linear calibration model for test runs.
+ struct CalibrationModel
+ {
+ public:
+ CalibrationModel(std::size_t scale,
+ uint64_t slope,
+ uint64_t yIntercept)
+ : Scale(scale),
+ Slope(slope),
+ YIntercept(yIntercept)
+ {
+
+ }
+
+
+ /// Scale.
+
+ /// Number of iterations per slope unit.
+ const std::size_t Scale;
+
+
+ /// Slope.
+ const uint64_t Slope;
+
+
+ /// Y-intercept;
+ const uint64_t YIntercept;
+
+
+ /// Get calibration value for a run.
+ int64_t GetCalibration(std::size_t iterations) const
+ {
+ return YIntercept + (iterations * Slope) / Scale;
+ }
+ };
+
+
+ /// Private constructor.
+ Benchmarker()
+ {
+
+ }
+
+
+ /// Private destructor.
+ ~Benchmarker()
+ {
+ // Release all test descriptors.
+ std::size_t index = _tests.size();
+ while (index--)
+ delete _tests[index];
+ }
+
+
+ /// Get the tests to be executed.
+ std::vector<TestDescriptor*> GetTests() const
+ {
+ std::vector<TestDescriptor*> tests;
+
+ std::size_t index = 0;
+ while (index < _tests.size())
+ tests.push_back(_tests[index++]);
+
+ return tests;
+ }
+
+
+ /// Test if a filter matches a string.
+
+ /// Adapted from gtest. All rights reserved by original authors.
+ static bool FilterMatchesString(const char* filter,
+ const std::string& str)
+ {
+ const char *patternStart = filter;
+
+ while (true)
+ {
+ if (PatternMatchesString(patternStart, str.c_str()))
+ return true;
+
+ // Finds the next pattern in the filter.
+ patternStart = strchr(patternStart, ':');
+
+ // Returns if no more pattern can be found.
+ if (!patternStart)
+ return false;
+
+ // Skips the pattern separater (the ':' character).
+ patternStart++;
+ }
+ }
+
+
+ /// Test if pattern matches a string.
+
+ /// Adapted from gtest. All rights reserved by original authors.
+ static bool PatternMatchesString(const char* pattern, const char *str)
+ {
+ switch (*pattern)
+ {
+ case '\0':
+ case ':':
+ return (*str == '\0');
+ case '?': // Matches any single character.
+ return ((*str != '\0') &&
+ (PatternMatchesString(pattern + 1, str + 1)));
+ case '*': // Matches any string (possibly empty) of characters.
+ return (((*str != '\0') &&
+ (PatternMatchesString(pattern, str + 1))) ||
+ (PatternMatchesString(pattern + 1, str)));
+ default:
+ return ((*pattern == *str) &&
+ (PatternMatchesString(pattern + 1, str + 1)));
+ }
+ }
+
+
+ /// Get calibration model.
+
+ /// Returns an average linear calibration model.
+ static CalibrationModel GetCalibrationModel()
+ {
+ // We perform a number of runs of varying iterations with an empty
+ // test body. The assumption here is, that the time taken for the
+ // test run is linear with regards to the number of iterations, ie.
+ // some constant overhead with a per-iteration overhead. This
+ // hypothesis has been manually validated by linear regression over
+ // sample data.
+ //
+ // In order to avoid losing too much precision, we are going to
+ // calibrate in terms of the overhead of some x n iterations,
+ // where n must be a sufficiently large number to produce some
+ // significant runtime. On a high-end 2012 Retina MacBook Pro with
+ // -O3 on clang-602.0.53 (LLVM 6.1.0) n = 1,000,000 produces
+ // run times of ~1.9 ms, which should be sufficiently precise.
+ //
+ // However, as the constant overhead is mostly related to
+ // retrieving the system clock, which under the same conditions
+ // clocks in at around 17 ms, we run the risk of winding up with
+ // a negative y-intercept if we do not fix the y-intercept. This
+ // intercept is therefore fixed by a large number of runs of 0
+ // iterations.
+ ::hayai::Test* test = new Test();
+
+#define HAYAI_CALIBRATION_INTERESECT_RUNS 10000
+
+#define HAYAI_CALIBRATION_RUNS 10
+#define HAYAI_CALIBRATION_SCALE 1000000
+#define HAYAI_CALIBRATION_PPR 6
+
+ // Determine the intercept.
+ uint64_t
+ interceptSum = 0,
+ interceptMin = std::numeric_limits<uint64_t>::min(),
+ interceptMax = 0;
+
+ for (std::size_t run = 0;
+ run < HAYAI_CALIBRATION_INTERESECT_RUNS;
+ ++run)
+ {
+ uint64_t intercept = test->Run(0);
+ interceptSum += intercept;
+ if (intercept < interceptMin)
+ interceptMin = intercept;
+ if (intercept > interceptMax)
+ interceptMax = intercept;
+ }
+
+ uint64_t interceptAvg =
+ interceptSum / HAYAI_CALIBRATION_INTERESECT_RUNS;
+
+ // Produce a series of sample points.
+ std::vector<uint64_t> x(HAYAI_CALIBRATION_RUNS *
+ HAYAI_CALIBRATION_PPR);
+ std::vector<uint64_t> t(HAYAI_CALIBRATION_RUNS *
+ HAYAI_CALIBRATION_PPR);
+
+ std::size_t point = 0;
+
+ for (std::size_t run = 0; run < HAYAI_CALIBRATION_RUNS; ++run)
+ {
+#define HAYAI_CALIBRATION_POINT(_x) \
+ x[point] = _x; \
+ t[point++] = \
+ test->Run(_x * std::size_t(HAYAI_CALIBRATION_SCALE))
+
+ HAYAI_CALIBRATION_POINT(1);
+ HAYAI_CALIBRATION_POINT(2);
+ HAYAI_CALIBRATION_POINT(5);
+ HAYAI_CALIBRATION_POINT(10);
+ HAYAI_CALIBRATION_POINT(15);
+ HAYAI_CALIBRATION_POINT(20);
+
+#undef HAYAI_CALIBRATION_POINT
+ }
+
+ // As we have a fixed y-intercept, b, the optimal slope for a line
+ // fitting the sample points will be
+ // $\frac {\sum_{i=1}^{n} x_n \cdot (y_n - b)}
+ // {\sum_{i=1}^{n} {x_n}^2}$.
+ uint64_t
+ sumProducts = 0,
+ sumXSquared = 0;
+
+ std::size_t p = x.size();
+ while (p--)
+ {
+ sumXSquared += x[p] * x[p];
+ sumProducts += x[p] * (t[p] - interceptAvg);
+ }
+
+ uint64_t slope = sumProducts / sumXSquared;
+
+ delete test;
+
+ return CalibrationModel(HAYAI_CALIBRATION_SCALE,
+ slope,
+ interceptAvg);
+
+#undef HAYAI_CALIBRATION_INTERESECT_RUNS
+
+#undef HAYAI_CALIBRATION_RUNS
+#undef HAYAI_CALIBRATION_SCALE
+#undef HAYAI_CALIBRATION_PPR
+ }
+
+
+ std::vector<Outputter*> _outputters; ///< Registered outputters.
+ std::vector<TestDescriptor*> _tests; ///< Registered tests.
+ std::vector<std::string> _include; ///< Test filters.
+ };
+}
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_clock.hpp b/deps/inja/third_party/include/hayai/hayai_clock.hpp
new file mode 100755
index 0000000..c6d4e41
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_clock.hpp
@@ -0,0 +1,367 @@
+//
+// System-specific implementation of the clock functions.
+//
+// Copyright (C) 2011 Nick Bruun <nick@bruun.co>
+// Copyright (C) 2013 Vlad Lazarenko <vlad@lazarenko.me>
+// Copyright (C) 2014 Nicolas Pauss <nicolas.pauss@gmail.com>
+//
+// Implementation notes:
+//
+// On Windows, QueryPerformanceCounter() is used. It gets
+// real-time clock with up to nanosecond precision.
+//
+// On Apple (OS X, iOS), mach_absolute_time() is used. It gets
+// CPU/bus dependent real-time clock with up to nanosecond precision.
+//
+// On Unix, gethrtime() is used with HP-UX and Solaris. Otherwise,
+// clock_gettime() is used to access monotonic real-time clock
+// with up to nanosecond precision. On kernels 2.6.28 and newer, the ticks
+// are also raw and are not subject to NTP and/or adjtime(3) adjustments.
+//
+// Other POSIX compliant platforms resort to using gettimeofday(). It is
+// subject to clock adjustments, does not allow for higher than microsecond
+// resolution and is also declared obsolete by POSIX.1-2008.
+//
+// Note on C++11:
+//
+// Starting with C++11, we could use std::chrono. However, the details of
+// what clock is really being used is implementation-specific. For example,
+// Visual Studio 2012 defines "high_resolution_clock" as system clock with
+// ~1 millisecond precision that is not acceptable for performance
+// measurements. Therefore, we are much better off having full control of what
+// mechanism we use to obtain the system clock.
+//
+// Note on durations: it is assumed that end times passed to the clock methods
+// are all after the start time. Wrap-around of clocks is not tested, as
+// nanosecond precision of unsigned 64-bit integers would require an uptime of
+// almost 585 years for this to happen. Let's call ourselves safe on that one.
+//
+#ifndef __HAYAI_CLOCK
+#define __HAYAI_CLOCK
+
+#include "hayai_compatibility.hpp"
+
+
+// POSIX
+#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+#include <unistd.h>
+#endif
+
+// Win32
+#if defined(_WIN32)
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
+#include <windows.h>
+
+// Apple
+#elif defined(__APPLE__) && defined(__MACH__)
+#include <mach/mach_time.h>
+
+// Unix
+#elif defined(__unix__) || defined(__unix) || defined(unix)
+
+// gethrtime
+# if (defined(__hpux) || defined(hpux)) || ((defined(__sun__) || defined(__sun) || defined(sun)) && (defined(__SVR4) || defined(__svr4__)))
+# include <sys/time.h>
+
+// clock_gettime
+# elif defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0)
+# include <time.h>
+
+// gettimeofday
+# else
+# include <sys/time.h>
+
+# endif
+#else
+#error "Unable to define high resolution timer for an unknown OS."
+#endif
+
+#include <stdexcept>
+#include <stdint.h>
+
+
+namespace hayai
+{
+// Win32
+#if defined(_WIN32)
+ class Clock
+ {
+ public:
+ /// Time point.
+
+ /// Opaque representation of a point in time.
+ typedef LARGE_INTEGER TimePoint;
+
+
+ /// Get the current time as a time point.
+
+ /// @returns the current time point.
+ static TimePoint Now()
+ {
+ TimePoint result;
+ QueryPerformanceCounter(&result);
+ return result;
+ }
+
+
+ /// Get the duration between two time points.
+
+ /// @param startTime Start time point.
+ /// @param endTime End time point.
+ /// @returns the number of nanoseconds elapsed between the two time
+ /// points.
+ static uint64_t Duration(const TimePoint& startTime,
+ const TimePoint& endTime)
+ {
+ const static double performanceFrequencyNs =
+ PerformanceFrequencyNs();
+
+ return static_cast<uint64_t>(
+ (endTime.QuadPart - startTime.QuadPart)
+ * performanceFrequencyNs
+ );
+ }
+
+
+ /// Clock implementation description.
+
+ /// @returns a description of the clock implementation used.
+ static const char* Description()
+ {
+ return "QueryPerformanceCounter";
+ }
+ private:
+ static double PerformanceFrequencyNs()
+ {
+ TimePoint result;
+ QueryPerformanceFrequency(&result);
+ return 1e9 / static_cast<double>(result.QuadPart);
+ }
+ };
+
+// Mach kernel.
+#elif defined(__APPLE__) && defined(__MACH__)
+ class Clock
+ {
+ public:
+ /// Time point.
+
+ /// Opaque representation of a point in time.
+ typedef uint64_t TimePoint;
+
+
+ /// Get the current time as a time point.
+
+ /// @returns the current time point.
+ static TimePoint Now() __hayai_noexcept
+ {
+ return mach_absolute_time();
+ }
+
+
+ /// Get the duration between two time points.
+
+ /// @param startTime Start time point.
+ /// @param endTime End time point.
+ /// @returns the number of nanoseconds elapsed between the two time
+ /// points.
+ static uint64_t Duration(const TimePoint& startTime,
+ const TimePoint& endTime) __hayai_noexcept
+ {
+ mach_timebase_info_data_t time_info;
+ mach_timebase_info(&time_info);
+
+ return (endTime - startTime) * time_info.numer / time_info.denom;
+ }
+
+
+ /// Clock implementation description.
+
+ /// @returns a description of the clock implementation used.
+ static const char* Description()
+ {
+ return "mach_absolute_time";
+ }
+ };
+
+// Unix
+#elif defined(__unix__) || defined(__unix) || defined(unix)
+
+// gethrtime
+# if (defined(__hpux) || defined(hpux)) || ((defined(__sun__) || defined(__sun) || defined(sun)) && (defined(__SVR4) || defined(__svr4__)))
+ class Clock
+ {
+ public:
+ /// Time point.
+
+ /// Opaque representation of a point in time.
+ typedef hrtime_t TimePoint;
+
+
+ /// Get the current time as a time point.
+
+ /// @returns the current time point.
+ static TimePoint Now() __hayai_noexcept
+ {
+ return gethrtime();
+ }
+
+
+ /// Get the duration between two time points.
+
+ /// @param startTime Start time point.
+ /// @param endTime End time point.
+ /// @returns the number of nanoseconds elapsed between the two time
+ /// points.
+ static uint64_t Duration(const TimePoint& startTime,
+ const TimePoint& endTime) __hayai_noexcept
+ {
+ return static_cast<uint64_t>(endTime - startTime);
+ }
+
+
+ /// Clock implementation description.
+
+ /// @returns a description of the clock implementation used.
+ static const char* Description()
+ {
+ return "gethrtime";
+ }
+ };
+
+
+// clock_gettime
+# elif defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0)
+ class Clock
+ {
+ public:
+ /// Time point.
+
+ /// Opaque representation of a point in time.
+ typedef struct timespec TimePoint;
+
+
+ /// Get the current time as a time point.
+
+ /// @returns the current time point.
+ static TimePoint Now() __hayai_noexcept
+ {
+ TimePoint result;
+# if defined(CLOCK_MONOTONIC_RAW)
+ clock_gettime(CLOCK_MONOTONIC_RAW, &result);
+# elif defined(CLOCK_MONOTONIC)
+ clock_gettime(CLOCK_MONOTONIC, &result);
+# elif defined(CLOCK_REALTIME)
+ clock_gettime(CLOCK_REALTIME, &result);
+# else
+ clock_gettime((clocId_t)-1, &result);
+# endif
+ return result;
+ }
+
+
+ /// Get the duration between two time points.
+
+ /// @param startTime Start time point.
+ /// @param endTime End time point.
+ /// @returns the number of nanoseconds elapsed between the two time
+ /// points.
+ static uint64_t Duration(const TimePoint& startTime,
+ const TimePoint& endTime) __hayai_noexcept
+ {
+ TimePoint timeDiff;
+
+ timeDiff.tv_sec = endTime.tv_sec - startTime.tv_sec;
+ if (endTime.tv_nsec < startTime.tv_nsec)
+ {
+ timeDiff.tv_nsec = endTime.tv_nsec + 1000000000LL -
+ startTime.tv_nsec;
+ timeDiff.tv_sec--;
+ }
+ else
+ timeDiff.tv_nsec = endTime.tv_nsec - startTime.tv_nsec;
+
+ return static_cast<uint64_t>(timeDiff.tv_sec * 1000000000LL +
+ timeDiff.tv_nsec);
+ }
+
+
+ /// Clock implementation description.
+
+ /// @returns a description of the clock implementation used.
+ static const char* Description()
+ {
+# if defined(CLOCK_MONOTONIC_RAW)
+ return "clock_gettime(CLOCK_MONOTONIC_RAW)";
+# elif defined(CLOCK_MONOTONIC)
+ return "clock_gettime(CLOCK_MONOTONIC)";
+# elif defined(CLOCK_REALTIME)
+ return "clock_gettime(CLOCK_REALTIME)";
+# else
+ return "clock_gettime(-1)";
+# endif
+ }
+ };
+
+// gettimeofday
+# else
+ class Clock
+ {
+ public:
+ /// Time point.
+
+ /// Opaque representation of a point in time.
+ typedef struct timeval TimePoint;
+
+
+ /// Get the current time as a time point.
+
+ /// @returns the current time point.
+ static TimePoint Now() __hayai_noexcept
+ {
+ TimePoint result;
+ gettimeofday(&result, NULL);
+ return result;
+ }
+
+
+ /// Get the duration between two time points.
+
+ /// @param startTime Start time point.
+ /// @param endTime End time point.
+ /// @returns the number of nanoseconds elapsed between the two time
+ /// points.
+ static uint64_t Duration(const TimePoint& startTime,
+ const TimePoint& endTime) __hayai_noexcept
+ {
+ TimePoint timeDiff;
+
+ timeDiff.tv_sec = endTime.tv_sec - startTime.tv_sec;
+ if (endTime.tv_usec < startTime.tv_usec)
+ {
+ timeDiff.tv_usec = endTime.tv_usec + 1000000L -
+ startTime.tv_usec;
+ timeDiff.tv_sec--;
+ }
+ else
+ timeDiff.tv_usec = endTime.tv_usec - startTime.tv_usec;
+
+ return static_cast<uint64_t>(timeDiff.tv_sec * 1000000000LL +
+ timeDiff.tv_usec * 1000);
+ }
+
+
+ /// Clock implementation description.
+
+ /// @returns a description of the clock implementation used.
+ static const char* Description()
+ {
+ return "gettimeofday";
+ }
+ };
+# endif
+#endif
+}
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_compatibility.hpp b/deps/inja/third_party/include/hayai/hayai_compatibility.hpp
new file mode 100755
index 0000000..8cb5307
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_compatibility.hpp
@@ -0,0 +1,10 @@
+#ifndef __HAYAI_COMPATIBILITY
+#define __HAYAI_COMPATIBILITY
+
+# if __cplusplus > 201100L
+# define __hayai_noexcept noexcept
+# else
+# define __hayai_noexcept
+# endif
+
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_console.hpp b/deps/inja/third_party/include/hayai/hayai_console.hpp
new file mode 100755
index 0000000..6639890
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_console.hpp
@@ -0,0 +1,199 @@
+#ifndef __HAYAI_CONSOLE
+#define __HAYAI_CONSOLE
+
+#include <iostream>
+
+#if !defined(HAYAI_NO_COLOR)
+# if defined(_WIN32)
+# ifndef NOMINMAX
+# define NOMINMAX
+# endif
+# include <windows.h>
+# else
+# include <unistd.h>
+# include <cstdio>
+# endif
+#endif
+
+
+namespace hayai
+{
+ /// Static helper class for outputting to a terminal/console.
+ class Console
+ {
+ public:
+ /// Console text colors.
+ enum TextColor
+ {
+ /// Default console color. Used for resets.
+ TextDefault,
+
+ /// Black.
+ ///
+ /// @warning Avoid using black unless it is absolutely necesssary.
+ TextBlack,
+
+ /// Blue.
+ TextBlue,
+
+ /// Green.
+ TextGreen,
+
+ /// Cyan.
+ TextCyan,
+
+ /// Red.
+ TextRed,
+
+ /// Purple.
+ TextPurple,
+
+ /// Yellow.
+ TextYellow,
+
+ /// White.
+ ///
+ /// @warning Avoid using white unless it is absolutely necessary.
+ TextWhite
+ };
+
+
+ /// Get the singleton instance of @ref Console.
+
+ /// @returns a reference to the singleton instance of the
+ /// benchmarker execution controller.
+ inline static Console& Instance()
+ {
+ static Console singleton;
+ return singleton;
+ }
+
+
+ /// Test if formatting is enabled.
+ inline static bool IsFormattingEnabled()
+ {
+ return Instance()._formattingEnabled;
+ }
+
+
+ /// Set whether formatting is enabled.
+ inline static void SetFormattingEnabled(bool enabled)
+ {
+ Instance()._formattingEnabled = enabled;
+ }
+ private:
+ inline Console()
+ : _formattingEnabled(true)
+ {
+
+ }
+
+
+ bool _formattingEnabled;
+ };
+
+#if defined(_WIN32) && !defined(HAYAI_NO_COLOR) // Windows
+ static inline WORD GetConsoleAttributes()
+ {
+ CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
+ GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE),
+ &consoleInfo);
+ return consoleInfo.wAttributes;
+ }
+
+ inline std::ostream& operator <<(std::ostream& stream,
+ const Console::TextColor& color)
+ {
+ static const WORD defaultConsoleAttributes =
+ GetConsoleAttributes();
+ WORD newColor;
+
+ if ((!Console::IsFormattingEnabled()) ||
+ ((stream.rdbuf() != std::cout.rdbuf()) &&
+ (stream.rdbuf() != std::cerr.rdbuf())))
+ return stream;
+
+ switch(color)
+ {
+ case Console::TextDefault:
+ newColor = defaultConsoleAttributes;
+ break;
+ case Console::TextBlack:
+ newColor = 0;
+ break;
+ case Console::TextBlue:
+ newColor = FOREGROUND_BLUE;
+ break;
+ case Console::TextGreen:
+ newColor = FOREGROUND_GREEN;
+ break;
+ case Console::TextCyan:
+ newColor = FOREGROUND_GREEN | FOREGROUND_BLUE;
+ break;
+ case Console::TextRed:
+ newColor = FOREGROUND_RED;
+ break;
+ case Console::TextPurple:
+ newColor = FOREGROUND_RED | FOREGROUND_BLUE;
+ break;
+ case Console::TextYellow:
+ newColor =
+ FOREGROUND_RED |
+ FOREGROUND_GREEN |
+ FOREGROUND_INTENSITY;
+ break;
+ case Console::TextWhite:
+ newColor =
+ FOREGROUND_RED |
+ FOREGROUND_GREEN |
+ FOREGROUND_BLUE |
+ FOREGROUND_INTENSITY;
+ break;
+ }
+ SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), newColor);
+ return stream;
+ }
+#elif !defined(HAYAI_NO_COLOR) // Linux or others
+ inline std::ostream& operator <<(std::ostream& stream,
+ const Console::TextColor& color)
+ {
+ static const bool outputNoColor = isatty(fileno(stdout)) != 1;
+
+ if ((!Console::IsFormattingEnabled()) ||
+ (outputNoColor) ||
+ ((stream.rdbuf() != std::cout.rdbuf()) &&
+ (stream.rdbuf() != std::cerr.rdbuf())))
+ return stream;
+
+ const char* value = "";
+ switch(color) {
+ case Console::TextDefault:
+ value = "\033[m"; break;
+ case Console::TextBlack:
+ value = "\033[0;30m"; break;
+ case Console::TextBlue:
+ value = "\033[0;34m"; break;
+ case Console::TextGreen:
+ value = "\033[0;32m"; break;
+ case Console::TextCyan:
+ value = "\033[0;36m"; break;
+ case Console::TextRed:
+ value = "\033[0;31m"; break;
+ case Console::TextPurple:
+ value = "\033[0;35m"; break;
+ case Console::TextYellow:
+ value = "\033[0;33m"; break;
+ case Console::TextWhite:
+ value = "\033[0;37m"; break;
+ }
+ return stream << value;
+ }
+#else // No color
+ inline std::ostream& operator <<(std::ostream& stream,
+ const Console::TextColor&)
+ {
+ return stream;
+ }
+#endif
+}
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_console_outputter.hpp b/deps/inja/third_party/include/hayai/hayai_console_outputter.hpp
new file mode 100755
index 0000000..f7cddd5
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_console_outputter.hpp
@@ -0,0 +1,284 @@
+#ifndef __HAYAI_CONSOLEOUTPUTTER
+#define __HAYAI_CONSOLEOUTPUTTER
+#include "hayai_outputter.hpp"
+#include "hayai_console.hpp"
+
+
+namespace hayai
+{
+ /// Console outputter.
+
+ /// Prints the result to standard output.
+ class ConsoleOutputter
+ : public Outputter
+ {
+ public:
+ /// Initialize console outputter.
+
+ /// @param stream Output stream. Must exist for the entire duration of
+ /// the outputter's use.
+ ConsoleOutputter(std::ostream& stream = std::cout)
+ : _stream(stream)
+ {
+
+ }
+
+
+ virtual void Begin(const std::size_t& enabledCount,
+ const std::size_t& disabledCount)
+ {
+ _stream << std::fixed;
+ _stream << Console::TextGreen << "[==========]"
+ << Console::TextDefault << " Running "
+ << enabledCount
+ << (enabledCount == 1 ? " benchmark." : " benchmarks");
+
+ if (disabledCount)
+ _stream << ", skipping "
+ << disabledCount
+ << (disabledCount == 1 ?
+ " benchmark." :
+ " benchmarks");
+ else
+ _stream << ".";
+
+ _stream << std::endl;
+ }
+
+
+ virtual void End(const std::size_t& executedCount,
+ const std::size_t& disabledCount)
+ {
+ _stream << Console::TextGreen << "[==========]"
+ << Console::TextDefault << " Ran " << executedCount
+ << (executedCount == 1 ?
+ " benchmark." :
+ " benchmarks");
+
+ if (disabledCount)
+ _stream << ", skipped "
+ << disabledCount
+ << (disabledCount == 1 ?
+ " benchmark." :
+ " benchmarks");
+ else
+ _stream << ".";
+
+ _stream << std::endl;
+ }
+
+
+ inline void BeginOrSkipTest(const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor& parameters,
+ const std::size_t& runsCount,
+ const std::size_t& iterationsCount,
+ const bool skip)
+ {
+ if (skip)
+ _stream << Console::TextCyan << "[ DISABLED ]";
+ else
+ _stream << Console::TextGreen << "[ RUN ]";
+
+ _stream << Console::TextYellow << " ";
+ WriteTestNameToStream(_stream, fixtureName, testName, parameters);
+ _stream << Console::TextDefault
+ << " (" << runsCount
+ << (runsCount == 1 ? " run, " : " runs, ")
+ << iterationsCount
+ << (iterationsCount == 1 ?
+ " iteration per run)" :
+ " iterations per run)")
+ << std::endl;
+ }
+
+
+ virtual void BeginTest(const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor& parameters,
+ const std::size_t& runsCount,
+ const std::size_t& iterationsCount)
+ {
+ BeginOrSkipTest(fixtureName,
+ testName,
+ parameters,
+ runsCount,
+ iterationsCount,
+ false);
+ }
+
+
+ virtual void SkipDisabledTest(
+ const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor& parameters,
+ const std::size_t& runsCount,
+ const std::size_t& iterationsCount
+ )
+ {
+ BeginOrSkipTest(fixtureName,
+ testName,
+ parameters,
+ runsCount,
+ iterationsCount,
+ true);
+ }
+
+
+ virtual void EndTest(const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor& parameters,
+ const TestResult& result)
+ {
+#define PAD(x) _stream << std::setw(34) << x << std::endl;
+#define PAD_DEVIATION(description, \
+ deviated, \
+ average, \
+ unit) \
+ { \
+ double _d_ = \
+ double(deviated) - double(average); \
+ \
+ PAD(description << \
+ deviated << " " << unit << " (" << \
+ (deviated < average ? \
+ Console::TextRed : \
+ Console::TextGreen) << \
+ (deviated > average ? "+" : "") << \
+ _d_ << " " << unit << " / " << \
+ (deviated > average ? "+" : "") << \
+ (_d_ * 100.0 / average) << " %" << \
+ Console::TextDefault << ")"); \
+ }
+#define PAD_DEVIATION_INVERSE(description, \
+ deviated, \
+ average, \
+ unit) \
+ { \
+ double _d_ = \
+ double(deviated) - double(average); \
+ \
+ PAD(description << \
+ deviated << " " << unit << " (" << \
+ (deviated > average ? \
+ Console::TextRed : \
+ Console::TextGreen) << \
+ (deviated > average ? "+" : "") << \
+ _d_ << " " << unit << " / " << \
+ (deviated > average ? "+" : "") << \
+ (_d_ * 100.0 / average) << " %" << \
+ Console::TextDefault << ")"); \
+ }
+
+ _stream << Console::TextGreen << "[ DONE ]"
+ << Console::TextYellow << " ";
+ WriteTestNameToStream(_stream, fixtureName, testName, parameters);
+ _stream << Console::TextDefault << " ("
+ << std::setprecision(6)
+ << (result.TimeTotal() / 1000000.0) << " ms)"
+ << std::endl;
+
+ _stream << Console::TextBlue << "[ RUNS ] "
+ << Console::TextDefault
+ << " Average time: "
+ << std::setprecision(3)
+ << result.RunTimeAverage() / 1000.0 << " us "
+ << "(" << Console::TextBlue << "~"
+ << result.RunTimeStdDev() / 1000.0 << " us"
+ << Console::TextDefault << ")"
+ << std::endl;
+
+ PAD_DEVIATION_INVERSE("Fastest time: ",
+ (result.RunTimeMinimum() / 1000.0),
+ (result.RunTimeAverage() / 1000.0),
+ "us");
+ PAD_DEVIATION_INVERSE("Slowest time: ",
+ (result.RunTimeMaximum() / 1000.0),
+ (result.RunTimeAverage() / 1000.0),
+ "us");
+ PAD("Median time: " <<
+ result.RunTimeMedian() / 1000.0 << " us (" <<
+ Console::TextCyan << "1st quartile: " <<
+ result.RunTimeQuartile1() / 1000.0 << " us | 3rd quartile: " <<
+ result.RunTimeQuartile3() / 1000.0 << " us" <<
+ Console::TextDefault << ")");
+
+ _stream << std::setprecision(5);
+
+ PAD("");
+ PAD("Average performance: " <<
+ result.RunsPerSecondAverage() << " runs/s");
+ PAD_DEVIATION("Best performance: ",
+ result.RunsPerSecondMaximum(),
+ result.RunsPerSecondAverage(),
+ "runs/s");
+ PAD_DEVIATION("Worst performance: ",
+ result.RunsPerSecondMinimum(),
+ result.RunsPerSecondAverage(),
+ "runs/s");
+ PAD("Median performance: " <<
+ result.RunsPerSecondMedian() << " runs/s (" <<
+ Console::TextCyan << "1st quartile: " <<
+ result.RunsPerSecondQuartile1() << " | 3rd quartile: " <<
+ result.RunsPerSecondQuartile3() <<
+ Console::TextDefault << ")");
+
+ PAD("");
+ _stream << Console::TextBlue << "[ITERATIONS] "
+ << Console::TextDefault
+ << std::setprecision(3)
+ << " Average time: "
+ << result.IterationTimeAverage() / 1000.0 << " us "
+ << "(" << Console::TextBlue << "~"
+ << result.IterationTimeStdDev() / 1000.0 << " us"
+ << Console::TextDefault << ")"
+ << std::endl;
+
+ PAD_DEVIATION_INVERSE("Fastest time: ",
+ (result.IterationTimeMinimum() / 1000.0),
+ (result.IterationTimeAverage() / 1000.0),
+ "us");
+ PAD_DEVIATION_INVERSE("Slowest time: ",
+ (result.IterationTimeMaximum() / 1000.0),
+ (result.IterationTimeAverage() / 1000.0),
+ "us");
+ PAD("Median time: " <<
+ result.IterationTimeMedian() / 1000.0 << " us (" <<
+ Console::TextCyan << "1st quartile: " <<
+ result.IterationTimeQuartile1() / 1000.0 <<
+ " us | 3rd quartile: " <<
+ result.IterationTimeQuartile3() / 1000.0 << " us" <<
+ Console::TextDefault << ")");
+
+ _stream << std::setprecision(5);
+
+ PAD("");
+ PAD("Average performance: " <<
+ result.IterationsPerSecondAverage() <<
+ " iterations/s");
+ PAD_DEVIATION("Best performance: ",
+ (result.IterationsPerSecondMaximum()),
+ (result.IterationsPerSecondAverage()),
+ "iterations/s");
+ PAD_DEVIATION("Worst performance: ",
+ (result.IterationsPerSecondMinimum()),
+ (result.IterationsPerSecondAverage()),
+ "iterations/s");
+ PAD("Median performance: " <<
+ result.IterationsPerSecondMedian() << " iterations/s (" <<
+ Console::TextCyan << "1st quartile: " <<
+ result.IterationsPerSecondQuartile1() <<
+ " | 3rd quartile: " <<
+ result.IterationsPerSecondQuartile3() <<
+ Console::TextDefault << ")");
+
+#undef PAD_DEVIATION_INVERSE
+#undef PAD_DEVIATION
+#undef PAD
+ }
+
+
+ std::ostream& _stream;
+ };
+}
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_default_test_factory.hpp b/deps/inja/third_party/include/hayai/hayai_default_test_factory.hpp
new file mode 100755
index 0000000..34f66ac
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_default_test_factory.hpp
@@ -0,0 +1,27 @@
+#ifndef __HAYAI_DEFAULTTESTFACTORY
+#define __HAYAI_DEFAULTTESTFACTORY
+#include "hayai_test_factory.hpp"
+
+namespace hayai
+{
+ /// Default test factory implementation.
+
+ /// Simply constructs an instance of a the test of class @ref T with no
+ /// constructor parameters.
+ ///
+ /// @tparam T Test class.
+ template<class T>
+ class TestFactoryDefault
+ : public TestFactory
+ {
+ public:
+ /// Create a test instance with no constructor parameters.
+
+ /// @returns a pointer to an initialized test.
+ virtual Test* CreateTest()
+ {
+ return new T();
+ }
+ };
+}
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_fixture.hpp b/deps/inja/third_party/include/hayai/hayai_fixture.hpp
new file mode 100755
index 0000000..315c234
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_fixture.hpp
@@ -0,0 +1,9 @@
+#ifndef __HAYAI_FIXTURE
+#define __HAYAI_FIXTURE
+#include "hayai_test.hpp"
+
+namespace hayai
+{
+ typedef Test Fixture;
+}
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_json_outputter.hpp b/deps/inja/third_party/include/hayai/hayai_json_outputter.hpp
new file mode 100755
index 0000000..0f172a5
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_json_outputter.hpp
@@ -0,0 +1,355 @@
+#ifndef __HAYAI_JSONOUTPUTTER
+#define __HAYAI_JSONOUTPUTTER
+#include <iomanip>
+#include <ostream>
+
+#include "hayai_outputter.hpp"
+
+
+#define JSON_OBJECT_BEGIN "{"
+#define JSON_OBJECT_END "}"
+#define JSON_ARRAY_BEGIN "["
+#define JSON_ARRAY_END "]"
+#define JSON_STRING_BEGIN "\""
+#define JSON_STRING_END "\""
+#define JSON_NAME_SEPARATOR ":"
+#define JSON_VALUE_SEPARATOR ","
+#define JSON_TRUE "true"
+#define JSON_FALSE "false"
+
+namespace hayai
+{
+ /// JSON outputter.
+
+ /// Outputs the result of benchmarks in JSON format with the following
+ /// structure:
+ ///
+ /// {
+ /// "format_version": 1,
+ /// "benchmarks": [{
+ /// "fixture": "DeliveryMan",
+ /// "name": "DeliverPackage",
+ /// "parameters": {
+ /// "declaration": "std::size_t distance",
+ /// "value": "1"
+ /// },
+ /// "iterations_per_run": 10,
+ /// "disabled": false,
+ /// "runs": [{
+ /// "duration": 3801.889831
+ /// }, ..]
+ /// }, {
+ /// "fixture": "DeliveryMan",
+ /// "name": "DisabledTest",
+ /// "iterations_per_run": 10,
+ /// "disabled": true
+ /// }, ..]
+ /// }
+ ///
+ /// All durations are represented as milliseconds.
+ class JsonOutputter
+ : public Outputter
+ {
+ public:
+ /// Initialize JSON outputter.
+
+ /// @param stream Output stream. Must exist for the entire duration of
+ /// the outputter's use.
+ JsonOutputter(std::ostream& stream)
+ : _stream(stream),
+ _firstTest(true)
+ {
+
+ }
+
+
+ virtual void Begin(const std::size_t& enabledCount,
+ const std::size_t& disabledCount)
+ {
+ (void)enabledCount;
+ (void)disabledCount;
+
+ _stream <<
+ JSON_OBJECT_BEGIN
+
+ JSON_STRING_BEGIN "format_version" JSON_STRING_END
+ JSON_NAME_SEPARATOR
+ "1"
+
+ JSON_VALUE_SEPARATOR
+
+ JSON_STRING_BEGIN "benchmarks" JSON_STRING_END
+ JSON_NAME_SEPARATOR
+ JSON_ARRAY_BEGIN;
+ }
+
+
+ virtual void End(const std::size_t& executedCount,
+ const std::size_t& disabledCount)
+ {
+ (void)executedCount;
+ (void)disabledCount;
+
+ _stream <<
+ JSON_ARRAY_END
+ JSON_OBJECT_END;
+ }
+
+
+ virtual void BeginTest(const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor& parameters,
+ const std::size_t& runsCount,
+ const std::size_t& iterationsCount)
+ {
+ BeginTestObject(fixtureName,
+ testName,
+ parameters,
+ runsCount,
+ iterationsCount,
+ false);
+ }
+
+
+ virtual void SkipDisabledTest(const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor& parameters,
+ const std::size_t& runsCount,
+ const std::size_t& iterationsCount)
+ {
+ BeginTestObject(fixtureName,
+ testName,
+ parameters,
+ runsCount,
+ iterationsCount,
+ true);
+ EndTestObject();
+ }
+
+
+ virtual void EndTest(const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor& parameters,
+ const TestResult& result)
+ {
+ (void)fixtureName;
+ (void)testName;
+ (void)parameters;
+
+ _stream <<
+ JSON_VALUE_SEPARATOR
+
+ JSON_STRING_BEGIN "runs" JSON_STRING_END
+ JSON_NAME_SEPARATOR
+ JSON_ARRAY_BEGIN;
+
+ const std::vector<uint64_t>& runTimes = result.RunTimes();
+
+ for (std::vector<uint64_t>::const_iterator it = runTimes.begin();
+ it != runTimes.end();
+ ++it)
+ {
+ if (it != runTimes.begin())
+ _stream << JSON_VALUE_SEPARATOR;
+
+ _stream << JSON_OBJECT_BEGIN
+ JSON_STRING_BEGIN "duration" JSON_STRING_END
+ JSON_NAME_SEPARATOR
+ << std::fixed
+ << std::setprecision(6)
+ << (double(*it) / 1000000.0)
+ << JSON_OBJECT_END;
+ }
+
+ _stream <<
+ JSON_ARRAY_END;
+
+ WriteDoubleProperty("mean", result.RunTimeAverage());
+ WriteDoubleProperty("std_dev", result.RunTimeStdDev());
+ WriteDoubleProperty("median", result.RunTimeMedian());
+ WriteDoubleProperty("quartile_1", result.RunTimeQuartile1());
+ WriteDoubleProperty("quartile_3", result.RunTimeQuartile3());
+
+ EndTestObject();
+ }
+ private:
+ void BeginTestObject(const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor& parameters,
+ const std::size_t& runsCount,
+ const std::size_t& iterationsCount,
+ bool disabled)
+ {
+ (void)runsCount;
+
+ if (_firstTest)
+ _firstTest = false;
+ else
+ _stream << JSON_VALUE_SEPARATOR;
+
+ _stream <<
+ JSON_OBJECT_BEGIN
+
+ JSON_STRING_BEGIN "fixture" JSON_STRING_END
+ JSON_NAME_SEPARATOR;
+
+ WriteString(fixtureName);
+
+ _stream <<
+ JSON_VALUE_SEPARATOR
+
+ JSON_STRING_BEGIN "name" JSON_STRING_END
+ JSON_NAME_SEPARATOR;
+
+ WriteString(testName);
+
+ _stream <<
+ JSON_VALUE_SEPARATOR;
+
+ const std::vector<TestParameterDescriptor>& descs =
+ parameters.Parameters();
+
+ if (!descs.empty())
+ {
+ _stream <<
+ JSON_STRING_BEGIN "parameters" JSON_STRING_END
+ JSON_NAME_SEPARATOR
+ JSON_ARRAY_BEGIN;
+
+ for (std::size_t i = 0; i < descs.size(); ++i)
+ {
+ if (i)
+ _stream << JSON_VALUE_SEPARATOR;
+
+ const TestParameterDescriptor& desc = descs[i];
+
+ _stream <<
+ JSON_OBJECT_BEGIN
+
+ JSON_STRING_BEGIN "declaration" JSON_STRING_END
+ JSON_NAME_SEPARATOR;
+
+ WriteString(desc.Declaration);
+
+ _stream <<
+ JSON_VALUE_SEPARATOR
+
+ JSON_STRING_BEGIN "value" JSON_STRING_END
+ JSON_NAME_SEPARATOR;
+
+ WriteString(desc.Value);
+
+ _stream <<
+ JSON_OBJECT_END;
+ }
+
+ _stream <<
+ JSON_ARRAY_END
+ JSON_VALUE_SEPARATOR;
+ }
+
+ _stream <<
+ JSON_STRING_BEGIN "iterations_per_run" JSON_STRING_END
+ JSON_NAME_SEPARATOR << iterationsCount <<
+
+ JSON_VALUE_SEPARATOR
+
+ JSON_STRING_BEGIN "disabled" JSON_STRING_END
+ JSON_NAME_SEPARATOR << (disabled ? JSON_TRUE : JSON_FALSE);
+ }
+
+
+ inline void EndTestObject()
+ {
+ _stream <<
+ JSON_OBJECT_END;
+ }
+
+
+ /// Write an escaped string.
+
+ /// The escaping is currently very rudimentary and assumes that names,
+ /// parameters etc. are ASCII.
+ ///
+ /// @param str String to write.
+ void WriteString(const std::string& str)
+ {
+ _stream << JSON_STRING_BEGIN;
+
+ std::string::const_iterator it = str.begin();
+ while (it != str.end())
+ {
+ char c = *it++;
+
+ switch (c)
+ {
+ case '\\':
+ case '"':
+ case '/':
+ _stream << "\\" << c;
+ break;
+
+ case '\b':
+ _stream << "\\b";
+ break;
+
+ case '\f':
+ _stream << "\\f";
+ break;
+
+ case '\n':
+ _stream << "\\n";
+ break;
+
+ case '\r':
+ _stream << "\\r";
+ break;
+
+ case '\t':
+ _stream << "\\t";
+ break;
+
+ default:
+ _stream << c;
+ break;
+ }
+ }
+
+ _stream << JSON_STRING_END;
+ }
+
+
+ /// Write a property with a double value.
+
+ /// @param key Property key.
+ /// @param value Property value.
+ void WriteDoubleProperty(const std::string& key, const double value)
+ {
+ _stream << JSON_VALUE_SEPARATOR
+ << JSON_STRING_BEGIN
+ << key
+ << JSON_STRING_END
+ << JSON_NAME_SEPARATOR
+ << std::fixed
+ << std::setprecision(6)
+ << (value / 1000000.0);
+ }
+
+
+ std::ostream& _stream;
+ bool _firstTest;
+ };
+}
+
+#undef JSON_OBJECT_BEGIN
+#undef JSON_OBJECT_END
+#undef JSON_ARRAY_BEGIN
+#undef JSON_ARRAY_END
+#undef JSON_STRING_BEGIN
+#undef JSON_STRING_END
+#undef JSON_NAME_SEPARATOR
+#undef JSON_VALUE_SEPARATOR
+#undef JSON_TRUE
+#undef JSON_FALSE
+
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_junit_xml_outputter.hpp b/deps/inja/third_party/include/hayai/hayai_junit_xml_outputter.hpp
new file mode 100755
index 0000000..e7e1164
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_junit_xml_outputter.hpp
@@ -0,0 +1,260 @@
+#ifndef __HAYAI_JUNITXMLOUTPUTTER
+#define __HAYAI_JUNITXMLOUTPUTTER
+#include <iomanip>
+#include <ostream>
+#include <vector>
+#include <sstream>
+#include <map>
+
+#include "hayai_outputter.hpp"
+
+
+namespace hayai
+{
+ /// JUnit-compatible XML outputter.
+ class JUnitXmlOutputter
+ : public Outputter
+ {
+ private:
+ /// Test case.
+ class TestCase
+ {
+ public:
+ TestCase(const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor& parameters,
+ const TestResult* result)
+ {
+ // Derive a pretty name.
+ std::stringstream nameStream;
+ WriteTestNameToStream(nameStream,
+ fixtureName,
+ testName,
+ parameters);
+ Name = nameStream.str();
+
+ // Derive the result.
+ Skipped = !result;
+
+ if (result)
+ {
+ std::stringstream timeStream;
+ timeStream << std::fixed
+ << std::setprecision(9)
+ << (result->IterationTimeAverage() / 1e9);
+ Time = timeStream.str();
+ }
+ }
+
+
+ std::string Name;
+ std::string Time;
+ bool Skipped;
+ };
+
+
+ /// Test suite map.
+ typedef std::map<std::string, std::vector<TestCase> > TestSuiteMap;
+ public:
+ /// Initialize outputter.
+
+ /// @param stream Output stream. Must exist for the entire duration of
+ /// the outputter's use.
+ JUnitXmlOutputter(std::ostream& stream)
+ : _stream(stream)
+ {
+
+ }
+
+
+ virtual void Begin(const std::size_t& enabledCount,
+ const std::size_t& disabledCount)
+ {
+ (void)enabledCount;
+ (void)disabledCount;
+ }
+
+
+ virtual void End(const std::size_t& executedCount,
+ const std::size_t& disabledCount)
+ {
+ (void)executedCount;
+ (void)disabledCount;
+
+ // Write the header.
+ _stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ << std::endl
+ << "<testsuites>" << std::endl;
+
+ // Write out each test suite (fixture.)
+ for (TestSuiteMap::iterator testSuiteIt = _testSuites.begin();
+ testSuiteIt != _testSuites.end();
+ ++testSuiteIt)
+ {
+ _stream << " <testsuite name=\"" << testSuiteIt->first
+ << "\" tests=\"" << testSuiteIt->second.size() << "\">"
+ << std::endl;
+
+ // Write out each test case.
+ for (std::vector<TestCase>::iterator testCaseIt =
+ testSuiteIt->second.begin();
+ testCaseIt != testSuiteIt->second.end();
+ ++testCaseIt)
+ {
+ _stream << " <testcase name=\"";
+ WriteEscapedString(testCaseIt->Name);
+ _stream << "\"";
+
+ if (!testCaseIt->Skipped)
+ _stream << " time=\"" << testCaseIt->Time << "\" />"
+ << std::endl;
+ else
+ {
+ _stream << ">" << std::endl
+ << " <skipped />" << std::endl
+ << " </testcase>" << std::endl;
+ }
+ }
+
+ _stream << " </testsuite>" << std::endl;
+ }
+
+ _stream << "</testsuites>" << std::endl;
+ }
+
+
+ virtual void BeginTest(const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor& parameters,
+ const std::size_t& runsCount,
+ const std::size_t& iterationsCount)
+ {
+ (void)fixtureName;
+ (void)testName;
+ (void)parameters;
+ (void)runsCount;
+ (void)iterationsCount;
+ }
+
+
+ virtual void SkipDisabledTest(const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor& parameters,
+ const std::size_t& runsCount,
+ const std::size_t& iterationsCount)
+ {
+ (void)fixtureName;
+ (void)testName;
+ (void)parameters;
+ (void)runsCount;
+ (void)iterationsCount;
+ }
+
+
+ virtual void EndTest(const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor& parameters,
+ const TestResult& result)
+ {
+ (void)fixtureName;
+ (void)testName;
+ (void)parameters;
+
+ TestSuiteMap::iterator fixtureIt =
+ _testSuites.find(fixtureName);
+ if (fixtureIt == _testSuites.end())
+ {
+ _testSuites[fixtureName] = std::vector<TestCase>();
+ fixtureIt = _testSuites.find(fixtureName);
+ }
+
+ std::vector<TestCase>& testCases = fixtureIt->second;
+
+ testCases.push_back(TestCase(fixtureName,
+ testName,
+ parameters,
+ &result));
+
+ /*
+ _stream <<
+ JSON_VALUE_SEPARATOR
+
+ JSON_STRING_BEGIN "runs" JSON_STRING_END
+ JSON_NAME_SEPARATOR
+ JSON_ARRAY_BEGIN;
+
+ const std::vector<uint64_t>& runTimes = result.RunTimes();
+
+ for (std::vector<uint64_t>::const_iterator it = runTimes.begin();
+ it != runTimes.end();
+ ++it)
+ {
+ if (it != runTimes.begin())
+ _stream << JSON_VALUE_SEPARATOR;
+
+ _stream << JSON_OBJECT_BEGIN
+
+ JSON_STRING_BEGIN "duration" JSON_STRING_END
+ JSON_NAME_SEPARATOR
+ << std::fixed
+ << std::setprecision(6)
+ << (double(*it) / 1000000.0)
+ << JSON_OBJECT_END;
+ }
+
+ _stream <<
+ JSON_ARRAY_END;
+
+ EndTestObject();
+ */
+ }
+ private:
+ /// Write an escaped string.
+
+ /// The escaping is currently very rudimentary and assumes that names,
+ /// parameters etc. are ASCII.
+ ///
+ /// @param str String to write.
+ void WriteEscapedString(const std::string& str)
+ {
+ std::string::const_iterator it = str.begin();
+ while (it != str.end())
+ {
+ char c = *it++;
+
+ switch (c)
+ {
+ case '"':
+ _stream << "&quot;";
+ break;
+
+ case '\'':
+ _stream << "&apos;";
+ break;
+
+ case '<':
+ _stream << "&lt;";
+ break;
+
+ case '>':
+ _stream << "&gt;";
+ break;
+
+ case '&':
+ _stream << "&amp;";
+ break;
+
+ default:
+ _stream << c;
+ break;
+ }
+ }
+ }
+
+
+ std::ostream& _stream;
+ TestSuiteMap _testSuites;
+ };
+}
+
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_main.hpp b/deps/inja/third_party/include/hayai/hayai_main.hpp
new file mode 100755
index 0000000..d6d7cd3
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_main.hpp
@@ -0,0 +1,530 @@
+#ifndef __HAYAI_MAIN
+#define __HAYAI_MAIN
+#include <algorithm>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#include <errno.h>
+#include <fstream>
+#include <set>
+#include <vector>
+
+#include "hayai.hpp"
+
+
+#if defined(_WIN32)
+# define PATH_SEPARATOR '\\'
+#else
+# define PATH_SEPARATOR '/'
+#endif
+
+
+#define HAYAI_MAIN_FORMAT_FLAG(_desc) \
+ ::hayai::Console::TextGreen << _desc << ::hayai::Console::TextDefault
+#define HAYAI_MAIN_FORMAT_ARGUMENT(_desc) \
+ ::hayai::Console::TextYellow << _desc << ::hayai::Console::TextDefault
+#define HAYAI_MAIN_FORMAT_ERROR(_desc) \
+ ::hayai::Console::TextRed << "Error:" << \
+ ::hayai::Console::TextDefault << " " << _desc
+#define HAYAI_MAIN_USAGE_ERROR(_desc) \
+ { \
+ std::cerr << HAYAI_MAIN_FORMAT_ERROR(_desc) << std::endl \
+ << std::endl; \
+ ShowUsage(argv[0]); \
+ return EXIT_FAILURE; \
+ }
+
+
+namespace hayai
+{
+ /// Execution mode.
+ enum MainExecutionMode
+ {
+ /// Run benchmarks.
+ MainRunBenchmarks,
+
+
+ /// List benchmarks but do not execute them.
+ MainListBenchmarks
+ };
+
+
+ /// File outputter.
+ class FileOutputter
+ {
+ public:
+ /// File outputter.
+
+ /// @param path Output path. Expected to be available during the life
+ /// time of the outputter.
+ FileOutputter(const char* path)
+ : _path(path),
+ _outputter(NULL)
+ {
+
+ }
+
+
+ virtual ~FileOutputter()
+ {
+ if (_outputter)
+ delete _outputter;
+
+ _stream.close();
+ }
+
+
+ /// Set up.
+
+ /// Opens the output file for writing and initializes the outputter.
+ virtual void SetUp()
+ {
+ _stream.open(_path,
+ std::ios_base::out |
+ std::ios_base::trunc |
+ std::ios_base::binary);
+ if (_stream.bad())
+ {
+ std::stringstream error;
+ error << "failed to open " << _path << " for writing: "
+ << strerror(errno);
+ throw std::runtime_error(error.str());
+ }
+
+ _outputter = CreateOutputter(_stream);
+ }
+
+
+ /// Outputter.
+ virtual ::hayai::Outputter& Outputter()
+ {
+ if (!_outputter)
+ throw std::runtime_error("outputter has not been set up");
+
+ return *_outputter;
+ }
+ protected:
+ /// Create outputter from output stream.
+
+ /// @param stream Output stream for the outputter.
+ /// @returns the outputter for the given format.
+ virtual ::hayai::Outputter* CreateOutputter(std::ostream& stream) = 0;
+ private:
+ const char* _path;
+ std::ofstream _stream;
+ ::hayai::Outputter* _outputter;
+ };
+
+
+#define FILE_OUTPUTTER_IMPLEMENTATION(_prefix) \
+ class _prefix ## FileOutputter \
+ : public FileOutputter \
+ { \
+ public: \
+ _prefix ## FileOutputter(const char* path) \
+ : FileOutputter(path) \
+ {} \
+ protected: \
+ virtual ::hayai::Outputter* CreateOutputter(std::ostream& stream) \
+ { \
+ return new ::hayai::_prefix ## Outputter(stream); \
+ } \
+ }
+
+
+ FILE_OUTPUTTER_IMPLEMENTATION(Json);
+ FILE_OUTPUTTER_IMPLEMENTATION(Console);
+ FILE_OUTPUTTER_IMPLEMENTATION(JUnitXml);
+
+#undef FILE_OUTPUTTER_IMPLEMENTATION
+
+
+ /// Default main executable runner for Hayai.
+ class MainRunner
+ {
+ public:
+ MainRunner()
+ : ExecutionMode(MainRunBenchmarks),
+ ShuffleBenchmarks(false),
+ StdoutOutputter(NULL)
+ {
+
+ }
+
+
+ ~MainRunner()
+ {
+ // Clean up the outputters.
+ for (std::vector<FileOutputter*>::iterator it =
+ FileOutputters.begin();
+ it != FileOutputters.end();
+ ++it)
+ delete *it;
+
+ if (StdoutOutputter)
+ delete StdoutOutputter;
+ }
+
+
+ /// Execution mode.
+ MainExecutionMode ExecutionMode;
+
+
+ /// Shuffle benchmarks.
+ bool ShuffleBenchmarks;
+
+
+ /// File outputters.
+ ///
+ /// Outputter will be freed by the class on destruction.
+ std::vector<FileOutputter*> FileOutputters;
+
+
+ /// Standard output outputter.
+ ///
+ /// Will be freed by the class on destruction.
+ Outputter* StdoutOutputter;
+
+
+ /// Parse arguments.
+
+ /// @param argc Argument count including the executable name.
+ /// @param argv Arguments.
+ /// @param residualArgs Pointer to vector to hold residual arguments
+ /// after parsing. If not NULL, the parser will not fail upon
+ /// encounting an unknown argument but will instead add it to the list
+ /// of residual arguments and return a success code. Note: the parser
+ /// will still fail if an invalid value is provided to a known
+ /// argument.
+ /// @returns 0 on success, otherwise the exit status code to be
+ /// returned from the executable.
+ int ParseArgs(int argc,
+ char** argv,
+ std::vector<char*>* residualArgs = NULL)
+ {
+ int argI = 1;
+ while (argI < argc)
+ {
+ char* arg = argv[argI++];
+ bool argLast = (argI == argc);
+ std::size_t argLen = strlen(arg);
+
+ if (argLen == 0)
+ continue;
+
+ // List flag.
+ if ((!strcmp(arg, "-l")) || (!strcmp(arg, "--list")))
+ ExecutionMode = ::hayai::MainListBenchmarks;
+ // Shuffle flag.
+ else if ((!strcmp(arg, "-s")) || (!strcmp(arg, "--shuffle")))
+ ShuffleBenchmarks = true;
+ // Filter flag.
+ else if ((!strcmp(arg, "-f")) || (!strcmp(arg, "--filter")))
+ {
+ if ((argLast) || (*argv[argI] == 0))
+ HAYAI_MAIN_USAGE_ERROR(HAYAI_MAIN_FORMAT_FLAG(arg) <<
+ " requires a pattern to be specified");
+ char* pattern = argv[argI++];
+
+ ::hayai::Benchmarker::ApplyPatternFilter(pattern);
+ }
+ // Output flag.
+ else if ((!strcmp(arg, "-o")) || (!strcmp(arg, "--output")))
+ {
+ if (argLast)
+ HAYAI_MAIN_USAGE_ERROR(HAYAI_MAIN_FORMAT_FLAG(arg) <<
+ " requires a format to be specified");
+ char* formatSpecifier = argv[argI++];
+
+ char* format = formatSpecifier;
+ char* path = strchr(formatSpecifier, ':');
+ if (path)
+ {
+ *(path++) = 0;
+ if (!strlen(path))
+ path = NULL;
+ }
+
+#define ADD_OUTPUTTER(_prefix) \
+ { \
+ if (path) \
+ FileOutputters.push_back( \
+ new ::hayai::_prefix ## FileOutputter(path) \
+ ); \
+ else \
+ { \
+ if (StdoutOutputter) \
+ delete StdoutOutputter; \
+ StdoutOutputter = \
+ new ::hayai::_prefix ## Outputter(std::cout); \
+ } \
+ }
+
+ if (!strcmp(format, "console"))
+ ADD_OUTPUTTER(Console)
+ else if (!strcmp(format, "json"))
+ ADD_OUTPUTTER(Json)
+ else if (!strcmp(format, "junit"))
+ ADD_OUTPUTTER(JUnitXml)
+ else
+ HAYAI_MAIN_USAGE_ERROR("invalid format: " << format);
+
+#undef ADD_OUTPUTTER
+ }
+ // Console coloring flag.
+ else if ((!strcmp(arg, "-c")) || (!strcmp(arg, "--color")))
+ {
+ if (argLast)
+ HAYAI_MAIN_USAGE_ERROR(
+ HAYAI_MAIN_FORMAT_FLAG(arg) <<
+ " requires an argument " <<
+ "of either " << HAYAI_MAIN_FORMAT_FLAG("yes") <<
+ " or " << HAYAI_MAIN_FORMAT_FLAG("no")
+ );
+
+ char* choice = argv[argI++];
+ bool enabled;
+
+ if ((!strcmp(choice, "yes")) ||
+ (!strcmp(choice, "true")) ||
+ (!strcmp(choice, "on")) ||
+ (!strcmp(choice, "1")))
+ enabled = true;
+ else if ((!strcmp(choice, "no")) ||
+ (!strcmp(choice, "false")) ||
+ (!strcmp(choice, "off")) ||
+ (!strcmp(choice, "0")))
+ enabled = false;
+ else
+ HAYAI_MAIN_USAGE_ERROR(
+ "invalid argument to " <<
+ HAYAI_MAIN_FORMAT_FLAG(arg) <<
+ ": " << choice
+ );
+
+ ::hayai::Console::SetFormattingEnabled(enabled);
+ }
+ // Help.
+ else if ((!strcmp(arg, "-?")) ||
+ (!strcmp(arg, "-h")) ||
+ (!strcmp(arg, "--help")))
+ {
+ ShowUsage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ else if (residualArgs)
+ {
+ residualArgs->push_back(arg);
+ }
+ else
+ {
+ HAYAI_MAIN_USAGE_ERROR("unknown option: " << arg);
+ }
+ }
+
+ return EXIT_SUCCESS;
+ }
+
+
+ /// Run the selected execution mode.
+
+ /// @returns the exit status code to be returned from the executable.
+ int Run()
+ {
+ // Execute based on the selected mode.
+ switch (ExecutionMode)
+ {
+ case ::hayai::MainRunBenchmarks:
+ return RunBenchmarks();
+
+ case ::hayai::MainListBenchmarks:
+ return ListBenchmarks();
+
+ default:
+ std::cerr << HAYAI_MAIN_FORMAT_ERROR(
+ "invalid execution mode: " << ExecutionMode
+ ) << std::endl;
+ return EXIT_FAILURE;
+ }
+ }
+ private:
+ /// Run benchmarks.
+
+ /// @returns the exit status code to be returned from the executable.
+ int RunBenchmarks()
+ {
+ // Hook up the outputs.
+ if (StdoutOutputter)
+ ::hayai::Benchmarker::AddOutputter(*StdoutOutputter);
+
+ for (std::vector< ::hayai::FileOutputter*>::iterator it =
+ FileOutputters.begin();
+ it < FileOutputters.end();
+ ++it)
+ {
+ ::hayai::FileOutputter& fileOutputter = **it;
+
+ try
+ {
+ fileOutputter.SetUp();
+ }
+ catch (std::exception& e)
+ {
+ std::cerr << HAYAI_MAIN_FORMAT_ERROR(e.what()) << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ ::hayai::Benchmarker::AddOutputter(fileOutputter.Outputter());
+ }
+
+ // Run the benchmarks.
+ if (ShuffleBenchmarks)
+ {
+ std::srand(static_cast<unsigned>(std::time(0)));
+ ::hayai::Benchmarker::ShuffleTests();
+ }
+
+ ::hayai::Benchmarker::RunAllTests();
+
+ return EXIT_SUCCESS;
+ }
+
+
+ /// List benchmarks.
+
+ /// @returns the exit status code to be returned from the executable.
+ int ListBenchmarks()
+ {
+ // List out the unique benchmark names.
+ std::vector<const ::hayai::TestDescriptor*> tests =
+ ::hayai::Benchmarker::ListTests();
+ std::vector<std::string> testNames;
+ std::set<std::string> uniqueTestNames;
+
+ for (std::vector<const ::hayai::TestDescriptor*>::iterator it =
+ tests.begin();
+ it < tests.end();
+ ++it)
+ {
+ if (uniqueTestNames.find((*it)->CanonicalName) !=
+ uniqueTestNames.end())
+ continue;
+
+ testNames.push_back((*it)->CanonicalName);
+ uniqueTestNames.insert((*it)->CanonicalName);
+ }
+
+ // Sort the benchmark names.
+ std::sort(testNames.begin(), testNames.end());
+
+ // Dump the list.
+ for (std::vector<std::string>::iterator it = testNames.begin();
+ it < testNames.end();
+ ++it)
+ std::cout << *it << std::endl;
+
+ return EXIT_SUCCESS;
+ }
+
+
+ /// Show usage.
+
+ /// @param execName Executable name.
+ void ShowUsage(const char* execName)
+ {
+ const char* baseName = strrchr(execName, PATH_SEPARATOR);
+
+ std::cerr << "Usage: " << (baseName ? baseName + 1 : execName)
+ << " " << HAYAI_MAIN_FORMAT_FLAG("[OPTIONS]") << std::endl
+ << std::endl
+
+ << " Runs the benchmarks for this project." << std::endl
+ << std::endl
+
+ << "Benchmark selection options:" << std::endl
+ << " " << HAYAI_MAIN_FORMAT_FLAG("-l") << ", "
+ << HAYAI_MAIN_FORMAT_FLAG("--list")
+ << std::endl
+ << " List the names of all benchmarks instead of "
+ << "running them." << std::endl
+ << " " << HAYAI_MAIN_FORMAT_FLAG("-f") << ", "
+ << HAYAI_MAIN_FORMAT_FLAG("--filter")
+ << " <" << HAYAI_MAIN_FORMAT_ARGUMENT("pattern") << ">"
+ << std::endl
+ << " Run only the tests whose name matches one of the "
+ << "positive patterns but" << std::endl
+ << " none of the negative patterns. '?' matches any "
+ << "single character; '*'" << std::endl
+ << " matches any substring; ':' separates two "
+ << "patterns."
+ << std::endl
+
+ << "Benchmark execution options:" << std::endl
+ << " " << HAYAI_MAIN_FORMAT_FLAG("-s") << ", "
+ << HAYAI_MAIN_FORMAT_FLAG("--shuffle")
+ << std::endl
+ << " Randomize benchmark execution order."
+ << std::endl
+ << std::endl
+
+ << "Benchmark output options:" << std::endl
+ << " " << HAYAI_MAIN_FORMAT_FLAG("-o") << ", "
+ << HAYAI_MAIN_FORMAT_FLAG("--output")
+ << " <" << HAYAI_MAIN_FORMAT_ARGUMENT("format") << ">[:"
+ << HAYAI_MAIN_FORMAT_ARGUMENT("<path>") << "]"
+ << std::endl
+ << " Output results in a specific format. If no "
+ << "path is specified, the output" << std::endl
+ << " will be presented on stdout. Can be specified "
+ << "multiple times to get output" << std::endl
+ << " in different formats. The supported formats are:"
+ << std::endl
+ << std::endl
+ << " " << HAYAI_MAIN_FORMAT_ARGUMENT("console")
+ << std::endl
+ << " Standard console output." << std::endl
+ << " " << HAYAI_MAIN_FORMAT_ARGUMENT("json")
+ << std::endl
+ << " JSON." << std::endl
+ << " " << HAYAI_MAIN_FORMAT_ARGUMENT("junit")
+ << std::endl
+ << " JUnit-compatible XML (very restrictive.)"
+ << std::endl
+ << std::endl
+ << " If multiple output formats are provided without "
+ << "a path, only the last" << std::endl
+ << " provided format will be output to stdout."
+ << std::endl
+ << " " << HAYAI_MAIN_FORMAT_FLAG("--c") << ", "
+ << HAYAI_MAIN_FORMAT_FLAG("--color") << " ("
+ << ::hayai::Console::TextGreen << "yes"
+ << ::hayai::Console::TextDefault << "|"
+ << ::hayai::Console::TextGreen << "no"
+ << ::hayai::Console::TextDefault << ")" << std::endl
+ << " Enable colored output when available. Default "
+ << ::hayai::Console::TextGreen << "yes"
+ << ::hayai::Console::TextDefault << "." << std::endl
+ << std::endl
+
+ << "Miscellaneous options:" << std::endl
+ << " " << HAYAI_MAIN_FORMAT_FLAG("-?") << ", "
+ << HAYAI_MAIN_FORMAT_FLAG("-h") << ", "
+ << HAYAI_MAIN_FORMAT_FLAG("--help") << std::endl
+ << " Show this help information." << std::endl
+ << std::endl
+
+ << "hayai version: " << HAYAI_VERSION << std::endl
+ << "Clock implementation: "
+ << ::hayai::Clock::Description()
+ << std::endl;
+ }
+ };
+}
+
+
+#undef HAYAI_MAIN_FORMAT_FLAG
+#undef HAYAI_MAIN_FORMAT_ARGUMENT
+#undef HAYAI_MAIN_FORMAT_ERROR
+#undef HAYAI_MAIN_USAGE_ERROR
+
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_outputter.hpp b/deps/inja/third_party/include/hayai/hayai_outputter.hpp
new file mode 100755
index 0000000..94055b2
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_outputter.hpp
@@ -0,0 +1,113 @@
+#ifndef __HAYAI_OUTPUTTER
+#define __HAYAI_OUTPUTTER
+#include <iostream>
+#include <cstddef>
+
+#include "hayai_test_result.hpp"
+
+
+namespace hayai
+{
+ /// Outputter.
+
+ /// Abstract base class for outputters.
+ class Outputter
+ {
+ public:
+ /// Begin benchmarking.
+
+ /// The total number of benchmarks registred is the sum of the two
+ /// counts passed to the outputter.
+ ///
+ /// @param enabledCount Number of benchmarks to be executed.
+ /// @param disabledCount Number of disabled benchmarks to be skipped.
+ virtual void Begin(const std::size_t& enabledCount,
+ const std::size_t& disabledCount) = 0;
+
+
+ /// End benchmarking.
+
+ /// @param executedCount Number of benchmarks that have been executed.
+ /// @param disabledCount Number of benchmarks that have been skipped
+ /// because they are disabled.
+ virtual void End(const std::size_t& executedCount,
+ const std::size_t& disabledCount) = 0;
+
+
+ /// Begin benchmark test run.
+
+ /// @param fixtureName Fixture name.
+ /// @param testName Test name.
+ /// @param parameters Test parameter description.
+ /// @param runsCount Number of runs to be executed.
+ /// @param iterationsCount Number of iterations per run.
+ virtual void BeginTest(const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor& parameters,
+ const std::size_t& runsCount,
+ const std::size_t& iterationsCount) = 0;
+
+
+ /// End benchmark test run.
+
+ /// @param fixtureName Fixture name.
+ /// @param testName Test name.
+ /// @param parameters Test parameter description.
+ /// @param result Test result.
+ virtual void EndTest(const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor& parameters,
+ const TestResult& result) = 0;
+
+
+ /// Skip disabled benchmark test run.
+
+ /// @param fixtureName Fixture name.
+ /// @param testName Test name.
+ /// @param parameters Test parameter description.
+ /// @param runsCount Number of runs to be executed.
+ /// @param iterationsCount Number of iterations per run.
+ virtual void SkipDisabledTest(const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor&
+ parameters,
+ const std::size_t& runsCount,
+ const std::size_t& iterationsCount) = 0;
+
+
+ virtual ~Outputter()
+ {
+
+ }
+ protected:
+ /// Write a nicely formatted test name to a stream.
+ static void WriteTestNameToStream(std::ostream& stream,
+ const std::string& fixtureName,
+ const std::string& testName,
+ const TestParametersDescriptor&
+ parameters)
+ {
+ stream << fixtureName << "." << testName;
+
+ const std::vector<TestParameterDescriptor>& descs =
+ parameters.Parameters();
+
+ if (descs.empty())
+ return;
+
+ stream << "(";
+
+ for (std::size_t i = 0; i < descs.size(); ++i)
+ {
+ if (i)
+ stream << ", ";
+
+ const TestParameterDescriptor& desc = descs[i];
+ stream << desc.Declaration << " = " << desc.Value;
+ }
+
+ stream << ")";
+ }
+ };
+}
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_test.hpp b/deps/inja/third_party/include/hayai/hayai_test.hpp
new file mode 100755
index 0000000..36d25fd
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_test.hpp
@@ -0,0 +1,83 @@
+#ifndef __HAYAI_TEST
+#define __HAYAI_TEST
+#include <cstddef>
+
+#include "hayai_clock.hpp"
+#include "hayai_test_result.hpp"
+
+
+namespace hayai
+{
+ /// Base test class.
+
+ /// @ref SetUp is invoked before each run, and @ref TearDown is invoked
+ /// once the run is finished. Iterations rely on the same fixture
+ /// for every run.
+ ///
+ /// The default test class does not contain any actual code in the
+ /// SetUp and TearDown methods, which means that tests can inherit
+ /// this class directly for non-fixture based benchmarking tests.
+ class Test
+ {
+ public:
+ /// Set up the testing fixture for execution of a run.
+ virtual void SetUp()
+ {
+
+ }
+
+
+ /// Tear down the previously set up testing fixture after the
+ /// execution run.
+ virtual void TearDown()
+ {
+
+ }
+
+
+ /// Run the test.
+
+ /// @param iterations Number of iterations to gather data for.
+ /// @returns the number of nanoseconds the run took.
+ uint64_t Run(std::size_t iterations)
+ {
+ std::size_t iteration = iterations;
+
+ // Set up the testing fixture.
+ SetUp();
+
+ // Get the starting time.
+ Clock::TimePoint startTime, endTime;
+
+ startTime = Clock::Now();
+
+ // Run the test body for each iteration.
+ while (iteration--)
+ TestBody();
+
+ // Get the ending time.
+ endTime = Clock::Now();
+
+ // Tear down the testing fixture.
+ TearDown();
+
+ // Return the duration in nanoseconds.
+ return Clock::Duration(startTime, endTime);
+ }
+
+
+ virtual ~Test()
+ {
+
+ }
+ protected:
+ /// Test body.
+
+ /// Executed for each iteration the benchmarking test is run.
+ virtual void TestBody()
+ {
+
+ }
+ };
+}
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_test_descriptor.hpp b/deps/inja/third_party/include/hayai/hayai_test_descriptor.hpp
new file mode 100755
index 0000000..529744e
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_test_descriptor.hpp
@@ -0,0 +1,365 @@
+#ifndef __HAYAI_TESTDESCRIPTOR
+#define __HAYAI_TESTDESCRIPTOR
+#include <cstring>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "hayai_test.hpp"
+#include "hayai_test_factory.hpp"
+
+
+namespace hayai
+{
+ /// Parameter declaration.
+
+ /// Describes parameter type and name.
+ class TestParameterDescriptor
+ {
+ public:
+ TestParameterDescriptor(std::string declaration,
+ std::string value)
+ : Declaration(declaration),
+ Value(value)
+ {
+
+ }
+
+
+ /// Declaration.
+ std::string Declaration;
+
+
+ /// Value.
+ std::string Value;
+ };
+
+
+ /// Test parameters descriptor.
+ class TestParametersDescriptor
+ {
+ private:
+ /// Quoting state.
+ enum QuotingState
+ {
+ /// Unquoted.
+ Unquoted,
+
+
+ /// Single quoted.
+ SingleQuoted,
+
+
+ /// Double quoted.
+ DoubleQuoted
+ };
+
+
+ /// Trimmed string.
+
+ /// @param start Start character.
+ /// @param end Character one position beyond end.
+ inline static std::string TrimmedString(const char* start,
+ const char* end)
+ {
+ while (start < end)
+ {
+ if ((*start == ' ') ||
+ (*start == '\r') ||
+ (*start == '\n') ||
+ (*start == '\t'))
+ ++start;
+ else
+ break;
+ }
+
+ while (end > start)
+ {
+ const char c = *(end - 1);
+
+ if ((c != ' ') &&
+ (c != '\r') &&
+ (c != '\n') &&
+ (c != '\t'))
+ break;
+
+ --end;
+ }
+
+ return std::string(start, std::string::size_type(end - start));
+ }
+
+
+ /// Parse comma separated parentherized value.
+
+ /// @param separated Separated values as "(..[, ..])".
+ /// @returns the individual values with white space trimmed.
+ static std::vector<std::string>
+ ParseCommaSeparated(const char* separated)
+ {
+ std::vector<std::string> result;
+
+ if (*separated)
+ ++separated;
+
+ while ((*separated) && (*separated != ')'))
+ {
+ std::size_t escapeCounter = 0;
+ const char* start = separated;
+ QuotingState state = Unquoted;
+ bool escaped = false;
+
+ while (*separated)
+ {
+ const char c = *separated++;
+
+ if (state == Unquoted)
+ {
+ if ((c == '"') || (c == '\''))
+ {
+ state = (c == '"' ? DoubleQuoted : SingleQuoted);
+ escaped = false;
+ }
+ else if ((c == '<') ||
+ (c == '(') ||
+ (c == '[') ||
+ (c == '{'))
+ ++escapeCounter;
+ else if ((escapeCounter) &&
+ ((c == '>') ||
+ (c == ')') ||
+ (c == ']') ||
+ (c == '}')))
+ --escapeCounter;
+ else if ((!escapeCounter) &&
+ ((c == ',') || (c == ')')))
+ {
+ result.push_back(TrimmedString(start,
+ separated - 1));
+ break;
+ }
+ }
+ else
+ {
+ if (escaped)
+ escaped = false;
+ else if (c == '\\')
+ escaped = true;
+ else if (c == (state == DoubleQuoted ? '"' : '\''))
+ state = Unquoted;
+ }
+ }
+ }
+
+ return result;
+ }
+
+
+ /// Parse parameter declaration.
+
+ /// @param raw Raw declaration.
+ TestParameterDescriptor ParseDescriptor(const std::string& raw)
+ {
+ const char* position = raw.c_str();
+
+ // Split the declaration into its declaration and its default
+ // type.
+ const char* equalPosition = NULL;
+ std::size_t escapeCounter = 0;
+ QuotingState state = Unquoted;
+ bool escaped = false;
+
+ while (*position)
+ {
+ const char c = *position++;
+
+ if (state == Unquoted)
+ {
+ if ((c == '"') || (c == '\''))
+ {
+ state = (c == '"' ? DoubleQuoted : SingleQuoted);
+ escaped = false;
+ }
+ else if ((c == '<') ||
+ (c == '(') ||
+ (c == '[') ||
+ (c == '{'))
+ ++escapeCounter;
+ else if ((escapeCounter) &&
+ ((c == '>') ||
+ (c == ')') ||
+ (c == ']') ||
+ (c == '}')))
+ --escapeCounter;
+ else if ((!escapeCounter) &&
+ (c == '='))
+ {
+ equalPosition = position;
+ break;
+ }
+ }
+ else
+ {
+ if (escaped)
+ escaped = false;
+ else if (c == '\\')
+ escaped = true;
+ else if (c == (state == DoubleQuoted ? '"' : '\''))
+ state = Unquoted;
+ }
+ }
+
+ // Construct the parameter descriptor.
+ if (equalPosition)
+ {
+ const char* start = raw.c_str();
+ const char* end = start + raw.length();
+
+ return TestParameterDescriptor(
+ std::string(TrimmedString(start,
+ equalPosition - 1)),
+ std::string(TrimmedString(equalPosition,
+ end))
+ );
+ }
+ else
+ return TestParameterDescriptor(raw, std::string());
+ }
+ public:
+ TestParametersDescriptor()
+ {
+
+ }
+
+
+ TestParametersDescriptor(const char* rawDeclarations,
+ const char* rawValues)
+ {
+ // Parse the declarations.
+ std::vector<std::string> declarations =
+ ParseCommaSeparated(rawDeclarations);
+
+ for (std::vector<std::string>::const_iterator it =
+ declarations.begin();
+ it != declarations.end();
+ ++it)
+ _parameters.push_back(ParseDescriptor(*it));
+
+ // Parse the values.
+ std::vector<std::string> values = ParseCommaSeparated(rawValues);
+
+ std::size_t
+ straightValues = (_parameters.size() > values.size() ?
+ values.size() :
+ _parameters.size()),
+ variadicValues = 0;
+
+ if (values.size() > _parameters.size())
+ {
+ if (straightValues > 0)
+ --straightValues;
+ variadicValues = values.size() - _parameters.size() + 1;
+ }
+
+ for (std::size_t i = 0; i < straightValues; ++i)
+ _parameters[i].Value = values[i];
+
+ if (variadicValues)
+ {
+ std::stringstream variadic;
+
+ for (std::size_t i = 0; i < variadicValues; ++i)
+ {
+ if (i)
+ variadic << ", ";
+ variadic << values[straightValues + i];
+ }
+
+ _parameters[_parameters.size() - 1].Value = variadic.str();
+ }
+ }
+
+
+ inline const std::vector<TestParameterDescriptor>& Parameters() const
+ {
+ return _parameters;
+ }
+ private:
+ std::vector<TestParameterDescriptor> _parameters;
+ };
+
+
+ /// Test descriptor.
+ class TestDescriptor
+ {
+ public:
+ /// Initialize a new test descriptor.
+
+ /// @param fixtureName Name of the fixture.
+ /// @param testName Name of the test.
+ /// @param runs Number of runs for the test.
+ /// @param iterations Number of iterations per run.
+ /// @param testFactory Test factory implementation for the test.
+ /// @param parameters Parametrized test parameters.
+ TestDescriptor(const char* fixtureName,
+ const char* testName,
+ std::size_t runs,
+ std::size_t iterations,
+ TestFactory* testFactory,
+ TestParametersDescriptor parameters,
+ bool isDisabled = false)
+ : FixtureName(fixtureName),
+ TestName(testName),
+ CanonicalName(std::string(fixtureName) + "." + testName),
+ Runs(runs),
+ Iterations(iterations),
+ Factory(testFactory),
+ Parameters(parameters),
+ IsDisabled(isDisabled)
+ {
+
+ }
+
+
+ /// Dispose of a test descriptor.
+ ~TestDescriptor()
+ {
+ delete this->Factory;
+ }
+
+
+ /// Fixture name.
+ std::string FixtureName;
+
+
+ /// Test name.
+ std::string TestName;
+
+
+ /// Canonical name.
+
+ /// As: <FixtureName>.<TestName>.
+ std::string CanonicalName;
+
+
+ /// Test runs.
+ std::size_t Runs;
+
+
+ /// Iterations per test run.
+ std::size_t Iterations;
+
+
+ /// Test factory.
+ TestFactory* Factory;
+
+
+ /// Parameters for parametrized tests
+ TestParametersDescriptor Parameters;
+
+
+ /// Disabled.
+ bool IsDisabled;
+ };
+}
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_test_factory.hpp b/deps/inja/third_party/include/hayai/hayai_test_factory.hpp
new file mode 100755
index 0000000..1c5f469
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_test_factory.hpp
@@ -0,0 +1,26 @@
+#ifndef __HAYAI_TESTFACTORY
+#define __HAYAI_TESTFACTORY
+#include "hayai_test.hpp"
+
+namespace hayai
+{
+ /// Base class for test factory implementations.
+ class TestFactory
+ {
+ public:
+ /// Virtual destructor
+
+ /// Has no function in the base class.
+ virtual ~TestFactory()
+ {
+
+ }
+
+
+ /// Creates a test instance to run.
+
+ /// @returns a pointer to an initialized test.
+ virtual Test* CreateTest() = 0;
+ };
+}
+#endif
diff --git a/deps/inja/third_party/include/hayai/hayai_test_result.hpp b/deps/inja/third_party/include/hayai/hayai_test_result.hpp
new file mode 100755
index 0000000..6c5368d
--- /dev/null
+++ b/deps/inja/third_party/include/hayai/hayai_test_result.hpp
@@ -0,0 +1,304 @@
+#ifndef __HAYAI_TESTRESULT
+#define __HAYAI_TESTRESULT
+#include <vector>
+#include <stdexcept>
+#include <limits>
+#include <cmath>
+
+#include "hayai_clock.hpp"
+
+
+namespace hayai
+{
+ /// Test result descriptor.
+
+ /// All durations are expressed in nanoseconds.
+ struct TestResult
+ {
+ public:
+ /// Initialize test result descriptor.
+
+ /// @param runTimes Timing for the individual runs.
+ /// @param iterations Number of iterations per run.
+ TestResult(const std::vector<uint64_t>& runTimes,
+ std::size_t iterations)
+ : _runTimes(runTimes),
+ _iterations(iterations),
+ _timeTotal(0),
+ _timeRunMin(std::numeric_limits<uint64_t>::max()),
+ _timeRunMax(std::numeric_limits<uint64_t>::min()),
+ _timeStdDev(0.0),
+ _timeMedian(0.0),
+ _timeQuartile1(0.0),
+ _timeQuartile3(0.0)
+ {
+ // Summarize under the assumption of values being accessed more
+ // than once.
+ std::vector<uint64_t>::iterator runIt = _runTimes.begin();
+
+ while (runIt != _runTimes.end())
+ {
+ const uint64_t run = *runIt;
+
+ _timeTotal += run;
+ if ((runIt == _runTimes.begin()) || (run > _timeRunMax))
+ _timeRunMax = run;
+ if ((runIt == _runTimes.begin()) || (run < _timeRunMin))
+ _timeRunMin = run;
+
+ ++runIt;
+ }
+
+ // Calculate standard deviation.
+ const double mean = RunTimeAverage();
+ double accu = 0.0;
+
+ runIt = _runTimes.begin();
+
+ while (runIt != _runTimes.end())
+ {
+ const uint64_t run = *runIt;
+ const double diff = double(run) - mean;
+ accu += (diff * diff);
+
+ ++runIt;
+ }
+
+ _timeStdDev = std::sqrt(accu / (_runTimes.size() - 1));
+
+ // Calculate quartiles.
+ std::vector<uint64_t> sortedRunTimes(_runTimes);
+ std::sort(sortedRunTimes.begin(), sortedRunTimes.end());
+
+ const std::size_t sortedSize = sortedRunTimes.size();
+ const std::size_t sortedSizeHalf = sortedSize / 2;
+
+ if (sortedSize >= 2)
+ {
+ const std::size_t quartile = sortedSizeHalf / 2;
+
+ if ((sortedSize % 2) == 0)
+ {
+ _timeMedian =
+ (double(sortedRunTimes[sortedSizeHalf - 1]) +
+ double(sortedRunTimes[sortedSizeHalf])) / 2;
+
+ _timeQuartile1 =
+ double(sortedRunTimes[quartile]);
+ _timeQuartile3 =
+ double(sortedRunTimes[sortedSizeHalf + quartile]);
+ }
+ else
+ {
+ _timeMedian = double(sortedRunTimes[sortedSizeHalf]);
+
+ _timeQuartile1 =
+ (double(sortedRunTimes[quartile - 1]) +
+ double(sortedRunTimes[quartile])) / 2;
+ _timeQuartile3 = (
+ double(
+ sortedRunTimes[sortedSizeHalf + (quartile - 1)]
+ ) +
+ double(
+ sortedRunTimes[sortedSizeHalf + quartile]
+ )
+ ) / 2;
+ }
+ }
+ else if (sortedSize > 0)
+ {
+ _timeQuartile1 = double(sortedRunTimes[0]);
+ _timeQuartile3 = _timeQuartile1;
+ }
+ }
+
+
+ /// Total time.
+ inline double TimeTotal() const
+ {
+ return double(_timeTotal);
+ }
+
+
+ /// Run times.
+ inline const std::vector<uint64_t>& RunTimes() const
+ {
+ return _runTimes;
+ }
+
+
+ /// Average time per run.
+ inline double RunTimeAverage() const
+ {
+ return double(_timeTotal) / double(_runTimes.size());
+ }
+
+ /// Standard deviation time per run.
+ inline double RunTimeStdDev() const
+ {
+ return _timeStdDev;
+ }
+
+ /// Median (2nd Quartile) time per run.
+ inline double RunTimeMedian() const
+ {
+ return _timeMedian;
+ }
+
+ /// 1st Quartile time per run.
+ inline double RunTimeQuartile1() const
+ {
+ return _timeQuartile1;
+ }
+
+ /// 3rd Quartile time per run.
+ inline double RunTimeQuartile3() const
+ {
+ return _timeQuartile3;
+ }
+
+ /// Maximum time per run.
+ inline double RunTimeMaximum() const
+ {
+ return double(_timeRunMax);
+ }
+
+
+ /// Minimum time per run.
+ inline double RunTimeMinimum() const
+ {
+ return double(_timeRunMin);
+ }
+
+
+ /// Average runs per second.
+ inline double RunsPerSecondAverage() const
+ {
+ return 1000000000.0 / RunTimeAverage();
+ }
+
+ /// Median (2nd Quartile) runs per second.
+ inline double RunsPerSecondMedian() const
+ {
+ return 1000000000.0 / RunTimeMedian();
+ }
+
+ /// 1st Quartile runs per second.
+ inline double RunsPerSecondQuartile1() const
+ {
+ return 1000000000.0 / RunTimeQuartile1();
+ }
+
+ /// 3rd Quartile runs per second.
+ inline double RunsPerSecondQuartile3() const
+ {
+ return 1000000000.0 / RunTimeQuartile3();
+ }
+
+ /// Maximum runs per second.
+ inline double RunsPerSecondMaximum() const
+ {
+ return 1000000000.0 / _timeRunMin;
+ }
+
+
+ /// Minimum runs per second.
+ inline double RunsPerSecondMinimum() const
+ {
+ return 1000000000.0 / _timeRunMax;
+ }
+
+
+ /// Average time per iteration.
+ inline double IterationTimeAverage() const
+ {
+ return RunTimeAverage() / double(_iterations);
+ }
+
+ /// Standard deviation time per iteration.
+ inline double IterationTimeStdDev() const
+ {
+ return RunTimeStdDev() / double(_iterations);
+ }
+
+ /// Median (2nd Quartile) time per iteration.
+ inline double IterationTimeMedian() const
+ {
+ return RunTimeMedian() / double(_iterations);
+ }
+
+ /// 1st Quartile time per iteration.
+ inline double IterationTimeQuartile1() const
+ {
+ return RunTimeQuartile1() / double(_iterations);
+ }
+
+ /// 3rd Quartile time per iteration.
+ inline double IterationTimeQuartile3() const
+ {
+ return RunTimeQuartile3() / double(_iterations);
+ }
+
+ /// Minimum time per iteration.
+ inline double IterationTimeMinimum() const
+ {
+ return _timeRunMin / double(_iterations);
+ }
+
+
+ /// Maximum time per iteration.
+ inline double IterationTimeMaximum() const
+ {
+ return _timeRunMax / double(_iterations);
+ }
+
+
+ /// Average iterations per second.
+ inline double IterationsPerSecondAverage() const
+ {
+ return 1000000000.0 / IterationTimeAverage();
+ }
+
+ /// Median (2nd Quartile) iterations per second.
+ inline double IterationsPerSecondMedian() const
+ {
+ return 1000000000.0 / IterationTimeMedian();
+ }
+
+ /// 1st Quartile iterations per second.
+ inline double IterationsPerSecondQuartile1() const
+ {
+ return 1000000000.0 / IterationTimeQuartile1();
+ }
+
+ /// 3rd Quartile iterations per second.
+ inline double IterationsPerSecondQuartile3() const
+ {
+ return 1000000000.0 / IterationTimeQuartile3();
+ }
+
+ /// Minimum iterations per second.
+ inline double IterationsPerSecondMinimum() const
+ {
+ return 1000000000.0 / IterationTimeMaximum();
+ }
+
+
+ /// Maximum iterations per second.
+ inline double IterationsPerSecondMaximum() const
+ {
+ return 1000000000.0 / IterationTimeMinimum();
+ }
+ private:
+ std::vector<uint64_t> _runTimes;
+ std::size_t _iterations;
+ uint64_t _timeTotal;
+ uint64_t _timeRunMin;
+ uint64_t _timeRunMax;
+ double _timeStdDev;
+ double _timeMedian;
+ double _timeQuartile1;
+ double _timeQuartile3;
+ };
+}
+#endif
diff --git a/deps/inja/third_party/include/nlohmann/LICENSE.MIT b/deps/inja/third_party/include/nlohmann/LICENSE.MIT
new file mode 100644
index 0000000..00599af
--- /dev/null
+++ b/deps/inja/third_party/include/nlohmann/LICENSE.MIT
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2013-2017 Niels Lohmann
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/deps/inja/third_party/include/nlohmann/json.hpp b/deps/inja/third_party/include/nlohmann/json.hpp
new file mode 100644
index 0000000..cc822a5
--- /dev/null
+++ b/deps/inja/third_party/include/nlohmann/json.hpp
@@ -0,0 +1,24665 @@
+/*
+ __ _____ _____ _____
+ __| | __| | | | JSON for Modern C++
+| | |__ | | | | | | version 3.8.0
+|_____|_____|_____|_|___| https://github.com/nlohmann/json
+
+Licensed under the MIT License <http://opensource.org/licenses/MIT>.
+SPDX-License-Identifier: MIT
+Copyright (c) 2013-2019 Niels Lohmann <http://nlohmann.me>.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+#ifndef INCLUDE_NLOHMANN_JSON_HPP_
+#define INCLUDE_NLOHMANN_JSON_HPP_
+
+#define NLOHMANN_JSON_VERSION_MAJOR 3
+#define NLOHMANN_JSON_VERSION_MINOR 8
+#define NLOHMANN_JSON_VERSION_PATCH 0
+
+#include <algorithm> // all_of, find, for_each
+#include <cassert> // assert
+#include <cstddef> // nullptr_t, ptrdiff_t, size_t
+#include <functional> // hash, less
+#include <initializer_list> // initializer_list
+#include <iosfwd> // istream, ostream
+#include <iterator> // random_access_iterator_tag
+#include <memory> // unique_ptr
+#include <numeric> // accumulate
+#include <string> // string, stoi, to_string
+#include <utility> // declval, forward, move, pair, swap
+#include <vector> // vector
+
+// #include <nlohmann/adl_serializer.hpp>
+
+
+#include <utility>
+
+// #include <nlohmann/detail/conversions/from_json.hpp>
+
+
+#include <algorithm> // transform
+#include <array> // array
+#include <forward_list> // forward_list
+#include <iterator> // inserter, front_inserter, end
+#include <map> // map
+#include <string> // string
+#include <tuple> // tuple, make_tuple
+#include <type_traits> // is_arithmetic, is_same, is_enum, underlying_type, is_convertible
+#include <unordered_map> // unordered_map
+#include <utility> // pair, declval
+#include <valarray> // valarray
+
+// #include <nlohmann/detail/boolean_operators.hpp>
+
+
+// Header <ciso646> is removed in C++20.
+// See <https://github.com/nlohmann/json/issues/2089> for more information.
+
+#if __cplusplus <= 201703L
+ #include <ciso646> // and, not, or
+#endif
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+
+#include <exception> // exception
+#include <stdexcept> // runtime_error
+#include <string> // to_string
+
+// #include <nlohmann/detail/input/position_t.hpp>
+
+
+#include <cstddef> // size_t
+
+namespace nlohmann
+{
+namespace detail
+{
+/// struct to capture the start position of the current token
+struct position_t
+{
+ /// the total number of characters read
+ std::size_t chars_read_total = 0;
+ /// the number of characters read in the current line
+ std::size_t chars_read_current_line = 0;
+ /// the number of lines read
+ std::size_t lines_read = 0;
+
+ /// conversion to size_t to preserve SAX interface
+ constexpr operator size_t() const
+ {
+ return chars_read_total;
+ }
+};
+
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+
+#include <utility> // pair
+// #include <nlohmann/thirdparty/hedley/hedley.hpp>
+/* Hedley - https://nemequ.github.io/hedley
+ * Created by Evan Nemerson <evan@nemerson.com>
+ *
+ * To the extent possible under law, the author(s) have dedicated all
+ * copyright and related and neighboring rights to this software to
+ * the public domain worldwide. This software is distributed without
+ * any warranty.
+ *
+ * For details, see <http://creativecommons.org/publicdomain/zero/1.0/>.
+ * SPDX-License-Identifier: CC0-1.0
+ */
+
+#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 13)
+#if defined(JSON_HEDLEY_VERSION)
+ #undef JSON_HEDLEY_VERSION
+#endif
+#define JSON_HEDLEY_VERSION 13
+
+#if defined(JSON_HEDLEY_STRINGIFY_EX)
+ #undef JSON_HEDLEY_STRINGIFY_EX
+#endif
+#define JSON_HEDLEY_STRINGIFY_EX(x) #x
+
+#if defined(JSON_HEDLEY_STRINGIFY)
+ #undef JSON_HEDLEY_STRINGIFY
+#endif
+#define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x)
+
+#if defined(JSON_HEDLEY_CONCAT_EX)
+ #undef JSON_HEDLEY_CONCAT_EX
+#endif
+#define JSON_HEDLEY_CONCAT_EX(a,b) a##b
+
+#if defined(JSON_HEDLEY_CONCAT)
+ #undef JSON_HEDLEY_CONCAT
+#endif
+#define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b)
+
+#if defined(JSON_HEDLEY_CONCAT3_EX)
+ #undef JSON_HEDLEY_CONCAT3_EX
+#endif
+#define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c
+
+#if defined(JSON_HEDLEY_CONCAT3)
+ #undef JSON_HEDLEY_CONCAT3
+#endif
+#define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c)
+
+#if defined(JSON_HEDLEY_VERSION_ENCODE)
+ #undef JSON_HEDLEY_VERSION_ENCODE
+#endif
+#define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision))
+
+#if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR)
+ #undef JSON_HEDLEY_VERSION_DECODE_MAJOR
+#endif
+#define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000)
+
+#if defined(JSON_HEDLEY_VERSION_DECODE_MINOR)
+ #undef JSON_HEDLEY_VERSION_DECODE_MINOR
+#endif
+#define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000)
+
+#if defined(JSON_HEDLEY_VERSION_DECODE_REVISION)
+ #undef JSON_HEDLEY_VERSION_DECODE_REVISION
+#endif
+#define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000)
+
+#if defined(JSON_HEDLEY_GNUC_VERSION)
+ #undef JSON_HEDLEY_GNUC_VERSION
+#endif
+#if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__)
+ #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
+#elif defined(__GNUC__)
+ #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0)
+#endif
+
+#if defined(JSON_HEDLEY_GNUC_VERSION_CHECK)
+ #undef JSON_HEDLEY_GNUC_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_GNUC_VERSION)
+ #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_MSVC_VERSION)
+ #undef JSON_HEDLEY_MSVC_VERSION
+#endif
+#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000)
+ #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100)
+#elif defined(_MSC_FULL_VER)
+ #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10)
+#elif defined(_MSC_VER)
+ #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0)
+#endif
+
+#if defined(JSON_HEDLEY_MSVC_VERSION_CHECK)
+ #undef JSON_HEDLEY_MSVC_VERSION_CHECK
+#endif
+#if !defined(_MSC_VER)
+ #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0)
+#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
+ #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch)))
+#elif defined(_MSC_VER) && (_MSC_VER >= 1200)
+ #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch)))
+#else
+ #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor)))
+#endif
+
+#if defined(JSON_HEDLEY_INTEL_VERSION)
+ #undef JSON_HEDLEY_INTEL_VERSION
+#endif
+#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE)
+ #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE)
+#elif defined(__INTEL_COMPILER)
+ #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0)
+#endif
+
+#if defined(JSON_HEDLEY_INTEL_VERSION_CHECK)
+ #undef JSON_HEDLEY_INTEL_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_INTEL_VERSION)
+ #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_PGI_VERSION)
+ #undef JSON_HEDLEY_PGI_VERSION
+#endif
+#if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__)
+ #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__)
+#endif
+
+#if defined(JSON_HEDLEY_PGI_VERSION_CHECK)
+ #undef JSON_HEDLEY_PGI_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_PGI_VERSION)
+ #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_SUNPRO_VERSION)
+ #undef JSON_HEDLEY_SUNPRO_VERSION
+#endif
+#if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000)
+ #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10)
+#elif defined(__SUNPRO_C)
+ #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf)
+#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000)
+ #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10)
+#elif defined(__SUNPRO_CC)
+ #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf)
+#endif
+
+#if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK)
+ #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_SUNPRO_VERSION)
+ #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION)
+ #undef JSON_HEDLEY_EMSCRIPTEN_VERSION
+#endif
+#if defined(__EMSCRIPTEN__)
+ #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__)
+#endif
+
+#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK)
+ #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION)
+ #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_ARM_VERSION)
+ #undef JSON_HEDLEY_ARM_VERSION
+#endif
+#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION)
+ #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100)
+#elif defined(__CC_ARM) && defined(__ARMCC_VERSION)
+ #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100)
+#endif
+
+#if defined(JSON_HEDLEY_ARM_VERSION_CHECK)
+ #undef JSON_HEDLEY_ARM_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_ARM_VERSION)
+ #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_IBM_VERSION)
+ #undef JSON_HEDLEY_IBM_VERSION
+#endif
+#if defined(__ibmxl__)
+ #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__)
+#elif defined(__xlC__) && defined(__xlC_ver__)
+ #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff)
+#elif defined(__xlC__)
+ #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0)
+#endif
+
+#if defined(JSON_HEDLEY_IBM_VERSION_CHECK)
+ #undef JSON_HEDLEY_IBM_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_IBM_VERSION)
+ #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_TI_VERSION)
+ #undef JSON_HEDLEY_TI_VERSION
+#endif
+#if \
+ defined(__TI_COMPILER_VERSION__) && \
+ ( \
+ defined(__TMS470__) || defined(__TI_ARM__) || \
+ defined(__MSP430__) || \
+ defined(__TMS320C2000__) \
+ )
+#if (__TI_COMPILER_VERSION__ >= 16000000)
+ #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
+#endif
+#endif
+
+#if defined(JSON_HEDLEY_TI_VERSION_CHECK)
+ #undef JSON_HEDLEY_TI_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_TI_VERSION)
+ #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_TI_CL2000_VERSION)
+ #undef JSON_HEDLEY_TI_CL2000_VERSION
+#endif
+#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__)
+ #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
+#endif
+
+#if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK)
+ #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_TI_CL2000_VERSION)
+ #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_TI_CL430_VERSION)
+ #undef JSON_HEDLEY_TI_CL430_VERSION
+#endif
+#if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__)
+ #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
+#endif
+
+#if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK)
+ #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_TI_CL430_VERSION)
+ #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_TI_ARMCL_VERSION)
+ #undef JSON_HEDLEY_TI_ARMCL_VERSION
+#endif
+#if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__))
+ #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
+#endif
+
+#if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK)
+ #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_TI_ARMCL_VERSION)
+ #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_TI_CL6X_VERSION)
+ #undef JSON_HEDLEY_TI_CL6X_VERSION
+#endif
+#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__)
+ #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
+#endif
+
+#if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK)
+ #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_TI_CL6X_VERSION)
+ #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_TI_CL7X_VERSION)
+ #undef JSON_HEDLEY_TI_CL7X_VERSION
+#endif
+#if defined(__TI_COMPILER_VERSION__) && defined(__C7000__)
+ #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
+#endif
+
+#if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK)
+ #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_TI_CL7X_VERSION)
+ #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_TI_CLPRU_VERSION)
+ #undef JSON_HEDLEY_TI_CLPRU_VERSION
+#endif
+#if defined(__TI_COMPILER_VERSION__) && defined(__PRU__)
+ #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000))
+#endif
+
+#if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK)
+ #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_TI_CLPRU_VERSION)
+ #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_CRAY_VERSION)
+ #undef JSON_HEDLEY_CRAY_VERSION
+#endif
+#if defined(_CRAYC)
+ #if defined(_RELEASE_PATCHLEVEL)
+ #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL)
+ #else
+ #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0)
+ #endif
+#endif
+
+#if defined(JSON_HEDLEY_CRAY_VERSION_CHECK)
+ #undef JSON_HEDLEY_CRAY_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_CRAY_VERSION)
+ #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_IAR_VERSION)
+ #undef JSON_HEDLEY_IAR_VERSION
+#endif
+#if defined(__IAR_SYSTEMS_ICC__)
+ #if __VER__ > 1000
+ #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000))
+ #else
+ #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(VER / 100, __VER__ % 100, 0)
+ #endif
+#endif
+
+#if defined(JSON_HEDLEY_IAR_VERSION_CHECK)
+ #undef JSON_HEDLEY_IAR_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_IAR_VERSION)
+ #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_TINYC_VERSION)
+ #undef JSON_HEDLEY_TINYC_VERSION
+#endif
+#if defined(__TINYC__)
+ #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100)
+#endif
+
+#if defined(JSON_HEDLEY_TINYC_VERSION_CHECK)
+ #undef JSON_HEDLEY_TINYC_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_TINYC_VERSION)
+ #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_DMC_VERSION)
+ #undef JSON_HEDLEY_DMC_VERSION
+#endif
+#if defined(__DMC__)
+ #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf)
+#endif
+
+#if defined(JSON_HEDLEY_DMC_VERSION_CHECK)
+ #undef JSON_HEDLEY_DMC_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_DMC_VERSION)
+ #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_COMPCERT_VERSION)
+ #undef JSON_HEDLEY_COMPCERT_VERSION
+#endif
+#if defined(__COMPCERT_VERSION__)
+ #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100)
+#endif
+
+#if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK)
+ #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_COMPCERT_VERSION)
+ #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_PELLES_VERSION)
+ #undef JSON_HEDLEY_PELLES_VERSION
+#endif
+#if defined(__POCC__)
+ #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0)
+#endif
+
+#if defined(JSON_HEDLEY_PELLES_VERSION_CHECK)
+ #undef JSON_HEDLEY_PELLES_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_PELLES_VERSION)
+ #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_GCC_VERSION)
+ #undef JSON_HEDLEY_GCC_VERSION
+#endif
+#if \
+ defined(JSON_HEDLEY_GNUC_VERSION) && \
+ !defined(__clang__) && \
+ !defined(JSON_HEDLEY_INTEL_VERSION) && \
+ !defined(JSON_HEDLEY_PGI_VERSION) && \
+ !defined(JSON_HEDLEY_ARM_VERSION) && \
+ !defined(JSON_HEDLEY_TI_VERSION) && \
+ !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \
+ !defined(JSON_HEDLEY_TI_CL430_VERSION) && \
+ !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \
+ !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \
+ !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \
+ !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \
+ !defined(__COMPCERT__)
+ #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION
+#endif
+
+#if defined(JSON_HEDLEY_GCC_VERSION_CHECK)
+ #undef JSON_HEDLEY_GCC_VERSION_CHECK
+#endif
+#if defined(JSON_HEDLEY_GCC_VERSION)
+ #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch))
+#else
+ #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0)
+#endif
+
+#if defined(JSON_HEDLEY_HAS_ATTRIBUTE)
+ #undef JSON_HEDLEY_HAS_ATTRIBUTE
+#endif
+#if defined(__has_attribute)
+ #define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute)
+#else
+ #define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0)
+#endif
+
+#if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE)
+ #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE
+#endif
+#if defined(__has_attribute)
+ #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) __has_attribute(attribute)
+#else
+ #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
+#endif
+
+#if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE)
+ #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE
+#endif
+#if defined(__has_attribute)
+ #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) __has_attribute(attribute)
+#else
+ #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
+#endif
+
+#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE)
+ #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE
+#endif
+#if \
+ defined(__has_cpp_attribute) && \
+ defined(__cplusplus) && \
+ (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0))
+ #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute)
+#else
+ #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0)
+#endif
+
+#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS)
+ #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS
+#endif
+#if !defined(__cplusplus) || !defined(__has_cpp_attribute)
+ #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0)
+#elif \
+ !defined(JSON_HEDLEY_PGI_VERSION) && \
+ !defined(JSON_HEDLEY_IAR_VERSION) && \
+ (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \
+ (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0))
+ #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute)
+#else
+ #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0)
+#endif
+
+#if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE)
+ #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE
+#endif
+#if defined(__has_cpp_attribute) && defined(__cplusplus)
+ #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute)
+#else
+ #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
+#endif
+
+#if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE)
+ #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE
+#endif
+#if defined(__has_cpp_attribute) && defined(__cplusplus)
+ #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute)
+#else
+ #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
+#endif
+
+#if defined(JSON_HEDLEY_HAS_BUILTIN)
+ #undef JSON_HEDLEY_HAS_BUILTIN
+#endif
+#if defined(__has_builtin)
+ #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin)
+#else
+ #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0)
+#endif
+
+#if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN)
+ #undef JSON_HEDLEY_GNUC_HAS_BUILTIN
+#endif
+#if defined(__has_builtin)
+ #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin)
+#else
+ #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
+#endif
+
+#if defined(JSON_HEDLEY_GCC_HAS_BUILTIN)
+ #undef JSON_HEDLEY_GCC_HAS_BUILTIN
+#endif
+#if defined(__has_builtin)
+ #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin)
+#else
+ #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
+#endif
+
+#if defined(JSON_HEDLEY_HAS_FEATURE)
+ #undef JSON_HEDLEY_HAS_FEATURE
+#endif
+#if defined(__has_feature)
+ #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature)
+#else
+ #define JSON_HEDLEY_HAS_FEATURE(feature) (0)
+#endif
+
+#if defined(JSON_HEDLEY_GNUC_HAS_FEATURE)
+ #undef JSON_HEDLEY_GNUC_HAS_FEATURE
+#endif
+#if defined(__has_feature)
+ #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature)
+#else
+ #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
+#endif
+
+#if defined(JSON_HEDLEY_GCC_HAS_FEATURE)
+ #undef JSON_HEDLEY_GCC_HAS_FEATURE
+#endif
+#if defined(__has_feature)
+ #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature)
+#else
+ #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
+#endif
+
+#if defined(JSON_HEDLEY_HAS_EXTENSION)
+ #undef JSON_HEDLEY_HAS_EXTENSION
+#endif
+#if defined(__has_extension)
+ #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension)
+#else
+ #define JSON_HEDLEY_HAS_EXTENSION(extension) (0)
+#endif
+
+#if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION)
+ #undef JSON_HEDLEY_GNUC_HAS_EXTENSION
+#endif
+#if defined(__has_extension)
+ #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension)
+#else
+ #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
+#endif
+
+#if defined(JSON_HEDLEY_GCC_HAS_EXTENSION)
+ #undef JSON_HEDLEY_GCC_HAS_EXTENSION
+#endif
+#if defined(__has_extension)
+ #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension)
+#else
+ #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
+#endif
+
+#if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE)
+ #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE
+#endif
+#if defined(__has_declspec_attribute)
+ #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute)
+#else
+ #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0)
+#endif
+
+#if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE)
+ #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE
+#endif
+#if defined(__has_declspec_attribute)
+ #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute)
+#else
+ #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
+#endif
+
+#if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE)
+ #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE
+#endif
+#if defined(__has_declspec_attribute)
+ #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute)
+#else
+ #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
+#endif
+
+#if defined(JSON_HEDLEY_HAS_WARNING)
+ #undef JSON_HEDLEY_HAS_WARNING
+#endif
+#if defined(__has_warning)
+ #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning)
+#else
+ #define JSON_HEDLEY_HAS_WARNING(warning) (0)
+#endif
+
+#if defined(JSON_HEDLEY_GNUC_HAS_WARNING)
+ #undef JSON_HEDLEY_GNUC_HAS_WARNING
+#endif
+#if defined(__has_warning)
+ #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning)
+#else
+ #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch)
+#endif
+
+#if defined(JSON_HEDLEY_GCC_HAS_WARNING)
+ #undef JSON_HEDLEY_GCC_HAS_WARNING
+#endif
+#if defined(__has_warning)
+ #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning)
+#else
+ #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
+#endif
+
+/* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for
+ HEDLEY INTERNAL USE ONLY. API subject to change without notice. */
+#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_)
+ #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_
+#endif
+#if defined(__cplusplus)
+# if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat")
+# if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions")
+# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
+ JSON_HEDLEY_DIAGNOSTIC_PUSH \
+ _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
+ _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \
+ xpr \
+ JSON_HEDLEY_DIAGNOSTIC_POP
+# else
+# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \
+ JSON_HEDLEY_DIAGNOSTIC_PUSH \
+ _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \
+ xpr \
+ JSON_HEDLEY_DIAGNOSTIC_POP
+# endif
+# endif
+#endif
+#if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x
+#endif
+
+#if defined(JSON_HEDLEY_CONST_CAST)
+ #undef JSON_HEDLEY_CONST_CAST
+#endif
+#if defined(__cplusplus)
+# define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast<T>(expr))
+#elif \
+ JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
+# define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \
+ JSON_HEDLEY_DIAGNOSTIC_PUSH \
+ JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \
+ ((T) (expr)); \
+ JSON_HEDLEY_DIAGNOSTIC_POP \
+ }))
+#else
+# define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr))
+#endif
+
+#if defined(JSON_HEDLEY_REINTERPRET_CAST)
+ #undef JSON_HEDLEY_REINTERPRET_CAST
+#endif
+#if defined(__cplusplus)
+ #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast<T>(expr))
+#else
+ #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr))
+#endif
+
+#if defined(JSON_HEDLEY_STATIC_CAST)
+ #undef JSON_HEDLEY_STATIC_CAST
+#endif
+#if defined(__cplusplus)
+ #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast<T>(expr))
+#else
+ #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr))
+#endif
+
+#if defined(JSON_HEDLEY_CPP_CAST)
+ #undef JSON_HEDLEY_CPP_CAST
+#endif
+#if defined(__cplusplus)
+# if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast")
+# define JSON_HEDLEY_CPP_CAST(T, expr) \
+ JSON_HEDLEY_DIAGNOSTIC_PUSH \
+ _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \
+ ((T) (expr)) \
+ JSON_HEDLEY_DIAGNOSTIC_POP
+# elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0)
+# define JSON_HEDLEY_CPP_CAST(T, expr) \
+ JSON_HEDLEY_DIAGNOSTIC_PUSH \
+ _Pragma("diag_suppress=Pe137") \
+ JSON_HEDLEY_DIAGNOSTIC_POP \
+# else
+# define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr))
+# endif
+#else
+# define JSON_HEDLEY_CPP_CAST(T, expr) (expr)
+#endif
+
+#if \
+ (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
+ defined(__clang__) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \
+ JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
+ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
+ JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \
+ JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \
+ JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \
+ (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR))
+ #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value)
+#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
+ #define JSON_HEDLEY_PRAGMA(value) __pragma(value)
+#else
+ #define JSON_HEDLEY_PRAGMA(value)
+#endif
+
+#if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH)
+ #undef JSON_HEDLEY_DIAGNOSTIC_PUSH
+#endif
+#if defined(JSON_HEDLEY_DIAGNOSTIC_POP)
+ #undef JSON_HEDLEY_DIAGNOSTIC_POP
+#endif
+#if defined(__clang__)
+ #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push")
+ #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop")
+#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
+ #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
+#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push")
+ #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop")
+#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push))
+ #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop))
+#elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push")
+ #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop")
+#elif \
+ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push")
+ #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop")
+#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)")
+ #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)")
+#else
+ #define JSON_HEDLEY_DIAGNOSTIC_PUSH
+ #define JSON_HEDLEY_DIAGNOSTIC_POP
+#endif
+
+#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED)
+ #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
+#endif
+#if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations")
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
+#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)")
+#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444")
+#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996))
+#elif \
+ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
+ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
+ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
+ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
+ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718")
+#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)")
+#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)")
+#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215")
+#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)")
+#else
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
+#endif
+
+#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS)
+ #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
+#endif
+#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas")
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"")
+#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)")
+#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675")
+#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"")
+#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068))
+#elif \
+ JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163")
+#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163")
+#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161")
+#else
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
+#endif
+
+#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES)
+ #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES
+#endif
+#if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes")
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"")
+#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+#elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)")
+#elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030))
+#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097")
+#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)")
+#elif \
+ JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173")
+#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097")
+#else
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES
+#endif
+
+#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL)
+ #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
+#endif
+#if JSON_HEDLEY_HAS_WARNING("-Wcast-qual")
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"")
+#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)")
+#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0)
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"")
+#else
+ #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
+#endif
+
+#if defined(JSON_HEDLEY_DEPRECATED)
+ #undef JSON_HEDLEY_DEPRECATED
+#endif
+#if defined(JSON_HEDLEY_DEPRECATED_FOR)
+ #undef JSON_HEDLEY_DEPRECATED_FOR
+#endif
+#if JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0)
+ #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since))
+ #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement))
+#elif defined(__cplusplus) && (__cplusplus >= 201402L)
+ #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]])
+ #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]])
+#elif \
+ JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \
+ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \
+ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
+ JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0)
+ #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since)))
+ #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement)))
+#elif \
+ JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
+ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
+ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
+ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
+ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
+ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
+ #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__))
+ #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__))
+#elif \
+ JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
+ JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0)
+ #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated)
+ #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated)
+#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
+ #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated")
+ #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated")
+#else
+ #define JSON_HEDLEY_DEPRECATED(since)
+ #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement)
+#endif
+
+#if defined(JSON_HEDLEY_UNAVAILABLE)
+ #undef JSON_HEDLEY_UNAVAILABLE
+#endif
+#if \
+ JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
+ #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since)))
+#else
+ #define JSON_HEDLEY_UNAVAILABLE(available_since)
+#endif
+
+#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT)
+ #undef JSON_HEDLEY_WARN_UNUSED_RESULT
+#endif
+#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG)
+ #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG
+#endif
+#if (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L)
+ #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
+ #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]])
+#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard)
+ #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
+ #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]])
+#elif \
+ JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
+ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
+ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
+ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
+ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
+ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \
+ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
+ #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
+ #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__))
+#elif defined(_Check_return_) /* SAL */
+ #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_
+ #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_
+#else
+ #define JSON_HEDLEY_WARN_UNUSED_RESULT
+ #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg)
+#endif
+
+#if defined(JSON_HEDLEY_SENTINEL)
+ #undef JSON_HEDLEY_SENTINEL
+#endif
+#if \
+ JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0)
+ #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position)))
+#else
+ #define JSON_HEDLEY_SENTINEL(position)
+#endif
+
+#if defined(JSON_HEDLEY_NO_RETURN)
+ #undef JSON_HEDLEY_NO_RETURN
+#endif
+#if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
+ #define JSON_HEDLEY_NO_RETURN __noreturn
+#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
+ #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__))
+#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
+ #define JSON_HEDLEY_NO_RETURN _Noreturn
+#elif defined(__cplusplus) && (__cplusplus >= 201103L)
+ #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]])
+#elif \
+ JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \
+ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
+ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
+ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
+ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
+ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
+ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
+ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
+ #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__))
+#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
+ #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return")
+#elif JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0)
+ #define JSON_HEDLEY_NO_RETURN __declspec(noreturn)
+#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus)
+ #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;")
+#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0)
+ #define JSON_HEDLEY_NO_RETURN __attribute((noreturn))
+#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0)
+ #define JSON_HEDLEY_NO_RETURN __declspec(noreturn)
+#else
+ #define JSON_HEDLEY_NO_RETURN
+#endif
+
+#if defined(JSON_HEDLEY_NO_ESCAPE)
+ #undef JSON_HEDLEY_NO_ESCAPE
+#endif
+#if JSON_HEDLEY_HAS_ATTRIBUTE(noescape)
+ #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__))
+#else
+ #define JSON_HEDLEY_NO_ESCAPE
+#endif
+
+#if defined(JSON_HEDLEY_UNREACHABLE)
+ #undef JSON_HEDLEY_UNREACHABLE
+#endif
+#if defined(JSON_HEDLEY_UNREACHABLE_RETURN)
+ #undef JSON_HEDLEY_UNREACHABLE_RETURN
+#endif
+#if defined(JSON_HEDLEY_ASSUME)
+ #undef JSON_HEDLEY_ASSUME
+#endif
+#if \
+ JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
+ #define JSON_HEDLEY_ASSUME(expr) __assume(expr)
+#elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume)
+ #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr)
+#elif \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0)
+ #if defined(__cplusplus)
+ #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr)
+ #else
+ #define JSON_HEDLEY_ASSUME(expr) _nassert(expr)
+ #endif
+#endif
+#if \
+ (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \
+ JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5)
+ #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable()
+#elif defined(JSON_HEDLEY_ASSUME)
+ #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0)
+#endif
+#if !defined(JSON_HEDLEY_ASSUME)
+ #if defined(JSON_HEDLEY_UNREACHABLE)
+ #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1)))
+ #else
+ #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr)
+ #endif
+#endif
+#if defined(JSON_HEDLEY_UNREACHABLE)
+ #if \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0)
+ #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value))
+ #else
+ #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE()
+ #endif
+#else
+ #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value)
+#endif
+#if !defined(JSON_HEDLEY_UNREACHABLE)
+ #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0)
+#endif
+
+JSON_HEDLEY_DIAGNOSTIC_PUSH
+#if JSON_HEDLEY_HAS_WARNING("-Wpedantic")
+ #pragma clang diagnostic ignored "-Wpedantic"
+#endif
+#if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus)
+ #pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
+#endif
+#if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0)
+ #if defined(__clang__)
+ #pragma clang diagnostic ignored "-Wvariadic-macros"
+ #elif defined(JSON_HEDLEY_GCC_VERSION)
+ #pragma GCC diagnostic ignored "-Wvariadic-macros"
+ #endif
+#endif
+#if defined(JSON_HEDLEY_NON_NULL)
+ #undef JSON_HEDLEY_NON_NULL
+#endif
+#if \
+ JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0)
+ #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
+#else
+ #define JSON_HEDLEY_NON_NULL(...)
+#endif
+JSON_HEDLEY_DIAGNOSTIC_POP
+
+#if defined(JSON_HEDLEY_PRINTF_FORMAT)
+ #undef JSON_HEDLEY_PRINTF_FORMAT
+#endif
+#if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO)
+ #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check)))
+#elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO)
+ #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check)))
+#elif \
+ JSON_HEDLEY_HAS_ATTRIBUTE(format) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \
+ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
+ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
+ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
+ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
+ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
+ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
+ #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check)))
+#elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0)
+ #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check))
+#else
+ #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check)
+#endif
+
+#if defined(JSON_HEDLEY_CONSTEXPR)
+ #undef JSON_HEDLEY_CONSTEXPR
+#endif
+#if defined(__cplusplus)
+ #if __cplusplus >= 201103L
+ #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr)
+ #endif
+#endif
+#if !defined(JSON_HEDLEY_CONSTEXPR)
+ #define JSON_HEDLEY_CONSTEXPR
+#endif
+
+#if defined(JSON_HEDLEY_PREDICT)
+ #undef JSON_HEDLEY_PREDICT
+#endif
+#if defined(JSON_HEDLEY_LIKELY)
+ #undef JSON_HEDLEY_LIKELY
+#endif
+#if defined(JSON_HEDLEY_UNLIKELY)
+ #undef JSON_HEDLEY_UNLIKELY
+#endif
+#if defined(JSON_HEDLEY_UNPREDICTABLE)
+ #undef JSON_HEDLEY_UNPREDICTABLE
+#endif
+#if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable)
+ #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr))
+#endif
+#if \
+ JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0)
+# define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability))
+# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability))
+# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability))
+# define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 )
+# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 )
+#elif \
+ JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
+ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
+ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
+ JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \
+ JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0)
+# define JSON_HEDLEY_PREDICT(expr, expected, probability) \
+ (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)))
+# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \
+ (__extension__ ({ \
+ double hedley_probability_ = (probability); \
+ ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \
+ }))
+# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \
+ (__extension__ ({ \
+ double hedley_probability_ = (probability); \
+ ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \
+ }))
+# define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1)
+# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
+#else
+# define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))
+# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr))
+# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr))
+# define JSON_HEDLEY_LIKELY(expr) (!!(expr))
+# define JSON_HEDLEY_UNLIKELY(expr) (!!(expr))
+#endif
+#if !defined(JSON_HEDLEY_UNPREDICTABLE)
+ #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5)
+#endif
+
+#if defined(JSON_HEDLEY_MALLOC)
+ #undef JSON_HEDLEY_MALLOC
+#endif
+#if \
+ JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
+ JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \
+ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
+ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
+ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
+ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
+ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
+ #define JSON_HEDLEY_MALLOC __attribute__((__malloc__))
+#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
+ #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory")
+#elif JSON_HEDLEY_MSVC_VERSION_CHECK(14, 0, 0)
+ #define JSON_HEDLEY_MALLOC __declspec(restrict)
+#else
+ #define JSON_HEDLEY_MALLOC
+#endif
+
+#if defined(JSON_HEDLEY_PURE)
+ #undef JSON_HEDLEY_PURE
+#endif
+#if \
+ JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
+ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
+ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
+ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
+ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
+ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
+ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
+ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
+# define JSON_HEDLEY_PURE __attribute__((__pure__))
+#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
+# define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data")
+#elif defined(__cplusplus) && \
+ ( \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \
+ )
+# define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;")
+#else
+# define JSON_HEDLEY_PURE
+#endif
+
+#if defined(JSON_HEDLEY_CONST)
+ #undef JSON_HEDLEY_CONST
+#endif
+#if \
+ JSON_HEDLEY_HAS_ATTRIBUTE(const) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
+ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
+ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
+ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
+ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
+ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
+ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \
+ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0)
+ #define JSON_HEDLEY_CONST __attribute__((__const__))
+#elif \
+ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0)
+ #define JSON_HEDLEY_CONST _Pragma("no_side_effect")
+#else
+ #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE
+#endif
+
+#if defined(JSON_HEDLEY_RESTRICT)
+ #undef JSON_HEDLEY_RESTRICT
+#endif
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus)
+ #define JSON_HEDLEY_RESTRICT restrict
+#elif \
+ JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \
+ JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
+ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
+ JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \
+ JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \
+ defined(__clang__)
+ #define JSON_HEDLEY_RESTRICT __restrict
+#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus)
+ #define JSON_HEDLEY_RESTRICT _Restrict
+#else
+ #define JSON_HEDLEY_RESTRICT
+#endif
+
+#if defined(JSON_HEDLEY_INLINE)
+ #undef JSON_HEDLEY_INLINE
+#endif
+#if \
+ (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \
+ (defined(__cplusplus) && (__cplusplus >= 199711L))
+ #define JSON_HEDLEY_INLINE inline
+#elif \
+ defined(JSON_HEDLEY_GCC_VERSION) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0)
+ #define JSON_HEDLEY_INLINE __inline__
+#elif \
+ JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
+ #define JSON_HEDLEY_INLINE __inline
+#else
+ #define JSON_HEDLEY_INLINE
+#endif
+
+#if defined(JSON_HEDLEY_ALWAYS_INLINE)
+ #undef JSON_HEDLEY_ALWAYS_INLINE
+#endif
+#if \
+ JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
+ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
+ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
+ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
+ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
+ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
+ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
+# define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE
+#elif JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0)
+# define JSON_HEDLEY_ALWAYS_INLINE __forceinline
+#elif defined(__cplusplus) && \
+ ( \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \
+ )
+# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;")
+#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
+# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced")
+#else
+# define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE
+#endif
+
+#if defined(JSON_HEDLEY_NEVER_INLINE)
+ #undef JSON_HEDLEY_NEVER_INLINE
+#endif
+#if \
+ JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
+ JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \
+ JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \
+ (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \
+ (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \
+ (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \
+ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \
+ JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
+ JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0)
+ #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__))
+#elif JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0)
+ #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline)
+#elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0)
+ #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline")
+#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus)
+ #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;")
+#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
+ #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never")
+#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0)
+ #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline))
+#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0)
+ #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline)
+#else
+ #define JSON_HEDLEY_NEVER_INLINE
+#endif
+
+#if defined(JSON_HEDLEY_PRIVATE)
+ #undef JSON_HEDLEY_PRIVATE
+#endif
+#if defined(JSON_HEDLEY_PUBLIC)
+ #undef JSON_HEDLEY_PUBLIC
+#endif
+#if defined(JSON_HEDLEY_IMPORT)
+ #undef JSON_HEDLEY_IMPORT
+#endif
+#if defined(_WIN32) || defined(__CYGWIN__)
+# define JSON_HEDLEY_PRIVATE
+# define JSON_HEDLEY_PUBLIC __declspec(dllexport)
+# define JSON_HEDLEY_IMPORT __declspec(dllimport)
+#else
+# if \
+ JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
+ JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
+ JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \
+ ( \
+ defined(__TI_EABI__) && \
+ ( \
+ (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \
+ ) \
+ )
+# define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden")))
+# define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default")))
+# else
+# define JSON_HEDLEY_PRIVATE
+# define JSON_HEDLEY_PUBLIC
+# endif
+# define JSON_HEDLEY_IMPORT extern
+#endif
+
+#if defined(JSON_HEDLEY_NO_THROW)
+ #undef JSON_HEDLEY_NO_THROW
+#endif
+#if \
+ JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
+ #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__))
+#elif \
+ JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0)
+ #define JSON_HEDLEY_NO_THROW __declspec(nothrow)
+#else
+ #define JSON_HEDLEY_NO_THROW
+#endif
+
+#if defined(JSON_HEDLEY_FALL_THROUGH)
+ #undef JSON_HEDLEY_FALL_THROUGH
+#endif
+#if \
+ JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0)
+ #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__))
+#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough)
+ #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]])
+#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough)
+ #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]])
+#elif defined(__fallthrough) /* SAL */
+ #define JSON_HEDLEY_FALL_THROUGH __fallthrough
+#else
+ #define JSON_HEDLEY_FALL_THROUGH
+#endif
+
+#if defined(JSON_HEDLEY_RETURNS_NON_NULL)
+ #undef JSON_HEDLEY_RETURNS_NON_NULL
+#endif
+#if \
+ JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0)
+ #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__))
+#elif defined(_Ret_notnull_) /* SAL */
+ #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_
+#else
+ #define JSON_HEDLEY_RETURNS_NON_NULL
+#endif
+
+#if defined(JSON_HEDLEY_ARRAY_PARAM)
+ #undef JSON_HEDLEY_ARRAY_PARAM
+#endif
+#if \
+ defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \
+ !defined(__STDC_NO_VLA__) && \
+ !defined(__cplusplus) && \
+ !defined(JSON_HEDLEY_PGI_VERSION) && \
+ !defined(JSON_HEDLEY_TINYC_VERSION)
+ #define JSON_HEDLEY_ARRAY_PARAM(name) (name)
+#else
+ #define JSON_HEDLEY_ARRAY_PARAM(name)
+#endif
+
+#if defined(JSON_HEDLEY_IS_CONSTANT)
+ #undef JSON_HEDLEY_IS_CONSTANT
+#endif
+#if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR)
+ #undef JSON_HEDLEY_REQUIRE_CONSTEXPR
+#endif
+/* JSON_HEDLEY_IS_CONSTEXPR_ is for
+ HEDLEY INTERNAL USE ONLY. API subject to change without notice. */
+#if defined(JSON_HEDLEY_IS_CONSTEXPR_)
+ #undef JSON_HEDLEY_IS_CONSTEXPR_
+#endif
+#if \
+ JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
+ JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \
+ JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \
+ (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \
+ JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0)
+ #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr)
+#endif
+#if !defined(__cplusplus)
+# if \
+ JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \
+ JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \
+ JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24)
+#if defined(__INTPTR_TYPE__)
+ #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*)
+#else
+ #include <stdint.h>
+ #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*)
+#endif
+# elif \
+ ( \
+ defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \
+ !defined(JSON_HEDLEY_SUNPRO_VERSION) && \
+ !defined(JSON_HEDLEY_PGI_VERSION) && \
+ !defined(JSON_HEDLEY_IAR_VERSION)) || \
+ JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \
+ JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \
+ JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0)
+#if defined(__INTPTR_TYPE__)
+ #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0)
+#else
+ #include <stdint.h>
+ #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0)
+#endif
+# elif \
+ defined(JSON_HEDLEY_GCC_VERSION) || \
+ defined(JSON_HEDLEY_INTEL_VERSION) || \
+ defined(JSON_HEDLEY_TINYC_VERSION) || \
+ defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \
+ JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \
+ defined(JSON_HEDLEY_TI_CL2000_VERSION) || \
+ defined(JSON_HEDLEY_TI_CL6X_VERSION) || \
+ defined(JSON_HEDLEY_TI_CL7X_VERSION) || \
+ defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \
+ defined(__clang__)
+# define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \
+ sizeof(void) != \
+ sizeof(*( \
+ 1 ? \
+ ((void*) ((expr) * 0L) ) : \
+((struct { char v[sizeof(void) * 2]; } *) 1) \
+ ) \
+ ) \
+ )
+# endif
+#endif
+#if defined(JSON_HEDLEY_IS_CONSTEXPR_)
+ #if !defined(JSON_HEDLEY_IS_CONSTANT)
+ #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr)
+ #endif
+ #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1))
+#else
+ #if !defined(JSON_HEDLEY_IS_CONSTANT)
+ #define JSON_HEDLEY_IS_CONSTANT(expr) (0)
+ #endif
+ #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr)
+#endif
+
+#if defined(JSON_HEDLEY_BEGIN_C_DECLS)
+ #undef JSON_HEDLEY_BEGIN_C_DECLS
+#endif
+#if defined(JSON_HEDLEY_END_C_DECLS)
+ #undef JSON_HEDLEY_END_C_DECLS
+#endif
+#if defined(JSON_HEDLEY_C_DECL)
+ #undef JSON_HEDLEY_C_DECL
+#endif
+#if defined(__cplusplus)
+ #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" {
+ #define JSON_HEDLEY_END_C_DECLS }
+ #define JSON_HEDLEY_C_DECL extern "C"
+#else
+ #define JSON_HEDLEY_BEGIN_C_DECLS
+ #define JSON_HEDLEY_END_C_DECLS
+ #define JSON_HEDLEY_C_DECL
+#endif
+
+#if defined(JSON_HEDLEY_STATIC_ASSERT)
+ #undef JSON_HEDLEY_STATIC_ASSERT
+#endif
+#if \
+ !defined(__cplusplus) && ( \
+ (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \
+ JSON_HEDLEY_HAS_FEATURE(c_static_assert) || \
+ JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
+ defined(_Static_assert) \
+ )
+# define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message)
+#elif \
+ (defined(__cplusplus) && (__cplusplus >= 201103L)) || \
+ JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0)
+# define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message))
+#else
+# define JSON_HEDLEY_STATIC_ASSERT(expr, message)
+#endif
+
+#if defined(JSON_HEDLEY_NULL)
+ #undef JSON_HEDLEY_NULL
+#endif
+#if defined(__cplusplus)
+ #if __cplusplus >= 201103L
+ #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr)
+ #elif defined(NULL)
+ #define JSON_HEDLEY_NULL NULL
+ #else
+ #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0)
+ #endif
+#elif defined(NULL)
+ #define JSON_HEDLEY_NULL NULL
+#else
+ #define JSON_HEDLEY_NULL ((void*) 0)
+#endif
+
+#if defined(JSON_HEDLEY_MESSAGE)
+ #undef JSON_HEDLEY_MESSAGE
+#endif
+#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas")
+# define JSON_HEDLEY_MESSAGE(msg) \
+ JSON_HEDLEY_DIAGNOSTIC_PUSH \
+ JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
+ JSON_HEDLEY_PRAGMA(message msg) \
+ JSON_HEDLEY_DIAGNOSTIC_POP
+#elif \
+ JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
+# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg)
+#elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0)
+# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg)
+#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0)
+# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg))
+#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0)
+# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg))
+#else
+# define JSON_HEDLEY_MESSAGE(msg)
+#endif
+
+#if defined(JSON_HEDLEY_WARNING)
+ #undef JSON_HEDLEY_WARNING
+#endif
+#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas")
+# define JSON_HEDLEY_WARNING(msg) \
+ JSON_HEDLEY_DIAGNOSTIC_PUSH \
+ JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \
+ JSON_HEDLEY_PRAGMA(clang warning msg) \
+ JSON_HEDLEY_DIAGNOSTIC_POP
+#elif \
+ JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \
+ JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \
+ JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0)
+# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg)
+#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0)
+# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg))
+#else
+# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg)
+#endif
+
+#if defined(JSON_HEDLEY_REQUIRE)
+ #undef JSON_HEDLEY_REQUIRE
+#endif
+#if defined(JSON_HEDLEY_REQUIRE_MSG)
+ #undef JSON_HEDLEY_REQUIRE_MSG
+#endif
+#if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if)
+# if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat")
+# define JSON_HEDLEY_REQUIRE(expr) \
+ JSON_HEDLEY_DIAGNOSTIC_PUSH \
+ _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \
+ __attribute__((diagnose_if(!(expr), #expr, "error"))) \
+ JSON_HEDLEY_DIAGNOSTIC_POP
+# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \
+ JSON_HEDLEY_DIAGNOSTIC_PUSH \
+ _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \
+ __attribute__((diagnose_if(!(expr), msg, "error"))) \
+ JSON_HEDLEY_DIAGNOSTIC_POP
+# else
+# define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error")))
+# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error")))
+# endif
+#else
+# define JSON_HEDLEY_REQUIRE(expr)
+# define JSON_HEDLEY_REQUIRE_MSG(expr,msg)
+#endif
+
+#if defined(JSON_HEDLEY_FLAGS)
+ #undef JSON_HEDLEY_FLAGS
+#endif
+#if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum)
+ #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__))
+#endif
+
+#if defined(JSON_HEDLEY_FLAGS_CAST)
+ #undef JSON_HEDLEY_FLAGS_CAST
+#endif
+#if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0)
+# define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \
+ JSON_HEDLEY_DIAGNOSTIC_PUSH \
+ _Pragma("warning(disable:188)") \
+ ((T) (expr)); \
+ JSON_HEDLEY_DIAGNOSTIC_POP \
+ }))
+#else
+# define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr)
+#endif
+
+#if defined(JSON_HEDLEY_EMPTY_BASES)
+ #undef JSON_HEDLEY_EMPTY_BASES
+#endif
+#if JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)
+ #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases)
+#else
+ #define JSON_HEDLEY_EMPTY_BASES
+#endif
+
+/* Remaining macros are deprecated. */
+
+#if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK)
+ #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK
+#endif
+#if defined(__clang__)
+ #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0)
+#else
+ #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch)
+#endif
+
+#if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE)
+ #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE
+#endif
+#define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute)
+
+#if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE)
+ #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE
+#endif
+#define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute)
+
+#if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN)
+ #undef JSON_HEDLEY_CLANG_HAS_BUILTIN
+#endif
+#define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin)
+
+#if defined(JSON_HEDLEY_CLANG_HAS_FEATURE)
+ #undef JSON_HEDLEY_CLANG_HAS_FEATURE
+#endif
+#define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature)
+
+#if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION)
+ #undef JSON_HEDLEY_CLANG_HAS_EXTENSION
+#endif
+#define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension)
+
+#if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE)
+ #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE
+#endif
+#define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute)
+
+#if defined(JSON_HEDLEY_CLANG_HAS_WARNING)
+ #undef JSON_HEDLEY_CLANG_HAS_WARNING
+#endif
+#define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning)
+
+#endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */
+
+
+// This file contains all internal macro definitions
+// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them
+
+// exclude unsupported compilers
+#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK)
+ #if defined(__clang__)
+ #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400
+ #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers"
+ #endif
+ #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER))
+ #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800
+ #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers"
+ #endif
+ #endif
+#endif
+
+// C++ language standard detection
+#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464
+ #define JSON_HAS_CPP_17
+ #define JSON_HAS_CPP_14
+#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)
+ #define JSON_HAS_CPP_14
+#endif
+
+// disable float-equal warnings on GCC/clang
+#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wfloat-equal"
+#endif
+
+// disable documentation warnings on clang
+#if defined(__clang__)
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wdocumentation"
+#endif
+
+// allow to disable exceptions
+#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION)
+ #define JSON_THROW(exception) throw exception
+ #define JSON_TRY try
+ #define JSON_CATCH(exception) catch(exception)
+ #define JSON_INTERNAL_CATCH(exception) catch(exception)
+#else
+ #include <cstdlib>
+ #define JSON_THROW(exception) std::abort()
+ #define JSON_TRY if(true)
+ #define JSON_CATCH(exception) if(false)
+ #define JSON_INTERNAL_CATCH(exception) if(false)
+#endif
+
+// override exception macros
+#if defined(JSON_THROW_USER)
+ #undef JSON_THROW
+ #define JSON_THROW JSON_THROW_USER
+#endif
+#if defined(JSON_TRY_USER)
+ #undef JSON_TRY
+ #define JSON_TRY JSON_TRY_USER
+#endif
+#if defined(JSON_CATCH_USER)
+ #undef JSON_CATCH
+ #define JSON_CATCH JSON_CATCH_USER
+ #undef JSON_INTERNAL_CATCH
+ #define JSON_INTERNAL_CATCH JSON_CATCH_USER
+#endif
+#if defined(JSON_INTERNAL_CATCH_USER)
+ #undef JSON_INTERNAL_CATCH
+ #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER
+#endif
+
+/*!
+@brief macro to briefly define a mapping between an enum and JSON
+@def NLOHMANN_JSON_SERIALIZE_ENUM
+@since version 3.4.0
+*/
+#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \
+ template<typename BasicJsonType> \
+ inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \
+ { \
+ static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \
+ static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \
+ auto it = std::find_if(std::begin(m), std::end(m), \
+ [e](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \
+ { \
+ return ej_pair.first == e; \
+ }); \
+ j = ((it != std::end(m)) ? it : std::begin(m))->second; \
+ } \
+ template<typename BasicJsonType> \
+ inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \
+ { \
+ static_assert(std::is_enum<ENUM_TYPE>::value, #ENUM_TYPE " must be an enum!"); \
+ static const std::pair<ENUM_TYPE, BasicJsonType> m[] = __VA_ARGS__; \
+ auto it = std::find_if(std::begin(m), std::end(m), \
+ [&j](const std::pair<ENUM_TYPE, BasicJsonType>& ej_pair) -> bool \
+ { \
+ return ej_pair.second == j; \
+ }); \
+ e = ((it != std::end(m)) ? it : std::begin(m))->first; \
+ }
+
+// Ugly macros to avoid uglier copy-paste when specializing basic_json. They
+// may be removed in the future once the class is split.
+
+#define NLOHMANN_BASIC_JSON_TPL_DECLARATION \
+ template<template<typename, typename, typename...> class ObjectType, \
+ template<typename, typename...> class ArrayType, \
+ class StringType, class BooleanType, class NumberIntegerType, \
+ class NumberUnsignedType, class NumberFloatType, \
+ template<typename> class AllocatorType, \
+ template<typename, typename = void> class JSONSerializer, \
+ class BinaryType>
+
+#define NLOHMANN_BASIC_JSON_TPL \
+ basic_json<ObjectType, ArrayType, StringType, BooleanType, \
+ NumberIntegerType, NumberUnsignedType, NumberFloatType, \
+ AllocatorType, JSONSerializer, BinaryType>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+////////////////
+// exceptions //
+////////////////
+
+/*!
+@brief general exception of the @ref basic_json class
+
+This class is an extension of `std::exception` objects with a member @a id for
+exception ids. It is used as the base class for all exceptions thrown by the
+@ref basic_json class. This class can hence be used as "wildcard" to catch
+exceptions.
+
+Subclasses:
+- @ref parse_error for exceptions indicating a parse error
+- @ref invalid_iterator for exceptions indicating errors with iterators
+- @ref type_error for exceptions indicating executing a member function with
+ a wrong type
+- @ref out_of_range for exceptions indicating access out of the defined range
+- @ref other_error for exceptions indicating other library errors
+
+@internal
+@note To have nothrow-copy-constructible exceptions, we internally use
+ `std::runtime_error` which can cope with arbitrary-length error messages.
+ Intermediate strings are built with static functions and then passed to
+ the actual constructor.
+@endinternal
+
+@liveexample{The following code shows how arbitrary library exceptions can be
+caught.,exception}
+
+@since version 3.0.0
+*/
+class exception : public std::exception
+{
+ public:
+ /// returns the explanatory string
+ JSON_HEDLEY_RETURNS_NON_NULL
+ const char* what() const noexcept override
+ {
+ return m.what();
+ }
+
+ /// the id of the exception
+ const int id;
+
+ protected:
+ JSON_HEDLEY_NON_NULL(3)
+ exception(int id_, const char* what_arg) : id(id_), m(what_arg) {}
+
+ static std::string name(const std::string& ename, int id_)
+ {
+ return "[json.exception." + ename + "." + std::to_string(id_) + "] ";
+ }
+
+ private:
+ /// an exception object as storage for error messages
+ std::runtime_error m;
+};
+
+/*!
+@brief exception indicating a parse error
+
+This exception is thrown by the library when a parse error occurs. Parse errors
+can occur during the deserialization of JSON text, CBOR, MessagePack, as well
+as when using JSON Patch.
+
+Member @a byte holds the byte index of the last read character in the input
+file.
+
+Exceptions have ids 1xx.
+
+name / id | example message | description
+------------------------------ | --------------- | -------------------------
+json.exception.parse_error.101 | parse error at 2: unexpected end of input; expected string literal | This error indicates a syntax error while deserializing a JSON text. The error message describes that an unexpected token (character) was encountered, and the member @a byte indicates the error position.
+json.exception.parse_error.102 | parse error at 14: missing or wrong low surrogate | JSON uses the `\uxxxx` format to describe Unicode characters. Code points above above 0xFFFF are split into two `\uxxxx` entries ("surrogate pairs"). This error indicates that the surrogate pair is incomplete or contains an invalid code point.
+json.exception.parse_error.103 | parse error: code points above 0x10FFFF are invalid | Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid.
+json.exception.parse_error.104 | parse error: JSON patch must be an array of objects | [RFC 6902](https://tools.ietf.org/html/rfc6902) requires a JSON Patch document to be a JSON document that represents an array of objects.
+json.exception.parse_error.105 | parse error: operation must have string member 'op' | An operation of a JSON Patch document must contain exactly one "op" member, whose value indicates the operation to perform. Its value must be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors.
+json.exception.parse_error.106 | parse error: array index '01' must not begin with '0' | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number without a leading `0`.
+json.exception.parse_error.107 | parse error: JSON pointer must be empty or begin with '/' - was: 'foo' | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character.
+json.exception.parse_error.108 | parse error: escape character '~' must be followed with '0' or '1' | In a JSON Pointer, only `~0` and `~1` are valid escape sequences.
+json.exception.parse_error.109 | parse error: array index 'one' is not a number | A JSON Pointer array index must be a number.
+json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read.
+json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read.
+json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read.
+json.exception.parse_error.114 | parse error: Unsupported BSON record type 0x0F | The parsing of the corresponding BSON record type is not implemented (yet).
+
+@note For an input with n bytes, 1 is the index of the first character and n+1
+ is the index of the terminating null byte or the end of file. This also
+ holds true when reading a byte vector (CBOR or MessagePack).
+
+@liveexample{The following code shows how a `parse_error` exception can be
+caught.,parse_error}
+
+@sa - @ref exception for the base class of the library exceptions
+@sa - @ref invalid_iterator for exceptions indicating errors with iterators
+@sa - @ref type_error for exceptions indicating executing a member function with
+ a wrong type
+@sa - @ref out_of_range for exceptions indicating access out of the defined range
+@sa - @ref other_error for exceptions indicating other library errors
+
+@since version 3.0.0
+*/
+class parse_error : public exception
+{
+ public:
+ /*!
+ @brief create a parse error exception
+ @param[in] id_ the id of the exception
+ @param[in] pos the position where the error occurred (or with
+ chars_read_total=0 if the position cannot be
+ determined)
+ @param[in] what_arg the explanatory string
+ @return parse_error object
+ */
+ static parse_error create(int id_, const position_t& pos, const std::string& what_arg)
+ {
+ std::string w = exception::name("parse_error", id_) + "parse error" +
+ position_string(pos) + ": " + what_arg;
+ return parse_error(id_, pos.chars_read_total, w.c_str());
+ }
+
+ static parse_error create(int id_, std::size_t byte_, const std::string& what_arg)
+ {
+ std::string w = exception::name("parse_error", id_) + "parse error" +
+ (byte_ != 0 ? (" at byte " + std::to_string(byte_)) : "") +
+ ": " + what_arg;
+ return parse_error(id_, byte_, w.c_str());
+ }
+
+ /*!
+ @brief byte index of the parse error
+
+ The byte index of the last read character in the input file.
+
+ @note For an input with n bytes, 1 is the index of the first character and
+ n+1 is the index of the terminating null byte or the end of file.
+ This also holds true when reading a byte vector (CBOR or MessagePack).
+ */
+ const std::size_t byte;
+
+ private:
+ parse_error(int id_, std::size_t byte_, const char* what_arg)
+ : exception(id_, what_arg), byte(byte_) {}
+
+ static std::string position_string(const position_t& pos)
+ {
+ return " at line " + std::to_string(pos.lines_read + 1) +
+ ", column " + std::to_string(pos.chars_read_current_line);
+ }
+};
+
+/*!
+@brief exception indicating errors with iterators
+
+This exception is thrown if iterators passed to a library function do not match
+the expected semantics.
+
+Exceptions have ids 2xx.
+
+name / id | example message | description
+----------------------------------- | --------------- | -------------------------
+json.exception.invalid_iterator.201 | iterators are not compatible | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid.
+json.exception.invalid_iterator.202 | iterator does not fit current value | In an erase or insert function, the passed iterator @a pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion.
+json.exception.invalid_iterator.203 | iterators do not fit current value | Either iterator passed to function @ref erase(IteratorType first, IteratorType last) does not belong to the JSON value from which values shall be erased. It hence does not define a valid range to delete values from.
+json.exception.invalid_iterator.204 | iterators out of range | When an iterator range for a primitive type (number, boolean, or string) is passed to a constructor or an erase function, this range has to be exactly (@ref begin(), @ref end()), because this is the only way the single stored value is expressed. All other ranges are invalid.
+json.exception.invalid_iterator.205 | iterator out of range | When an iterator for a primitive type (number, boolean, or string) is passed to an erase function, the iterator has to be the @ref begin() iterator, because it is the only way to address the stored value. All other iterators are invalid.
+json.exception.invalid_iterator.206 | cannot construct with iterators from null | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) belong to a JSON null value and hence to not define a valid range.
+json.exception.invalid_iterator.207 | cannot use key() for non-object iterators | The key() member function can only be used on iterators belonging to a JSON object, because other types do not have a concept of a key.
+json.exception.invalid_iterator.208 | cannot use operator[] for object iterators | The operator[] to specify a concrete offset cannot be used on iterators belonging to a JSON object, because JSON objects are unordered.
+json.exception.invalid_iterator.209 | cannot use offsets with object iterators | The offset operators (+, -, +=, -=) cannot be used on iterators belonging to a JSON object, because JSON objects are unordered.
+json.exception.invalid_iterator.210 | iterators do not fit | The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid.
+json.exception.invalid_iterator.211 | passed iterators may not belong to container | The iterator range passed to the insert function must not be a subrange of the container to insert to.
+json.exception.invalid_iterator.212 | cannot compare iterators of different containers | When two iterators are compared, they must belong to the same container.
+json.exception.invalid_iterator.213 | cannot compare order of object iterators | The order of object iterators cannot be compared, because JSON objects are unordered.
+json.exception.invalid_iterator.214 | cannot get value | Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to @ref begin().
+
+@liveexample{The following code shows how an `invalid_iterator` exception can be
+caught.,invalid_iterator}
+
+@sa - @ref exception for the base class of the library exceptions
+@sa - @ref parse_error for exceptions indicating a parse error
+@sa - @ref type_error for exceptions indicating executing a member function with
+ a wrong type
+@sa - @ref out_of_range for exceptions indicating access out of the defined range
+@sa - @ref other_error for exceptions indicating other library errors
+
+@since version 3.0.0
+*/
+class invalid_iterator : public exception
+{
+ public:
+ static invalid_iterator create(int id_, const std::string& what_arg)
+ {
+ std::string w = exception::name("invalid_iterator", id_) + what_arg;
+ return invalid_iterator(id_, w.c_str());
+ }
+
+ private:
+ JSON_HEDLEY_NON_NULL(3)
+ invalid_iterator(int id_, const char* what_arg)
+ : exception(id_, what_arg) {}
+};
+
+/*!
+@brief exception indicating executing a member function with a wrong type
+
+This exception is thrown in case of a type error; that is, a library function is
+executed on a JSON value whose type does not match the expected semantics.
+
+Exceptions have ids 3xx.
+
+name / id | example message | description
+----------------------------- | --------------- | -------------------------
+json.exception.type_error.301 | cannot create object from initializer list | To create an object from an initializer list, the initializer list must consist only of a list of pairs whose first element is a string. When this constraint is violated, an array is created instead.
+json.exception.type_error.302 | type must be object, but is array | During implicit or explicit value conversion, the JSON type must be compatible to the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types.
+json.exception.type_error.303 | incompatible ReferenceType for get_ref, actual type is object | To retrieve a reference to a value stored in a @ref basic_json object with @ref get_ref, the type of the reference must match the value type. For instance, for a JSON array, the @a ReferenceType must be @ref array_t &.
+json.exception.type_error.304 | cannot use at() with string | The @ref at() member functions can only be executed for certain JSON types.
+json.exception.type_error.305 | cannot use operator[] with string | The @ref operator[] member functions can only be executed for certain JSON types.
+json.exception.type_error.306 | cannot use value() with string | The @ref value() member functions can only be executed for certain JSON types.
+json.exception.type_error.307 | cannot use erase() with string | The @ref erase() member functions can only be executed for certain JSON types.
+json.exception.type_error.308 | cannot use push_back() with string | The @ref push_back() and @ref operator+= member functions can only be executed for certain JSON types.
+json.exception.type_error.309 | cannot use insert() with | The @ref insert() member functions can only be executed for certain JSON types.
+json.exception.type_error.310 | cannot use swap() with number | The @ref swap() member functions can only be executed for certain JSON types.
+json.exception.type_error.311 | cannot use emplace_back() with string | The @ref emplace_back() member function can only be executed for certain JSON types.
+json.exception.type_error.312 | cannot use update() with string | The @ref update() member functions can only be executed for certain JSON types.
+json.exception.type_error.313 | invalid value to unflatten | The @ref unflatten function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well defined.
+json.exception.type_error.314 | only objects can be unflattened | The @ref unflatten function only works for an object whose keys are JSON Pointers.
+json.exception.type_error.315 | values in object must be primitive | The @ref unflatten function only works for an object whose keys are JSON Pointers and whose values are primitive.
+json.exception.type_error.316 | invalid UTF-8 byte at index 10: 0x7E | The @ref dump function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded. |
+json.exception.type_error.317 | JSON value cannot be serialized to requested format | The dynamic type of the object cannot be represented in the requested serialization format (e.g. a raw `true` or `null` JSON object cannot be serialized to BSON) |
+
+@liveexample{The following code shows how a `type_error` exception can be
+caught.,type_error}
+
+@sa - @ref exception for the base class of the library exceptions
+@sa - @ref parse_error for exceptions indicating a parse error
+@sa - @ref invalid_iterator for exceptions indicating errors with iterators
+@sa - @ref out_of_range for exceptions indicating access out of the defined range
+@sa - @ref other_error for exceptions indicating other library errors
+
+@since version 3.0.0
+*/
+class type_error : public exception
+{
+ public:
+ static type_error create(int id_, const std::string& what_arg)
+ {
+ std::string w = exception::name("type_error", id_) + what_arg;
+ return type_error(id_, w.c_str());
+ }
+
+ private:
+ JSON_HEDLEY_NON_NULL(3)
+ type_error(int id_, const char* what_arg) : exception(id_, what_arg) {}
+};
+
+/*!
+@brief exception indicating access out of the defined range
+
+This exception is thrown in case a library function is called on an input
+parameter that exceeds the expected range, for instance in case of array
+indices or nonexisting object keys.
+
+Exceptions have ids 4xx.
+
+name / id | example message | description
+------------------------------- | --------------- | -------------------------
+json.exception.out_of_range.401 | array index 3 is out of range | The provided array index @a i is larger than @a size-1.
+json.exception.out_of_range.402 | array index '-' (3) is out of range | The special array index `-` in a JSON Pointer never describes a valid element of the array, but the index past the end. That is, it can only be used to add elements at this position, but not to read it.
+json.exception.out_of_range.403 | key 'foo' not found | The provided key was not found in the JSON object.
+json.exception.out_of_range.404 | unresolved reference token 'foo' | A reference token in a JSON Pointer could not be resolved.
+json.exception.out_of_range.405 | JSON pointer has no parent | The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value.
+json.exception.out_of_range.406 | number overflow parsing '10E1000' | A parsed number could not be stored as without changing it to NaN or INF.
+json.exception.out_of_range.407 | number overflow serializing '9223372036854775808' | UBJSON and BSON only support integer numbers up to 9223372036854775807. |
+json.exception.out_of_range.408 | excessive array size: 8658170730974374167 | The size (following `#`) of an UBJSON array or object exceeds the maximal capacity. |
+json.exception.out_of_range.409 | BSON key cannot contain code point U+0000 (at byte 2) | Key identifiers to be serialized to BSON cannot contain code point U+0000, since the key is stored as zero-terminated c-string |
+
+@liveexample{The following code shows how an `out_of_range` exception can be
+caught.,out_of_range}
+
+@sa - @ref exception for the base class of the library exceptions
+@sa - @ref parse_error for exceptions indicating a parse error
+@sa - @ref invalid_iterator for exceptions indicating errors with iterators
+@sa - @ref type_error for exceptions indicating executing a member function with
+ a wrong type
+@sa - @ref other_error for exceptions indicating other library errors
+
+@since version 3.0.0
+*/
+class out_of_range : public exception
+{
+ public:
+ static out_of_range create(int id_, const std::string& what_arg)
+ {
+ std::string w = exception::name("out_of_range", id_) + what_arg;
+ return out_of_range(id_, w.c_str());
+ }
+
+ private:
+ JSON_HEDLEY_NON_NULL(3)
+ out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {}
+};
+
+/*!
+@brief exception indicating other library errors
+
+This exception is thrown in case of errors that cannot be classified with the
+other exception types.
+
+Exceptions have ids 5xx.
+
+name / id | example message | description
+------------------------------ | --------------- | -------------------------
+json.exception.other_error.501 | unsuccessful: {"op":"test","path":"/baz", "value":"bar"} | A JSON Patch operation 'test' failed. The unsuccessful operation is also printed.
+
+@sa - @ref exception for the base class of the library exceptions
+@sa - @ref parse_error for exceptions indicating a parse error
+@sa - @ref invalid_iterator for exceptions indicating errors with iterators
+@sa - @ref type_error for exceptions indicating executing a member function with
+ a wrong type
+@sa - @ref out_of_range for exceptions indicating access out of the defined range
+
+@liveexample{The following code shows how an `other_error` exception can be
+caught.,other_error}
+
+@since version 3.0.0
+*/
+class other_error : public exception
+{
+ public:
+ static other_error create(int id_, const std::string& what_arg)
+ {
+ std::string w = exception::name("other_error", id_) + what_arg;
+ return other_error(id_, w.c_str());
+ }
+
+ private:
+ JSON_HEDLEY_NON_NULL(3)
+ other_error(int id_, const char* what_arg) : exception(id_, what_arg) {}
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/meta/cpp_future.hpp>
+
+
+#include <cstddef> // size_t
+#include <type_traits> // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type
+
+// #include <nlohmann/detail/boolean_operators.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+// alias templates to reduce boilerplate
+template<bool B, typename T = void>
+using enable_if_t = typename std::enable_if<B, T>::type;
+
+template<typename T>
+using uncvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type;
+
+// implementation of C++14 index_sequence and affiliates
+// source: https://stackoverflow.com/a/32223343
+template<std::size_t... Ints>
+struct index_sequence
+{
+ using type = index_sequence;
+ using value_type = std::size_t;
+ static constexpr std::size_t size() noexcept
+ {
+ return sizeof...(Ints);
+ }
+};
+
+template<class Sequence1, class Sequence2>
+struct merge_and_renumber;
+
+template<std::size_t... I1, std::size_t... I2>
+struct merge_and_renumber<index_sequence<I1...>, index_sequence<I2...>>
+ : index_sequence < I1..., (sizeof...(I1) + I2)... > {};
+
+template<std::size_t N>
+struct make_index_sequence
+ : merge_and_renumber < typename make_index_sequence < N / 2 >::type,
+ typename make_index_sequence < N - N / 2 >::type > {};
+
+template<> struct make_index_sequence<0> : index_sequence<> {};
+template<> struct make_index_sequence<1> : index_sequence<0> {};
+
+template<typename... Ts>
+using index_sequence_for = make_index_sequence<sizeof...(Ts)>;
+
+// dispatch utility (taken from ranges-v3)
+template<unsigned N> struct priority_tag : priority_tag < N - 1 > {};
+template<> struct priority_tag<0> {};
+
+// taken from ranges-v3
+template<typename T>
+struct static_const
+{
+ static constexpr T value{};
+};
+
+template<typename T>
+constexpr T static_const<T>::value;
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/meta/type_traits.hpp>
+
+
+#include <limits> // numeric_limits
+#include <type_traits> // false_type, is_constructible, is_integral, is_same, true_type
+#include <utility> // declval
+
+// #include <nlohmann/detail/boolean_operators.hpp>
+
+// #include <nlohmann/detail/iterators/iterator_traits.hpp>
+
+
+#include <iterator> // random_access_iterator_tag
+
+// #include <nlohmann/detail/meta/void_t.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+template <typename ...Ts> struct make_void
+{
+ using type = void;
+};
+template <typename ...Ts> using void_t = typename make_void<Ts...>::type;
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/meta/cpp_future.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+template <typename It, typename = void>
+struct iterator_types {};
+
+template <typename It>
+struct iterator_types <
+ It,
+ void_t<typename It::difference_type, typename It::value_type, typename It::pointer,
+ typename It::reference, typename It::iterator_category >>
+{
+ using difference_type = typename It::difference_type;
+ using value_type = typename It::value_type;
+ using pointer = typename It::pointer;
+ using reference = typename It::reference;
+ using iterator_category = typename It::iterator_category;
+};
+
+// This is required as some compilers implement std::iterator_traits in a way that
+// doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341.
+template <typename T, typename = void>
+struct iterator_traits
+{
+};
+
+template <typename T>
+struct iterator_traits < T, enable_if_t < !std::is_pointer<T>::value >>
+ : iterator_types<T>
+{
+};
+
+template <typename T>
+struct iterator_traits<T*, enable_if_t<std::is_object<T>::value>>
+{
+ using iterator_category = std::random_access_iterator_tag;
+ using value_type = T;
+ using difference_type = ptrdiff_t;
+ using pointer = T*;
+ using reference = T&;
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/meta/cpp_future.hpp>
+
+// #include <nlohmann/detail/meta/detected.hpp>
+
+
+#include <type_traits>
+
+// #include <nlohmann/detail/meta/void_t.hpp>
+
+
+// https://en.cppreference.com/w/cpp/experimental/is_detected
+namespace nlohmann
+{
+namespace detail
+{
+struct nonesuch
+{
+ nonesuch() = delete;
+ ~nonesuch() = delete;
+ nonesuch(nonesuch const&) = delete;
+ nonesuch(nonesuch const&&) = delete;
+ void operator=(nonesuch const&) = delete;
+ void operator=(nonesuch&&) = delete;
+};
+
+template <class Default,
+ class AlwaysVoid,
+ template <class...> class Op,
+ class... Args>
+struct detector
+{
+ using value_t = std::false_type;
+ using type = Default;
+};
+
+template <class Default, template <class...> class Op, class... Args>
+struct detector<Default, void_t<Op<Args...>>, Op, Args...>
+{
+ using value_t = std::true_type;
+ using type = Op<Args...>;
+};
+
+template <template <class...> class Op, class... Args>
+using is_detected = typename detector<nonesuch, void, Op, Args...>::value_t;
+
+template <template <class...> class Op, class... Args>
+using detected_t = typename detector<nonesuch, void, Op, Args...>::type;
+
+template <class Default, template <class...> class Op, class... Args>
+using detected_or = detector<Default, void, Op, Args...>;
+
+template <class Default, template <class...> class Op, class... Args>
+using detected_or_t = typename detected_or<Default, Op, Args...>::type;
+
+template <class Expected, template <class...> class Op, class... Args>
+using is_detected_exact = std::is_same<Expected, detected_t<Op, Args...>>;
+
+template <class To, template <class...> class Op, class... Args>
+using is_detected_convertible =
+ std::is_convertible<detected_t<Op, Args...>, To>;
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/json_fwd.hpp>
+#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_
+#define INCLUDE_NLOHMANN_JSON_FWD_HPP_
+
+#include <cstdint> // int64_t, uint64_t
+#include <map> // map
+#include <memory> // allocator
+#include <string> // string
+#include <vector> // vector
+
+/*!
+@brief namespace for Niels Lohmann
+@see https://github.com/nlohmann
+@since version 1.0.0
+*/
+namespace nlohmann
+{
+/*!
+@brief default JSONSerializer template argument
+
+This serializer ignores the template arguments and uses ADL
+([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl))
+for serialization.
+*/
+template<typename T = void, typename SFINAE = void>
+struct adl_serializer;
+
+template<template<typename U, typename V, typename... Args> class ObjectType =
+ std::map,
+ template<typename U, typename... Args> class ArrayType = std::vector,
+ class StringType = std::string, class BooleanType = bool,
+ class NumberIntegerType = std::int64_t,
+ class NumberUnsignedType = std::uint64_t,
+ class NumberFloatType = double,
+ template<typename U> class AllocatorType = std::allocator,
+ template<typename T, typename SFINAE = void> class JSONSerializer =
+ adl_serializer,
+ class BinaryType = std::vector<std::uint8_t>>
+class basic_json;
+
+/*!
+@brief JSON Pointer
+
+A JSON pointer defines a string syntax for identifying a specific value
+within a JSON document. It can be used with functions `at` and
+`operator[]`. Furthermore, JSON pointers are the base for JSON patches.
+
+@sa [RFC 6901](https://tools.ietf.org/html/rfc6901)
+
+@since version 2.0.0
+*/
+template<typename BasicJsonType>
+class json_pointer;
+
+/*!
+@brief default JSON class
+
+This type is the default specialization of the @ref basic_json class which
+uses the standard template types.
+
+@since version 1.0.0
+*/
+using json = basic_json<>;
+} // namespace nlohmann
+
+#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_
+
+
+namespace nlohmann
+{
+/*!
+@brief detail namespace with internal helper functions
+
+This namespace collects functions that should not be exposed,
+implementations of some @ref basic_json methods, and meta-programming helpers.
+
+@since version 2.1.0
+*/
+namespace detail
+{
+/////////////
+// helpers //
+/////////////
+
+// Note to maintainers:
+//
+// Every trait in this file expects a non CV-qualified type.
+// The only exceptions are in the 'aliases for detected' section
+// (i.e. those of the form: decltype(T::member_function(std::declval<T>())))
+//
+// In this case, T has to be properly CV-qualified to constraint the function arguments
+// (e.g. to_json(BasicJsonType&, const T&))
+
+template<typename> struct is_basic_json : std::false_type {};
+
+NLOHMANN_BASIC_JSON_TPL_DECLARATION
+struct is_basic_json<NLOHMANN_BASIC_JSON_TPL> : std::true_type {};
+
+//////////////////////
+// json_ref helpers //
+//////////////////////
+
+template <typename>
+class json_ref;
+
+template<typename>
+struct is_json_ref : std::false_type {};
+
+template <typename T>
+struct is_json_ref<json_ref<T>> : std::true_type {};
+
+//////////////////////////
+// aliases for detected //
+//////////////////////////
+
+template <typename T>
+using mapped_type_t = typename T::mapped_type;
+
+template <typename T>
+using key_type_t = typename T::key_type;
+
+template <typename T>
+using value_type_t = typename T::value_type;
+
+template <typename T>
+using difference_type_t = typename T::difference_type;
+
+template <typename T>
+using pointer_t = typename T::pointer;
+
+template <typename T>
+using reference_t = typename T::reference;
+
+template <typename T>
+using iterator_category_t = typename T::iterator_category;
+
+template <typename T>
+using iterator_t = typename T::iterator;
+
+template <typename T, typename... Args>
+using to_json_function = decltype(T::to_json(std::declval<Args>()...));
+
+template <typename T, typename... Args>
+using from_json_function = decltype(T::from_json(std::declval<Args>()...));
+
+template <typename T, typename U>
+using get_template_function = decltype(std::declval<T>().template get<U>());
+
+// trait checking if JSONSerializer<T>::from_json(json const&, udt&) exists
+template <typename BasicJsonType, typename T, typename = void>
+struct has_from_json : std::false_type {};
+
+template <typename BasicJsonType, typename T>
+struct has_from_json<BasicJsonType, T,
+ enable_if_t<not is_basic_json<T>::value>>
+{
+ using serializer = typename BasicJsonType::template json_serializer<T, void>;
+
+ static constexpr bool value =
+ is_detected_exact<void, from_json_function, serializer,
+ const BasicJsonType&, T&>::value;
+};
+
+// This trait checks if JSONSerializer<T>::from_json(json const&) exists
+// this overload is used for non-default-constructible user-defined-types
+template <typename BasicJsonType, typename T, typename = void>
+struct has_non_default_from_json : std::false_type {};
+
+template<typename BasicJsonType, typename T>
+struct has_non_default_from_json<BasicJsonType, T, enable_if_t<not is_basic_json<T>::value>>
+{
+ using serializer = typename BasicJsonType::template json_serializer<T, void>;
+
+ static constexpr bool value =
+ is_detected_exact<T, from_json_function, serializer,
+ const BasicJsonType&>::value;
+};
+
+// This trait checks if BasicJsonType::json_serializer<T>::to_json exists
+// Do not evaluate the trait when T is a basic_json type, to avoid template instantiation infinite recursion.
+template <typename BasicJsonType, typename T, typename = void>
+struct has_to_json : std::false_type {};
+
+template <typename BasicJsonType, typename T>
+struct has_to_json<BasicJsonType, T, enable_if_t<not is_basic_json<T>::value>>
+{
+ using serializer = typename BasicJsonType::template json_serializer<T, void>;
+
+ static constexpr bool value =
+ is_detected_exact<void, to_json_function, serializer, BasicJsonType&,
+ T>::value;
+};
+
+
+///////////////////
+// is_ functions //
+///////////////////
+
+template <typename T, typename = void>
+struct is_iterator_traits : std::false_type {};
+
+template <typename T>
+struct is_iterator_traits<iterator_traits<T>>
+{
+ private:
+ using traits = iterator_traits<T>;
+
+ public:
+ static constexpr auto value =
+ is_detected<value_type_t, traits>::value &&
+ is_detected<difference_type_t, traits>::value &&
+ is_detected<pointer_t, traits>::value &&
+ is_detected<iterator_category_t, traits>::value &&
+ is_detected<reference_t, traits>::value;
+};
+
+// source: https://stackoverflow.com/a/37193089/4116453
+
+template <typename T, typename = void>
+struct is_complete_type : std::false_type {};
+
+template <typename T>
+struct is_complete_type<T, decltype(void(sizeof(T)))> : std::true_type {};
+
+template <typename BasicJsonType, typename CompatibleObjectType,
+ typename = void>
+struct is_compatible_object_type_impl : std::false_type {};
+
+template <typename BasicJsonType, typename CompatibleObjectType>
+struct is_compatible_object_type_impl <
+ BasicJsonType, CompatibleObjectType,
+ enable_if_t<is_detected<mapped_type_t, CompatibleObjectType>::value and
+ is_detected<key_type_t, CompatibleObjectType>::value >>
+{
+
+ using object_t = typename BasicJsonType::object_t;
+
+ // macOS's is_constructible does not play well with nonesuch...
+ static constexpr bool value =
+ std::is_constructible<typename object_t::key_type,
+ typename CompatibleObjectType::key_type>::value and
+ std::is_constructible<typename object_t::mapped_type,
+ typename CompatibleObjectType::mapped_type>::value;
+};
+
+template <typename BasicJsonType, typename CompatibleObjectType>
+struct is_compatible_object_type
+ : is_compatible_object_type_impl<BasicJsonType, CompatibleObjectType> {};
+
+template <typename BasicJsonType, typename ConstructibleObjectType,
+ typename = void>
+struct is_constructible_object_type_impl : std::false_type {};
+
+template <typename BasicJsonType, typename ConstructibleObjectType>
+struct is_constructible_object_type_impl <
+ BasicJsonType, ConstructibleObjectType,
+ enable_if_t<is_detected<mapped_type_t, ConstructibleObjectType>::value and
+ is_detected<key_type_t, ConstructibleObjectType>::value >>
+{
+ using object_t = typename BasicJsonType::object_t;
+
+ static constexpr bool value =
+ (std::is_default_constructible<ConstructibleObjectType>::value and
+ (std::is_move_assignable<ConstructibleObjectType>::value or
+ std::is_copy_assignable<ConstructibleObjectType>::value) and
+ (std::is_constructible<typename ConstructibleObjectType::key_type,
+ typename object_t::key_type>::value and
+ std::is_same <
+ typename object_t::mapped_type,
+ typename ConstructibleObjectType::mapped_type >::value)) or
+ (has_from_json<BasicJsonType,
+ typename ConstructibleObjectType::mapped_type>::value or
+ has_non_default_from_json <
+ BasicJsonType,
+ typename ConstructibleObjectType::mapped_type >::value);
+};
+
+template <typename BasicJsonType, typename ConstructibleObjectType>
+struct is_constructible_object_type
+ : is_constructible_object_type_impl<BasicJsonType,
+ ConstructibleObjectType> {};
+
+template <typename BasicJsonType, typename CompatibleStringType,
+ typename = void>
+struct is_compatible_string_type_impl : std::false_type {};
+
+template <typename BasicJsonType, typename CompatibleStringType>
+struct is_compatible_string_type_impl <
+ BasicJsonType, CompatibleStringType,
+ enable_if_t<is_detected_exact<typename BasicJsonType::string_t::value_type,
+ value_type_t, CompatibleStringType>::value >>
+{
+ static constexpr auto value =
+ std::is_constructible<typename BasicJsonType::string_t, CompatibleStringType>::value;
+};
+
+template <typename BasicJsonType, typename ConstructibleStringType>
+struct is_compatible_string_type
+ : is_compatible_string_type_impl<BasicJsonType, ConstructibleStringType> {};
+
+template <typename BasicJsonType, typename ConstructibleStringType,
+ typename = void>
+struct is_constructible_string_type_impl : std::false_type {};
+
+template <typename BasicJsonType, typename ConstructibleStringType>
+struct is_constructible_string_type_impl <
+ BasicJsonType, ConstructibleStringType,
+ enable_if_t<is_detected_exact<typename BasicJsonType::string_t::value_type,
+ value_type_t, ConstructibleStringType>::value >>
+{
+ static constexpr auto value =
+ std::is_constructible<ConstructibleStringType,
+ typename BasicJsonType::string_t>::value;
+};
+
+template <typename BasicJsonType, typename ConstructibleStringType>
+struct is_constructible_string_type
+ : is_constructible_string_type_impl<BasicJsonType, ConstructibleStringType> {};
+
+template <typename BasicJsonType, typename CompatibleArrayType, typename = void>
+struct is_compatible_array_type_impl : std::false_type {};
+
+template <typename BasicJsonType, typename CompatibleArrayType>
+struct is_compatible_array_type_impl <
+ BasicJsonType, CompatibleArrayType,
+ enable_if_t<is_detected<value_type_t, CompatibleArrayType>::value and
+ is_detected<iterator_t, CompatibleArrayType>::value and
+// This is needed because json_reverse_iterator has a ::iterator type...
+// Therefore it is detected as a CompatibleArrayType.
+// The real fix would be to have an Iterable concept.
+ not is_iterator_traits<
+ iterator_traits<CompatibleArrayType>>::value >>
+{
+ static constexpr bool value =
+ std::is_constructible<BasicJsonType,
+ typename CompatibleArrayType::value_type>::value;
+};
+
+template <typename BasicJsonType, typename CompatibleArrayType>
+struct is_compatible_array_type
+ : is_compatible_array_type_impl<BasicJsonType, CompatibleArrayType> {};
+
+template <typename BasicJsonType, typename ConstructibleArrayType, typename = void>
+struct is_constructible_array_type_impl : std::false_type {};
+
+template <typename BasicJsonType, typename ConstructibleArrayType>
+struct is_constructible_array_type_impl <
+ BasicJsonType, ConstructibleArrayType,
+ enable_if_t<std::is_same<ConstructibleArrayType,
+ typename BasicJsonType::value_type>::value >>
+ : std::true_type {};
+
+template <typename BasicJsonType, typename ConstructibleArrayType>
+struct is_constructible_array_type_impl <
+ BasicJsonType, ConstructibleArrayType,
+ enable_if_t<not std::is_same<ConstructibleArrayType,
+ typename BasicJsonType::value_type>::value and
+ std::is_default_constructible<ConstructibleArrayType>::value and
+(std::is_move_assignable<ConstructibleArrayType>::value or
+ std::is_copy_assignable<ConstructibleArrayType>::value) and
+is_detected<value_type_t, ConstructibleArrayType>::value and
+is_detected<iterator_t, ConstructibleArrayType>::value and
+is_complete_type<
+detected_t<value_type_t, ConstructibleArrayType>>::value >>
+{
+ static constexpr bool value =
+ // This is needed because json_reverse_iterator has a ::iterator type,
+ // furthermore, std::back_insert_iterator (and other iterators) have a
+ // base class `iterator`... Therefore it is detected as a
+ // ConstructibleArrayType. The real fix would be to have an Iterable
+ // concept.
+ not is_iterator_traits<iterator_traits<ConstructibleArrayType>>::value and
+
+ (std::is_same<typename ConstructibleArrayType::value_type,
+ typename BasicJsonType::array_t::value_type>::value or
+ has_from_json<BasicJsonType,
+ typename ConstructibleArrayType::value_type>::value or
+ has_non_default_from_json <
+ BasicJsonType, typename ConstructibleArrayType::value_type >::value);
+};
+
+template <typename BasicJsonType, typename ConstructibleArrayType>
+struct is_constructible_array_type
+ : is_constructible_array_type_impl<BasicJsonType, ConstructibleArrayType> {};
+
+template <typename RealIntegerType, typename CompatibleNumberIntegerType,
+ typename = void>
+struct is_compatible_integer_type_impl : std::false_type {};
+
+template <typename RealIntegerType, typename CompatibleNumberIntegerType>
+struct is_compatible_integer_type_impl <
+ RealIntegerType, CompatibleNumberIntegerType,
+ enable_if_t<std::is_integral<RealIntegerType>::value and
+ std::is_integral<CompatibleNumberIntegerType>::value and
+ not std::is_same<bool, CompatibleNumberIntegerType>::value >>
+{
+ // is there an assert somewhere on overflows?
+ using RealLimits = std::numeric_limits<RealIntegerType>;
+ using CompatibleLimits = std::numeric_limits<CompatibleNumberIntegerType>;
+
+ static constexpr auto value =
+ std::is_constructible<RealIntegerType,
+ CompatibleNumberIntegerType>::value and
+ CompatibleLimits::is_integer and
+ RealLimits::is_signed == CompatibleLimits::is_signed;
+};
+
+template <typename RealIntegerType, typename CompatibleNumberIntegerType>
+struct is_compatible_integer_type
+ : is_compatible_integer_type_impl<RealIntegerType,
+ CompatibleNumberIntegerType> {};
+
+template <typename BasicJsonType, typename CompatibleType, typename = void>
+struct is_compatible_type_impl: std::false_type {};
+
+template <typename BasicJsonType, typename CompatibleType>
+struct is_compatible_type_impl <
+ BasicJsonType, CompatibleType,
+ enable_if_t<is_complete_type<CompatibleType>::value >>
+{
+ static constexpr bool value =
+ has_to_json<BasicJsonType, CompatibleType>::value;
+};
+
+template <typename BasicJsonType, typename CompatibleType>
+struct is_compatible_type
+ : is_compatible_type_impl<BasicJsonType, CompatibleType> {};
+
+// https://en.cppreference.com/w/cpp/types/conjunction
+template<class...> struct conjunction : std::true_type { };
+template<class B1> struct conjunction<B1> : B1 { };
+template<class B1, class... Bn>
+struct conjunction<B1, Bn...>
+: std::conditional<bool(B1::value), conjunction<Bn...>, B1>::type {};
+
+template <typename T1, typename T2>
+struct is_constructible_tuple : std::false_type {};
+
+template <typename T1, typename... Args>
+struct is_constructible_tuple<T1, std::tuple<Args...>> : conjunction<std::is_constructible<T1, Args>...> {};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+#include <array> // array
+#include <cstddef> // size_t
+#include <cstdint> // uint8_t
+#include <string> // string
+
+// #include <nlohmann/detail/boolean_operators.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+///////////////////////////
+// JSON type enumeration //
+///////////////////////////
+
+/*!
+@brief the JSON type enumeration
+
+This enumeration collects the different JSON types. It is internally used to
+distinguish the stored values, and the functions @ref basic_json::is_null(),
+@ref basic_json::is_object(), @ref basic_json::is_array(),
+@ref basic_json::is_string(), @ref basic_json::is_boolean(),
+@ref basic_json::is_number() (with @ref basic_json::is_number_integer(),
+@ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()),
+@ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and
+@ref basic_json::is_structured() rely on it.
+
+@note There are three enumeration entries (number_integer, number_unsigned, and
+number_float), because the library distinguishes these three types for numbers:
+@ref basic_json::number_unsigned_t is used for unsigned integers,
+@ref basic_json::number_integer_t is used for signed integers, and
+@ref basic_json::number_float_t is used for floating-point numbers or to
+approximate integers which do not fit in the limits of their respective type.
+
+@sa @ref basic_json::basic_json(const value_t value_type) -- create a JSON
+value with the default value for a given type
+
+@since version 1.0.0
+*/
+enum class value_t : std::uint8_t
+{
+ null, ///< null value
+ object, ///< object (unordered set of name/value pairs)
+ array, ///< array (ordered collection of values)
+ string, ///< string value
+ boolean, ///< boolean value
+ number_integer, ///< number value (signed integer)
+ number_unsigned, ///< number value (unsigned integer)
+ number_float, ///< number value (floating-point)
+ binary, ///< binary array (ordered collection of bytes)
+ discarded ///< discarded by the parser callback function
+};
+
+/*!
+@brief comparison operator for JSON types
+
+Returns an ordering that is similar to Python:
+- order: null < boolean < number < object < array < string < binary
+- furthermore, each type is not smaller than itself
+- discarded values are not comparable
+- binary is represented as a b"" string in python and directly comparable to a
+ string; however, making a binary array directly comparable with a string would
+ be surprising behavior in a JSON file.
+
+@since version 1.0.0
+*/
+inline bool operator<(const value_t lhs, const value_t rhs) noexcept
+{
+ static constexpr std::array<std::uint8_t, 9> order = {{
+ 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */,
+ 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */,
+ 6 /* binary */
+ }
+ };
+
+ const auto l_index = static_cast<std::size_t>(lhs);
+ const auto r_index = static_cast<std::size_t>(rhs);
+ return l_index < order.size() and r_index < order.size() and order[l_index] < order[r_index];
+}
+} // namespace detail
+} // namespace nlohmann
+
+
+namespace nlohmann
+{
+namespace detail
+{
+template<typename BasicJsonType>
+void from_json(const BasicJsonType& j, typename std::nullptr_t& n)
+{
+ if (JSON_HEDLEY_UNLIKELY(not j.is_null()))
+ {
+ JSON_THROW(type_error::create(302, "type must be null, but is " + std::string(j.type_name())));
+ }
+ n = nullptr;
+}
+
+// overloads for basic_json template parameters
+template<typename BasicJsonType, typename ArithmeticType,
+ enable_if_t<std::is_arithmetic<ArithmeticType>::value and
+ not std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,
+ int> = 0>
+void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val)
+{
+ switch (static_cast<value_t>(j))
+ {
+ case value_t::number_unsigned:
+ {
+ val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());
+ break;
+ }
+ case value_t::number_integer:
+ {
+ val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());
+ break;
+ }
+ case value_t::number_float:
+ {
+ val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());
+ break;
+ }
+
+ default:
+ JSON_THROW(type_error::create(302, "type must be number, but is " + std::string(j.type_name())));
+ }
+}
+
+template<typename BasicJsonType>
+void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b)
+{
+ if (JSON_HEDLEY_UNLIKELY(not j.is_boolean()))
+ {
+ JSON_THROW(type_error::create(302, "type must be boolean, but is " + std::string(j.type_name())));
+ }
+ b = *j.template get_ptr<const typename BasicJsonType::boolean_t*>();
+}
+
+template<typename BasicJsonType>
+void from_json(const BasicJsonType& j, typename BasicJsonType::string_t& s)
+{
+ if (JSON_HEDLEY_UNLIKELY(not j.is_string()))
+ {
+ JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name())));
+ }
+ s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
+}
+
+template <
+ typename BasicJsonType, typename ConstructibleStringType,
+ enable_if_t <
+ is_constructible_string_type<BasicJsonType, ConstructibleStringType>::value and
+ not std::is_same<typename BasicJsonType::string_t,
+ ConstructibleStringType>::value,
+ int > = 0 >
+void from_json(const BasicJsonType& j, ConstructibleStringType& s)
+{
+ if (JSON_HEDLEY_UNLIKELY(not j.is_string()))
+ {
+ JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name())));
+ }
+
+ s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
+}
+
+template<typename BasicJsonType>
+void from_json(const BasicJsonType& j, typename BasicJsonType::number_float_t& val)
+{
+ get_arithmetic_value(j, val);
+}
+
+template<typename BasicJsonType>
+void from_json(const BasicJsonType& j, typename BasicJsonType::number_unsigned_t& val)
+{
+ get_arithmetic_value(j, val);
+}
+
+template<typename BasicJsonType>
+void from_json(const BasicJsonType& j, typename BasicJsonType::number_integer_t& val)
+{
+ get_arithmetic_value(j, val);
+}
+
+template<typename BasicJsonType, typename EnumType,
+ enable_if_t<std::is_enum<EnumType>::value, int> = 0>
+void from_json(const BasicJsonType& j, EnumType& e)
+{
+ typename std::underlying_type<EnumType>::type val;
+ get_arithmetic_value(j, val);
+ e = static_cast<EnumType>(val);
+}
+
+// forward_list doesn't have an insert method
+template<typename BasicJsonType, typename T, typename Allocator,
+ enable_if_t<std::is_convertible<BasicJsonType, T>::value, int> = 0>
+void from_json(const BasicJsonType& j, std::forward_list<T, Allocator>& l)
+{
+ if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
+ {
+ JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
+ }
+ l.clear();
+ std::transform(j.rbegin(), j.rend(),
+ std::front_inserter(l), [](const BasicJsonType & i)
+ {
+ return i.template get<T>();
+ });
+}
+
+// valarray doesn't have an insert method
+template<typename BasicJsonType, typename T,
+ enable_if_t<std::is_convertible<BasicJsonType, T>::value, int> = 0>
+void from_json(const BasicJsonType& j, std::valarray<T>& l)
+{
+ if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
+ {
+ JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
+ }
+ l.resize(j.size());
+ std::copy(j.begin(), j.end(), std::begin(l));
+}
+
+template <typename BasicJsonType, typename T, std::size_t N>
+auto from_json(const BasicJsonType& j, T (&arr)[N])
+-> decltype(j.template get<T>(), void())
+{
+ for (std::size_t i = 0; i < N; ++i)
+ {
+ arr[i] = j.at(i).template get<T>();
+ }
+}
+
+template<typename BasicJsonType>
+void from_json_array_impl(const BasicJsonType& j, typename BasicJsonType::array_t& arr, priority_tag<3> /*unused*/)
+{
+ arr = *j.template get_ptr<const typename BasicJsonType::array_t*>();
+}
+
+template <typename BasicJsonType, typename T, std::size_t N>
+auto from_json_array_impl(const BasicJsonType& j, std::array<T, N>& arr,
+ priority_tag<2> /*unused*/)
+-> decltype(j.template get<T>(), void())
+{
+ for (std::size_t i = 0; i < N; ++i)
+ {
+ arr[i] = j.at(i).template get<T>();
+ }
+}
+
+template<typename BasicJsonType, typename ConstructibleArrayType>
+auto from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr, priority_tag<1> /*unused*/)
+-> decltype(
+ arr.reserve(std::declval<typename ConstructibleArrayType::size_type>()),
+ j.template get<typename ConstructibleArrayType::value_type>(),
+ void())
+{
+ using std::end;
+
+ ConstructibleArrayType ret;
+ ret.reserve(j.size());
+ std::transform(j.begin(), j.end(),
+ std::inserter(ret, end(ret)), [](const BasicJsonType & i)
+ {
+ // get<BasicJsonType>() returns *this, this won't call a from_json
+ // method when value_type is BasicJsonType
+ return i.template get<typename ConstructibleArrayType::value_type>();
+ });
+ arr = std::move(ret);
+}
+
+template <typename BasicJsonType, typename ConstructibleArrayType>
+void from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr,
+ priority_tag<0> /*unused*/)
+{
+ using std::end;
+
+ ConstructibleArrayType ret;
+ std::transform(
+ j.begin(), j.end(), std::inserter(ret, end(ret)),
+ [](const BasicJsonType & i)
+ {
+ // get<BasicJsonType>() returns *this, this won't call a from_json
+ // method when value_type is BasicJsonType
+ return i.template get<typename ConstructibleArrayType::value_type>();
+ });
+ arr = std::move(ret);
+}
+
+template <typename BasicJsonType, typename ConstructibleArrayType,
+ enable_if_t <
+ is_constructible_array_type<BasicJsonType, ConstructibleArrayType>::value and
+ not is_constructible_object_type<BasicJsonType, ConstructibleArrayType>::value and
+ not is_constructible_string_type<BasicJsonType, ConstructibleArrayType>::value and
+ not std::is_same<ConstructibleArrayType, typename BasicJsonType::binary_t>::value and
+ not is_basic_json<ConstructibleArrayType>::value,
+ int > = 0 >
+auto from_json(const BasicJsonType& j, ConstructibleArrayType& arr)
+-> decltype(from_json_array_impl(j, arr, priority_tag<3> {}),
+j.template get<typename ConstructibleArrayType::value_type>(),
+void())
+{
+ if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
+ {
+ JSON_THROW(type_error::create(302, "type must be array, but is " +
+ std::string(j.type_name())));
+ }
+
+ from_json_array_impl(j, arr, priority_tag<3> {});
+}
+
+template <typename BasicJsonType>
+void from_json(const BasicJsonType& j, typename BasicJsonType::binary_t& bin)
+{
+ if (JSON_HEDLEY_UNLIKELY(not j.is_binary()))
+ {
+ JSON_THROW(type_error::create(302, "type must be binary, but is " + std::string(j.type_name())));
+ }
+
+ bin = *j.template get_ptr<const typename BasicJsonType::binary_t*>();
+}
+
+template<typename BasicJsonType, typename ConstructibleObjectType,
+ enable_if_t<is_constructible_object_type<BasicJsonType, ConstructibleObjectType>::value, int> = 0>
+void from_json(const BasicJsonType& j, ConstructibleObjectType& obj)
+{
+ if (JSON_HEDLEY_UNLIKELY(not j.is_object()))
+ {
+ JSON_THROW(type_error::create(302, "type must be object, but is " + std::string(j.type_name())));
+ }
+
+ ConstructibleObjectType ret;
+ auto inner_object = j.template get_ptr<const typename BasicJsonType::object_t*>();
+ using value_type = typename ConstructibleObjectType::value_type;
+ std::transform(
+ inner_object->begin(), inner_object->end(),
+ std::inserter(ret, ret.begin()),
+ [](typename BasicJsonType::object_t::value_type const & p)
+ {
+ return value_type(p.first, p.second.template get<typename ConstructibleObjectType::mapped_type>());
+ });
+ obj = std::move(ret);
+}
+
+// overload for arithmetic types, not chosen for basic_json template arguments
+// (BooleanType, etc..); note: Is it really necessary to provide explicit
+// overloads for boolean_t etc. in case of a custom BooleanType which is not
+// an arithmetic type?
+template<typename BasicJsonType, typename ArithmeticType,
+ enable_if_t <
+ std::is_arithmetic<ArithmeticType>::value and
+ not std::is_same<ArithmeticType, typename BasicJsonType::number_unsigned_t>::value and
+ not std::is_same<ArithmeticType, typename BasicJsonType::number_integer_t>::value and
+ not std::is_same<ArithmeticType, typename BasicJsonType::number_float_t>::value and
+ not std::is_same<ArithmeticType, typename BasicJsonType::boolean_t>::value,
+ int> = 0>
+void from_json(const BasicJsonType& j, ArithmeticType& val)
+{
+ switch (static_cast<value_t>(j))
+ {
+ case value_t::number_unsigned:
+ {
+ val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_unsigned_t*>());
+ break;
+ }
+ case value_t::number_integer:
+ {
+ val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_integer_t*>());
+ break;
+ }
+ case value_t::number_float:
+ {
+ val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::number_float_t*>());
+ break;
+ }
+ case value_t::boolean:
+ {
+ val = static_cast<ArithmeticType>(*j.template get_ptr<const typename BasicJsonType::boolean_t*>());
+ break;
+ }
+
+ default:
+ JSON_THROW(type_error::create(302, "type must be number, but is " + std::string(j.type_name())));
+ }
+}
+
+template<typename BasicJsonType, typename A1, typename A2>
+void from_json(const BasicJsonType& j, std::pair<A1, A2>& p)
+{
+ p = {j.at(0).template get<A1>(), j.at(1).template get<A2>()};
+}
+
+template<typename BasicJsonType, typename Tuple, std::size_t... Idx>
+void from_json_tuple_impl(const BasicJsonType& j, Tuple& t, index_sequence<Idx...> /*unused*/)
+{
+ t = std::make_tuple(j.at(Idx).template get<typename std::tuple_element<Idx, Tuple>::type>()...);
+}
+
+template<typename BasicJsonType, typename... Args>
+void from_json(const BasicJsonType& j, std::tuple<Args...>& t)
+{
+ from_json_tuple_impl(j, t, index_sequence_for<Args...> {});
+}
+
+template <typename BasicJsonType, typename Key, typename Value, typename Compare, typename Allocator,
+ typename = enable_if_t<not std::is_constructible<
+ typename BasicJsonType::string_t, Key>::value>>
+void from_json(const BasicJsonType& j, std::map<Key, Value, Compare, Allocator>& m)
+{
+ if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
+ {
+ JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
+ }
+ m.clear();
+ for (const auto& p : j)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not p.is_array()))
+ {
+ JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(p.type_name())));
+ }
+ m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>());
+ }
+}
+
+template <typename BasicJsonType, typename Key, typename Value, typename Hash, typename KeyEqual, typename Allocator,
+ typename = enable_if_t<not std::is_constructible<
+ typename BasicJsonType::string_t, Key>::value>>
+void from_json(const BasicJsonType& j, std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>& m)
+{
+ if (JSON_HEDLEY_UNLIKELY(not j.is_array()))
+ {
+ JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(j.type_name())));
+ }
+ m.clear();
+ for (const auto& p : j)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not p.is_array()))
+ {
+ JSON_THROW(type_error::create(302, "type must be array, but is " + std::string(p.type_name())));
+ }
+ m.emplace(p.at(0).template get<Key>(), p.at(1).template get<Value>());
+ }
+}
+
+struct from_json_fn
+{
+ template<typename BasicJsonType, typename T>
+ auto operator()(const BasicJsonType& j, T& val) const
+ noexcept(noexcept(from_json(j, val)))
+ -> decltype(from_json(j, val), void())
+ {
+ return from_json(j, val);
+ }
+};
+} // namespace detail
+
+/// namespace to hold default `from_json` function
+/// to see why this is required:
+/// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html
+namespace
+{
+constexpr const auto& from_json = detail::static_const<detail::from_json_fn>::value;
+} // namespace
+} // namespace nlohmann
+
+// #include <nlohmann/detail/conversions/to_json.hpp>
+
+
+#include <algorithm> // copy
+#include <iterator> // begin, end
+#include <string> // string
+#include <tuple> // tuple, get
+#include <type_traits> // is_same, is_constructible, is_floating_point, is_enum, underlying_type
+#include <utility> // move, forward, declval, pair
+#include <valarray> // valarray
+#include <vector> // vector
+
+// #include <nlohmann/detail/boolean_operators.hpp>
+
+// #include <nlohmann/detail/iterators/iteration_proxy.hpp>
+
+
+#include <cstddef> // size_t
+#include <iterator> // input_iterator_tag
+#include <string> // string, to_string
+#include <tuple> // tuple_size, get, tuple_element
+
+// #include <nlohmann/detail/meta/type_traits.hpp>
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+template<typename string_type>
+void int_to_string( string_type& target, std::size_t value )
+{
+ target = std::to_string(value);
+}
+template <typename IteratorType> class iteration_proxy_value
+{
+ public:
+ using difference_type = std::ptrdiff_t;
+ using value_type = iteration_proxy_value;
+ using pointer = value_type * ;
+ using reference = value_type & ;
+ using iterator_category = std::input_iterator_tag;
+ using string_type = typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().key() ) >::type >::type;
+
+ private:
+ /// the iterator
+ IteratorType anchor;
+ /// an index for arrays (used to create key names)
+ std::size_t array_index = 0;
+ /// last stringified array index
+ mutable std::size_t array_index_last = 0;
+ /// a string representation of the array index
+ mutable string_type array_index_str = "0";
+ /// an empty string (to return a reference for primitive values)
+ const string_type empty_str = "";
+
+ public:
+ explicit iteration_proxy_value(IteratorType it) noexcept : anchor(it) {}
+
+ /// dereference operator (needed for range-based for)
+ iteration_proxy_value& operator*()
+ {
+ return *this;
+ }
+
+ /// increment operator (needed for range-based for)
+ iteration_proxy_value& operator++()
+ {
+ ++anchor;
+ ++array_index;
+
+ return *this;
+ }
+
+ /// equality operator (needed for InputIterator)
+ bool operator==(const iteration_proxy_value& o) const
+ {
+ return anchor == o.anchor;
+ }
+
+ /// inequality operator (needed for range-based for)
+ bool operator!=(const iteration_proxy_value& o) const
+ {
+ return anchor != o.anchor;
+ }
+
+ /// return key of the iterator
+ const string_type& key() const
+ {
+ assert(anchor.m_object != nullptr);
+
+ switch (anchor.m_object->type())
+ {
+ // use integer array index as key
+ case value_t::array:
+ {
+ if (array_index != array_index_last)
+ {
+ int_to_string( array_index_str, array_index );
+ array_index_last = array_index;
+ }
+ return array_index_str;
+ }
+
+ // use key from the object
+ case value_t::object:
+ return anchor.key();
+
+ // use an empty key for all primitive types
+ default:
+ return empty_str;
+ }
+ }
+
+ /// return value of the iterator
+ typename IteratorType::reference value() const
+ {
+ return anchor.value();
+ }
+};
+
+/// proxy class for the items() function
+template<typename IteratorType> class iteration_proxy
+{
+ private:
+ /// the container to iterate
+ typename IteratorType::reference container;
+
+ public:
+ /// construct iteration proxy from a container
+ explicit iteration_proxy(typename IteratorType::reference cont) noexcept
+ : container(cont) {}
+
+ /// return iterator begin (needed for range-based for)
+ iteration_proxy_value<IteratorType> begin() noexcept
+ {
+ return iteration_proxy_value<IteratorType>(container.begin());
+ }
+
+ /// return iterator end (needed for range-based for)
+ iteration_proxy_value<IteratorType> end() noexcept
+ {
+ return iteration_proxy_value<IteratorType>(container.end());
+ }
+};
+// Structured Bindings Support
+// For further reference see https://blog.tartanllama.xyz/structured-bindings/
+// And see https://github.com/nlohmann/json/pull/1391
+template <std::size_t N, typename IteratorType, enable_if_t<N == 0, int> = 0>
+auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>& i) -> decltype(i.key())
+{
+ return i.key();
+}
+// Structured Bindings Support
+// For further reference see https://blog.tartanllama.xyz/structured-bindings/
+// And see https://github.com/nlohmann/json/pull/1391
+template <std::size_t N, typename IteratorType, enable_if_t<N == 1, int> = 0>
+auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>& i) -> decltype(i.value())
+{
+ return i.value();
+}
+} // namespace detail
+} // namespace nlohmann
+
+// The Addition to the STD Namespace is required to add
+// Structured Bindings Support to the iteration_proxy_value class
+// For further reference see https://blog.tartanllama.xyz/structured-bindings/
+// And see https://github.com/nlohmann/json/pull/1391
+namespace std
+{
+#if defined(__clang__)
+ // Fix: https://github.com/nlohmann/json/issues/1401
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wmismatched-tags"
+#endif
+template <typename IteratorType>
+class tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>>
+ : public std::integral_constant<std::size_t, 2> {};
+
+template <std::size_t N, typename IteratorType>
+class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >>
+{
+ public:
+ using type = decltype(
+ get<N>(std::declval <
+ ::nlohmann::detail::iteration_proxy_value<IteratorType >> ()));
+};
+#if defined(__clang__)
+ #pragma clang diagnostic pop
+#endif
+} // namespace std
+
+// #include <nlohmann/detail/meta/cpp_future.hpp>
+
+// #include <nlohmann/detail/meta/type_traits.hpp>
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+//////////////////
+// constructors //
+//////////////////
+
+template<value_t> struct external_constructor;
+
+template<>
+struct external_constructor<value_t::boolean>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::boolean_t b) noexcept
+ {
+ j.m_type = value_t::boolean;
+ j.m_value = b;
+ j.assert_invariant();
+ }
+};
+
+template<>
+struct external_constructor<value_t::string>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, const typename BasicJsonType::string_t& s)
+ {
+ j.m_type = value_t::string;
+ j.m_value = s;
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::string_t&& s)
+ {
+ j.m_type = value_t::string;
+ j.m_value = std::move(s);
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType, typename CompatibleStringType,
+ enable_if_t<not std::is_same<CompatibleStringType, typename BasicJsonType::string_t>::value,
+ int> = 0>
+ static void construct(BasicJsonType& j, const CompatibleStringType& str)
+ {
+ j.m_type = value_t::string;
+ j.m_value.string = j.template create<typename BasicJsonType::string_t>(str);
+ j.assert_invariant();
+ }
+};
+
+template<>
+struct external_constructor<value_t::binary>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, const typename BasicJsonType::binary_t& b)
+ {
+ j.m_type = value_t::binary;
+ typename BasicJsonType::binary_t value{b};
+ j.m_value = value;
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::binary_t&& b)
+ {
+ j.m_type = value_t::binary;
+ typename BasicJsonType::binary_t value{std::move(b)};
+ j.m_value = value;
+ j.assert_invariant();
+ }
+};
+
+template<>
+struct external_constructor<value_t::number_float>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::number_float_t val) noexcept
+ {
+ j.m_type = value_t::number_float;
+ j.m_value = val;
+ j.assert_invariant();
+ }
+};
+
+template<>
+struct external_constructor<value_t::number_unsigned>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::number_unsigned_t val) noexcept
+ {
+ j.m_type = value_t::number_unsigned;
+ j.m_value = val;
+ j.assert_invariant();
+ }
+};
+
+template<>
+struct external_constructor<value_t::number_integer>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::number_integer_t val) noexcept
+ {
+ j.m_type = value_t::number_integer;
+ j.m_value = val;
+ j.assert_invariant();
+ }
+};
+
+template<>
+struct external_constructor<value_t::array>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, const typename BasicJsonType::array_t& arr)
+ {
+ j.m_type = value_t::array;
+ j.m_value = arr;
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::array_t&& arr)
+ {
+ j.m_type = value_t::array;
+ j.m_value = std::move(arr);
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType, typename CompatibleArrayType,
+ enable_if_t<not std::is_same<CompatibleArrayType, typename BasicJsonType::array_t>::value,
+ int> = 0>
+ static void construct(BasicJsonType& j, const CompatibleArrayType& arr)
+ {
+ using std::begin;
+ using std::end;
+ j.m_type = value_t::array;
+ j.m_value.array = j.template create<typename BasicJsonType::array_t>(begin(arr), end(arr));
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, const std::vector<bool>& arr)
+ {
+ j.m_type = value_t::array;
+ j.m_value = value_t::array;
+ j.m_value.array->reserve(arr.size());
+ for (const bool x : arr)
+ {
+ j.m_value.array->push_back(x);
+ }
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType, typename T,
+ enable_if_t<std::is_convertible<T, BasicJsonType>::value, int> = 0>
+ static void construct(BasicJsonType& j, const std::valarray<T>& arr)
+ {
+ j.m_type = value_t::array;
+ j.m_value = value_t::array;
+ j.m_value.array->resize(arr.size());
+ if (arr.size() > 0)
+ {
+ std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin());
+ }
+ j.assert_invariant();
+ }
+};
+
+template<>
+struct external_constructor<value_t::object>
+{
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, const typename BasicJsonType::object_t& obj)
+ {
+ j.m_type = value_t::object;
+ j.m_value = obj;
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType>
+ static void construct(BasicJsonType& j, typename BasicJsonType::object_t&& obj)
+ {
+ j.m_type = value_t::object;
+ j.m_value = std::move(obj);
+ j.assert_invariant();
+ }
+
+ template<typename BasicJsonType, typename CompatibleObjectType,
+ enable_if_t<not std::is_same<CompatibleObjectType, typename BasicJsonType::object_t>::value, int> = 0>
+ static void construct(BasicJsonType& j, const CompatibleObjectType& obj)
+ {
+ using std::begin;
+ using std::end;
+
+ j.m_type = value_t::object;
+ j.m_value.object = j.template create<typename BasicJsonType::object_t>(begin(obj), end(obj));
+ j.assert_invariant();
+ }
+};
+
+/////////////
+// to_json //
+/////////////
+
+template<typename BasicJsonType, typename T,
+ enable_if_t<std::is_same<T, typename BasicJsonType::boolean_t>::value, int> = 0>
+void to_json(BasicJsonType& j, T b) noexcept
+{
+ external_constructor<value_t::boolean>::construct(j, b);
+}
+
+template<typename BasicJsonType, typename CompatibleString,
+ enable_if_t<std::is_constructible<typename BasicJsonType::string_t, CompatibleString>::value, int> = 0>
+void to_json(BasicJsonType& j, const CompatibleString& s)
+{
+ external_constructor<value_t::string>::construct(j, s);
+}
+
+template<typename BasicJsonType>
+void to_json(BasicJsonType& j, typename BasicJsonType::string_t&& s)
+{
+ external_constructor<value_t::string>::construct(j, std::move(s));
+}
+
+template<typename BasicJsonType, typename FloatType,
+ enable_if_t<std::is_floating_point<FloatType>::value, int> = 0>
+void to_json(BasicJsonType& j, FloatType val) noexcept
+{
+ external_constructor<value_t::number_float>::construct(j, static_cast<typename BasicJsonType::number_float_t>(val));
+}
+
+template<typename BasicJsonType, typename CompatibleNumberUnsignedType,
+ enable_if_t<is_compatible_integer_type<typename BasicJsonType::number_unsigned_t, CompatibleNumberUnsignedType>::value, int> = 0>
+void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noexcept
+{
+ external_constructor<value_t::number_unsigned>::construct(j, static_cast<typename BasicJsonType::number_unsigned_t>(val));
+}
+
+template<typename BasicJsonType, typename CompatibleNumberIntegerType,
+ enable_if_t<is_compatible_integer_type<typename BasicJsonType::number_integer_t, CompatibleNumberIntegerType>::value, int> = 0>
+void to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noexcept
+{
+ external_constructor<value_t::number_integer>::construct(j, static_cast<typename BasicJsonType::number_integer_t>(val));
+}
+
+template<typename BasicJsonType, typename EnumType,
+ enable_if_t<std::is_enum<EnumType>::value, int> = 0>
+void to_json(BasicJsonType& j, EnumType e) noexcept
+{
+ using underlying_type = typename std::underlying_type<EnumType>::type;
+ external_constructor<value_t::number_integer>::construct(j, static_cast<underlying_type>(e));
+}
+
+template<typename BasicJsonType>
+void to_json(BasicJsonType& j, const std::vector<bool>& e)
+{
+ external_constructor<value_t::array>::construct(j, e);
+}
+
+template <typename BasicJsonType, typename CompatibleArrayType,
+ enable_if_t<is_compatible_array_type<BasicJsonType,
+ CompatibleArrayType>::value and
+ not is_compatible_object_type<BasicJsonType, CompatibleArrayType>::value and
+ not is_compatible_string_type<BasicJsonType, CompatibleArrayType>::value and
+ not std::is_same<typename BasicJsonType::binary_t, CompatibleArrayType>::value and
+ not is_basic_json<CompatibleArrayType>::value,
+ int> = 0>
+void to_json(BasicJsonType& j, const CompatibleArrayType& arr)
+{
+ external_constructor<value_t::array>::construct(j, arr);
+}
+
+template <typename BasicJsonType>
+void to_json(BasicJsonType& j, const typename BasicJsonType::binary_t& bin)
+{
+ external_constructor<value_t::binary>::construct(j, bin);
+}
+
+template<typename BasicJsonType, typename T,
+ enable_if_t<std::is_convertible<T, BasicJsonType>::value, int> = 0>
+void to_json(BasicJsonType& j, const std::valarray<T>& arr)
+{
+ external_constructor<value_t::array>::construct(j, std::move(arr));
+}
+
+template<typename BasicJsonType>
+void to_json(BasicJsonType& j, typename BasicJsonType::array_t&& arr)
+{
+ external_constructor<value_t::array>::construct(j, std::move(arr));
+}
+
+template<typename BasicJsonType, typename CompatibleObjectType,
+ enable_if_t<is_compatible_object_type<BasicJsonType, CompatibleObjectType>::value and not is_basic_json<CompatibleObjectType>::value, int> = 0>
+void to_json(BasicJsonType& j, const CompatibleObjectType& obj)
+{
+ external_constructor<value_t::object>::construct(j, obj);
+}
+
+template<typename BasicJsonType>
+void to_json(BasicJsonType& j, typename BasicJsonType::object_t&& obj)
+{
+ external_constructor<value_t::object>::construct(j, std::move(obj));
+}
+
+template <
+ typename BasicJsonType, typename T, std::size_t N,
+ enable_if_t<not std::is_constructible<typename BasicJsonType::string_t,
+ const T(&)[N]>::value,
+ int> = 0 >
+void to_json(BasicJsonType& j, const T(&arr)[N])
+{
+ external_constructor<value_t::array>::construct(j, arr);
+}
+
+template < typename BasicJsonType, typename T1, typename T2, enable_if_t < std::is_constructible<BasicJsonType, T1>::value&& std::is_constructible<BasicJsonType, T2>::value, int > = 0 >
+void to_json(BasicJsonType& j, const std::pair<T1, T2>& p)
+{
+ j = { p.first, p.second };
+}
+
+// for https://github.com/nlohmann/json/pull/1134
+template < typename BasicJsonType, typename T,
+ enable_if_t<std::is_same<T, iteration_proxy_value<typename BasicJsonType::iterator>>::value, int> = 0>
+void to_json(BasicJsonType& j, const T& b)
+{
+ j = { {b.key(), b.value()} };
+}
+
+template<typename BasicJsonType, typename Tuple, std::size_t... Idx>
+void to_json_tuple_impl(BasicJsonType& j, const Tuple& t, index_sequence<Idx...> /*unused*/)
+{
+ j = { std::get<Idx>(t)... };
+}
+
+template<typename BasicJsonType, typename T, enable_if_t<is_constructible_tuple<BasicJsonType, T>::value, int > = 0>
+void to_json(BasicJsonType& j, const T& t)
+{
+ to_json_tuple_impl(j, t, make_index_sequence<std::tuple_size<T>::value> {});
+}
+
+struct to_json_fn
+{
+ template<typename BasicJsonType, typename T>
+ auto operator()(BasicJsonType& j, T&& val) const noexcept(noexcept(to_json(j, std::forward<T>(val))))
+ -> decltype(to_json(j, std::forward<T>(val)), void())
+ {
+ return to_json(j, std::forward<T>(val));
+ }
+};
+} // namespace detail
+
+/// namespace to hold default `to_json` function
+namespace
+{
+constexpr const auto& to_json = detail::static_const<detail::to_json_fn>::value;
+} // namespace
+} // namespace nlohmann
+
+
+namespace nlohmann
+{
+
+template<typename, typename>
+struct adl_serializer
+{
+ /*!
+ @brief convert a JSON value to any value type
+
+ This function is usually called by the `get()` function of the
+ @ref basic_json class (either explicit or via conversion operators).
+
+ @param[in] j JSON value to read from
+ @param[in,out] val value to write to
+ */
+ template<typename BasicJsonType, typename ValueType>
+ static auto from_json(BasicJsonType&& j, ValueType& val) noexcept(
+ noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)))
+ -> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void())
+ {
+ ::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
+ }
+
+ /*!
+ @brief convert any value type to a JSON value
+
+ This function is usually called by the constructors of the @ref basic_json
+ class.
+
+ @param[in,out] j JSON value to write to
+ @param[in] val value to read from
+ */
+ template <typename BasicJsonType, typename ValueType>
+ static auto to_json(BasicJsonType& j, ValueType&& val) noexcept(
+ noexcept(::nlohmann::to_json(j, std::forward<ValueType>(val))))
+ -> decltype(::nlohmann::to_json(j, std::forward<ValueType>(val)), void())
+ {
+ ::nlohmann::to_json(j, std::forward<ValueType>(val));
+ }
+};
+
+} // namespace nlohmann
+
+// #include <nlohmann/byte_container_with_subtype.hpp>
+
+
+#include <cstdint> // uint8_t
+#include <tuple> // tie
+#include <utility> // move
+
+namespace nlohmann
+{
+
+/*!
+@brief an internal type for a backed binary type
+
+This type extends the template parameter @a BinaryType provided to `basic_json`
+with a subtype used by BSON and MessagePack. This type exists so that the user
+does not have to specify a type themselves with a specific naming scheme in
+order to override the binary type.
+
+@tparam BinaryType container to store bytes (`std::vector<std::uint8_t>` by
+ default)
+
+@since version 3.8.0
+*/
+template<typename BinaryType>
+class byte_container_with_subtype : public BinaryType
+{
+ public:
+ /// the type of the underlying container
+ using container_type = BinaryType;
+
+ byte_container_with_subtype() noexcept(noexcept(container_type()))
+ : container_type()
+ {}
+
+ byte_container_with_subtype(const container_type& b) noexcept(noexcept(container_type(b)))
+ : container_type(b)
+ {}
+
+ byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b))))
+ : container_type(std::move(b))
+ {}
+
+ byte_container_with_subtype(const container_type& b, std::uint8_t subtype) noexcept(noexcept(container_type(b)))
+ : container_type(b)
+ , m_subtype(subtype)
+ , m_has_subtype(true)
+ {}
+
+ byte_container_with_subtype(container_type&& b, std::uint8_t subtype) noexcept(noexcept(container_type(std::move(b))))
+ : container_type(std::move(b))
+ , m_subtype(subtype)
+ , m_has_subtype(true)
+ {}
+
+ bool operator==(const byte_container_with_subtype& rhs) const
+ {
+ return std::tie(static_cast<const BinaryType&>(*this), m_subtype, m_has_subtype) ==
+ std::tie(static_cast<const BinaryType&>(rhs), rhs.m_subtype, rhs.m_has_subtype);
+ }
+
+ bool operator!=(const byte_container_with_subtype& rhs) const
+ {
+ return !(rhs == *this);
+ }
+
+ /*!
+ @brief sets the binary subtype
+
+ Sets the binary subtype of the value, also flags a binary JSON value as
+ having a subtype, which has implications for serialization.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @sa @ref subtype() -- return the binary subtype
+ @sa @ref clear_subtype() -- clears the binary subtype
+ @sa @ref has_subtype() -- returns whether or not the binary value has a
+ subtype
+
+ @since version 3.8.0
+ */
+ void set_subtype(std::uint8_t subtype) noexcept
+ {
+ m_subtype = subtype;
+ m_has_subtype = true;
+ }
+
+ /*!
+ @brief return the binary subtype
+
+ Returns the numerical subtype of the value if it has a subtype. If it does
+ not have a subtype, this function will return size_t(-1) as a sentinel
+ value.
+
+ @return the numerical subtype of the binary value
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @sa @ref set_subtype() -- sets the binary subtype
+ @sa @ref clear_subtype() -- clears the binary subtype
+ @sa @ref has_subtype() -- returns whether or not the binary value has a
+ subtype
+
+ @since version 3.8.0
+ */
+ constexpr std::uint8_t subtype() const noexcept
+ {
+ return m_subtype;
+ }
+
+ /*!
+ @brief return whether the value has a subtype
+
+ @return whether the value has a subtype
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @sa @ref subtype() -- return the binary subtype
+ @sa @ref set_subtype() -- sets the binary subtype
+ @sa @ref clear_subtype() -- clears the binary subtype
+
+ @since version 3.8.0
+ */
+ constexpr bool has_subtype() const noexcept
+ {
+ return m_has_subtype;
+ }
+
+ /*!
+ @brief clears the binary subtype
+
+ Clears the binary subtype and flags the value as not having a subtype, which
+ has implications for serialization; for instance MessagePack will prefer the
+ bin family over the ext family.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @sa @ref subtype() -- return the binary subtype
+ @sa @ref set_subtype() -- sets the binary subtype
+ @sa @ref has_subtype() -- returns whether or not the binary value has a
+ subtype
+
+ @since version 3.8.0
+ */
+ void clear_subtype() noexcept
+ {
+ m_subtype = 0;
+ m_has_subtype = false;
+ }
+
+ private:
+ std::uint8_t m_subtype = 0;
+ bool m_has_subtype = false;
+};
+
+} // namespace nlohmann
+
+// #include <nlohmann/detail/boolean_operators.hpp>
+
+// #include <nlohmann/detail/conversions/from_json.hpp>
+
+// #include <nlohmann/detail/conversions/to_json.hpp>
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+// #include <nlohmann/detail/input/binary_reader.hpp>
+
+
+#include <algorithm> // generate_n
+#include <array> // array
+#include <cassert> // assert
+#include <cmath> // ldexp
+#include <cstddef> // size_t
+#include <cstdint> // uint8_t, uint16_t, uint32_t, uint64_t
+#include <cstdio> // snprintf
+#include <cstring> // memcpy
+#include <iterator> // back_inserter
+#include <limits> // numeric_limits
+#include <string> // char_traits, string
+#include <utility> // make_pair, move
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+// #include <nlohmann/detail/input/input_adapters.hpp>
+
+
+#include <array> // array
+#include <cassert> // assert
+#include <cstddef> // size_t
+#include <cstdio> //FILE *
+#include <cstring> // strlen
+#include <istream> // istream
+#include <iterator> // begin, end, iterator_traits, random_access_iterator_tag, distance, next
+#include <memory> // shared_ptr, make_shared, addressof
+#include <numeric> // accumulate
+#include <string> // string, char_traits
+#include <type_traits> // enable_if, is_base_of, is_pointer, is_integral, remove_pointer
+#include <utility> // pair, declval
+
+// #include <nlohmann/detail/iterators/iterator_traits.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+/// the supported input formats
+enum class input_format_t { json, cbor, msgpack, ubjson, bson };
+
+////////////////////
+// input adapters //
+////////////////////
+
+/*!
+Input adapter for stdio file access. This adapter read only 1 byte and do not use any
+ buffer. This adapter is a very low level adapter.
+*/
+class file_input_adapter
+{
+ public:
+ using char_type = char;
+
+ JSON_HEDLEY_NON_NULL(2)
+ explicit file_input_adapter(std::FILE* f) noexcept
+ : m_file(f)
+ {}
+
+ // make class move-only
+ file_input_adapter(const file_input_adapter&) = delete;
+ file_input_adapter(file_input_adapter&&) = default;
+ file_input_adapter& operator=(const file_input_adapter&) = delete;
+ file_input_adapter& operator=(file_input_adapter&&) = delete;
+
+ std::char_traits<char>::int_type get_character() noexcept
+ {
+ return std::fgetc(m_file);
+ }
+
+ private:
+ /// the file pointer to read from
+ std::FILE* m_file;
+};
+
+
+/*!
+Input adapter for a (caching) istream. Ignores a UFT Byte Order Mark at
+beginning of input. Does not support changing the underlying std::streambuf
+in mid-input. Maintains underlying std::istream and std::streambuf to support
+subsequent use of standard std::istream operations to process any input
+characters following those used in parsing the JSON input. Clears the
+std::istream flags; any input errors (e.g., EOF) will be detected by the first
+subsequent call for input from the std::istream.
+*/
+class input_stream_adapter
+{
+ public:
+ using char_type = char;
+
+ ~input_stream_adapter()
+ {
+ // clear stream flags; we use underlying streambuf I/O, do not
+ // maintain ifstream flags, except eof
+ if (is)
+ {
+ is->clear(is->rdstate() & std::ios::eofbit);
+ }
+ }
+
+ explicit input_stream_adapter(std::istream& i)
+ : is(&i), sb(i.rdbuf())
+ {}
+
+ // delete because of pointer members
+ input_stream_adapter(const input_stream_adapter&) = delete;
+ input_stream_adapter& operator=(input_stream_adapter&) = delete;
+ input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete;
+
+ input_stream_adapter(input_stream_adapter&& rhs) : is(rhs.is), sb(rhs.sb)
+ {
+ rhs.is = nullptr;
+ rhs.sb = nullptr;
+ }
+
+ // std::istream/std::streambuf use std::char_traits<char>::to_int_type, to
+ // ensure that std::char_traits<char>::eof() and the character 0xFF do not
+ // end up as the same value, eg. 0xFFFFFFFF.
+ std::char_traits<char>::int_type get_character()
+ {
+ auto res = sb->sbumpc();
+ // set eof manually, as we don't use the istream interface.
+ if (JSON_HEDLEY_UNLIKELY(res == EOF))
+ {
+ is->clear(is->rdstate() | std::ios::eofbit);
+ }
+ return res;
+ }
+
+ private:
+ /// the associated input stream
+ std::istream* is = nullptr;
+ std::streambuf* sb = nullptr;
+};
+
+// General-purpose iterator-based adapter. It might not be as fast as
+// theoretically possible for some containers, but it is extremely versatile.
+template<typename IteratorType>
+class iterator_input_adapter
+{
+ public:
+ using char_type = typename std::iterator_traits<IteratorType>::value_type;
+
+ iterator_input_adapter(IteratorType first, IteratorType last)
+ : current(std::move(first)), end(std::move(last)) {}
+
+ typename std::char_traits<char_type>::int_type get_character()
+ {
+ if (JSON_HEDLEY_LIKELY(current != end))
+ {
+ auto result = std::char_traits<char_type>::to_int_type(*current);
+ std::advance(current, 1);
+ return result;
+ }
+ else
+ {
+ return std::char_traits<char_type>::eof();
+ }
+ }
+
+ private:
+ IteratorType current;
+ IteratorType end;
+
+ template<typename BaseInputAdapter, size_t T>
+ friend struct wide_string_input_helper;
+
+ bool empty() const
+ {
+ return current == end;
+ }
+
+};
+
+
+template<typename BaseInputAdapter, size_t T>
+struct wide_string_input_helper;
+
+template<typename BaseInputAdapter>
+struct wide_string_input_helper<BaseInputAdapter, 4>
+{
+ // UTF-32
+ static void fill_buffer(BaseInputAdapter& input,
+ std::array<std::char_traits<char>::int_type, 4>& utf8_bytes,
+ size_t& utf8_bytes_index,
+ size_t& utf8_bytes_filled)
+ {
+ utf8_bytes_index = 0;
+
+ if (JSON_HEDLEY_UNLIKELY(input.empty()))
+ {
+ utf8_bytes[0] = std::char_traits<char>::eof();
+ utf8_bytes_filled = 1;
+ }
+ else
+ {
+ // get the current character
+ const auto wc = input.get_character();
+
+ // UTF-32 to UTF-8 encoding
+ if (wc < 0x80)
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(wc);
+ utf8_bytes_filled = 1;
+ }
+ else if (wc <= 0x7FF)
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xC0u | ((static_cast<unsigned int>(wc) >> 6u) & 0x1Fu));
+ utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | (static_cast<unsigned int>(wc) & 0x3Fu));
+ utf8_bytes_filled = 2;
+ }
+ else if (wc <= 0xFFFF)
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xE0u | ((static_cast<unsigned int>(wc) >> 12u) & 0x0Fu));
+ utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | ((static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
+ utf8_bytes[2] = static_cast<std::char_traits<char>::int_type>(0x80u | (static_cast<unsigned int>(wc) & 0x3Fu));
+ utf8_bytes_filled = 3;
+ }
+ else if (wc <= 0x10FFFF)
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xF0u | ((static_cast<unsigned int>(wc) >> 18u) & 0x07u));
+ utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | ((static_cast<unsigned int>(wc) >> 12u) & 0x3Fu));
+ utf8_bytes[2] = static_cast<std::char_traits<char>::int_type>(0x80u | ((static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
+ utf8_bytes[3] = static_cast<std::char_traits<char>::int_type>(0x80u | (static_cast<unsigned int>(wc) & 0x3Fu));
+ utf8_bytes_filled = 4;
+ }
+ else
+ {
+ // unknown character
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(wc);
+ utf8_bytes_filled = 1;
+ }
+ }
+ }
+};
+
+template<typename BaseInputAdapter>
+struct wide_string_input_helper<BaseInputAdapter, 2>
+{
+ // UTF-16
+ static void fill_buffer(BaseInputAdapter& input,
+ std::array<std::char_traits<char>::int_type, 4>& utf8_bytes,
+ size_t& utf8_bytes_index,
+ size_t& utf8_bytes_filled)
+ {
+ utf8_bytes_index = 0;
+
+ if (JSON_HEDLEY_UNLIKELY(input.empty()))
+ {
+ utf8_bytes[0] = std::char_traits<char>::eof();
+ utf8_bytes_filled = 1;
+ }
+ else
+ {
+ // get the current character
+ const auto wc = input.get_character();
+
+ // UTF-16 to UTF-8 encoding
+ if (wc < 0x80)
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(wc);
+ utf8_bytes_filled = 1;
+ }
+ else if (wc <= 0x7FF)
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xC0u | ((static_cast<unsigned int>(wc) >> 6u)));
+ utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | (static_cast<unsigned int>(wc) & 0x3Fu));
+ utf8_bytes_filled = 2;
+ }
+ else if (0xD800 > wc or wc >= 0xE000)
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xE0u | ((static_cast<unsigned int>(wc) >> 12u)));
+ utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | ((static_cast<unsigned int>(wc) >> 6u) & 0x3Fu));
+ utf8_bytes[2] = static_cast<std::char_traits<char>::int_type>(0x80u | (static_cast<unsigned int>(wc) & 0x3Fu));
+ utf8_bytes_filled = 3;
+ }
+ else
+ {
+ if (JSON_HEDLEY_UNLIKELY(not input.empty()))
+ {
+ const auto wc2 = static_cast<unsigned int>(input.get_character());
+ const auto charcode = 0x10000u + (((static_cast<unsigned int>(wc) & 0x3FFu) << 10u) | (wc2 & 0x3FFu));
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(0xF0u | (charcode >> 18u));
+ utf8_bytes[1] = static_cast<std::char_traits<char>::int_type>(0x80u | ((charcode >> 12u) & 0x3Fu));
+ utf8_bytes[2] = static_cast<std::char_traits<char>::int_type>(0x80u | ((charcode >> 6u) & 0x3Fu));
+ utf8_bytes[3] = static_cast<std::char_traits<char>::int_type>(0x80u | (charcode & 0x3Fu));
+ utf8_bytes_filled = 4;
+ }
+ else
+ {
+ utf8_bytes[0] = static_cast<std::char_traits<char>::int_type>(wc);
+ utf8_bytes_filled = 1;
+ }
+ }
+ }
+ }
+};
+
+// Wraps another input apdater to convert wide character types into individual bytes.
+template<typename BaseInputAdapter, typename WideCharType>
+class wide_string_input_adapter
+{
+ public:
+ using char_type = char;
+
+ wide_string_input_adapter(BaseInputAdapter base)
+ : base_adapter(base) {}
+
+ typename std::char_traits<char>::int_type get_character() noexcept
+ {
+ // check if buffer needs to be filled
+ if (utf8_bytes_index == utf8_bytes_filled)
+ {
+ fill_buffer<sizeof(WideCharType)>();
+
+ assert(utf8_bytes_filled > 0);
+ assert(utf8_bytes_index == 0);
+ }
+
+ // use buffer
+ assert(utf8_bytes_filled > 0);
+ assert(utf8_bytes_index < utf8_bytes_filled);
+ return utf8_bytes[utf8_bytes_index++];
+ }
+
+ private:
+ BaseInputAdapter base_adapter;
+
+ template<size_t T>
+ void fill_buffer()
+ {
+ wide_string_input_helper<BaseInputAdapter, T>::fill_buffer(base_adapter, utf8_bytes, utf8_bytes_index, utf8_bytes_filled);
+ }
+
+ /// a buffer for UTF-8 bytes
+ std::array<std::char_traits<char>::int_type, 4> utf8_bytes = {{0, 0, 0, 0}};
+
+ /// index to the utf8_codes array for the next valid byte
+ std::size_t utf8_bytes_index = 0;
+ /// number of valid bytes in the utf8_codes array
+ std::size_t utf8_bytes_filled = 0;
+};
+
+
+template<typename IteratorType, typename Enable = void>
+struct iterator_input_adapter_factory
+{
+ using iterator_type = IteratorType;
+ using char_type = typename std::iterator_traits<iterator_type>::value_type;
+ using adapter_type = iterator_input_adapter<iterator_type>;
+
+ static adapter_type create(IteratorType first, IteratorType last)
+ {
+ return adapter_type(std::move(first), std::move(last));
+ }
+};
+
+template<typename T>
+struct is_iterator_of_multibyte
+{
+ using value_type = typename std::iterator_traits<T>::value_type;
+ enum
+ {
+ value = sizeof(value_type) > 1
+ };
+};
+
+template<typename IteratorType>
+struct iterator_input_adapter_factory<IteratorType, enable_if_t<is_iterator_of_multibyte<IteratorType>::value>>
+{
+ using iterator_type = IteratorType;
+ using char_type = typename std::iterator_traits<iterator_type>::value_type;
+ using base_adapter_type = iterator_input_adapter<iterator_type>;
+ using adapter_type = wide_string_input_adapter<base_adapter_type, char_type>;
+
+ static adapter_type create(IteratorType first, IteratorType last)
+ {
+ return adapter_type(base_adapter_type(std::move(first), std::move(last)));
+ }
+};
+
+// General purpose iterator-based input
+template<typename IteratorType>
+typename iterator_input_adapter_factory<IteratorType>::adapter_type input_adapter(IteratorType first, IteratorType last)
+{
+ using factory_type = iterator_input_adapter_factory<IteratorType>;
+ return factory_type::create(first, last);
+}
+
+// Convenience shorthand from container to iterator
+template<typename ContainerType>
+auto input_adapter(const ContainerType& container) -> decltype(input_adapter(begin(container), end(container)))
+{
+ // Enable ADL
+ using std::begin;
+ using std::end;
+
+ return input_adapter(begin(container), end(container));
+}
+
+// Special cases with fast paths
+inline file_input_adapter input_adapter(std::FILE* file)
+{
+ return file_input_adapter(file);
+}
+
+inline input_stream_adapter input_adapter(std::istream& stream)
+{
+ return input_stream_adapter(stream);
+}
+
+inline input_stream_adapter input_adapter(std::istream&& stream)
+{
+ return input_stream_adapter(stream);
+}
+
+using contiguous_bytes_input_adapter = decltype(input_adapter(std::declval<const char*>(), std::declval<const char*>()));
+
+// Null-delimited strings, and the like.
+template < typename CharT,
+ typename std::enable_if <
+ std::is_pointer<CharT>::value and
+ not std::is_array<CharT>::value and
+ std::is_integral<typename std::remove_pointer<CharT>::type>::value and
+ sizeof(typename std::remove_pointer<CharT>::type) == 1,
+ int >::type = 0 >
+contiguous_bytes_input_adapter input_adapter(CharT b)
+{
+ auto length = std::strlen(reinterpret_cast<const char*>(b));
+ auto ptr = reinterpret_cast<const char*>(b);
+ return input_adapter(ptr, ptr + length);
+}
+
+template<typename T, std::size_t N>
+auto input_adapter(T (&array)[N]) -> decltype(input_adapter(array, array + N))
+{
+ return input_adapter(array, array + N);
+}
+
+// This class only handles inputs of input_buffer_adapter type.
+// It's required so that expressions like {ptr, len} can be implicitely casted
+// to the correct adapter.
+class span_input_adapter
+{
+ public:
+ template<typename CharT,
+ typename std::enable_if<
+ std::is_pointer<CharT>::value and
+ std::is_integral<typename std::remove_pointer<CharT>::type>::value and
+ sizeof(typename std::remove_pointer<CharT>::type) == 1,
+ int>::type = 0>
+ span_input_adapter(CharT b, std::size_t l)
+ : ia(reinterpret_cast<const char*>(b), reinterpret_cast<const char*>(b) + l) {}
+
+ template<class IteratorType,
+ typename std::enable_if<
+ std::is_same<typename iterator_traits<IteratorType>::iterator_category, std::random_access_iterator_tag>::value,
+ int>::type = 0>
+ span_input_adapter(IteratorType first, IteratorType last)
+ : ia(input_adapter(first, last)) {}
+
+ contiguous_bytes_input_adapter&& get()
+ {
+ return std::move(ia);
+ }
+
+ private:
+ contiguous_bytes_input_adapter ia;
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/input/json_sax.hpp>
+
+
+#include <cassert> // assert
+#include <cstddef>
+#include <string> // string
+#include <utility> // move
+#include <vector> // vector
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+
+namespace nlohmann
+{
+
+/*!
+@brief SAX interface
+
+This class describes the SAX interface used by @ref nlohmann::json::sax_parse.
+Each function is called in different situations while the input is parsed. The
+boolean return value informs the parser whether to continue processing the
+input.
+*/
+template<typename BasicJsonType>
+struct json_sax
+{
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+ using binary_t = typename BasicJsonType::binary_t;
+
+ /*!
+ @brief a null value was read
+ @return whether parsing should proceed
+ */
+ virtual bool null() = 0;
+
+ /*!
+ @brief a boolean value was read
+ @param[in] val boolean value
+ @return whether parsing should proceed
+ */
+ virtual bool boolean(bool val) = 0;
+
+ /*!
+ @brief an integer number was read
+ @param[in] val integer value
+ @return whether parsing should proceed
+ */
+ virtual bool number_integer(number_integer_t val) = 0;
+
+ /*!
+ @brief an unsigned integer number was read
+ @param[in] val unsigned integer value
+ @return whether parsing should proceed
+ */
+ virtual bool number_unsigned(number_unsigned_t val) = 0;
+
+ /*!
+ @brief an floating-point number was read
+ @param[in] val floating-point value
+ @param[in] s raw token value
+ @return whether parsing should proceed
+ */
+ virtual bool number_float(number_float_t val, const string_t& s) = 0;
+
+ /*!
+ @brief a string was read
+ @param[in] val string value
+ @return whether parsing should proceed
+ @note It is safe to move the passed string.
+ */
+ virtual bool string(string_t& val) = 0;
+
+ /*!
+ @brief a binary string was read
+ @param[in] val binary value
+ @return whether parsing should proceed
+ @note It is safe to move the passed binary.
+ */
+ virtual bool binary(binary_t& val) = 0;
+
+ /*!
+ @brief the beginning of an object was read
+ @param[in] elements number of object elements or -1 if unknown
+ @return whether parsing should proceed
+ @note binary formats may report the number of elements
+ */
+ virtual bool start_object(std::size_t elements) = 0;
+
+ /*!
+ @brief an object key was read
+ @param[in] val object key
+ @return whether parsing should proceed
+ @note It is safe to move the passed string.
+ */
+ virtual bool key(string_t& val) = 0;
+
+ /*!
+ @brief the end of an object was read
+ @return whether parsing should proceed
+ */
+ virtual bool end_object() = 0;
+
+ /*!
+ @brief the beginning of an array was read
+ @param[in] elements number of array elements or -1 if unknown
+ @return whether parsing should proceed
+ @note binary formats may report the number of elements
+ */
+ virtual bool start_array(std::size_t elements) = 0;
+
+ /*!
+ @brief the end of an array was read
+ @return whether parsing should proceed
+ */
+ virtual bool end_array() = 0;
+
+ /*!
+ @brief a parse error occurred
+ @param[in] position the position in the input where the error occurs
+ @param[in] last_token the last read token
+ @param[in] ex an exception object describing the error
+ @return whether parsing should proceed (must return false)
+ */
+ virtual bool parse_error(std::size_t position,
+ const std::string& last_token,
+ const detail::exception& ex) = 0;
+
+ virtual ~json_sax() = default;
+};
+
+
+namespace detail
+{
+/*!
+@brief SAX implementation to create a JSON value from SAX events
+
+This class implements the @ref json_sax interface and processes the SAX events
+to create a JSON value which makes it basically a DOM parser. The structure or
+hierarchy of the JSON value is managed by the stack `ref_stack` which contains
+a pointer to the respective array or object for each recursion depth.
+
+After successful parsing, the value that is passed by reference to the
+constructor contains the parsed value.
+
+@tparam BasicJsonType the JSON type
+*/
+template<typename BasicJsonType>
+class json_sax_dom_parser
+{
+ public:
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+ using binary_t = typename BasicJsonType::binary_t;
+
+ /*!
+ @param[in, out] r reference to a JSON value that is manipulated while
+ parsing
+ @param[in] allow_exceptions_ whether parse errors yield exceptions
+ */
+ explicit json_sax_dom_parser(BasicJsonType& r, const bool allow_exceptions_ = true)
+ : root(r), allow_exceptions(allow_exceptions_)
+ {}
+
+ // make class move-only
+ json_sax_dom_parser(const json_sax_dom_parser&) = delete;
+ json_sax_dom_parser(json_sax_dom_parser&&) = default;
+ json_sax_dom_parser& operator=(const json_sax_dom_parser&) = delete;
+ json_sax_dom_parser& operator=(json_sax_dom_parser&&) = default;
+ ~json_sax_dom_parser() = default;
+
+ bool null()
+ {
+ handle_value(nullptr);
+ return true;
+ }
+
+ bool boolean(bool val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool number_integer(number_integer_t val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool number_unsigned(number_unsigned_t val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool number_float(number_float_t val, const string_t& /*unused*/)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool string(string_t& val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool binary(binary_t& val)
+ {
+ handle_value(std::move(val));
+ return true;
+ }
+
+ bool start_object(std::size_t len)
+ {
+ ref_stack.push_back(handle_value(BasicJsonType::value_t::object));
+
+ if (JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
+ {
+ JSON_THROW(out_of_range::create(408,
+ "excessive object size: " + std::to_string(len)));
+ }
+
+ return true;
+ }
+
+ bool key(string_t& val)
+ {
+ // add null at given key and store the reference for later
+ object_element = &(ref_stack.back()->m_value.object->operator[](val));
+ return true;
+ }
+
+ bool end_object()
+ {
+ ref_stack.pop_back();
+ return true;
+ }
+
+ bool start_array(std::size_t len)
+ {
+ ref_stack.push_back(handle_value(BasicJsonType::value_t::array));
+
+ if (JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
+ {
+ JSON_THROW(out_of_range::create(408,
+ "excessive array size: " + std::to_string(len)));
+ }
+
+ return true;
+ }
+
+ bool end_array()
+ {
+ ref_stack.pop_back();
+ return true;
+ }
+
+ bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/,
+ const detail::exception& ex)
+ {
+ errored = true;
+ if (allow_exceptions)
+ {
+ // determine the proper exception type from the id
+ switch ((ex.id / 100) % 100)
+ {
+ case 1:
+ JSON_THROW(*static_cast<const detail::parse_error*>(&ex));
+ case 4:
+ JSON_THROW(*static_cast<const detail::out_of_range*>(&ex));
+ // LCOV_EXCL_START
+ case 2:
+ JSON_THROW(*static_cast<const detail::invalid_iterator*>(&ex));
+ case 3:
+ JSON_THROW(*static_cast<const detail::type_error*>(&ex));
+ case 5:
+ JSON_THROW(*static_cast<const detail::other_error*>(&ex));
+ default:
+ assert(false);
+ // LCOV_EXCL_STOP
+ }
+ }
+ return false;
+ }
+
+ constexpr bool is_errored() const
+ {
+ return errored;
+ }
+
+ private:
+ /*!
+ @invariant If the ref stack is empty, then the passed value will be the new
+ root.
+ @invariant If the ref stack contains a value, then it is an array or an
+ object to which we can add elements
+ */
+ template<typename Value>
+ JSON_HEDLEY_RETURNS_NON_NULL
+ BasicJsonType* handle_value(Value&& v)
+ {
+ if (ref_stack.empty())
+ {
+ root = BasicJsonType(std::forward<Value>(v));
+ return &root;
+ }
+
+ assert(ref_stack.back()->is_array() or ref_stack.back()->is_object());
+
+ if (ref_stack.back()->is_array())
+ {
+ ref_stack.back()->m_value.array->emplace_back(std::forward<Value>(v));
+ return &(ref_stack.back()->m_value.array->back());
+ }
+
+ assert(ref_stack.back()->is_object());
+ assert(object_element);
+ *object_element = BasicJsonType(std::forward<Value>(v));
+ return object_element;
+ }
+
+ /// the parsed JSON value
+ BasicJsonType& root;
+ /// stack to model hierarchy of values
+ std::vector<BasicJsonType*> ref_stack {};
+ /// helper to hold the reference for the next object element
+ BasicJsonType* object_element = nullptr;
+ /// whether a syntax error occurred
+ bool errored = false;
+ /// whether to throw exceptions in case of errors
+ const bool allow_exceptions = true;
+};
+
+template<typename BasicJsonType>
+class json_sax_dom_callback_parser
+{
+ public:
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+ using binary_t = typename BasicJsonType::binary_t;
+ using parser_callback_t = typename BasicJsonType::parser_callback_t;
+ using parse_event_t = typename BasicJsonType::parse_event_t;
+
+ json_sax_dom_callback_parser(BasicJsonType& r,
+ const parser_callback_t cb,
+ const bool allow_exceptions_ = true)
+ : root(r), callback(cb), allow_exceptions(allow_exceptions_)
+ {
+ keep_stack.push_back(true);
+ }
+
+ // make class move-only
+ json_sax_dom_callback_parser(const json_sax_dom_callback_parser&) = delete;
+ json_sax_dom_callback_parser(json_sax_dom_callback_parser&&) = default;
+ json_sax_dom_callback_parser& operator=(const json_sax_dom_callback_parser&) = delete;
+ json_sax_dom_callback_parser& operator=(json_sax_dom_callback_parser&&) = default;
+ ~json_sax_dom_callback_parser() = default;
+
+ bool null()
+ {
+ handle_value(nullptr);
+ return true;
+ }
+
+ bool boolean(bool val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool number_integer(number_integer_t val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool number_unsigned(number_unsigned_t val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool number_float(number_float_t val, const string_t& /*unused*/)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool string(string_t& val)
+ {
+ handle_value(val);
+ return true;
+ }
+
+ bool binary(binary_t& val)
+ {
+ handle_value(std::move(val));
+ return true;
+ }
+
+ bool start_object(std::size_t len)
+ {
+ // check callback for object start
+ const bool keep = callback(static_cast<int>(ref_stack.size()), parse_event_t::object_start, discarded);
+ keep_stack.push_back(keep);
+
+ auto val = handle_value(BasicJsonType::value_t::object, true);
+ ref_stack.push_back(val.second);
+
+ // check object limit
+ if (ref_stack.back() and JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
+ {
+ JSON_THROW(out_of_range::create(408, "excessive object size: " + std::to_string(len)));
+ }
+
+ return true;
+ }
+
+ bool key(string_t& val)
+ {
+ BasicJsonType k = BasicJsonType(val);
+
+ // check callback for key
+ const bool keep = callback(static_cast<int>(ref_stack.size()), parse_event_t::key, k);
+ key_keep_stack.push_back(keep);
+
+ // add discarded value at given key and store the reference for later
+ if (keep and ref_stack.back())
+ {
+ object_element = &(ref_stack.back()->m_value.object->operator[](val) = discarded);
+ }
+
+ return true;
+ }
+
+ bool end_object()
+ {
+ if (ref_stack.back() and not callback(static_cast<int>(ref_stack.size()) - 1, parse_event_t::object_end, *ref_stack.back()))
+ {
+ // discard object
+ *ref_stack.back() = discarded;
+ }
+
+ assert(not ref_stack.empty());
+ assert(not keep_stack.empty());
+ ref_stack.pop_back();
+ keep_stack.pop_back();
+
+ if (not ref_stack.empty() and ref_stack.back() and ref_stack.back()->is_structured())
+ {
+ // remove discarded value
+ for (auto it = ref_stack.back()->begin(); it != ref_stack.back()->end(); ++it)
+ {
+ if (it->is_discarded())
+ {
+ ref_stack.back()->erase(it);
+ break;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ bool start_array(std::size_t len)
+ {
+ const bool keep = callback(static_cast<int>(ref_stack.size()), parse_event_t::array_start, discarded);
+ keep_stack.push_back(keep);
+
+ auto val = handle_value(BasicJsonType::value_t::array, true);
+ ref_stack.push_back(val.second);
+
+ // check array limit
+ if (ref_stack.back() and JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) and len > ref_stack.back()->max_size()))
+ {
+ JSON_THROW(out_of_range::create(408, "excessive array size: " + std::to_string(len)));
+ }
+
+ return true;
+ }
+
+ bool end_array()
+ {
+ bool keep = true;
+
+ if (ref_stack.back())
+ {
+ keep = callback(static_cast<int>(ref_stack.size()) - 1, parse_event_t::array_end, *ref_stack.back());
+ if (not keep)
+ {
+ // discard array
+ *ref_stack.back() = discarded;
+ }
+ }
+
+ assert(not ref_stack.empty());
+ assert(not keep_stack.empty());
+ ref_stack.pop_back();
+ keep_stack.pop_back();
+
+ // remove discarded value
+ if (not keep and not ref_stack.empty() and ref_stack.back()->is_array())
+ {
+ ref_stack.back()->m_value.array->pop_back();
+ }
+
+ return true;
+ }
+
+ bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/,
+ const detail::exception& ex)
+ {
+ errored = true;
+ if (allow_exceptions)
+ {
+ // determine the proper exception type from the id
+ switch ((ex.id / 100) % 100)
+ {
+ case 1:
+ JSON_THROW(*static_cast<const detail::parse_error*>(&ex));
+ case 4:
+ JSON_THROW(*static_cast<const detail::out_of_range*>(&ex));
+ // LCOV_EXCL_START
+ case 2:
+ JSON_THROW(*static_cast<const detail::invalid_iterator*>(&ex));
+ case 3:
+ JSON_THROW(*static_cast<const detail::type_error*>(&ex));
+ case 5:
+ JSON_THROW(*static_cast<const detail::other_error*>(&ex));
+ default:
+ assert(false);
+ // LCOV_EXCL_STOP
+ }
+ }
+ return false;
+ }
+
+ constexpr bool is_errored() const
+ {
+ return errored;
+ }
+
+ private:
+ /*!
+ @param[in] v value to add to the JSON value we build during parsing
+ @param[in] skip_callback whether we should skip calling the callback
+ function; this is required after start_array() and
+ start_object() SAX events, because otherwise we would call the
+ callback function with an empty array or object, respectively.
+
+ @invariant If the ref stack is empty, then the passed value will be the new
+ root.
+ @invariant If the ref stack contains a value, then it is an array or an
+ object to which we can add elements
+
+ @return pair of boolean (whether value should be kept) and pointer (to the
+ passed value in the ref_stack hierarchy; nullptr if not kept)
+ */
+ template<typename Value>
+ std::pair<bool, BasicJsonType*> handle_value(Value&& v, const bool skip_callback = false)
+ {
+ assert(not keep_stack.empty());
+
+ // do not handle this value if we know it would be added to a discarded
+ // container
+ if (not keep_stack.back())
+ {
+ return {false, nullptr};
+ }
+
+ // create value
+ auto value = BasicJsonType(std::forward<Value>(v));
+
+ // check callback
+ const bool keep = skip_callback or callback(static_cast<int>(ref_stack.size()), parse_event_t::value, value);
+
+ // do not handle this value if we just learnt it shall be discarded
+ if (not keep)
+ {
+ return {false, nullptr};
+ }
+
+ if (ref_stack.empty())
+ {
+ root = std::move(value);
+ return {true, &root};
+ }
+
+ // skip this value if we already decided to skip the parent
+ // (https://github.com/nlohmann/json/issues/971#issuecomment-413678360)
+ if (not ref_stack.back())
+ {
+ return {false, nullptr};
+ }
+
+ // we now only expect arrays and objects
+ assert(ref_stack.back()->is_array() or ref_stack.back()->is_object());
+
+ // array
+ if (ref_stack.back()->is_array())
+ {
+ ref_stack.back()->m_value.array->push_back(std::move(value));
+ return {true, &(ref_stack.back()->m_value.array->back())};
+ }
+
+ // object
+ assert(ref_stack.back()->is_object());
+ // check if we should store an element for the current key
+ assert(not key_keep_stack.empty());
+ const bool store_element = key_keep_stack.back();
+ key_keep_stack.pop_back();
+
+ if (not store_element)
+ {
+ return {false, nullptr};
+ }
+
+ assert(object_element);
+ *object_element = std::move(value);
+ return {true, object_element};
+ }
+
+ /// the parsed JSON value
+ BasicJsonType& root;
+ /// stack to model hierarchy of values
+ std::vector<BasicJsonType*> ref_stack {};
+ /// stack to manage which values to keep
+ std::vector<bool> keep_stack {};
+ /// stack to manage which object keys to keep
+ std::vector<bool> key_keep_stack {};
+ /// helper to hold the reference for the next object element
+ BasicJsonType* object_element = nullptr;
+ /// whether a syntax error occurred
+ bool errored = false;
+ /// callback function
+ const parser_callback_t callback = nullptr;
+ /// whether to throw exceptions in case of errors
+ const bool allow_exceptions = true;
+ /// a discarded value for the callback
+ BasicJsonType discarded = BasicJsonType::value_t::discarded;
+};
+
+template<typename BasicJsonType>
+class json_sax_acceptor
+{
+ public:
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+ using binary_t = typename BasicJsonType::binary_t;
+
+ bool null()
+ {
+ return true;
+ }
+
+ bool boolean(bool /*unused*/)
+ {
+ return true;
+ }
+
+ bool number_integer(number_integer_t /*unused*/)
+ {
+ return true;
+ }
+
+ bool number_unsigned(number_unsigned_t /*unused*/)
+ {
+ return true;
+ }
+
+ bool number_float(number_float_t /*unused*/, const string_t& /*unused*/)
+ {
+ return true;
+ }
+
+ bool string(string_t& /*unused*/)
+ {
+ return true;
+ }
+
+ bool binary(binary_t& /*unused*/)
+ {
+ return true;
+ }
+
+ bool start_object(std::size_t /*unused*/ = std::size_t(-1))
+ {
+ return true;
+ }
+
+ bool key(string_t& /*unused*/)
+ {
+ return true;
+ }
+
+ bool end_object()
+ {
+ return true;
+ }
+
+ bool start_array(std::size_t /*unused*/ = std::size_t(-1))
+ {
+ return true;
+ }
+
+ bool end_array()
+ {
+ return true;
+ }
+
+ bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/, const detail::exception& /*unused*/)
+ {
+ return false;
+ }
+};
+} // namespace detail
+
+} // namespace nlohmann
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/meta/is_sax.hpp>
+
+
+#include <cstdint> // size_t
+#include <utility> // declval
+#include <string> // string
+
+// #include <nlohmann/detail/meta/detected.hpp>
+
+// #include <nlohmann/detail/meta/type_traits.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+template <typename T>
+using null_function_t = decltype(std::declval<T&>().null());
+
+template <typename T>
+using boolean_function_t =
+ decltype(std::declval<T&>().boolean(std::declval<bool>()));
+
+template <typename T, typename Integer>
+using number_integer_function_t =
+ decltype(std::declval<T&>().number_integer(std::declval<Integer>()));
+
+template <typename T, typename Unsigned>
+using number_unsigned_function_t =
+ decltype(std::declval<T&>().number_unsigned(std::declval<Unsigned>()));
+
+template <typename T, typename Float, typename String>
+using number_float_function_t = decltype(std::declval<T&>().number_float(
+ std::declval<Float>(), std::declval<const String&>()));
+
+template <typename T, typename String>
+using string_function_t =
+ decltype(std::declval<T&>().string(std::declval<String&>()));
+
+template <typename T>
+using start_object_function_t =
+ decltype(std::declval<T&>().start_object(std::declval<std::size_t>()));
+
+template <typename T, typename String>
+using key_function_t =
+ decltype(std::declval<T&>().key(std::declval<String&>()));
+
+template <typename T>
+using end_object_function_t = decltype(std::declval<T&>().end_object());
+
+template <typename T>
+using start_array_function_t =
+ decltype(std::declval<T&>().start_array(std::declval<std::size_t>()));
+
+template <typename T>
+using end_array_function_t = decltype(std::declval<T&>().end_array());
+
+template <typename T, typename Exception>
+using parse_error_function_t = decltype(std::declval<T&>().parse_error(
+ std::declval<std::size_t>(), std::declval<const std::string&>(),
+ std::declval<const Exception&>()));
+
+template <typename SAX, typename BasicJsonType>
+struct is_sax
+{
+ private:
+ static_assert(is_basic_json<BasicJsonType>::value,
+ "BasicJsonType must be of type basic_json<...>");
+
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+ using exception_t = typename BasicJsonType::exception;
+
+ public:
+ static constexpr bool value =
+ is_detected_exact<bool, null_function_t, SAX>::value &&
+ is_detected_exact<bool, boolean_function_t, SAX>::value &&
+ is_detected_exact<bool, number_integer_function_t, SAX,
+ number_integer_t>::value &&
+ is_detected_exact<bool, number_unsigned_function_t, SAX,
+ number_unsigned_t>::value &&
+ is_detected_exact<bool, number_float_function_t, SAX, number_float_t,
+ string_t>::value &&
+ is_detected_exact<bool, string_function_t, SAX, string_t>::value &&
+ is_detected_exact<bool, start_object_function_t, SAX>::value &&
+ is_detected_exact<bool, key_function_t, SAX, string_t>::value &&
+ is_detected_exact<bool, end_object_function_t, SAX>::value &&
+ is_detected_exact<bool, start_array_function_t, SAX>::value &&
+ is_detected_exact<bool, end_array_function_t, SAX>::value &&
+ is_detected_exact<bool, parse_error_function_t, SAX, exception_t>::value;
+};
+
+template <typename SAX, typename BasicJsonType>
+struct is_sax_static_asserts
+{
+ private:
+ static_assert(is_basic_json<BasicJsonType>::value,
+ "BasicJsonType must be of type basic_json<...>");
+
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+ using exception_t = typename BasicJsonType::exception;
+
+ public:
+ static_assert(is_detected_exact<bool, null_function_t, SAX>::value,
+ "Missing/invalid function: bool null()");
+ static_assert(is_detected_exact<bool, boolean_function_t, SAX>::value,
+ "Missing/invalid function: bool boolean(bool)");
+ static_assert(is_detected_exact<bool, boolean_function_t, SAX>::value,
+ "Missing/invalid function: bool boolean(bool)");
+ static_assert(
+ is_detected_exact<bool, number_integer_function_t, SAX,
+ number_integer_t>::value,
+ "Missing/invalid function: bool number_integer(number_integer_t)");
+ static_assert(
+ is_detected_exact<bool, number_unsigned_function_t, SAX,
+ number_unsigned_t>::value,
+ "Missing/invalid function: bool number_unsigned(number_unsigned_t)");
+ static_assert(is_detected_exact<bool, number_float_function_t, SAX,
+ number_float_t, string_t>::value,
+ "Missing/invalid function: bool number_float(number_float_t, const string_t&)");
+ static_assert(
+ is_detected_exact<bool, string_function_t, SAX, string_t>::value,
+ "Missing/invalid function: bool string(string_t&)");
+ static_assert(is_detected_exact<bool, start_object_function_t, SAX>::value,
+ "Missing/invalid function: bool start_object(std::size_t)");
+ static_assert(is_detected_exact<bool, key_function_t, SAX, string_t>::value,
+ "Missing/invalid function: bool key(string_t&)");
+ static_assert(is_detected_exact<bool, end_object_function_t, SAX>::value,
+ "Missing/invalid function: bool end_object()");
+ static_assert(is_detected_exact<bool, start_array_function_t, SAX>::value,
+ "Missing/invalid function: bool start_array(std::size_t)");
+ static_assert(is_detected_exact<bool, end_array_function_t, SAX>::value,
+ "Missing/invalid function: bool end_array()");
+ static_assert(
+ is_detected_exact<bool, parse_error_function_t, SAX, exception_t>::value,
+ "Missing/invalid function: bool parse_error(std::size_t, const "
+ "std::string&, const exception&)");
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+
+/*!
+@brief determine system byte order
+
+@return true if and only if system's byte order is little endian
+
+@note from https://stackoverflow.com/a/1001328/266378
+*/
+static inline bool little_endianess(int num = 1) noexcept
+{
+ return *reinterpret_cast<char*>(&num) == 1;
+}
+
+
+///////////////////
+// binary reader //
+///////////////////
+
+/*!
+@brief deserialization of CBOR, MessagePack, and UBJSON values
+*/
+template<typename BasicJsonType, typename InputAdapterType, typename SAX = json_sax_dom_parser<BasicJsonType>>
+class binary_reader
+{
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+ using binary_t = typename BasicJsonType::binary_t;
+ using json_sax_t = SAX;
+ using char_type = typename InputAdapterType::char_type;
+ using char_int_type = typename std::char_traits<char_type>::int_type;
+
+ public:
+ /*!
+ @brief create a binary reader
+
+ @param[in] adapter input adapter to read from
+ */
+ explicit binary_reader(InputAdapterType&& adapter) : ia(std::move(adapter))
+ {
+ (void)detail::is_sax_static_asserts<SAX, BasicJsonType> {};
+ }
+
+ // make class move-only
+ binary_reader(const binary_reader&) = delete;
+ binary_reader(binary_reader&&) = default;
+ binary_reader& operator=(const binary_reader&) = delete;
+ binary_reader& operator=(binary_reader&&) = default;
+ ~binary_reader() = default;
+
+ /*!
+ @param[in] format the binary format to parse
+ @param[in] sax_ a SAX event processor
+ @param[in] strict whether to expect the input to be consumed completed
+
+ @return
+ */
+ JSON_HEDLEY_NON_NULL(3)
+ bool sax_parse(const input_format_t format,
+ json_sax_t* sax_,
+ const bool strict = true)
+ {
+ sax = sax_;
+ bool result = false;
+
+ switch (format)
+ {
+ case input_format_t::bson:
+ result = parse_bson_internal();
+ break;
+
+ case input_format_t::cbor:
+ result = parse_cbor_internal();
+ break;
+
+ case input_format_t::msgpack:
+ result = parse_msgpack_internal();
+ break;
+
+ case input_format_t::ubjson:
+ result = parse_ubjson_internal();
+ break;
+
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+
+ // strict mode: next byte must be EOF
+ if (result and strict)
+ {
+ if (format == input_format_t::ubjson)
+ {
+ get_ignore_noop();
+ }
+ else
+ {
+ get();
+ }
+
+ if (JSON_HEDLEY_UNLIKELY(current != std::char_traits<char_type>::eof()))
+ {
+ return sax->parse_error(chars_read, get_token_string(),
+ parse_error::create(110, chars_read, exception_message(format, "expected end of input; last byte: 0x" + get_token_string(), "value")));
+ }
+ }
+
+ return result;
+ }
+
+ private:
+ //////////
+ // BSON //
+ //////////
+
+ /*!
+ @brief Reads in a BSON-object and passes it to the SAX-parser.
+ @return whether a valid BSON-value was passed to the SAX parser
+ */
+ bool parse_bson_internal()
+ {
+ std::int32_t document_size;
+ get_number<std::int32_t, true>(input_format_t::bson, document_size);
+
+ if (JSON_HEDLEY_UNLIKELY(not sax->start_object(std::size_t(-1))))
+ {
+ return false;
+ }
+
+ if (JSON_HEDLEY_UNLIKELY(not parse_bson_element_list(/*is_array*/false)))
+ {
+ return false;
+ }
+
+ return sax->end_object();
+ }
+
+ /*!
+ @brief Parses a C-style string from the BSON input.
+ @param[in, out] result A reference to the string variable where the read
+ string is to be stored.
+ @return `true` if the \x00-byte indicating the end of the string was
+ encountered before the EOF; false` indicates an unexpected EOF.
+ */
+ bool get_bson_cstr(string_t& result)
+ {
+ auto out = std::back_inserter(result);
+ while (true)
+ {
+ get();
+ if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::bson, "cstring")))
+ {
+ return false;
+ }
+ if (current == 0x00)
+ {
+ return true;
+ }
+ *out++ = static_cast<typename string_t::value_type>(current);
+ }
+
+ return true;
+ }
+
+ /*!
+ @brief Parses a zero-terminated string of length @a len from the BSON
+ input.
+ @param[in] len The length (including the zero-byte at the end) of the
+ string to be read.
+ @param[in, out] result A reference to the string variable where the read
+ string is to be stored.
+ @tparam NumberType The type of the length @a len
+ @pre len >= 1
+ @return `true` if the string was successfully parsed
+ */
+ template<typename NumberType>
+ bool get_bson_string(const NumberType len, string_t& result)
+ {
+ if (JSON_HEDLEY_UNLIKELY(len < 1))
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, "string length must be at least 1, is " + std::to_string(len), "string")));
+ }
+
+ return get_string(input_format_t::bson, len - static_cast<NumberType>(1), result) and get() != std::char_traits<char_type>::eof();
+ }
+
+ /*!
+ @brief Parses a byte array input of length @a len from the BSON input.
+ @param[in] len The length of the byte array to be read.
+ @param[in, out] result A reference to the binary variable where the read
+ array is to be stored.
+ @tparam NumberType The type of the length @a len
+ @pre len >= 0
+ @return `true` if the byte array was successfully parsed
+ */
+ template<typename NumberType>
+ bool get_bson_binary(const NumberType len, binary_t& result)
+ {
+ if (JSON_HEDLEY_UNLIKELY(len < 0))
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, "byte array length cannot be negative, is " + std::to_string(len), "binary")));
+ }
+
+ // All BSON binary values have a subtype
+ std::uint8_t subtype;
+ get_number<std::uint8_t>(input_format_t::bson, subtype);
+ result.set_subtype(subtype);
+
+ return get_binary(input_format_t::bson, len, result);
+ }
+
+ /*!
+ @brief Read a BSON document element of the given @a element_type.
+ @param[in] element_type The BSON element type, c.f. http://bsonspec.org/spec.html
+ @param[in] element_type_parse_position The position in the input stream,
+ where the `element_type` was read.
+ @warning Not all BSON element types are supported yet. An unsupported
+ @a element_type will give rise to a parse_error.114:
+ Unsupported BSON record type 0x...
+ @return whether a valid BSON-object/array was passed to the SAX parser
+ */
+ bool parse_bson_element_internal(const char_int_type element_type,
+ const std::size_t element_type_parse_position)
+ {
+ switch (element_type)
+ {
+ case 0x01: // double
+ {
+ double number;
+ return get_number<double, true>(input_format_t::bson, number) and sax->number_float(static_cast<number_float_t>(number), "");
+ }
+
+ case 0x02: // string
+ {
+ std::int32_t len;
+ string_t value;
+ return get_number<std::int32_t, true>(input_format_t::bson, len) and get_bson_string(len, value) and sax->string(value);
+ }
+
+ case 0x03: // object
+ {
+ return parse_bson_internal();
+ }
+
+ case 0x04: // array
+ {
+ return parse_bson_array();
+ }
+
+ case 0x05: // binary
+ {
+ std::int32_t len;
+ binary_t value;
+ return get_number<std::int32_t, true>(input_format_t::bson, len) and get_bson_binary(len, value) and sax->binary(value);
+ }
+
+ case 0x08: // boolean
+ {
+ return sax->boolean(get() != 0);
+ }
+
+ case 0x0A: // null
+ {
+ return sax->null();
+ }
+
+ case 0x10: // int32
+ {
+ std::int32_t value;
+ return get_number<std::int32_t, true>(input_format_t::bson, value) and sax->number_integer(value);
+ }
+
+ case 0x12: // int64
+ {
+ std::int64_t value;
+ return get_number<std::int64_t, true>(input_format_t::bson, value) and sax->number_integer(value);
+ }
+
+ default: // anything else not supported (yet)
+ {
+ std::array<char, 3> cr{{}};
+ (std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(element_type));
+ return sax->parse_error(element_type_parse_position, std::string(cr.data()), parse_error::create(114, element_type_parse_position, "Unsupported BSON record type 0x" + std::string(cr.data())));
+ }
+ }
+ }
+
+ /*!
+ @brief Read a BSON element list (as specified in the BSON-spec)
+
+ The same binary layout is used for objects and arrays, hence it must be
+ indicated with the argument @a is_array which one is expected
+ (true --> array, false --> object).
+
+ @param[in] is_array Determines if the element list being read is to be
+ treated as an object (@a is_array == false), or as an
+ array (@a is_array == true).
+ @return whether a valid BSON-object/array was passed to the SAX parser
+ */
+ bool parse_bson_element_list(const bool is_array)
+ {
+ string_t key;
+
+ while (auto element_type = get())
+ {
+ if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::bson, "element list")))
+ {
+ return false;
+ }
+
+ const std::size_t element_type_parse_position = chars_read;
+ if (JSON_HEDLEY_UNLIKELY(not get_bson_cstr(key)))
+ {
+ return false;
+ }
+
+ if (not is_array and not sax->key(key))
+ {
+ return false;
+ }
+
+ if (JSON_HEDLEY_UNLIKELY(not parse_bson_element_internal(element_type, element_type_parse_position)))
+ {
+ return false;
+ }
+
+ // get_bson_cstr only appends
+ key.clear();
+ }
+
+ return true;
+ }
+
+ /*!
+ @brief Reads an array from the BSON input and passes it to the SAX-parser.
+ @return whether a valid BSON-array was passed to the SAX parser
+ */
+ bool parse_bson_array()
+ {
+ std::int32_t document_size;
+ get_number<std::int32_t, true>(input_format_t::bson, document_size);
+
+ if (JSON_HEDLEY_UNLIKELY(not sax->start_array(std::size_t(-1))))
+ {
+ return false;
+ }
+
+ if (JSON_HEDLEY_UNLIKELY(not parse_bson_element_list(/*is_array*/true)))
+ {
+ return false;
+ }
+
+ return sax->end_array();
+ }
+
+ //////////
+ // CBOR //
+ //////////
+
+ /*!
+ @param[in] get_char whether a new character should be retrieved from the
+ input (true, default) or whether the last read
+ character should be considered instead
+
+ @return whether a valid CBOR value was passed to the SAX parser
+ */
+ bool parse_cbor_internal(const bool get_char = true)
+ {
+ switch (get_char ? get() : current)
+ {
+ // EOF
+ case std::char_traits<char_type>::eof():
+ return unexpect_eof(input_format_t::cbor, "value");
+
+ // Integer 0x00..0x17 (0..23)
+ case 0x00:
+ case 0x01:
+ case 0x02:
+ case 0x03:
+ case 0x04:
+ case 0x05:
+ case 0x06:
+ case 0x07:
+ case 0x08:
+ case 0x09:
+ case 0x0A:
+ case 0x0B:
+ case 0x0C:
+ case 0x0D:
+ case 0x0E:
+ case 0x0F:
+ case 0x10:
+ case 0x11:
+ case 0x12:
+ case 0x13:
+ case 0x14:
+ case 0x15:
+ case 0x16:
+ case 0x17:
+ return sax->number_unsigned(static_cast<number_unsigned_t>(current));
+
+ case 0x18: // Unsigned integer (one-byte uint8_t follows)
+ {
+ std::uint8_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_unsigned(number);
+ }
+
+ case 0x19: // Unsigned integer (two-byte uint16_t follows)
+ {
+ std::uint16_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_unsigned(number);
+ }
+
+ case 0x1A: // Unsigned integer (four-byte uint32_t follows)
+ {
+ std::uint32_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_unsigned(number);
+ }
+
+ case 0x1B: // Unsigned integer (eight-byte uint64_t follows)
+ {
+ std::uint64_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_unsigned(number);
+ }
+
+ // Negative integer -1-0x00..-1-0x17 (-1..-24)
+ case 0x20:
+ case 0x21:
+ case 0x22:
+ case 0x23:
+ case 0x24:
+ case 0x25:
+ case 0x26:
+ case 0x27:
+ case 0x28:
+ case 0x29:
+ case 0x2A:
+ case 0x2B:
+ case 0x2C:
+ case 0x2D:
+ case 0x2E:
+ case 0x2F:
+ case 0x30:
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ case 0x37:
+ return sax->number_integer(static_cast<std::int8_t>(0x20 - 1 - current));
+
+ case 0x38: // Negative integer (one-byte uint8_t follows)
+ {
+ std::uint8_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_integer(static_cast<number_integer_t>(-1) - number);
+ }
+
+ case 0x39: // Negative integer -1-n (two-byte uint16_t follows)
+ {
+ std::uint16_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_integer(static_cast<number_integer_t>(-1) - number);
+ }
+
+ case 0x3A: // Negative integer -1-n (four-byte uint32_t follows)
+ {
+ std::uint32_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_integer(static_cast<number_integer_t>(-1) - number);
+ }
+
+ case 0x3B: // Negative integer -1-n (eight-byte uint64_t follows)
+ {
+ std::uint64_t number;
+ return get_number(input_format_t::cbor, number) and sax->number_integer(static_cast<number_integer_t>(-1)
+ - static_cast<number_integer_t>(number));
+ }
+
+ // Binary data (0x00..0x17 bytes follow)
+ case 0x40:
+ case 0x41:
+ case 0x42:
+ case 0x43:
+ case 0x44:
+ case 0x45:
+ case 0x46:
+ case 0x47:
+ case 0x48:
+ case 0x49:
+ case 0x4A:
+ case 0x4B:
+ case 0x4C:
+ case 0x4D:
+ case 0x4E:
+ case 0x4F:
+ case 0x50:
+ case 0x51:
+ case 0x52:
+ case 0x53:
+ case 0x54:
+ case 0x55:
+ case 0x56:
+ case 0x57:
+ case 0x58: // Binary data (one-byte uint8_t for n follows)
+ case 0x59: // Binary data (two-byte uint16_t for n follow)
+ case 0x5A: // Binary data (four-byte uint32_t for n follow)
+ case 0x5B: // Binary data (eight-byte uint64_t for n follow)
+ case 0x5F: // Binary data (indefinite length)
+ {
+ binary_t b;
+ return get_cbor_binary(b) and sax->binary(b);
+ }
+
+ // UTF-8 string (0x00..0x17 bytes follow)
+ case 0x60:
+ case 0x61:
+ case 0x62:
+ case 0x63:
+ case 0x64:
+ case 0x65:
+ case 0x66:
+ case 0x67:
+ case 0x68:
+ case 0x69:
+ case 0x6A:
+ case 0x6B:
+ case 0x6C:
+ case 0x6D:
+ case 0x6E:
+ case 0x6F:
+ case 0x70:
+ case 0x71:
+ case 0x72:
+ case 0x73:
+ case 0x74:
+ case 0x75:
+ case 0x76:
+ case 0x77:
+ case 0x78: // UTF-8 string (one-byte uint8_t for n follows)
+ case 0x79: // UTF-8 string (two-byte uint16_t for n follow)
+ case 0x7A: // UTF-8 string (four-byte uint32_t for n follow)
+ case 0x7B: // UTF-8 string (eight-byte uint64_t for n follow)
+ case 0x7F: // UTF-8 string (indefinite length)
+ {
+ string_t s;
+ return get_cbor_string(s) and sax->string(s);
+ }
+
+ // array (0x00..0x17 data items follow)
+ case 0x80:
+ case 0x81:
+ case 0x82:
+ case 0x83:
+ case 0x84:
+ case 0x85:
+ case 0x86:
+ case 0x87:
+ case 0x88:
+ case 0x89:
+ case 0x8A:
+ case 0x8B:
+ case 0x8C:
+ case 0x8D:
+ case 0x8E:
+ case 0x8F:
+ case 0x90:
+ case 0x91:
+ case 0x92:
+ case 0x93:
+ case 0x94:
+ case 0x95:
+ case 0x96:
+ case 0x97:
+ return get_cbor_array(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x1Fu));
+
+ case 0x98: // array (one-byte uint8_t for n follows)
+ {
+ std::uint8_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_array(static_cast<std::size_t>(len));
+ }
+
+ case 0x99: // array (two-byte uint16_t for n follow)
+ {
+ std::uint16_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_array(static_cast<std::size_t>(len));
+ }
+
+ case 0x9A: // array (four-byte uint32_t for n follow)
+ {
+ std::uint32_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_array(static_cast<std::size_t>(len));
+ }
+
+ case 0x9B: // array (eight-byte uint64_t for n follow)
+ {
+ std::uint64_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_array(static_cast<std::size_t>(len));
+ }
+
+ case 0x9F: // array (indefinite length)
+ return get_cbor_array(std::size_t(-1));
+
+ // map (0x00..0x17 pairs of data items follow)
+ case 0xA0:
+ case 0xA1:
+ case 0xA2:
+ case 0xA3:
+ case 0xA4:
+ case 0xA5:
+ case 0xA6:
+ case 0xA7:
+ case 0xA8:
+ case 0xA9:
+ case 0xAA:
+ case 0xAB:
+ case 0xAC:
+ case 0xAD:
+ case 0xAE:
+ case 0xAF:
+ case 0xB0:
+ case 0xB1:
+ case 0xB2:
+ case 0xB3:
+ case 0xB4:
+ case 0xB5:
+ case 0xB6:
+ case 0xB7:
+ return get_cbor_object(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x1Fu));
+
+ case 0xB8: // map (one-byte uint8_t for n follows)
+ {
+ std::uint8_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_object(static_cast<std::size_t>(len));
+ }
+
+ case 0xB9: // map (two-byte uint16_t for n follow)
+ {
+ std::uint16_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_object(static_cast<std::size_t>(len));
+ }
+
+ case 0xBA: // map (four-byte uint32_t for n follow)
+ {
+ std::uint32_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_object(static_cast<std::size_t>(len));
+ }
+
+ case 0xBB: // map (eight-byte uint64_t for n follow)
+ {
+ std::uint64_t len;
+ return get_number(input_format_t::cbor, len) and get_cbor_object(static_cast<std::size_t>(len));
+ }
+
+ case 0xBF: // map (indefinite length)
+ return get_cbor_object(std::size_t(-1));
+
+ case 0xF4: // false
+ return sax->boolean(false);
+
+ case 0xF5: // true
+ return sax->boolean(true);
+
+ case 0xF6: // null
+ return sax->null();
+
+ case 0xF9: // Half-Precision Float (two-byte IEEE 754)
+ {
+ const auto byte1_raw = get();
+ if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::cbor, "number")))
+ {
+ return false;
+ }
+ const auto byte2_raw = get();
+ if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::cbor, "number")))
+ {
+ return false;
+ }
+
+ const auto byte1 = static_cast<unsigned char>(byte1_raw);
+ const auto byte2 = static_cast<unsigned char>(byte2_raw);
+
+ // code from RFC 7049, Appendix D, Figure 3:
+ // As half-precision floating-point numbers were only added
+ // to IEEE 754 in 2008, today's programming platforms often
+ // still only have limited support for them. It is very
+ // easy to include at least decoding support for them even
+ // without such support. An example of a small decoder for
+ // half-precision floating-point numbers in the C language
+ // is shown in Fig. 3.
+ const auto half = static_cast<unsigned int>((byte1 << 8u) + byte2);
+ const double val = [&half]
+ {
+ const int exp = (half >> 10u) & 0x1Fu;
+ const unsigned int mant = half & 0x3FFu;
+ assert(0 <= exp and exp <= 32);
+ assert(mant <= 1024);
+ switch (exp)
+ {
+ case 0:
+ return std::ldexp(mant, -24);
+ case 31:
+ return (mant == 0)
+ ? std::numeric_limits<double>::infinity()
+ : std::numeric_limits<double>::quiet_NaN();
+ default:
+ return std::ldexp(mant + 1024, exp - 25);
+ }
+ }();
+ return sax->number_float((half & 0x8000u) != 0
+ ? static_cast<number_float_t>(-val)
+ : static_cast<number_float_t>(val), "");
+ }
+
+ case 0xFA: // Single-Precision Float (four-byte IEEE 754)
+ {
+ float number;
+ return get_number(input_format_t::cbor, number) and sax->number_float(static_cast<number_float_t>(number), "");
+ }
+
+ case 0xFB: // Double-Precision Float (eight-byte IEEE 754)
+ {
+ double number;
+ return get_number(input_format_t::cbor, number) and sax->number_float(static_cast<number_float_t>(number), "");
+ }
+
+ default: // anything else (0xFF is handled inside the other types)
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::cbor, "invalid byte: 0x" + last_token, "value")));
+ }
+ }
+ }
+
+ /*!
+ @brief reads a CBOR string
+
+ This function first reads starting bytes to determine the expected
+ string length and then copies this number of bytes into a string.
+ Additionally, CBOR's strings with indefinite lengths are supported.
+
+ @param[out] result created string
+
+ @return whether string creation completed
+ */
+ bool get_cbor_string(string_t& result)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::cbor, "string")))
+ {
+ return false;
+ }
+
+ switch (current)
+ {
+ // UTF-8 string (0x00..0x17 bytes follow)
+ case 0x60:
+ case 0x61:
+ case 0x62:
+ case 0x63:
+ case 0x64:
+ case 0x65:
+ case 0x66:
+ case 0x67:
+ case 0x68:
+ case 0x69:
+ case 0x6A:
+ case 0x6B:
+ case 0x6C:
+ case 0x6D:
+ case 0x6E:
+ case 0x6F:
+ case 0x70:
+ case 0x71:
+ case 0x72:
+ case 0x73:
+ case 0x74:
+ case 0x75:
+ case 0x76:
+ case 0x77:
+ {
+ return get_string(input_format_t::cbor, static_cast<unsigned int>(current) & 0x1Fu, result);
+ }
+
+ case 0x78: // UTF-8 string (one-byte uint8_t for n follows)
+ {
+ std::uint8_t len;
+ return get_number(input_format_t::cbor, len) and get_string(input_format_t::cbor, len, result);
+ }
+
+ case 0x79: // UTF-8 string (two-byte uint16_t for n follow)
+ {
+ std::uint16_t len;
+ return get_number(input_format_t::cbor, len) and get_string(input_format_t::cbor, len, result);
+ }
+
+ case 0x7A: // UTF-8 string (four-byte uint32_t for n follow)
+ {
+ std::uint32_t len;
+ return get_number(input_format_t::cbor, len) and get_string(input_format_t::cbor, len, result);
+ }
+
+ case 0x7B: // UTF-8 string (eight-byte uint64_t for n follow)
+ {
+ std::uint64_t len;
+ return get_number(input_format_t::cbor, len) and get_string(input_format_t::cbor, len, result);
+ }
+
+ case 0x7F: // UTF-8 string (indefinite length)
+ {
+ while (get() != 0xFF)
+ {
+ string_t chunk;
+ if (not get_cbor_string(chunk))
+ {
+ return false;
+ }
+ result.append(chunk);
+ }
+ return true;
+ }
+
+ default:
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::cbor, "expected length specification (0x60-0x7B) or indefinite string type (0x7F); last byte: 0x" + last_token, "string")));
+ }
+ }
+ }
+
+ /*!
+ @brief reads a CBOR byte array
+
+ This function first reads starting bytes to determine the expected
+ byte array length and then copies this number of bytes into the byte array.
+ Additionally, CBOR's byte arrays with indefinite lengths are supported.
+
+ @param[out] result created byte array
+
+ @return whether byte array creation completed
+ */
+ bool get_cbor_binary(binary_t& result)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::cbor, "binary")))
+ {
+ return false;
+ }
+
+ switch (current)
+ {
+ // Binary data (0x00..0x17 bytes follow)
+ case 0x40:
+ case 0x41:
+ case 0x42:
+ case 0x43:
+ case 0x44:
+ case 0x45:
+ case 0x46:
+ case 0x47:
+ case 0x48:
+ case 0x49:
+ case 0x4A:
+ case 0x4B:
+ case 0x4C:
+ case 0x4D:
+ case 0x4E:
+ case 0x4F:
+ case 0x50:
+ case 0x51:
+ case 0x52:
+ case 0x53:
+ case 0x54:
+ case 0x55:
+ case 0x56:
+ case 0x57:
+ {
+ return get_binary(input_format_t::cbor, static_cast<unsigned int>(current) & 0x1Fu, result);
+ }
+
+ case 0x58: // Binary data (one-byte uint8_t for n follows)
+ {
+ std::uint8_t len;
+ return get_number(input_format_t::cbor, len) and
+ get_binary(input_format_t::cbor, len, result);
+ }
+
+ case 0x59: // Binary data (two-byte uint16_t for n follow)
+ {
+ std::uint16_t len;
+ return get_number(input_format_t::cbor, len) and
+ get_binary(input_format_t::cbor, len, result);
+ }
+
+ case 0x5A: // Binary data (four-byte uint32_t for n follow)
+ {
+ std::uint32_t len;
+ return get_number(input_format_t::cbor, len) and
+ get_binary(input_format_t::cbor, len, result);
+ }
+
+ case 0x5B: // Binary data (eight-byte uint64_t for n follow)
+ {
+ std::uint64_t len;
+ return get_number(input_format_t::cbor, len) and
+ get_binary(input_format_t::cbor, len, result);
+ }
+
+ case 0x5F: // Binary data (indefinite length)
+ {
+ while (get() != 0xFF)
+ {
+ binary_t chunk;
+ if (not get_cbor_binary(chunk))
+ {
+ return false;
+ }
+ result.insert(result.end(), chunk.begin(), chunk.end());
+ }
+ return true;
+ }
+
+ default:
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::cbor, "expected length specification (0x40-0x5B) or indefinite binary array type (0x5F); last byte: 0x" + last_token, "binary")));
+ }
+ }
+ }
+
+ /*!
+ @param[in] len the length of the array or std::size_t(-1) for an
+ array of indefinite size
+ @return whether array creation completed
+ */
+ bool get_cbor_array(const std::size_t len)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->start_array(len)))
+ {
+ return false;
+ }
+
+ if (len != std::size_t(-1))
+ {
+ for (std::size_t i = 0; i < len; ++i)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not parse_cbor_internal()))
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ while (get() != 0xFF)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not parse_cbor_internal(false)))
+ {
+ return false;
+ }
+ }
+ }
+
+ return sax->end_array();
+ }
+
+ /*!
+ @param[in] len the length of the object or std::size_t(-1) for an
+ object of indefinite size
+ @return whether object creation completed
+ */
+ bool get_cbor_object(const std::size_t len)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->start_object(len)))
+ {
+ return false;
+ }
+
+ string_t key;
+ if (len != std::size_t(-1))
+ {
+ for (std::size_t i = 0; i < len; ++i)
+ {
+ get();
+ if (JSON_HEDLEY_UNLIKELY(not get_cbor_string(key) or not sax->key(key)))
+ {
+ return false;
+ }
+
+ if (JSON_HEDLEY_UNLIKELY(not parse_cbor_internal()))
+ {
+ return false;
+ }
+ key.clear();
+ }
+ }
+ else
+ {
+ while (get() != 0xFF)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not get_cbor_string(key) or not sax->key(key)))
+ {
+ return false;
+ }
+
+ if (JSON_HEDLEY_UNLIKELY(not parse_cbor_internal()))
+ {
+ return false;
+ }
+ key.clear();
+ }
+ }
+
+ return sax->end_object();
+ }
+
+ /////////////
+ // MsgPack //
+ /////////////
+
+ /*!
+ @return whether a valid MessagePack value was passed to the SAX parser
+ */
+ bool parse_msgpack_internal()
+ {
+ switch (get())
+ {
+ // EOF
+ case std::char_traits<char_type>::eof():
+ return unexpect_eof(input_format_t::msgpack, "value");
+
+ // positive fixint
+ case 0x00:
+ case 0x01:
+ case 0x02:
+ case 0x03:
+ case 0x04:
+ case 0x05:
+ case 0x06:
+ case 0x07:
+ case 0x08:
+ case 0x09:
+ case 0x0A:
+ case 0x0B:
+ case 0x0C:
+ case 0x0D:
+ case 0x0E:
+ case 0x0F:
+ case 0x10:
+ case 0x11:
+ case 0x12:
+ case 0x13:
+ case 0x14:
+ case 0x15:
+ case 0x16:
+ case 0x17:
+ case 0x18:
+ case 0x19:
+ case 0x1A:
+ case 0x1B:
+ case 0x1C:
+ case 0x1D:
+ case 0x1E:
+ case 0x1F:
+ case 0x20:
+ case 0x21:
+ case 0x22:
+ case 0x23:
+ case 0x24:
+ case 0x25:
+ case 0x26:
+ case 0x27:
+ case 0x28:
+ case 0x29:
+ case 0x2A:
+ case 0x2B:
+ case 0x2C:
+ case 0x2D:
+ case 0x2E:
+ case 0x2F:
+ case 0x30:
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ case 0x37:
+ case 0x38:
+ case 0x39:
+ case 0x3A:
+ case 0x3B:
+ case 0x3C:
+ case 0x3D:
+ case 0x3E:
+ case 0x3F:
+ case 0x40:
+ case 0x41:
+ case 0x42:
+ case 0x43:
+ case 0x44:
+ case 0x45:
+ case 0x46:
+ case 0x47:
+ case 0x48:
+ case 0x49:
+ case 0x4A:
+ case 0x4B:
+ case 0x4C:
+ case 0x4D:
+ case 0x4E:
+ case 0x4F:
+ case 0x50:
+ case 0x51:
+ case 0x52:
+ case 0x53:
+ case 0x54:
+ case 0x55:
+ case 0x56:
+ case 0x57:
+ case 0x58:
+ case 0x59:
+ case 0x5A:
+ case 0x5B:
+ case 0x5C:
+ case 0x5D:
+ case 0x5E:
+ case 0x5F:
+ case 0x60:
+ case 0x61:
+ case 0x62:
+ case 0x63:
+ case 0x64:
+ case 0x65:
+ case 0x66:
+ case 0x67:
+ case 0x68:
+ case 0x69:
+ case 0x6A:
+ case 0x6B:
+ case 0x6C:
+ case 0x6D:
+ case 0x6E:
+ case 0x6F:
+ case 0x70:
+ case 0x71:
+ case 0x72:
+ case 0x73:
+ case 0x74:
+ case 0x75:
+ case 0x76:
+ case 0x77:
+ case 0x78:
+ case 0x79:
+ case 0x7A:
+ case 0x7B:
+ case 0x7C:
+ case 0x7D:
+ case 0x7E:
+ case 0x7F:
+ return sax->number_unsigned(static_cast<number_unsigned_t>(current));
+
+ // fixmap
+ case 0x80:
+ case 0x81:
+ case 0x82:
+ case 0x83:
+ case 0x84:
+ case 0x85:
+ case 0x86:
+ case 0x87:
+ case 0x88:
+ case 0x89:
+ case 0x8A:
+ case 0x8B:
+ case 0x8C:
+ case 0x8D:
+ case 0x8E:
+ case 0x8F:
+ return get_msgpack_object(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x0Fu));
+
+ // fixarray
+ case 0x90:
+ case 0x91:
+ case 0x92:
+ case 0x93:
+ case 0x94:
+ case 0x95:
+ case 0x96:
+ case 0x97:
+ case 0x98:
+ case 0x99:
+ case 0x9A:
+ case 0x9B:
+ case 0x9C:
+ case 0x9D:
+ case 0x9E:
+ case 0x9F:
+ return get_msgpack_array(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x0Fu));
+
+ // fixstr
+ case 0xA0:
+ case 0xA1:
+ case 0xA2:
+ case 0xA3:
+ case 0xA4:
+ case 0xA5:
+ case 0xA6:
+ case 0xA7:
+ case 0xA8:
+ case 0xA9:
+ case 0xAA:
+ case 0xAB:
+ case 0xAC:
+ case 0xAD:
+ case 0xAE:
+ case 0xAF:
+ case 0xB0:
+ case 0xB1:
+ case 0xB2:
+ case 0xB3:
+ case 0xB4:
+ case 0xB5:
+ case 0xB6:
+ case 0xB7:
+ case 0xB8:
+ case 0xB9:
+ case 0xBA:
+ case 0xBB:
+ case 0xBC:
+ case 0xBD:
+ case 0xBE:
+ case 0xBF:
+ case 0xD9: // str 8
+ case 0xDA: // str 16
+ case 0xDB: // str 32
+ {
+ string_t s;
+ return get_msgpack_string(s) and sax->string(s);
+ }
+
+ case 0xC0: // nil
+ return sax->null();
+
+ case 0xC2: // false
+ return sax->boolean(false);
+
+ case 0xC3: // true
+ return sax->boolean(true);
+
+ case 0xC4: // bin 8
+ case 0xC5: // bin 16
+ case 0xC6: // bin 32
+ case 0xC7: // ext 8
+ case 0xC8: // ext 16
+ case 0xC9: // ext 32
+ case 0xD4: // fixext 1
+ case 0xD5: // fixext 2
+ case 0xD6: // fixext 4
+ case 0xD7: // fixext 8
+ case 0xD8: // fixext 16
+ {
+ binary_t b;
+ return get_msgpack_binary(b) and sax->binary(b);
+ }
+
+ case 0xCA: // float 32
+ {
+ float number;
+ return get_number(input_format_t::msgpack, number) and sax->number_float(static_cast<number_float_t>(number), "");
+ }
+
+ case 0xCB: // float 64
+ {
+ double number;
+ return get_number(input_format_t::msgpack, number) and sax->number_float(static_cast<number_float_t>(number), "");
+ }
+
+ case 0xCC: // uint 8
+ {
+ std::uint8_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_unsigned(number);
+ }
+
+ case 0xCD: // uint 16
+ {
+ std::uint16_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_unsigned(number);
+ }
+
+ case 0xCE: // uint 32
+ {
+ std::uint32_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_unsigned(number);
+ }
+
+ case 0xCF: // uint 64
+ {
+ std::uint64_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_unsigned(number);
+ }
+
+ case 0xD0: // int 8
+ {
+ std::int8_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_integer(number);
+ }
+
+ case 0xD1: // int 16
+ {
+ std::int16_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_integer(number);
+ }
+
+ case 0xD2: // int 32
+ {
+ std::int32_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_integer(number);
+ }
+
+ case 0xD3: // int 64
+ {
+ std::int64_t number;
+ return get_number(input_format_t::msgpack, number) and sax->number_integer(number);
+ }
+
+ case 0xDC: // array 16
+ {
+ std::uint16_t len;
+ return get_number(input_format_t::msgpack, len) and get_msgpack_array(static_cast<std::size_t>(len));
+ }
+
+ case 0xDD: // array 32
+ {
+ std::uint32_t len;
+ return get_number(input_format_t::msgpack, len) and get_msgpack_array(static_cast<std::size_t>(len));
+ }
+
+ case 0xDE: // map 16
+ {
+ std::uint16_t len;
+ return get_number(input_format_t::msgpack, len) and get_msgpack_object(static_cast<std::size_t>(len));
+ }
+
+ case 0xDF: // map 32
+ {
+ std::uint32_t len;
+ return get_number(input_format_t::msgpack, len) and get_msgpack_object(static_cast<std::size_t>(len));
+ }
+
+ // negative fixint
+ case 0xE0:
+ case 0xE1:
+ case 0xE2:
+ case 0xE3:
+ case 0xE4:
+ case 0xE5:
+ case 0xE6:
+ case 0xE7:
+ case 0xE8:
+ case 0xE9:
+ case 0xEA:
+ case 0xEB:
+ case 0xEC:
+ case 0xED:
+ case 0xEE:
+ case 0xEF:
+ case 0xF0:
+ case 0xF1:
+ case 0xF2:
+ case 0xF3:
+ case 0xF4:
+ case 0xF5:
+ case 0xF6:
+ case 0xF7:
+ case 0xF8:
+ case 0xF9:
+ case 0xFA:
+ case 0xFB:
+ case 0xFC:
+ case 0xFD:
+ case 0xFE:
+ case 0xFF:
+ return sax->number_integer(static_cast<std::int8_t>(current));
+
+ default: // anything else
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::msgpack, "invalid byte: 0x" + last_token, "value")));
+ }
+ }
+ }
+
+ /*!
+ @brief reads a MessagePack string
+
+ This function first reads starting bytes to determine the expected
+ string length and then copies this number of bytes into a string.
+
+ @param[out] result created string
+
+ @return whether string creation completed
+ */
+ bool get_msgpack_string(string_t& result)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::msgpack, "string")))
+ {
+ return false;
+ }
+
+ switch (current)
+ {
+ // fixstr
+ case 0xA0:
+ case 0xA1:
+ case 0xA2:
+ case 0xA3:
+ case 0xA4:
+ case 0xA5:
+ case 0xA6:
+ case 0xA7:
+ case 0xA8:
+ case 0xA9:
+ case 0xAA:
+ case 0xAB:
+ case 0xAC:
+ case 0xAD:
+ case 0xAE:
+ case 0xAF:
+ case 0xB0:
+ case 0xB1:
+ case 0xB2:
+ case 0xB3:
+ case 0xB4:
+ case 0xB5:
+ case 0xB6:
+ case 0xB7:
+ case 0xB8:
+ case 0xB9:
+ case 0xBA:
+ case 0xBB:
+ case 0xBC:
+ case 0xBD:
+ case 0xBE:
+ case 0xBF:
+ {
+ return get_string(input_format_t::msgpack, static_cast<unsigned int>(current) & 0x1Fu, result);
+ }
+
+ case 0xD9: // str 8
+ {
+ std::uint8_t len;
+ return get_number(input_format_t::msgpack, len) and get_string(input_format_t::msgpack, len, result);
+ }
+
+ case 0xDA: // str 16
+ {
+ std::uint16_t len;
+ return get_number(input_format_t::msgpack, len) and get_string(input_format_t::msgpack, len, result);
+ }
+
+ case 0xDB: // str 32
+ {
+ std::uint32_t len;
+ return get_number(input_format_t::msgpack, len) and get_string(input_format_t::msgpack, len, result);
+ }
+
+ default:
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::msgpack, "expected length specification (0xA0-0xBF, 0xD9-0xDB); last byte: 0x" + last_token, "string")));
+ }
+ }
+ }
+
+ /*!
+ @brief reads a MessagePack byte array
+
+ This function first reads starting bytes to determine the expected
+ byte array length and then copies this number of bytes into a byte array.
+
+ @param[out] result created byte array
+
+ @return whether byte array creation completed
+ */
+ bool get_msgpack_binary(binary_t& result)
+ {
+ // helper function to set the subtype
+ auto assign_and_return_true = [&result](std::int8_t subtype)
+ {
+ result.set_subtype(static_cast<std::uint8_t>(subtype));
+ return true;
+ };
+
+ switch (current)
+ {
+ case 0xC4: // bin 8
+ {
+ std::uint8_t len;
+ return get_number(input_format_t::msgpack, len) and
+ get_binary(input_format_t::msgpack, len, result);
+ }
+
+ case 0xC5: // bin 16
+ {
+ std::uint16_t len;
+ return get_number(input_format_t::msgpack, len) and
+ get_binary(input_format_t::msgpack, len, result);
+ }
+
+ case 0xC6: // bin 32
+ {
+ std::uint32_t len;
+ return get_number(input_format_t::msgpack, len) and
+ get_binary(input_format_t::msgpack, len, result);
+ }
+
+ case 0xC7: // ext 8
+ {
+ std::uint8_t len;
+ std::int8_t subtype;
+ return get_number(input_format_t::msgpack, len) and
+ get_number(input_format_t::msgpack, subtype) and
+ get_binary(input_format_t::msgpack, len, result) and
+ assign_and_return_true(subtype);
+ }
+
+ case 0xC8: // ext 16
+ {
+ std::uint16_t len;
+ std::int8_t subtype;
+ return get_number(input_format_t::msgpack, len) and
+ get_number(input_format_t::msgpack, subtype) and
+ get_binary(input_format_t::msgpack, len, result) and
+ assign_and_return_true(subtype);
+ }
+
+ case 0xC9: // ext 32
+ {
+ std::uint32_t len;
+ std::int8_t subtype;
+ return get_number(input_format_t::msgpack, len) and
+ get_number(input_format_t::msgpack, subtype) and
+ get_binary(input_format_t::msgpack, len, result) and
+ assign_and_return_true(subtype);
+ }
+
+ case 0xD4: // fixext 1
+ {
+ std::int8_t subtype;
+ return get_number(input_format_t::msgpack, subtype) and
+ get_binary(input_format_t::msgpack, 1, result) and
+ assign_and_return_true(subtype);
+ }
+
+ case 0xD5: // fixext 2
+ {
+ std::int8_t subtype;
+ return get_number(input_format_t::msgpack, subtype) and
+ get_binary(input_format_t::msgpack, 2, result) and
+ assign_and_return_true(subtype);
+ }
+
+ case 0xD6: // fixext 4
+ {
+ std::int8_t subtype;
+ return get_number(input_format_t::msgpack, subtype) and
+ get_binary(input_format_t::msgpack, 4, result) and
+ assign_and_return_true(subtype);
+ }
+
+ case 0xD7: // fixext 8
+ {
+ std::int8_t subtype;
+ return get_number(input_format_t::msgpack, subtype) and
+ get_binary(input_format_t::msgpack, 8, result) and
+ assign_and_return_true(subtype);
+ }
+
+ case 0xD8: // fixext 16
+ {
+ std::int8_t subtype;
+ return get_number(input_format_t::msgpack, subtype) and
+ get_binary(input_format_t::msgpack, 16, result) and
+ assign_and_return_true(subtype);
+ }
+
+ default: // LCOV_EXCL_LINE
+ return false; // LCOV_EXCL_LINE
+ }
+ }
+
+ /*!
+ @param[in] len the length of the array
+ @return whether array creation completed
+ */
+ bool get_msgpack_array(const std::size_t len)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->start_array(len)))
+ {
+ return false;
+ }
+
+ for (std::size_t i = 0; i < len; ++i)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not parse_msgpack_internal()))
+ {
+ return false;
+ }
+ }
+
+ return sax->end_array();
+ }
+
+ /*!
+ @param[in] len the length of the object
+ @return whether object creation completed
+ */
+ bool get_msgpack_object(const std::size_t len)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->start_object(len)))
+ {
+ return false;
+ }
+
+ string_t key;
+ for (std::size_t i = 0; i < len; ++i)
+ {
+ get();
+ if (JSON_HEDLEY_UNLIKELY(not get_msgpack_string(key) or not sax->key(key)))
+ {
+ return false;
+ }
+
+ if (JSON_HEDLEY_UNLIKELY(not parse_msgpack_internal()))
+ {
+ return false;
+ }
+ key.clear();
+ }
+
+ return sax->end_object();
+ }
+
+ ////////////
+ // UBJSON //
+ ////////////
+
+ /*!
+ @param[in] get_char whether a new character should be retrieved from the
+ input (true, default) or whether the last read
+ character should be considered instead
+
+ @return whether a valid UBJSON value was passed to the SAX parser
+ */
+ bool parse_ubjson_internal(const bool get_char = true)
+ {
+ return get_ubjson_value(get_char ? get_ignore_noop() : current);
+ }
+
+ /*!
+ @brief reads a UBJSON string
+
+ This function is either called after reading the 'S' byte explicitly
+ indicating a string, or in case of an object key where the 'S' byte can be
+ left out.
+
+ @param[out] result created string
+ @param[in] get_char whether a new character should be retrieved from the
+ input (true, default) or whether the last read
+ character should be considered instead
+
+ @return whether string creation completed
+ */
+ bool get_ubjson_string(string_t& result, const bool get_char = true)
+ {
+ if (get_char)
+ {
+ get(); // TODO(niels): may we ignore N here?
+ }
+
+ if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "value")))
+ {
+ return false;
+ }
+
+ switch (current)
+ {
+ case 'U':
+ {
+ std::uint8_t len;
+ return get_number(input_format_t::ubjson, len) and get_string(input_format_t::ubjson, len, result);
+ }
+
+ case 'i':
+ {
+ std::int8_t len;
+ return get_number(input_format_t::ubjson, len) and get_string(input_format_t::ubjson, len, result);
+ }
+
+ case 'I':
+ {
+ std::int16_t len;
+ return get_number(input_format_t::ubjson, len) and get_string(input_format_t::ubjson, len, result);
+ }
+
+ case 'l':
+ {
+ std::int32_t len;
+ return get_number(input_format_t::ubjson, len) and get_string(input_format_t::ubjson, len, result);
+ }
+
+ case 'L':
+ {
+ std::int64_t len;
+ return get_number(input_format_t::ubjson, len) and get_string(input_format_t::ubjson, len, result);
+ }
+
+ default:
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::ubjson, "expected length type specification (U, i, I, l, L); last byte: 0x" + last_token, "string")));
+ }
+ }
+
+ /*!
+ @param[out] result determined size
+ @return whether size determination completed
+ */
+ bool get_ubjson_size_value(std::size_t& result)
+ {
+ switch (get_ignore_noop())
+ {
+ case 'U':
+ {
+ std::uint8_t number;
+ if (JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number)))
+ {
+ return false;
+ }
+ result = static_cast<std::size_t>(number);
+ return true;
+ }
+
+ case 'i':
+ {
+ std::int8_t number;
+ if (JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number)))
+ {
+ return false;
+ }
+ result = static_cast<std::size_t>(number);
+ return true;
+ }
+
+ case 'I':
+ {
+ std::int16_t number;
+ if (JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number)))
+ {
+ return false;
+ }
+ result = static_cast<std::size_t>(number);
+ return true;
+ }
+
+ case 'l':
+ {
+ std::int32_t number;
+ if (JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number)))
+ {
+ return false;
+ }
+ result = static_cast<std::size_t>(number);
+ return true;
+ }
+
+ case 'L':
+ {
+ std::int64_t number;
+ if (JSON_HEDLEY_UNLIKELY(not get_number(input_format_t::ubjson, number)))
+ {
+ return false;
+ }
+ result = static_cast<std::size_t>(number);
+ return true;
+ }
+
+ default:
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::ubjson, "expected length type specification (U, i, I, l, L) after '#'; last byte: 0x" + last_token, "size")));
+ }
+ }
+ }
+
+ /*!
+ @brief determine the type and size for a container
+
+ In the optimized UBJSON format, a type and a size can be provided to allow
+ for a more compact representation.
+
+ @param[out] result pair of the size and the type
+
+ @return whether pair creation completed
+ */
+ bool get_ubjson_size_type(std::pair<std::size_t, char_int_type>& result)
+ {
+ result.first = string_t::npos; // size
+ result.second = 0; // type
+
+ get_ignore_noop();
+
+ if (current == '$')
+ {
+ result.second = get(); // must not ignore 'N', because 'N' maybe the type
+ if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "type")))
+ {
+ return false;
+ }
+
+ get_ignore_noop();
+ if (JSON_HEDLEY_UNLIKELY(current != '#'))
+ {
+ if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "value")))
+ {
+ return false;
+ }
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::ubjson, "expected '#' after type information; last byte: 0x" + last_token, "size")));
+ }
+
+ return get_ubjson_size_value(result.first);
+ }
+
+ if (current == '#')
+ {
+ return get_ubjson_size_value(result.first);
+ }
+
+ return true;
+ }
+
+ /*!
+ @param prefix the previously read or set type prefix
+ @return whether value creation completed
+ */
+ bool get_ubjson_value(const char_int_type prefix)
+ {
+ switch (prefix)
+ {
+ case std::char_traits<char_type>::eof(): // EOF
+ return unexpect_eof(input_format_t::ubjson, "value");
+
+ case 'T': // true
+ return sax->boolean(true);
+ case 'F': // false
+ return sax->boolean(false);
+
+ case 'Z': // null
+ return sax->null();
+
+ case 'U':
+ {
+ std::uint8_t number;
+ return get_number(input_format_t::ubjson, number) and sax->number_unsigned(number);
+ }
+
+ case 'i':
+ {
+ std::int8_t number;
+ return get_number(input_format_t::ubjson, number) and sax->number_integer(number);
+ }
+
+ case 'I':
+ {
+ std::int16_t number;
+ return get_number(input_format_t::ubjson, number) and sax->number_integer(number);
+ }
+
+ case 'l':
+ {
+ std::int32_t number;
+ return get_number(input_format_t::ubjson, number) and sax->number_integer(number);
+ }
+
+ case 'L':
+ {
+ std::int64_t number;
+ return get_number(input_format_t::ubjson, number) and sax->number_integer(number);
+ }
+
+ case 'd':
+ {
+ float number;
+ return get_number(input_format_t::ubjson, number) and sax->number_float(static_cast<number_float_t>(number), "");
+ }
+
+ case 'D':
+ {
+ double number;
+ return get_number(input_format_t::ubjson, number) and sax->number_float(static_cast<number_float_t>(number), "");
+ }
+
+ case 'C': // char
+ {
+ get();
+ if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(input_format_t::ubjson, "char")))
+ {
+ return false;
+ }
+ if (JSON_HEDLEY_UNLIKELY(current > 127))
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::ubjson, "byte after 'C' must be in range 0x00..0x7F; last byte: 0x" + last_token, "char")));
+ }
+ string_t s(1, static_cast<typename string_t::value_type>(current));
+ return sax->string(s);
+ }
+
+ case 'S': // string
+ {
+ string_t s;
+ return get_ubjson_string(s) and sax->string(s);
+ }
+
+ case '[': // array
+ return get_ubjson_array();
+
+ case '{': // object
+ return get_ubjson_object();
+
+ default: // anything else
+ {
+ auto last_token = get_token_string();
+ return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::ubjson, "invalid byte: 0x" + last_token, "value")));
+ }
+ }
+ }
+
+ /*!
+ @return whether array creation completed
+ */
+ bool get_ubjson_array()
+ {
+ std::pair<std::size_t, char_int_type> size_and_type;
+ if (JSON_HEDLEY_UNLIKELY(not get_ubjson_size_type(size_and_type)))
+ {
+ return false;
+ }
+
+ if (size_and_type.first != string_t::npos)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->start_array(size_and_type.first)))
+ {
+ return false;
+ }
+
+ if (size_and_type.second != 0)
+ {
+ if (size_and_type.second != 'N')
+ {
+ for (std::size_t i = 0; i < size_and_type.first; ++i)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not get_ubjson_value(size_and_type.second)))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ else
+ {
+ for (std::size_t i = 0; i < size_and_type.first; ++i)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not parse_ubjson_internal()))
+ {
+ return false;
+ }
+ }
+ }
+ }
+ else
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->start_array(std::size_t(-1))))
+ {
+ return false;
+ }
+
+ while (current != ']')
+ {
+ if (JSON_HEDLEY_UNLIKELY(not parse_ubjson_internal(false)))
+ {
+ return false;
+ }
+ get_ignore_noop();
+ }
+ }
+
+ return sax->end_array();
+ }
+
+ /*!
+ @return whether object creation completed
+ */
+ bool get_ubjson_object()
+ {
+ std::pair<std::size_t, char_int_type> size_and_type;
+ if (JSON_HEDLEY_UNLIKELY(not get_ubjson_size_type(size_and_type)))
+ {
+ return false;
+ }
+
+ string_t key;
+ if (size_and_type.first != string_t::npos)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->start_object(size_and_type.first)))
+ {
+ return false;
+ }
+
+ if (size_and_type.second != 0)
+ {
+ for (std::size_t i = 0; i < size_and_type.first; ++i)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not get_ubjson_string(key) or not sax->key(key)))
+ {
+ return false;
+ }
+ if (JSON_HEDLEY_UNLIKELY(not get_ubjson_value(size_and_type.second)))
+ {
+ return false;
+ }
+ key.clear();
+ }
+ }
+ else
+ {
+ for (std::size_t i = 0; i < size_and_type.first; ++i)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not get_ubjson_string(key) or not sax->key(key)))
+ {
+ return false;
+ }
+ if (JSON_HEDLEY_UNLIKELY(not parse_ubjson_internal()))
+ {
+ return false;
+ }
+ key.clear();
+ }
+ }
+ }
+ else
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->start_object(std::size_t(-1))))
+ {
+ return false;
+ }
+
+ while (current != '}')
+ {
+ if (JSON_HEDLEY_UNLIKELY(not get_ubjson_string(key, false) or not sax->key(key)))
+ {
+ return false;
+ }
+ if (JSON_HEDLEY_UNLIKELY(not parse_ubjson_internal()))
+ {
+ return false;
+ }
+ get_ignore_noop();
+ key.clear();
+ }
+ }
+
+ return sax->end_object();
+ }
+
+ // Note, no reader for UBJSON binary types is implemented because they do
+ // not exist
+
+ ///////////////////////
+ // Utility functions //
+ ///////////////////////
+
+ /*!
+ @brief get next character from the input
+
+ This function provides the interface to the used input adapter. It does
+ not throw in case the input reached EOF, but returns a -'ve valued
+ `std::char_traits<char_type>::eof()` in that case.
+
+ @return character read from the input
+ */
+ char_int_type get()
+ {
+ ++chars_read;
+ return current = ia.get_character();
+ }
+
+ /*!
+ @return character read from the input after ignoring all 'N' entries
+ */
+ char_int_type get_ignore_noop()
+ {
+ do
+ {
+ get();
+ }
+ while (current == 'N');
+
+ return current;
+ }
+
+ /*
+ @brief read a number from the input
+
+ @tparam NumberType the type of the number
+ @param[in] format the current format (for diagnostics)
+ @param[out] result number of type @a NumberType
+
+ @return whether conversion completed
+
+ @note This function needs to respect the system's endianess, because
+ bytes in CBOR, MessagePack, and UBJSON are stored in network order
+ (big endian) and therefore need reordering on little endian systems.
+ */
+ template<typename NumberType, bool InputIsLittleEndian = false>
+ bool get_number(const input_format_t format, NumberType& result)
+ {
+ // step 1: read input into array with system's byte order
+ std::array<std::uint8_t, sizeof(NumberType)> vec;
+ for (std::size_t i = 0; i < sizeof(NumberType); ++i)
+ {
+ get();
+ if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(format, "number")))
+ {
+ return false;
+ }
+
+ // reverse byte order prior to conversion if necessary
+ if (is_little_endian != InputIsLittleEndian)
+ {
+ vec[sizeof(NumberType) - i - 1] = static_cast<std::uint8_t>(current);
+ }
+ else
+ {
+ vec[i] = static_cast<std::uint8_t>(current); // LCOV_EXCL_LINE
+ }
+ }
+
+ // step 2: convert array into number of type T and return
+ std::memcpy(&result, vec.data(), sizeof(NumberType));
+ return true;
+ }
+
+ /*!
+ @brief create a string by reading characters from the input
+
+ @tparam NumberType the type of the number
+ @param[in] format the current format (for diagnostics)
+ @param[in] len number of characters to read
+ @param[out] result string created by reading @a len bytes
+
+ @return whether string creation completed
+
+ @note We can not reserve @a len bytes for the result, because @a len
+ may be too large. Usually, @ref unexpect_eof() detects the end of
+ the input before we run out of string memory.
+ */
+ template<typename NumberType>
+ bool get_string(const input_format_t format,
+ const NumberType len,
+ string_t& result)
+ {
+ bool success = true;
+ std::generate_n(std::back_inserter(result), len, [this, &success, &format]()
+ {
+ get();
+ if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(format, "string")))
+ {
+ success = false;
+ }
+ return std::char_traits<char_type>::to_char_type(current);
+ });
+ return success;
+ }
+
+ /*!
+ @brief create a byte array by reading bytes from the input
+
+ @tparam NumberType the type of the number
+ @param[in] format the current format (for diagnostics)
+ @param[in] len number of bytes to read
+ @param[out] result byte array created by reading @a len bytes
+
+ @return whether byte array creation completed
+
+ @note We can not reserve @a len bytes for the result, because @a len
+ may be too large. Usually, @ref unexpect_eof() detects the end of
+ the input before we run out of memory.
+ */
+ template<typename NumberType>
+ bool get_binary(const input_format_t format,
+ const NumberType len,
+ binary_t& result)
+ {
+ bool success = true;
+ std::generate_n(std::back_inserter(result), len, [this, &success, &format]()
+ {
+ get();
+ if (JSON_HEDLEY_UNLIKELY(not unexpect_eof(format, "binary")))
+ {
+ success = false;
+ }
+ return static_cast<std::uint8_t>(current);
+ });
+ return success;
+ }
+
+ /*!
+ @param[in] format the current format (for diagnostics)
+ @param[in] context further context information (for diagnostics)
+ @return whether the last read character is not EOF
+ */
+ JSON_HEDLEY_NON_NULL(3)
+ bool unexpect_eof(const input_format_t format, const char* context) const
+ {
+ if (JSON_HEDLEY_UNLIKELY(current == std::char_traits<char_type>::eof()))
+ {
+ return sax->parse_error(chars_read, "<end of file>",
+ parse_error::create(110, chars_read, exception_message(format, "unexpected end of input", context)));
+ }
+ return true;
+ }
+
+ /*!
+ @return a string representation of the last read byte
+ */
+ std::string get_token_string() const
+ {
+ std::array<char, 3> cr{{}};
+ (std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(current));
+ return std::string{cr.data()};
+ }
+
+ /*!
+ @param[in] format the current format
+ @param[in] detail a detailed error message
+ @param[in] context further context information
+ @return a message string to use in the parse_error exceptions
+ */
+ std::string exception_message(const input_format_t format,
+ const std::string& detail,
+ const std::string& context) const
+ {
+ std::string error_msg = "syntax error while parsing ";
+
+ switch (format)
+ {
+ case input_format_t::cbor:
+ error_msg += "CBOR";
+ break;
+
+ case input_format_t::msgpack:
+ error_msg += "MessagePack";
+ break;
+
+ case input_format_t::ubjson:
+ error_msg += "UBJSON";
+ break;
+
+ case input_format_t::bson:
+ error_msg += "BSON";
+ break;
+
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+
+ return error_msg + " " + context + ": " + detail;
+ }
+
+ private:
+ /// input adapter
+ InputAdapterType ia;
+
+ /// the current character
+ char_int_type current = std::char_traits<char_type>::eof();
+
+ /// the number of characters read
+ std::size_t chars_read = 0;
+
+ /// whether we can assume little endianess
+ const bool is_little_endian = little_endianess();
+
+ /// the SAX parser
+ json_sax_t* sax = nullptr;
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/input/input_adapters.hpp>
+
+// #include <nlohmann/detail/input/lexer.hpp>
+
+
+#include <array> // array
+#include <clocale> // localeconv
+#include <cstddef> // size_t
+#include <cstdio> // snprintf
+#include <cstdlib> // strtof, strtod, strtold, strtoll, strtoull
+#include <initializer_list> // initializer_list
+#include <string> // char_traits, string
+#include <utility> // move
+#include <vector> // vector
+
+// #include <nlohmann/detail/input/input_adapters.hpp>
+
+// #include <nlohmann/detail/input/position_t.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+///////////
+// lexer //
+///////////
+
+template<typename BasicJsonType>
+class lexer_base
+{
+ public:
+ /// token types for the parser
+ enum class token_type
+ {
+ uninitialized, ///< indicating the scanner is uninitialized
+ literal_true, ///< the `true` literal
+ literal_false, ///< the `false` literal
+ literal_null, ///< the `null` literal
+ value_string, ///< a string -- use get_string() for actual value
+ value_unsigned, ///< an unsigned integer -- use get_number_unsigned() for actual value
+ value_integer, ///< a signed integer -- use get_number_integer() for actual value
+ value_float, ///< an floating point number -- use get_number_float() for actual value
+ begin_array, ///< the character for array begin `[`
+ begin_object, ///< the character for object begin `{`
+ end_array, ///< the character for array end `]`
+ end_object, ///< the character for object end `}`
+ name_separator, ///< the name separator `:`
+ value_separator, ///< the value separator `,`
+ parse_error, ///< indicating a parse error
+ end_of_input, ///< indicating the end of the input buffer
+ literal_or_value ///< a literal or the begin of a value (only for diagnostics)
+ };
+
+ /// return name of values of type token_type (only used for errors)
+ JSON_HEDLEY_RETURNS_NON_NULL
+ JSON_HEDLEY_CONST
+ static const char* token_type_name(const token_type t) noexcept
+ {
+ switch (t)
+ {
+ case token_type::uninitialized:
+ return "<uninitialized>";
+ case token_type::literal_true:
+ return "true literal";
+ case token_type::literal_false:
+ return "false literal";
+ case token_type::literal_null:
+ return "null literal";
+ case token_type::value_string:
+ return "string literal";
+ case token_type::value_unsigned:
+ case token_type::value_integer:
+ case token_type::value_float:
+ return "number literal";
+ case token_type::begin_array:
+ return "'['";
+ case token_type::begin_object:
+ return "'{'";
+ case token_type::end_array:
+ return "']'";
+ case token_type::end_object:
+ return "'}'";
+ case token_type::name_separator:
+ return "':'";
+ case token_type::value_separator:
+ return "','";
+ case token_type::parse_error:
+ return "<parse error>";
+ case token_type::end_of_input:
+ return "end of input";
+ case token_type::literal_or_value:
+ return "'[', '{', or a literal";
+ // LCOV_EXCL_START
+ default: // catch non-enum values
+ return "unknown token";
+ // LCOV_EXCL_STOP
+ }
+ }
+};
+/*!
+@brief lexical analysis
+
+This class organizes the lexical analysis during JSON deserialization.
+*/
+template<typename BasicJsonType, typename InputAdapterType>
+class lexer : public lexer_base<BasicJsonType>
+{
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+ using char_type = typename InputAdapterType::char_type;
+ using char_int_type = typename std::char_traits<char_type>::int_type;
+
+ public:
+ using token_type = typename lexer_base<BasicJsonType>::token_type;
+
+ explicit lexer(InputAdapterType&& adapter)
+ : ia(std::move(adapter)), decimal_point_char(static_cast<char_int_type>(get_decimal_point())) {}
+
+ // delete because of pointer members
+ lexer(const lexer&) = delete;
+ lexer(lexer&&) = default;
+ lexer& operator=(lexer&) = delete;
+ lexer& operator=(lexer&&) = default;
+ ~lexer() = default;
+
+ private:
+ /////////////////////
+ // locales
+ /////////////////////
+
+ /// return the locale-dependent decimal point
+ JSON_HEDLEY_PURE
+ static char get_decimal_point() noexcept
+ {
+ const auto loc = localeconv();
+ assert(loc != nullptr);
+ return (loc->decimal_point == nullptr) ? '.' : *(loc->decimal_point);
+ }
+
+ /////////////////////
+ // scan functions
+ /////////////////////
+
+ /*!
+ @brief get codepoint from 4 hex characters following `\u`
+
+ For input "\u c1 c2 c3 c4" the codepoint is:
+ (c1 * 0x1000) + (c2 * 0x0100) + (c3 * 0x0010) + c4
+ = (c1 << 12) + (c2 << 8) + (c3 << 4) + (c4 << 0)
+
+ Furthermore, the possible characters '0'..'9', 'A'..'F', and 'a'..'f'
+ must be converted to the integers 0x0..0x9, 0xA..0xF, 0xA..0xF, resp. The
+ conversion is done by subtracting the offset (0x30, 0x37, and 0x57)
+ between the ASCII value of the character and the desired integer value.
+
+ @return codepoint (0x0000..0xFFFF) or -1 in case of an error (e.g. EOF or
+ non-hex character)
+ */
+ int get_codepoint()
+ {
+ // this function only makes sense after reading `\u`
+ assert(current == 'u');
+ int codepoint = 0;
+
+ const auto factors = { 12u, 8u, 4u, 0u };
+ for (const auto factor : factors)
+ {
+ get();
+
+ if (current >= '0' and current <= '9')
+ {
+ codepoint += static_cast<int>((static_cast<unsigned int>(current) - 0x30u) << factor);
+ }
+ else if (current >= 'A' and current <= 'F')
+ {
+ codepoint += static_cast<int>((static_cast<unsigned int>(current) - 0x37u) << factor);
+ }
+ else if (current >= 'a' and current <= 'f')
+ {
+ codepoint += static_cast<int>((static_cast<unsigned int>(current) - 0x57u) << factor);
+ }
+ else
+ {
+ return -1;
+ }
+ }
+
+ assert(0x0000 <= codepoint and codepoint <= 0xFFFF);
+ return codepoint;
+ }
+
+ /*!
+ @brief check if the next byte(s) are inside a given range
+
+ Adds the current byte and, for each passed range, reads a new byte and
+ checks if it is inside the range. If a violation was detected, set up an
+ error message and return false. Otherwise, return true.
+
+ @param[in] ranges list of integers; interpreted as list of pairs of
+ inclusive lower and upper bound, respectively
+
+ @pre The passed list @a ranges must have 2, 4, or 6 elements; that is,
+ 1, 2, or 3 pairs. This precondition is enforced by an assertion.
+
+ @return true if and only if no range violation was detected
+ */
+ bool next_byte_in_range(std::initializer_list<char_int_type> ranges)
+ {
+ assert(ranges.size() == 2 or ranges.size() == 4 or ranges.size() == 6);
+ add(current);
+
+ for (auto range = ranges.begin(); range != ranges.end(); ++range)
+ {
+ get();
+ if (JSON_HEDLEY_LIKELY(*range <= current and current <= *(++range)))
+ {
+ add(current);
+ }
+ else
+ {
+ error_message = "invalid string: ill-formed UTF-8 byte";
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /*!
+ @brief scan a string literal
+
+ This function scans a string according to Sect. 7 of RFC 7159. While
+ scanning, bytes are escaped and copied into buffer token_buffer. Then the
+ function returns successfully, token_buffer is *not* null-terminated (as it
+ may contain \0 bytes), and token_buffer.size() is the number of bytes in the
+ string.
+
+ @return token_type::value_string if string could be successfully scanned,
+ token_type::parse_error otherwise
+
+ @note In case of errors, variable error_message contains a textual
+ description.
+ */
+ token_type scan_string()
+ {
+ // reset token_buffer (ignore opening quote)
+ reset();
+
+ // we entered the function by reading an open quote
+ assert(current == '\"');
+
+ while (true)
+ {
+ // get next character
+ switch (get())
+ {
+ // end of file while parsing string
+ case std::char_traits<char_type>::eof():
+ {
+ error_message = "invalid string: missing closing quote";
+ return token_type::parse_error;
+ }
+
+ // closing quote
+ case '\"':
+ {
+ return token_type::value_string;
+ }
+
+ // escapes
+ case '\\':
+ {
+ switch (get())
+ {
+ // quotation mark
+ case '\"':
+ add('\"');
+ break;
+ // reverse solidus
+ case '\\':
+ add('\\');
+ break;
+ // solidus
+ case '/':
+ add('/');
+ break;
+ // backspace
+ case 'b':
+ add('\b');
+ break;
+ // form feed
+ case 'f':
+ add('\f');
+ break;
+ // line feed
+ case 'n':
+ add('\n');
+ break;
+ // carriage return
+ case 'r':
+ add('\r');
+ break;
+ // tab
+ case 't':
+ add('\t');
+ break;
+
+ // unicode escapes
+ case 'u':
+ {
+ const int codepoint1 = get_codepoint();
+ int codepoint = codepoint1; // start with codepoint1
+
+ if (JSON_HEDLEY_UNLIKELY(codepoint1 == -1))
+ {
+ error_message = "invalid string: '\\u' must be followed by 4 hex digits";
+ return token_type::parse_error;
+ }
+
+ // check if code point is a high surrogate
+ if (0xD800 <= codepoint1 and codepoint1 <= 0xDBFF)
+ {
+ // expect next \uxxxx entry
+ if (JSON_HEDLEY_LIKELY(get() == '\\' and get() == 'u'))
+ {
+ const int codepoint2 = get_codepoint();
+
+ if (JSON_HEDLEY_UNLIKELY(codepoint2 == -1))
+ {
+ error_message = "invalid string: '\\u' must be followed by 4 hex digits";
+ return token_type::parse_error;
+ }
+
+ // check if codepoint2 is a low surrogate
+ if (JSON_HEDLEY_LIKELY(0xDC00 <= codepoint2 and codepoint2 <= 0xDFFF))
+ {
+ // overwrite codepoint
+ codepoint = static_cast<int>(
+ // high surrogate occupies the most significant 22 bits
+ (static_cast<unsigned int>(codepoint1) << 10u)
+ // low surrogate occupies the least significant 15 bits
+ + static_cast<unsigned int>(codepoint2)
+ // there is still the 0xD800, 0xDC00 and 0x10000 noise
+ // in the result so we have to subtract with:
+ // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00
+ - 0x35FDC00u);
+ }
+ else
+ {
+ error_message = "invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF";
+ return token_type::parse_error;
+ }
+ }
+ else
+ {
+ error_message = "invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF";
+ return token_type::parse_error;
+ }
+ }
+ else
+ {
+ if (JSON_HEDLEY_UNLIKELY(0xDC00 <= codepoint1 and codepoint1 <= 0xDFFF))
+ {
+ error_message = "invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF";
+ return token_type::parse_error;
+ }
+ }
+
+ // result of the above calculation yields a proper codepoint
+ assert(0x00 <= codepoint and codepoint <= 0x10FFFF);
+
+ // translate codepoint into bytes
+ if (codepoint < 0x80)
+ {
+ // 1-byte characters: 0xxxxxxx (ASCII)
+ add(static_cast<char_int_type>(codepoint));
+ }
+ else if (codepoint <= 0x7FF)
+ {
+ // 2-byte characters: 110xxxxx 10xxxxxx
+ add(static_cast<char_int_type>(0xC0u | (static_cast<unsigned int>(codepoint) >> 6u)));
+ add(static_cast<char_int_type>(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu)));
+ }
+ else if (codepoint <= 0xFFFF)
+ {
+ // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx
+ add(static_cast<char_int_type>(0xE0u | (static_cast<unsigned int>(codepoint) >> 12u)));
+ add(static_cast<char_int_type>(0x80u | ((static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu)));
+ add(static_cast<char_int_type>(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu)));
+ }
+ else
+ {
+ // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ add(static_cast<char_int_type>(0xF0u | (static_cast<unsigned int>(codepoint) >> 18u)));
+ add(static_cast<char_int_type>(0x80u | ((static_cast<unsigned int>(codepoint) >> 12u) & 0x3Fu)));
+ add(static_cast<char_int_type>(0x80u | ((static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu)));
+ add(static_cast<char_int_type>(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu)));
+ }
+
+ break;
+ }
+
+ // other characters after escape
+ default:
+ error_message = "invalid string: forbidden character after backslash";
+ return token_type::parse_error;
+ }
+
+ break;
+ }
+
+ // invalid control characters
+ case 0x00:
+ {
+ error_message = "invalid string: control character U+0000 (NUL) must be escaped to \\u0000";
+ return token_type::parse_error;
+ }
+
+ case 0x01:
+ {
+ error_message = "invalid string: control character U+0001 (SOH) must be escaped to \\u0001";
+ return token_type::parse_error;
+ }
+
+ case 0x02:
+ {
+ error_message = "invalid string: control character U+0002 (STX) must be escaped to \\u0002";
+ return token_type::parse_error;
+ }
+
+ case 0x03:
+ {
+ error_message = "invalid string: control character U+0003 (ETX) must be escaped to \\u0003";
+ return token_type::parse_error;
+ }
+
+ case 0x04:
+ {
+ error_message = "invalid string: control character U+0004 (EOT) must be escaped to \\u0004";
+ return token_type::parse_error;
+ }
+
+ case 0x05:
+ {
+ error_message = "invalid string: control character U+0005 (ENQ) must be escaped to \\u0005";
+ return token_type::parse_error;
+ }
+
+ case 0x06:
+ {
+ error_message = "invalid string: control character U+0006 (ACK) must be escaped to \\u0006";
+ return token_type::parse_error;
+ }
+
+ case 0x07:
+ {
+ error_message = "invalid string: control character U+0007 (BEL) must be escaped to \\u0007";
+ return token_type::parse_error;
+ }
+
+ case 0x08:
+ {
+ error_message = "invalid string: control character U+0008 (BS) must be escaped to \\u0008 or \\b";
+ return token_type::parse_error;
+ }
+
+ case 0x09:
+ {
+ error_message = "invalid string: control character U+0009 (HT) must be escaped to \\u0009 or \\t";
+ return token_type::parse_error;
+ }
+
+ case 0x0A:
+ {
+ error_message = "invalid string: control character U+000A (LF) must be escaped to \\u000A or \\n";
+ return token_type::parse_error;
+ }
+
+ case 0x0B:
+ {
+ error_message = "invalid string: control character U+000B (VT) must be escaped to \\u000B";
+ return token_type::parse_error;
+ }
+
+ case 0x0C:
+ {
+ error_message = "invalid string: control character U+000C (FF) must be escaped to \\u000C or \\f";
+ return token_type::parse_error;
+ }
+
+ case 0x0D:
+ {
+ error_message = "invalid string: control character U+000D (CR) must be escaped to \\u000D or \\r";
+ return token_type::parse_error;
+ }
+
+ case 0x0E:
+ {
+ error_message = "invalid string: control character U+000E (SO) must be escaped to \\u000E";
+ return token_type::parse_error;
+ }
+
+ case 0x0F:
+ {
+ error_message = "invalid string: control character U+000F (SI) must be escaped to \\u000F";
+ return token_type::parse_error;
+ }
+
+ case 0x10:
+ {
+ error_message = "invalid string: control character U+0010 (DLE) must be escaped to \\u0010";
+ return token_type::parse_error;
+ }
+
+ case 0x11:
+ {
+ error_message = "invalid string: control character U+0011 (DC1) must be escaped to \\u0011";
+ return token_type::parse_error;
+ }
+
+ case 0x12:
+ {
+ error_message = "invalid string: control character U+0012 (DC2) must be escaped to \\u0012";
+ return token_type::parse_error;
+ }
+
+ case 0x13:
+ {
+ error_message = "invalid string: control character U+0013 (DC3) must be escaped to \\u0013";
+ return token_type::parse_error;
+ }
+
+ case 0x14:
+ {
+ error_message = "invalid string: control character U+0014 (DC4) must be escaped to \\u0014";
+ return token_type::parse_error;
+ }
+
+ case 0x15:
+ {
+ error_message = "invalid string: control character U+0015 (NAK) must be escaped to \\u0015";
+ return token_type::parse_error;
+ }
+
+ case 0x16:
+ {
+ error_message = "invalid string: control character U+0016 (SYN) must be escaped to \\u0016";
+ return token_type::parse_error;
+ }
+
+ case 0x17:
+ {
+ error_message = "invalid string: control character U+0017 (ETB) must be escaped to \\u0017";
+ return token_type::parse_error;
+ }
+
+ case 0x18:
+ {
+ error_message = "invalid string: control character U+0018 (CAN) must be escaped to \\u0018";
+ return token_type::parse_error;
+ }
+
+ case 0x19:
+ {
+ error_message = "invalid string: control character U+0019 (EM) must be escaped to \\u0019";
+ return token_type::parse_error;
+ }
+
+ case 0x1A:
+ {
+ error_message = "invalid string: control character U+001A (SUB) must be escaped to \\u001A";
+ return token_type::parse_error;
+ }
+
+ case 0x1B:
+ {
+ error_message = "invalid string: control character U+001B (ESC) must be escaped to \\u001B";
+ return token_type::parse_error;
+ }
+
+ case 0x1C:
+ {
+ error_message = "invalid string: control character U+001C (FS) must be escaped to \\u001C";
+ return token_type::parse_error;
+ }
+
+ case 0x1D:
+ {
+ error_message = "invalid string: control character U+001D (GS) must be escaped to \\u001D";
+ return token_type::parse_error;
+ }
+
+ case 0x1E:
+ {
+ error_message = "invalid string: control character U+001E (RS) must be escaped to \\u001E";
+ return token_type::parse_error;
+ }
+
+ case 0x1F:
+ {
+ error_message = "invalid string: control character U+001F (US) must be escaped to \\u001F";
+ return token_type::parse_error;
+ }
+
+ // U+0020..U+007F (except U+0022 (quote) and U+005C (backspace))
+ case 0x20:
+ case 0x21:
+ case 0x23:
+ case 0x24:
+ case 0x25:
+ case 0x26:
+ case 0x27:
+ case 0x28:
+ case 0x29:
+ case 0x2A:
+ case 0x2B:
+ case 0x2C:
+ case 0x2D:
+ case 0x2E:
+ case 0x2F:
+ case 0x30:
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ case 0x37:
+ case 0x38:
+ case 0x39:
+ case 0x3A:
+ case 0x3B:
+ case 0x3C:
+ case 0x3D:
+ case 0x3E:
+ case 0x3F:
+ case 0x40:
+ case 0x41:
+ case 0x42:
+ case 0x43:
+ case 0x44:
+ case 0x45:
+ case 0x46:
+ case 0x47:
+ case 0x48:
+ case 0x49:
+ case 0x4A:
+ case 0x4B:
+ case 0x4C:
+ case 0x4D:
+ case 0x4E:
+ case 0x4F:
+ case 0x50:
+ case 0x51:
+ case 0x52:
+ case 0x53:
+ case 0x54:
+ case 0x55:
+ case 0x56:
+ case 0x57:
+ case 0x58:
+ case 0x59:
+ case 0x5A:
+ case 0x5B:
+ case 0x5D:
+ case 0x5E:
+ case 0x5F:
+ case 0x60:
+ case 0x61:
+ case 0x62:
+ case 0x63:
+ case 0x64:
+ case 0x65:
+ case 0x66:
+ case 0x67:
+ case 0x68:
+ case 0x69:
+ case 0x6A:
+ case 0x6B:
+ case 0x6C:
+ case 0x6D:
+ case 0x6E:
+ case 0x6F:
+ case 0x70:
+ case 0x71:
+ case 0x72:
+ case 0x73:
+ case 0x74:
+ case 0x75:
+ case 0x76:
+ case 0x77:
+ case 0x78:
+ case 0x79:
+ case 0x7A:
+ case 0x7B:
+ case 0x7C:
+ case 0x7D:
+ case 0x7E:
+ case 0x7F:
+ {
+ add(current);
+ break;
+ }
+
+ // U+0080..U+07FF: bytes C2..DF 80..BF
+ case 0xC2:
+ case 0xC3:
+ case 0xC4:
+ case 0xC5:
+ case 0xC6:
+ case 0xC7:
+ case 0xC8:
+ case 0xC9:
+ case 0xCA:
+ case 0xCB:
+ case 0xCC:
+ case 0xCD:
+ case 0xCE:
+ case 0xCF:
+ case 0xD0:
+ case 0xD1:
+ case 0xD2:
+ case 0xD3:
+ case 0xD4:
+ case 0xD5:
+ case 0xD6:
+ case 0xD7:
+ case 0xD8:
+ case 0xD9:
+ case 0xDA:
+ case 0xDB:
+ case 0xDC:
+ case 0xDD:
+ case 0xDE:
+ case 0xDF:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not next_byte_in_range({0x80, 0xBF})))
+ {
+ return token_type::parse_error;
+ }
+ break;
+ }
+
+ // U+0800..U+0FFF: bytes E0 A0..BF 80..BF
+ case 0xE0:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0xA0, 0xBF, 0x80, 0xBF}))))
+ {
+ return token_type::parse_error;
+ }
+ break;
+ }
+
+ // U+1000..U+CFFF: bytes E1..EC 80..BF 80..BF
+ // U+E000..U+FFFF: bytes EE..EF 80..BF 80..BF
+ case 0xE1:
+ case 0xE2:
+ case 0xE3:
+ case 0xE4:
+ case 0xE5:
+ case 0xE6:
+ case 0xE7:
+ case 0xE8:
+ case 0xE9:
+ case 0xEA:
+ case 0xEB:
+ case 0xEC:
+ case 0xEE:
+ case 0xEF:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x80, 0xBF, 0x80, 0xBF}))))
+ {
+ return token_type::parse_error;
+ }
+ break;
+ }
+
+ // U+D000..U+D7FF: bytes ED 80..9F 80..BF
+ case 0xED:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x80, 0x9F, 0x80, 0xBF}))))
+ {
+ return token_type::parse_error;
+ }
+ break;
+ }
+
+ // U+10000..U+3FFFF F0 90..BF 80..BF 80..BF
+ case 0xF0:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x90, 0xBF, 0x80, 0xBF, 0x80, 0xBF}))))
+ {
+ return token_type::parse_error;
+ }
+ break;
+ }
+
+ // U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF
+ case 0xF1:
+ case 0xF2:
+ case 0xF3:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF}))))
+ {
+ return token_type::parse_error;
+ }
+ break;
+ }
+
+ // U+100000..U+10FFFF F4 80..8F 80..BF 80..BF
+ case 0xF4:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not (next_byte_in_range({0x80, 0x8F, 0x80, 0xBF, 0x80, 0xBF}))))
+ {
+ return token_type::parse_error;
+ }
+ break;
+ }
+
+ // remaining bytes (80..C1 and F5..FF) are ill-formed
+ default:
+ {
+ error_message = "invalid string: ill-formed UTF-8 byte";
+ return token_type::parse_error;
+ }
+ }
+ }
+ }
+
+ JSON_HEDLEY_NON_NULL(2)
+ static void strtof(float& f, const char* str, char** endptr) noexcept
+ {
+ f = std::strtof(str, endptr);
+ }
+
+ JSON_HEDLEY_NON_NULL(2)
+ static void strtof(double& f, const char* str, char** endptr) noexcept
+ {
+ f = std::strtod(str, endptr);
+ }
+
+ JSON_HEDLEY_NON_NULL(2)
+ static void strtof(long double& f, const char* str, char** endptr) noexcept
+ {
+ f = std::strtold(str, endptr);
+ }
+
+ /*!
+ @brief scan a number literal
+
+ This function scans a string according to Sect. 6 of RFC 7159.
+
+ The function is realized with a deterministic finite state machine derived
+ from the grammar described in RFC 7159. Starting in state "init", the
+ input is read and used to determined the next state. Only state "done"
+ accepts the number. State "error" is a trap state to model errors. In the
+ table below, "anything" means any character but the ones listed before.
+
+ state | 0 | 1-9 | e E | + | - | . | anything
+ ---------|----------|----------|----------|---------|---------|----------|-----------
+ init | zero | any1 | [error] | [error] | minus | [error] | [error]
+ minus | zero | any1 | [error] | [error] | [error] | [error] | [error]
+ zero | done | done | exponent | done | done | decimal1 | done
+ any1 | any1 | any1 | exponent | done | done | decimal1 | done
+ decimal1 | decimal2 | decimal2 | [error] | [error] | [error] | [error] | [error]
+ decimal2 | decimal2 | decimal2 | exponent | done | done | done | done
+ exponent | any2 | any2 | [error] | sign | sign | [error] | [error]
+ sign | any2 | any2 | [error] | [error] | [error] | [error] | [error]
+ any2 | any2 | any2 | done | done | done | done | done
+
+ The state machine is realized with one label per state (prefixed with
+ "scan_number_") and `goto` statements between them. The state machine
+ contains cycles, but any cycle can be left when EOF is read. Therefore,
+ the function is guaranteed to terminate.
+
+ During scanning, the read bytes are stored in token_buffer. This string is
+ then converted to a signed integer, an unsigned integer, or a
+ floating-point number.
+
+ @return token_type::value_unsigned, token_type::value_integer, or
+ token_type::value_float if number could be successfully scanned,
+ token_type::parse_error otherwise
+
+ @note The scanner is independent of the current locale. Internally, the
+ locale's decimal point is used instead of `.` to work with the
+ locale-dependent converters.
+ */
+ token_type scan_number() // lgtm [cpp/use-of-goto]
+ {
+ // reset token_buffer to store the number's bytes
+ reset();
+
+ // the type of the parsed number; initially set to unsigned; will be
+ // changed if minus sign, decimal point or exponent is read
+ token_type number_type = token_type::value_unsigned;
+
+ // state (init): we just found out we need to scan a number
+ switch (current)
+ {
+ case '-':
+ {
+ add(current);
+ goto scan_number_minus;
+ }
+
+ case '0':
+ {
+ add(current);
+ goto scan_number_zero;
+ }
+
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_any1;
+ }
+
+ // all other characters are rejected outside scan_number()
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+
+scan_number_minus:
+ // state: we just parsed a leading minus sign
+ number_type = token_type::value_integer;
+ switch (get())
+ {
+ case '0':
+ {
+ add(current);
+ goto scan_number_zero;
+ }
+
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_any1;
+ }
+
+ default:
+ {
+ error_message = "invalid number; expected digit after '-'";
+ return token_type::parse_error;
+ }
+ }
+
+scan_number_zero:
+ // state: we just parse a zero (maybe with a leading minus sign)
+ switch (get())
+ {
+ case '.':
+ {
+ add(decimal_point_char);
+ goto scan_number_decimal1;
+ }
+
+ case 'e':
+ case 'E':
+ {
+ add(current);
+ goto scan_number_exponent;
+ }
+
+ default:
+ goto scan_number_done;
+ }
+
+scan_number_any1:
+ // state: we just parsed a number 0-9 (maybe with a leading minus sign)
+ switch (get())
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_any1;
+ }
+
+ case '.':
+ {
+ add(decimal_point_char);
+ goto scan_number_decimal1;
+ }
+
+ case 'e':
+ case 'E':
+ {
+ add(current);
+ goto scan_number_exponent;
+ }
+
+ default:
+ goto scan_number_done;
+ }
+
+scan_number_decimal1:
+ // state: we just parsed a decimal point
+ number_type = token_type::value_float;
+ switch (get())
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_decimal2;
+ }
+
+ default:
+ {
+ error_message = "invalid number; expected digit after '.'";
+ return token_type::parse_error;
+ }
+ }
+
+scan_number_decimal2:
+ // we just parsed at least one number after a decimal point
+ switch (get())
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_decimal2;
+ }
+
+ case 'e':
+ case 'E':
+ {
+ add(current);
+ goto scan_number_exponent;
+ }
+
+ default:
+ goto scan_number_done;
+ }
+
+scan_number_exponent:
+ // we just parsed an exponent
+ number_type = token_type::value_float;
+ switch (get())
+ {
+ case '+':
+ case '-':
+ {
+ add(current);
+ goto scan_number_sign;
+ }
+
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_any2;
+ }
+
+ default:
+ {
+ error_message =
+ "invalid number; expected '+', '-', or digit after exponent";
+ return token_type::parse_error;
+ }
+ }
+
+scan_number_sign:
+ // we just parsed an exponent sign
+ switch (get())
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_any2;
+ }
+
+ default:
+ {
+ error_message = "invalid number; expected digit after exponent sign";
+ return token_type::parse_error;
+ }
+ }
+
+scan_number_any2:
+ // we just parsed a number after the exponent or exponent sign
+ switch (get())
+ {
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ {
+ add(current);
+ goto scan_number_any2;
+ }
+
+ default:
+ goto scan_number_done;
+ }
+
+scan_number_done:
+ // unget the character after the number (we only read it to know that
+ // we are done scanning a number)
+ unget();
+
+ char* endptr = nullptr;
+ errno = 0;
+
+ // try to parse integers first and fall back to floats
+ if (number_type == token_type::value_unsigned)
+ {
+ const auto x = std::strtoull(token_buffer.data(), &endptr, 10);
+
+ // we checked the number format before
+ assert(endptr == token_buffer.data() + token_buffer.size());
+
+ if (errno == 0)
+ {
+ value_unsigned = static_cast<number_unsigned_t>(x);
+ if (value_unsigned == x)
+ {
+ return token_type::value_unsigned;
+ }
+ }
+ }
+ else if (number_type == token_type::value_integer)
+ {
+ const auto x = std::strtoll(token_buffer.data(), &endptr, 10);
+
+ // we checked the number format before
+ assert(endptr == token_buffer.data() + token_buffer.size());
+
+ if (errno == 0)
+ {
+ value_integer = static_cast<number_integer_t>(x);
+ if (value_integer == x)
+ {
+ return token_type::value_integer;
+ }
+ }
+ }
+
+ // this code is reached if we parse a floating-point number or if an
+ // integer conversion above failed
+ strtof(value_float, token_buffer.data(), &endptr);
+
+ // we checked the number format before
+ assert(endptr == token_buffer.data() + token_buffer.size());
+
+ return token_type::value_float;
+ }
+
+ /*!
+ @param[in] literal_text the literal text to expect
+ @param[in] length the length of the passed literal text
+ @param[in] return_type the token type to return on success
+ */
+ JSON_HEDLEY_NON_NULL(2)
+ token_type scan_literal(const char_type* literal_text, const std::size_t length,
+ token_type return_type)
+ {
+ assert(std::char_traits<char_type>::to_char_type(current) == literal_text[0]);
+ for (std::size_t i = 1; i < length; ++i)
+ {
+ if (JSON_HEDLEY_UNLIKELY(std::char_traits<char_type>::to_char_type(get()) != literal_text[i]))
+ {
+ error_message = "invalid literal";
+ return token_type::parse_error;
+ }
+ }
+ return return_type;
+ }
+
+ /////////////////////
+ // input management
+ /////////////////////
+
+ /// reset token_buffer; current character is beginning of token
+ void reset() noexcept
+ {
+ token_buffer.clear();
+ token_string.clear();
+ token_string.push_back(std::char_traits<char_type>::to_char_type(current));
+ }
+
+ /*
+ @brief get next character from the input
+
+ This function provides the interface to the used input adapter. It does
+ not throw in case the input reached EOF, but returns a
+ `std::char_traits<char>::eof()` in that case. Stores the scanned characters
+ for use in error messages.
+
+ @return character read from the input
+ */
+ char_int_type get()
+ {
+ ++position.chars_read_total;
+ ++position.chars_read_current_line;
+
+ if (next_unget)
+ {
+ // just reset the next_unget variable and work with current
+ next_unget = false;
+ }
+ else
+ {
+ current = ia.get_character();
+ }
+
+ if (JSON_HEDLEY_LIKELY(current != std::char_traits<char_type>::eof()))
+ {
+ token_string.push_back(std::char_traits<char_type>::to_char_type(current));
+ }
+
+ if (current == '\n')
+ {
+ ++position.lines_read;
+ position.chars_read_current_line = 0;
+ }
+
+ return current;
+ }
+
+ /*!
+ @brief unget current character (read it again on next get)
+
+ We implement unget by setting variable next_unget to true. The input is not
+ changed - we just simulate ungetting by modifying chars_read_total,
+ chars_read_current_line, and token_string. The next call to get() will
+ behave as if the unget character is read again.
+ */
+ void unget()
+ {
+ next_unget = true;
+
+ --position.chars_read_total;
+
+ // in case we "unget" a newline, we have to also decrement the lines_read
+ if (position.chars_read_current_line == 0)
+ {
+ if (position.lines_read > 0)
+ {
+ --position.lines_read;
+ }
+ }
+ else
+ {
+ --position.chars_read_current_line;
+ }
+
+ if (JSON_HEDLEY_LIKELY(current != std::char_traits<char_type>::eof()))
+ {
+ assert(not token_string.empty());
+ token_string.pop_back();
+ }
+ }
+
+ /// add a character to token_buffer
+ void add(char_int_type c)
+ {
+ token_buffer.push_back(static_cast<typename string_t::value_type>(c));
+ }
+
+ public:
+ /////////////////////
+ // value getters
+ /////////////////////
+
+ /// return integer value
+ constexpr number_integer_t get_number_integer() const noexcept
+ {
+ return value_integer;
+ }
+
+ /// return unsigned integer value
+ constexpr number_unsigned_t get_number_unsigned() const noexcept
+ {
+ return value_unsigned;
+ }
+
+ /// return floating-point value
+ constexpr number_float_t get_number_float() const noexcept
+ {
+ return value_float;
+ }
+
+ /// return current string value (implicitly resets the token; useful only once)
+ string_t& get_string()
+ {
+ return token_buffer;
+ }
+
+ /////////////////////
+ // diagnostics
+ /////////////////////
+
+ /// return position of last read token
+ constexpr position_t get_position() const noexcept
+ {
+ return position;
+ }
+
+ /// return the last read token (for errors only). Will never contain EOF
+ /// (an arbitrary value that is not a valid char value, often -1), because
+ /// 255 may legitimately occur. May contain NUL, which should be escaped.
+ std::string get_token_string() const
+ {
+ // escape control characters
+ std::string result;
+ for (const auto c : token_string)
+ {
+ if (static_cast<unsigned char>(c) <= '\x1F')
+ {
+ // escape control characters
+ std::array<char, 9> cs{{}};
+ (std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c));
+ result += cs.data();
+ }
+ else
+ {
+ // add character as is
+ result.push_back(static_cast<std::string::value_type>(c));
+ }
+ }
+
+ return result;
+ }
+
+ /// return syntax error message
+ JSON_HEDLEY_RETURNS_NON_NULL
+ constexpr const char* get_error_message() const noexcept
+ {
+ return error_message;
+ }
+
+ /////////////////////
+ // actual scanner
+ /////////////////////
+
+ /*!
+ @brief skip the UTF-8 byte order mark
+ @return true iff there is no BOM or the correct BOM has been skipped
+ */
+ bool skip_bom()
+ {
+ if (get() == 0xEF)
+ {
+ // check if we completely parse the BOM
+ return get() == 0xBB and get() == 0xBF;
+ }
+
+ // the first character is not the beginning of the BOM; unget it to
+ // process is later
+ unget();
+ return true;
+ }
+
+ token_type scan()
+ {
+ // initially, skip the BOM
+ if (position.chars_read_total == 0 and not skip_bom())
+ {
+ error_message = "invalid BOM; must be 0xEF 0xBB 0xBF if given";
+ return token_type::parse_error;
+ }
+
+ // read next character and ignore whitespace
+ do
+ {
+ get();
+ }
+ while (current == ' ' or current == '\t' or current == '\n' or current == '\r');
+
+ switch (current)
+ {
+ // structural characters
+ case '[':
+ return token_type::begin_array;
+ case ']':
+ return token_type::end_array;
+ case '{':
+ return token_type::begin_object;
+ case '}':
+ return token_type::end_object;
+ case ':':
+ return token_type::name_separator;
+ case ',':
+ return token_type::value_separator;
+
+ // literals
+ case 't':
+ {
+ std::array<char_type, 4> true_literal = {{'t', 'r', 'u', 'e'}};
+ return scan_literal(true_literal.data(), true_literal.size(), token_type::literal_true);
+ }
+ case 'f':
+ {
+ std::array<char_type, 5> false_literal = {{'f', 'a', 'l', 's', 'e'}};
+ return scan_literal(false_literal.data(), false_literal.size(), token_type::literal_false);
+ }
+ case 'n':
+ {
+ std::array<char_type, 4> null_literal = {{'n', 'u', 'l', 'l'}};
+ return scan_literal(null_literal.data(), null_literal.size(), token_type::literal_null);
+ }
+
+ // string
+ case '\"':
+ return scan_string();
+
+ // number
+ case '-':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ return scan_number();
+
+ // end of input (the null byte is needed when parsing from
+ // string literals)
+ case '\0':
+ case std::char_traits<char_type>::eof():
+ return token_type::end_of_input;
+
+ // error
+ default:
+ error_message = "invalid literal";
+ return token_type::parse_error;
+ }
+ }
+
+ private:
+ /// input adapter
+ InputAdapterType ia;
+
+ /// the current character
+ char_int_type current = std::char_traits<char_type>::eof();
+
+ /// whether the next get() call should just return current
+ bool next_unget = false;
+
+ /// the start position of the current token
+ position_t position {};
+
+ /// raw input token string (for error messages)
+ std::vector<char_type> token_string {};
+
+ /// buffer for variable-length tokens (numbers, strings)
+ string_t token_buffer {};
+
+ /// a description of occurred lexer errors
+ const char* error_message = "";
+
+ // number values
+ number_integer_t value_integer = 0;
+ number_unsigned_t value_unsigned = 0;
+ number_float_t value_float = 0;
+
+ /// the decimal point
+ const char_int_type decimal_point_char = '.';
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/input/parser.hpp>
+
+
+#include <cassert> // assert
+#include <cmath> // isfinite
+#include <cstdint> // uint8_t
+#include <functional> // function
+#include <string> // string
+#include <utility> // move
+#include <vector> // vector
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+// #include <nlohmann/detail/input/input_adapters.hpp>
+
+// #include <nlohmann/detail/input/json_sax.hpp>
+
+// #include <nlohmann/detail/input/lexer.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/meta/is_sax.hpp>
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+////////////
+// parser //
+////////////
+
+enum class parse_event_t : uint8_t
+{
+ /// the parser read `{` and started to process a JSON object
+ object_start,
+ /// the parser read `}` and finished processing a JSON object
+ object_end,
+ /// the parser read `[` and started to process a JSON array
+ array_start,
+ /// the parser read `]` and finished processing a JSON array
+ array_end,
+ /// the parser read a key of a value in an object
+ key,
+ /// the parser finished reading a JSON value
+ value
+};
+
+template<typename BasicJsonType>
+using parser_callback_t =
+ std::function<bool(int depth, parse_event_t event, BasicJsonType& parsed)>;
+
+/*!
+@brief syntax analysis
+
+This class implements a recursive descent parser.
+*/
+template<typename BasicJsonType, typename InputAdapterType>
+class parser
+{
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using string_t = typename BasicJsonType::string_t;
+ using lexer_t = lexer<BasicJsonType, InputAdapterType>;
+ using token_type = typename lexer_t::token_type;
+
+ public:
+ /// a parser reading from an input adapter
+ explicit parser(InputAdapterType&& adapter,
+ const parser_callback_t<BasicJsonType> cb = nullptr,
+ const bool allow_exceptions_ = true)
+ : callback(cb), m_lexer(std::move(adapter)), allow_exceptions(allow_exceptions_)
+ {
+ // read first token
+ get_token();
+ }
+
+ /*!
+ @brief public parser interface
+
+ @param[in] strict whether to expect the last token to be EOF
+ @param[in,out] result parsed JSON value
+
+ @throw parse_error.101 in case of an unexpected token
+ @throw parse_error.102 if to_unicode fails or surrogate error
+ @throw parse_error.103 if to_unicode fails
+ */
+ void parse(const bool strict, BasicJsonType& result)
+ {
+ if (callback)
+ {
+ json_sax_dom_callback_parser<BasicJsonType> sdp(result, callback, allow_exceptions);
+ sax_parse_internal(&sdp);
+ result.assert_invariant();
+
+ // in strict mode, input must be completely read
+ if (strict and (get_token() != token_type::end_of_input))
+ {
+ sdp.parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::end_of_input, "value")));
+ }
+
+ // in case of an error, return discarded value
+ if (sdp.is_errored())
+ {
+ result = value_t::discarded;
+ return;
+ }
+
+ // set top-level value to null if it was discarded by the callback
+ // function
+ if (result.is_discarded())
+ {
+ result = nullptr;
+ }
+ }
+ else
+ {
+ json_sax_dom_parser<BasicJsonType> sdp(result, allow_exceptions);
+ sax_parse_internal(&sdp);
+ result.assert_invariant();
+
+ // in strict mode, input must be completely read
+ if (strict and (get_token() != token_type::end_of_input))
+ {
+ sdp.parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::end_of_input, "value")));
+ }
+
+ // in case of an error, return discarded value
+ if (sdp.is_errored())
+ {
+ result = value_t::discarded;
+ return;
+ }
+ }
+ }
+
+ /*!
+ @brief public accept interface
+
+ @param[in] strict whether to expect the last token to be EOF
+ @return whether the input is a proper JSON text
+ */
+ bool accept(const bool strict = true)
+ {
+ json_sax_acceptor<BasicJsonType> sax_acceptor;
+ return sax_parse(&sax_acceptor, strict);
+ }
+
+ template <typename SAX>
+ JSON_HEDLEY_NON_NULL(2)
+ bool sax_parse(SAX* sax, const bool strict = true)
+ {
+ (void)detail::is_sax_static_asserts<SAX, BasicJsonType> {};
+ const bool result = sax_parse_internal(sax);
+
+ // strict mode: next byte must be EOF
+ if (result and strict and (get_token() != token_type::end_of_input))
+ {
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::end_of_input, "value")));
+ }
+
+ return result;
+ }
+
+ private:
+ template <typename SAX>
+ JSON_HEDLEY_NON_NULL(2)
+ bool sax_parse_internal(SAX* sax)
+ {
+ // stack to remember the hierarchy of structured values we are parsing
+ // true = array; false = object
+ std::vector<bool> states;
+ // value to avoid a goto (see comment where set to true)
+ bool skip_to_state_evaluation = false;
+
+ while (true)
+ {
+ if (not skip_to_state_evaluation)
+ {
+ // invariant: get_token() was called before each iteration
+ switch (last_token)
+ {
+ case token_type::begin_object:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->start_object(std::size_t(-1))))
+ {
+ return false;
+ }
+
+ // closing } -> we are done
+ if (get_token() == token_type::end_object)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->end_object()))
+ {
+ return false;
+ }
+ break;
+ }
+
+ // parse key
+ if (JSON_HEDLEY_UNLIKELY(last_token != token_type::value_string))
+ {
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::value_string, "object key")));
+ }
+ if (JSON_HEDLEY_UNLIKELY(not sax->key(m_lexer.get_string())))
+ {
+ return false;
+ }
+
+ // parse separator (:)
+ if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::name_separator))
+ {
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::name_separator, "object separator")));
+ }
+
+ // remember we are now inside an object
+ states.push_back(false);
+
+ // parse values
+ get_token();
+ continue;
+ }
+
+ case token_type::begin_array:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->start_array(std::size_t(-1))))
+ {
+ return false;
+ }
+
+ // closing ] -> we are done
+ if (get_token() == token_type::end_array)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->end_array()))
+ {
+ return false;
+ }
+ break;
+ }
+
+ // remember we are now inside an array
+ states.push_back(true);
+
+ // parse values (no need to call get_token)
+ continue;
+ }
+
+ case token_type::value_float:
+ {
+ const auto res = m_lexer.get_number_float();
+
+ if (JSON_HEDLEY_UNLIKELY(not std::isfinite(res)))
+ {
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ out_of_range::create(406, "number overflow parsing '" + m_lexer.get_token_string() + "'"));
+ }
+
+ if (JSON_HEDLEY_UNLIKELY(not sax->number_float(res, m_lexer.get_string())))
+ {
+ return false;
+ }
+
+ break;
+ }
+
+ case token_type::literal_false:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->boolean(false)))
+ {
+ return false;
+ }
+ break;
+ }
+
+ case token_type::literal_null:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->null()))
+ {
+ return false;
+ }
+ break;
+ }
+
+ case token_type::literal_true:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->boolean(true)))
+ {
+ return false;
+ }
+ break;
+ }
+
+ case token_type::value_integer:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->number_integer(m_lexer.get_number_integer())))
+ {
+ return false;
+ }
+ break;
+ }
+
+ case token_type::value_string:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->string(m_lexer.get_string())))
+ {
+ return false;
+ }
+ break;
+ }
+
+ case token_type::value_unsigned:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->number_unsigned(m_lexer.get_number_unsigned())))
+ {
+ return false;
+ }
+ break;
+ }
+
+ case token_type::parse_error:
+ {
+ // using "uninitialized" to avoid "expected" message
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::uninitialized, "value")));
+ }
+
+ default: // the last token was unexpected
+ {
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::literal_or_value, "value")));
+ }
+ }
+ }
+ else
+ {
+ skip_to_state_evaluation = false;
+ }
+
+ // we reached this line after we successfully parsed a value
+ if (states.empty())
+ {
+ // empty stack: we reached the end of the hierarchy: done
+ return true;
+ }
+
+ if (states.back()) // array
+ {
+ // comma -> next value
+ if (get_token() == token_type::value_separator)
+ {
+ // parse a new value
+ get_token();
+ continue;
+ }
+
+ // closing ]
+ if (JSON_HEDLEY_LIKELY(last_token == token_type::end_array))
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->end_array()))
+ {
+ return false;
+ }
+
+ // We are done with this array. Before we can parse a
+ // new value, we need to evaluate the new state first.
+ // By setting skip_to_state_evaluation to false, we
+ // are effectively jumping to the beginning of this if.
+ assert(not states.empty());
+ states.pop_back();
+ skip_to_state_evaluation = true;
+ continue;
+ }
+
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::end_array, "array")));
+ }
+ else // object
+ {
+ // comma -> next value
+ if (get_token() == token_type::value_separator)
+ {
+ // parse key
+ if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::value_string))
+ {
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::value_string, "object key")));
+ }
+
+ if (JSON_HEDLEY_UNLIKELY(not sax->key(m_lexer.get_string())))
+ {
+ return false;
+ }
+
+ // parse separator (:)
+ if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::name_separator))
+ {
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::name_separator, "object separator")));
+ }
+
+ // parse values
+ get_token();
+ continue;
+ }
+
+ // closing }
+ if (JSON_HEDLEY_LIKELY(last_token == token_type::end_object))
+ {
+ if (JSON_HEDLEY_UNLIKELY(not sax->end_object()))
+ {
+ return false;
+ }
+
+ // We are done with this object. Before we can parse a
+ // new value, we need to evaluate the new state first.
+ // By setting skip_to_state_evaluation to false, we
+ // are effectively jumping to the beginning of this if.
+ assert(not states.empty());
+ states.pop_back();
+ skip_to_state_evaluation = true;
+ continue;
+ }
+
+ return sax->parse_error(m_lexer.get_position(),
+ m_lexer.get_token_string(),
+ parse_error::create(101, m_lexer.get_position(),
+ exception_message(token_type::end_object, "object")));
+ }
+ }
+ }
+
+ /// get next token from lexer
+ token_type get_token()
+ {
+ return last_token = m_lexer.scan();
+ }
+
+ std::string exception_message(const token_type expected, const std::string& context)
+ {
+ std::string error_msg = "syntax error ";
+
+ if (not context.empty())
+ {
+ error_msg += "while parsing " + context + " ";
+ }
+
+ error_msg += "- ";
+
+ if (last_token == token_type::parse_error)
+ {
+ error_msg += std::string(m_lexer.get_error_message()) + "; last read: '" +
+ m_lexer.get_token_string() + "'";
+ }
+ else
+ {
+ error_msg += "unexpected " + std::string(lexer_t::token_type_name(last_token));
+ }
+
+ if (expected != token_type::uninitialized)
+ {
+ error_msg += "; expected " + std::string(lexer_t::token_type_name(expected));
+ }
+
+ return error_msg;
+ }
+
+ private:
+ /// callback function
+ const parser_callback_t<BasicJsonType> callback = nullptr;
+ /// the type of the last read token
+ token_type last_token = token_type::uninitialized;
+ /// the lexer
+ lexer_t m_lexer;
+ /// whether to throw exceptions in case of errors
+ const bool allow_exceptions = true;
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/iterators/internal_iterator.hpp>
+
+
+// #include <nlohmann/detail/iterators/primitive_iterator.hpp>
+
+
+#include <cstddef> // ptrdiff_t
+#include <limits> // numeric_limits
+
+namespace nlohmann
+{
+namespace detail
+{
+/*
+@brief an iterator for primitive JSON types
+
+This class models an iterator for primitive JSON types (boolean, number,
+string). It's only purpose is to allow the iterator/const_iterator classes
+to "iterate" over primitive values. Internally, the iterator is modeled by
+a `difference_type` variable. Value begin_value (`0`) models the begin,
+end_value (`1`) models past the end.
+*/
+class primitive_iterator_t
+{
+ private:
+ using difference_type = std::ptrdiff_t;
+ static constexpr difference_type begin_value = 0;
+ static constexpr difference_type end_value = begin_value + 1;
+
+ /// iterator as signed integer type
+ difference_type m_it = (std::numeric_limits<std::ptrdiff_t>::min)();
+
+ public:
+ constexpr difference_type get_value() const noexcept
+ {
+ return m_it;
+ }
+
+ /// set iterator to a defined beginning
+ void set_begin() noexcept
+ {
+ m_it = begin_value;
+ }
+
+ /// set iterator to a defined past the end
+ void set_end() noexcept
+ {
+ m_it = end_value;
+ }
+
+ /// return whether the iterator can be dereferenced
+ constexpr bool is_begin() const noexcept
+ {
+ return m_it == begin_value;
+ }
+
+ /// return whether the iterator is at end
+ constexpr bool is_end() const noexcept
+ {
+ return m_it == end_value;
+ }
+
+ friend constexpr bool operator==(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
+ {
+ return lhs.m_it == rhs.m_it;
+ }
+
+ friend constexpr bool operator<(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
+ {
+ return lhs.m_it < rhs.m_it;
+ }
+
+ primitive_iterator_t operator+(difference_type n) noexcept
+ {
+ auto result = *this;
+ result += n;
+ return result;
+ }
+
+ friend constexpr difference_type operator-(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept
+ {
+ return lhs.m_it - rhs.m_it;
+ }
+
+ primitive_iterator_t& operator++() noexcept
+ {
+ ++m_it;
+ return *this;
+ }
+
+ primitive_iterator_t const operator++(int) noexcept
+ {
+ auto result = *this;
+ ++m_it;
+ return result;
+ }
+
+ primitive_iterator_t& operator--() noexcept
+ {
+ --m_it;
+ return *this;
+ }
+
+ primitive_iterator_t const operator--(int) noexcept
+ {
+ auto result = *this;
+ --m_it;
+ return result;
+ }
+
+ primitive_iterator_t& operator+=(difference_type n) noexcept
+ {
+ m_it += n;
+ return *this;
+ }
+
+ primitive_iterator_t& operator-=(difference_type n) noexcept
+ {
+ m_it -= n;
+ return *this;
+ }
+};
+} // namespace detail
+} // namespace nlohmann
+
+
+namespace nlohmann
+{
+namespace detail
+{
+/*!
+@brief an iterator value
+
+@note This structure could easily be a union, but MSVC currently does not allow
+unions members with complex constructors, see https://github.com/nlohmann/json/pull/105.
+*/
+template<typename BasicJsonType> struct internal_iterator
+{
+ /// iterator for JSON objects
+ typename BasicJsonType::object_t::iterator object_iterator {};
+ /// iterator for JSON arrays
+ typename BasicJsonType::array_t::iterator array_iterator {};
+ /// iterator for JSON binary arrays
+ typename BasicJsonType::binary_t::container_type::iterator binary_iterator {};
+ /// generic iterator for all other types
+ primitive_iterator_t primitive_iterator {};
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/iterators/iter_impl.hpp>
+
+
+#include <iterator> // iterator, random_access_iterator_tag, bidirectional_iterator_tag, advance, next
+#include <type_traits> // conditional, is_const, remove_const
+
+// #include <nlohmann/detail/boolean_operators.hpp>
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+// #include <nlohmann/detail/iterators/internal_iterator.hpp>
+
+// #include <nlohmann/detail/iterators/primitive_iterator.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/meta/cpp_future.hpp>
+
+// #include <nlohmann/detail/meta/type_traits.hpp>
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+// forward declare, to be able to friend it later on
+template<typename IteratorType> class iteration_proxy;
+template<typename IteratorType> class iteration_proxy_value;
+
+/*!
+@brief a template for a bidirectional iterator for the @ref basic_json class
+This class implements a both iterators (iterator and const_iterator) for the
+@ref basic_json class.
+@note An iterator is called *initialized* when a pointer to a JSON value has
+ been set (e.g., by a constructor or a copy assignment). If the iterator is
+ default-constructed, it is *uninitialized* and most methods are undefined.
+ **The library uses assertions to detect calls on uninitialized iterators.**
+@requirement The class satisfies the following concept requirements:
+-
+[BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator):
+ The iterator that can be moved can be moved in both directions (i.e.
+ incremented and decremented).
+@since version 1.0.0, simplified in version 2.0.9, change to bidirectional
+ iterators in version 3.0.0 (see https://github.com/nlohmann/json/issues/593)
+*/
+template<typename BasicJsonType>
+class iter_impl
+{
+ /// allow basic_json to access private members
+ friend iter_impl<typename std::conditional<std::is_const<BasicJsonType>::value, typename std::remove_const<BasicJsonType>::type, const BasicJsonType>::type>;
+ friend BasicJsonType;
+ friend iteration_proxy<iter_impl>;
+ friend iteration_proxy_value<iter_impl>;
+
+ using object_t = typename BasicJsonType::object_t;
+ using array_t = typename BasicJsonType::array_t;
+ // make sure BasicJsonType is basic_json or const basic_json
+ static_assert(is_basic_json<typename std::remove_const<BasicJsonType>::type>::value,
+ "iter_impl only accepts (const) basic_json");
+
+ public:
+
+ /// The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17.
+ /// The C++ Standard has never required user-defined iterators to derive from std::iterator.
+ /// A user-defined iterator should provide publicly accessible typedefs named
+ /// iterator_category, value_type, difference_type, pointer, and reference.
+ /// Note that value_type is required to be non-const, even for constant iterators.
+ using iterator_category = std::bidirectional_iterator_tag;
+
+ /// the type of the values when the iterator is dereferenced
+ using value_type = typename BasicJsonType::value_type;
+ /// a type to represent differences between iterators
+ using difference_type = typename BasicJsonType::difference_type;
+ /// defines a pointer to the type iterated over (value_type)
+ using pointer = typename std::conditional<std::is_const<BasicJsonType>::value,
+ typename BasicJsonType::const_pointer,
+ typename BasicJsonType::pointer>::type;
+ /// defines a reference to the type iterated over (value_type)
+ using reference =
+ typename std::conditional<std::is_const<BasicJsonType>::value,
+ typename BasicJsonType::const_reference,
+ typename BasicJsonType::reference>::type;
+
+ /// default constructor
+ iter_impl() = default;
+
+ /*!
+ @brief constructor for a given JSON instance
+ @param[in] object pointer to a JSON object for this iterator
+ @pre object != nullptr
+ @post The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ explicit iter_impl(pointer object) noexcept : m_object(object)
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ {
+ m_it.object_iterator = typename object_t::iterator();
+ break;
+ }
+
+ case value_t::array:
+ {
+ m_it.array_iterator = typename array_t::iterator();
+ break;
+ }
+
+ default:
+ {
+ m_it.primitive_iterator = primitive_iterator_t();
+ break;
+ }
+ }
+ }
+
+ /*!
+ @note The conventional copy constructor and copy assignment are implicitly
+ defined. Combined with the following converting constructor and
+ assignment, they support: (1) copy from iterator to iterator, (2)
+ copy from const iterator to const iterator, and (3) conversion from
+ iterator to const iterator. However conversion from const iterator
+ to iterator is not defined.
+ */
+
+ /*!
+ @brief const copy constructor
+ @param[in] other const iterator to copy from
+ @note This copy constructor had to be defined explicitly to circumvent a bug
+ occurring on msvc v19.0 compiler (VS 2015) debug build. For more
+ information refer to: https://github.com/nlohmann/json/issues/1608
+ */
+ iter_impl(const iter_impl<const BasicJsonType>& other) noexcept
+ : m_object(other.m_object), m_it(other.m_it)
+ {}
+
+ /*!
+ @brief converting assignment
+ @param[in] other const iterator to copy from
+ @return const/non-const iterator
+ @note It is not checked whether @a other is initialized.
+ */
+ iter_impl& operator=(const iter_impl<const BasicJsonType>& other) noexcept
+ {
+ m_object = other.m_object;
+ m_it = other.m_it;
+ return *this;
+ }
+
+ /*!
+ @brief converting constructor
+ @param[in] other non-const iterator to copy from
+ @note It is not checked whether @a other is initialized.
+ */
+ iter_impl(const iter_impl<typename std::remove_const<BasicJsonType>::type>& other) noexcept
+ : m_object(other.m_object), m_it(other.m_it)
+ {}
+
+ /*!
+ @brief converting assignment
+ @param[in] other non-const iterator to copy from
+ @return const/non-const iterator
+ @note It is not checked whether @a other is initialized.
+ */
+ iter_impl& operator=(const iter_impl<typename std::remove_const<BasicJsonType>::type>& other) noexcept
+ {
+ m_object = other.m_object;
+ m_it = other.m_it;
+ return *this;
+ }
+
+ private:
+ /*!
+ @brief set the iterator to the first value
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ void set_begin() noexcept
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ {
+ m_it.object_iterator = m_object->m_value.object->begin();
+ break;
+ }
+
+ case value_t::array:
+ {
+ m_it.array_iterator = m_object->m_value.array->begin();
+ break;
+ }
+
+ case value_t::null:
+ {
+ // set to end so begin()==end() is true: null is empty
+ m_it.primitive_iterator.set_end();
+ break;
+ }
+
+ default:
+ {
+ m_it.primitive_iterator.set_begin();
+ break;
+ }
+ }
+ }
+
+ /*!
+ @brief set the iterator past the last value
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ void set_end() noexcept
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ {
+ m_it.object_iterator = m_object->m_value.object->end();
+ break;
+ }
+
+ case value_t::array:
+ {
+ m_it.array_iterator = m_object->m_value.array->end();
+ break;
+ }
+
+ default:
+ {
+ m_it.primitive_iterator.set_end();
+ break;
+ }
+ }
+ }
+
+ public:
+ /*!
+ @brief return a reference to the value pointed to by the iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ reference operator*() const
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ {
+ assert(m_it.object_iterator != m_object->m_value.object->end());
+ return m_it.object_iterator->second;
+ }
+
+ case value_t::array:
+ {
+ assert(m_it.array_iterator != m_object->m_value.array->end());
+ return *m_it.array_iterator;
+ }
+
+ case value_t::null:
+ JSON_THROW(invalid_iterator::create(214, "cannot get value"));
+
+ default:
+ {
+ if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.is_begin()))
+ {
+ return *m_object;
+ }
+
+ JSON_THROW(invalid_iterator::create(214, "cannot get value"));
+ }
+ }
+ }
+
+ /*!
+ @brief dereference the iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ pointer operator->() const
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ {
+ assert(m_it.object_iterator != m_object->m_value.object->end());
+ return &(m_it.object_iterator->second);
+ }
+
+ case value_t::array:
+ {
+ assert(m_it.array_iterator != m_object->m_value.array->end());
+ return &*m_it.array_iterator;
+ }
+
+ default:
+ {
+ if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.is_begin()))
+ {
+ return m_object;
+ }
+
+ JSON_THROW(invalid_iterator::create(214, "cannot get value"));
+ }
+ }
+ }
+
+ /*!
+ @brief post-increment (it++)
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl const operator++(int)
+ {
+ auto result = *this;
+ ++(*this);
+ return result;
+ }
+
+ /*!
+ @brief pre-increment (++it)
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl& operator++()
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ {
+ std::advance(m_it.object_iterator, 1);
+ break;
+ }
+
+ case value_t::array:
+ {
+ std::advance(m_it.array_iterator, 1);
+ break;
+ }
+
+ default:
+ {
+ ++m_it.primitive_iterator;
+ break;
+ }
+ }
+
+ return *this;
+ }
+
+ /*!
+ @brief post-decrement (it--)
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl const operator--(int)
+ {
+ auto result = *this;
+ --(*this);
+ return result;
+ }
+
+ /*!
+ @brief pre-decrement (--it)
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl& operator--()
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ {
+ std::advance(m_it.object_iterator, -1);
+ break;
+ }
+
+ case value_t::array:
+ {
+ std::advance(m_it.array_iterator, -1);
+ break;
+ }
+
+ default:
+ {
+ --m_it.primitive_iterator;
+ break;
+ }
+ }
+
+ return *this;
+ }
+
+ /*!
+ @brief comparison: equal
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ bool operator==(const iter_impl& other) const
+ {
+ // if objects are not the same, the comparison is undefined
+ if (JSON_HEDLEY_UNLIKELY(m_object != other.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers"));
+ }
+
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ return (m_it.object_iterator == other.m_it.object_iterator);
+
+ case value_t::array:
+ return (m_it.array_iterator == other.m_it.array_iterator);
+
+ default:
+ return (m_it.primitive_iterator == other.m_it.primitive_iterator);
+ }
+ }
+
+ /*!
+ @brief comparison: not equal
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ bool operator!=(const iter_impl& other) const
+ {
+ return not operator==(other);
+ }
+
+ /*!
+ @brief comparison: smaller
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ bool operator<(const iter_impl& other) const
+ {
+ // if objects are not the same, the comparison is undefined
+ if (JSON_HEDLEY_UNLIKELY(m_object != other.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(212, "cannot compare iterators of different containers"));
+ }
+
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ JSON_THROW(invalid_iterator::create(213, "cannot compare order of object iterators"));
+
+ case value_t::array:
+ return (m_it.array_iterator < other.m_it.array_iterator);
+
+ default:
+ return (m_it.primitive_iterator < other.m_it.primitive_iterator);
+ }
+ }
+
+ /*!
+ @brief comparison: less than or equal
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ bool operator<=(const iter_impl& other) const
+ {
+ return not other.operator < (*this);
+ }
+
+ /*!
+ @brief comparison: greater than
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ bool operator>(const iter_impl& other) const
+ {
+ return not operator<=(other);
+ }
+
+ /*!
+ @brief comparison: greater than or equal
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ bool operator>=(const iter_impl& other) const
+ {
+ return not operator<(other);
+ }
+
+ /*!
+ @brief add to iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl& operator+=(difference_type i)
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ JSON_THROW(invalid_iterator::create(209, "cannot use offsets with object iterators"));
+
+ case value_t::array:
+ {
+ std::advance(m_it.array_iterator, i);
+ break;
+ }
+
+ default:
+ {
+ m_it.primitive_iterator += i;
+ break;
+ }
+ }
+
+ return *this;
+ }
+
+ /*!
+ @brief subtract from iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl& operator-=(difference_type i)
+ {
+ return operator+=(-i);
+ }
+
+ /*!
+ @brief add to iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl operator+(difference_type i) const
+ {
+ auto result = *this;
+ result += i;
+ return result;
+ }
+
+ /*!
+ @brief addition of distance and iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ friend iter_impl operator+(difference_type i, const iter_impl& it)
+ {
+ auto result = it;
+ result += i;
+ return result;
+ }
+
+ /*!
+ @brief subtract from iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ iter_impl operator-(difference_type i) const
+ {
+ auto result = *this;
+ result -= i;
+ return result;
+ }
+
+ /*!
+ @brief return difference
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ difference_type operator-(const iter_impl& other) const
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ JSON_THROW(invalid_iterator::create(209, "cannot use offsets with object iterators"));
+
+ case value_t::array:
+ return m_it.array_iterator - other.m_it.array_iterator;
+
+ default:
+ return m_it.primitive_iterator - other.m_it.primitive_iterator;
+ }
+ }
+
+ /*!
+ @brief access to successor
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ reference operator[](difference_type n) const
+ {
+ assert(m_object != nullptr);
+
+ switch (m_object->m_type)
+ {
+ case value_t::object:
+ JSON_THROW(invalid_iterator::create(208, "cannot use operator[] for object iterators"));
+
+ case value_t::array:
+ return *std::next(m_it.array_iterator, n);
+
+ case value_t::null:
+ JSON_THROW(invalid_iterator::create(214, "cannot get value"));
+
+ default:
+ {
+ if (JSON_HEDLEY_LIKELY(m_it.primitive_iterator.get_value() == -n))
+ {
+ return *m_object;
+ }
+
+ JSON_THROW(invalid_iterator::create(214, "cannot get value"));
+ }
+ }
+ }
+
+ /*!
+ @brief return the key of an object iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ const typename object_t::key_type& key() const
+ {
+ assert(m_object != nullptr);
+
+ if (JSON_HEDLEY_LIKELY(m_object->is_object()))
+ {
+ return m_it.object_iterator->first;
+ }
+
+ JSON_THROW(invalid_iterator::create(207, "cannot use key() for non-object iterators"));
+ }
+
+ /*!
+ @brief return the value of an iterator
+ @pre The iterator is initialized; i.e. `m_object != nullptr`.
+ */
+ reference value() const
+ {
+ return operator*();
+ }
+
+ private:
+ /// associated JSON instance
+ pointer m_object = nullptr;
+ /// the actual iterator of the associated instance
+ internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/iterators/iteration_proxy.hpp>
+
+// #include <nlohmann/detail/iterators/json_reverse_iterator.hpp>
+
+
+#include <cstddef> // ptrdiff_t
+#include <iterator> // reverse_iterator
+#include <utility> // declval
+
+namespace nlohmann
+{
+namespace detail
+{
+//////////////////////
+// reverse_iterator //
+//////////////////////
+
+/*!
+@brief a template for a reverse iterator class
+
+@tparam Base the base iterator type to reverse. Valid types are @ref
+iterator (to create @ref reverse_iterator) and @ref const_iterator (to
+create @ref const_reverse_iterator).
+
+@requirement The class satisfies the following concept requirements:
+-
+[BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator):
+ The iterator that can be moved can be moved in both directions (i.e.
+ incremented and decremented).
+- [OutputIterator](https://en.cppreference.com/w/cpp/named_req/OutputIterator):
+ It is possible to write to the pointed-to element (only if @a Base is
+ @ref iterator).
+
+@since version 1.0.0
+*/
+template<typename Base>
+class json_reverse_iterator : public std::reverse_iterator<Base>
+{
+ public:
+ using difference_type = std::ptrdiff_t;
+ /// shortcut to the reverse iterator adapter
+ using base_iterator = std::reverse_iterator<Base>;
+ /// the reference type for the pointed-to element
+ using reference = typename Base::reference;
+
+ /// create reverse iterator from iterator
+ explicit json_reverse_iterator(const typename base_iterator::iterator_type& it) noexcept
+ : base_iterator(it) {}
+
+ /// create reverse iterator from base class
+ explicit json_reverse_iterator(const base_iterator& it) noexcept : base_iterator(it) {}
+
+ /// post-increment (it++)
+ json_reverse_iterator const operator++(int)
+ {
+ return static_cast<json_reverse_iterator>(base_iterator::operator++(1));
+ }
+
+ /// pre-increment (++it)
+ json_reverse_iterator& operator++()
+ {
+ return static_cast<json_reverse_iterator&>(base_iterator::operator++());
+ }
+
+ /// post-decrement (it--)
+ json_reverse_iterator const operator--(int)
+ {
+ return static_cast<json_reverse_iterator>(base_iterator::operator--(1));
+ }
+
+ /// pre-decrement (--it)
+ json_reverse_iterator& operator--()
+ {
+ return static_cast<json_reverse_iterator&>(base_iterator::operator--());
+ }
+
+ /// add to iterator
+ json_reverse_iterator& operator+=(difference_type i)
+ {
+ return static_cast<json_reverse_iterator&>(base_iterator::operator+=(i));
+ }
+
+ /// add to iterator
+ json_reverse_iterator operator+(difference_type i) const
+ {
+ return static_cast<json_reverse_iterator>(base_iterator::operator+(i));
+ }
+
+ /// subtract from iterator
+ json_reverse_iterator operator-(difference_type i) const
+ {
+ return static_cast<json_reverse_iterator>(base_iterator::operator-(i));
+ }
+
+ /// return difference
+ difference_type operator-(const json_reverse_iterator& other) const
+ {
+ return base_iterator(*this) - base_iterator(other);
+ }
+
+ /// access to successor
+ reference operator[](difference_type n) const
+ {
+ return *(this->operator+(n));
+ }
+
+ /// return the key of an object iterator
+ auto key() const -> decltype(std::declval<Base>().key())
+ {
+ auto it = --this->base();
+ return it.key();
+ }
+
+ /// return the value of an iterator
+ reference value() const
+ {
+ auto it = --this->base();
+ return it.operator * ();
+ }
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/iterators/primitive_iterator.hpp>
+
+// #include <nlohmann/detail/json_pointer.hpp>
+
+
+#include <algorithm> // all_of
+#include <cassert> // assert
+#include <cctype> // isdigit
+#include <numeric> // accumulate
+#include <string> // string
+#include <utility> // move
+#include <vector> // vector
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+namespace nlohmann
+{
+template<typename BasicJsonType>
+class json_pointer
+{
+ // allow basic_json to access private members
+ NLOHMANN_BASIC_JSON_TPL_DECLARATION
+ friend class basic_json;
+
+ public:
+ /*!
+ @brief create JSON pointer
+
+ Create a JSON pointer according to the syntax described in
+ [Section 3 of RFC6901](https://tools.ietf.org/html/rfc6901#section-3).
+
+ @param[in] s string representing the JSON pointer; if omitted, the empty
+ string is assumed which references the whole JSON value
+
+ @throw parse_error.107 if the given JSON pointer @a s is nonempty and does
+ not begin with a slash (`/`); see example below
+
+ @throw parse_error.108 if a tilde (`~`) in the given JSON pointer @a s is
+ not followed by `0` (representing `~`) or `1` (representing `/`); see
+ example below
+
+ @liveexample{The example shows the construction several valid JSON pointers
+ as well as the exceptional behavior.,json_pointer}
+
+ @since version 2.0.0
+ */
+ explicit json_pointer(const std::string& s = "")
+ : reference_tokens(split(s))
+ {}
+
+ /*!
+ @brief return a string representation of the JSON pointer
+
+ @invariant For each JSON pointer `ptr`, it holds:
+ @code {.cpp}
+ ptr == json_pointer(ptr.to_string());
+ @endcode
+
+ @return a string representation of the JSON pointer
+
+ @liveexample{The example shows the result of `to_string`.,json_pointer__to_string}
+
+ @since version 2.0.0
+ */
+ std::string to_string() const
+ {
+ return std::accumulate(reference_tokens.begin(), reference_tokens.end(),
+ std::string{},
+ [](const std::string & a, const std::string & b)
+ {
+ return a + "/" + escape(b);
+ });
+ }
+
+ /// @copydoc to_string()
+ operator std::string() const
+ {
+ return to_string();
+ }
+
+ /*!
+ @brief append another JSON pointer at the end of this JSON pointer
+
+ @param[in] ptr JSON pointer to append
+ @return JSON pointer with @a ptr appended
+
+ @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add}
+
+ @complexity Linear in the length of @a ptr.
+
+ @sa @ref operator/=(std::string) to append a reference token
+ @sa @ref operator/=(std::size_t) to append an array index
+ @sa @ref operator/(const json_pointer&, const json_pointer&) for a binary operator
+
+ @since version 3.6.0
+ */
+ json_pointer& operator/=(const json_pointer& ptr)
+ {
+ reference_tokens.insert(reference_tokens.end(),
+ ptr.reference_tokens.begin(),
+ ptr.reference_tokens.end());
+ return *this;
+ }
+
+ /*!
+ @brief append an unescaped reference token at the end of this JSON pointer
+
+ @param[in] token reference token to append
+ @return JSON pointer with @a token appended without escaping @a token
+
+ @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add}
+
+ @complexity Amortized constant.
+
+ @sa @ref operator/=(const json_pointer&) to append a JSON pointer
+ @sa @ref operator/=(std::size_t) to append an array index
+ @sa @ref operator/(const json_pointer&, std::size_t) for a binary operator
+
+ @since version 3.6.0
+ */
+ json_pointer& operator/=(std::string token)
+ {
+ push_back(std::move(token));
+ return *this;
+ }
+
+ /*!
+ @brief append an array index at the end of this JSON pointer
+
+ @param[in] array_idx array index to append
+ @return JSON pointer with @a array_idx appended
+
+ @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add}
+
+ @complexity Amortized constant.
+
+ @sa @ref operator/=(const json_pointer&) to append a JSON pointer
+ @sa @ref operator/=(std::string) to append a reference token
+ @sa @ref operator/(const json_pointer&, std::string) for a binary operator
+
+ @since version 3.6.0
+ */
+ json_pointer& operator/=(std::size_t array_idx)
+ {
+ return *this /= std::to_string(array_idx);
+ }
+
+ /*!
+ @brief create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer
+
+ @param[in] lhs JSON pointer
+ @param[in] rhs JSON pointer
+ @return a new JSON pointer with @a rhs appended to @a lhs
+
+ @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary}
+
+ @complexity Linear in the length of @a lhs and @a rhs.
+
+ @sa @ref operator/=(const json_pointer&) to append a JSON pointer
+
+ @since version 3.6.0
+ */
+ friend json_pointer operator/(const json_pointer& lhs,
+ const json_pointer& rhs)
+ {
+ return json_pointer(lhs) /= rhs;
+ }
+
+ /*!
+ @brief create a new JSON pointer by appending the unescaped token at the end of the JSON pointer
+
+ @param[in] ptr JSON pointer
+ @param[in] token reference token
+ @return a new JSON pointer with unescaped @a token appended to @a ptr
+
+ @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary}
+
+ @complexity Linear in the length of @a ptr.
+
+ @sa @ref operator/=(std::string) to append a reference token
+
+ @since version 3.6.0
+ */
+ friend json_pointer operator/(const json_pointer& ptr, std::string token)
+ {
+ return json_pointer(ptr) /= std::move(token);
+ }
+
+ /*!
+ @brief create a new JSON pointer by appending the array-index-token at the end of the JSON pointer
+
+ @param[in] ptr JSON pointer
+ @param[in] array_idx array index
+ @return a new JSON pointer with @a array_idx appended to @a ptr
+
+ @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary}
+
+ @complexity Linear in the length of @a ptr.
+
+ @sa @ref operator/=(std::size_t) to append an array index
+
+ @since version 3.6.0
+ */
+ friend json_pointer operator/(const json_pointer& ptr, std::size_t array_idx)
+ {
+ return json_pointer(ptr) /= array_idx;
+ }
+
+ /*!
+ @brief returns the parent of this JSON pointer
+
+ @return parent of this JSON pointer; in case this JSON pointer is the root,
+ the root itself is returned
+
+ @complexity Linear in the length of the JSON pointer.
+
+ @liveexample{The example shows the result of `parent_pointer` for different
+ JSON Pointers.,json_pointer__parent_pointer}
+
+ @since version 3.6.0
+ */
+ json_pointer parent_pointer() const
+ {
+ if (empty())
+ {
+ return *this;
+ }
+
+ json_pointer res = *this;
+ res.pop_back();
+ return res;
+ }
+
+ /*!
+ @brief remove last reference token
+
+ @pre not `empty()`
+
+ @liveexample{The example shows the usage of `pop_back`.,json_pointer__pop_back}
+
+ @complexity Constant.
+
+ @throw out_of_range.405 if JSON pointer has no parent
+
+ @since version 3.6.0
+ */
+ void pop_back()
+ {
+ if (JSON_HEDLEY_UNLIKELY(empty()))
+ {
+ JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
+ }
+
+ reference_tokens.pop_back();
+ }
+
+ /*!
+ @brief return last reference token
+
+ @pre not `empty()`
+ @return last reference token
+
+ @liveexample{The example shows the usage of `back`.,json_pointer__back}
+
+ @complexity Constant.
+
+ @throw out_of_range.405 if JSON pointer has no parent
+
+ @since version 3.6.0
+ */
+ const std::string& back() const
+ {
+ if (JSON_HEDLEY_UNLIKELY(empty()))
+ {
+ JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
+ }
+
+ return reference_tokens.back();
+ }
+
+ /*!
+ @brief append an unescaped token at the end of the reference pointer
+
+ @param[in] token token to add
+
+ @complexity Amortized constant.
+
+ @liveexample{The example shows the result of `push_back` for different
+ JSON Pointers.,json_pointer__push_back}
+
+ @since version 3.6.0
+ */
+ void push_back(const std::string& token)
+ {
+ reference_tokens.push_back(token);
+ }
+
+ /// @copydoc push_back(const std::string&)
+ void push_back(std::string&& token)
+ {
+ reference_tokens.push_back(std::move(token));
+ }
+
+ /*!
+ @brief return whether pointer points to the root document
+
+ @return true iff the JSON pointer points to the root document
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @liveexample{The example shows the result of `empty` for different JSON
+ Pointers.,json_pointer__empty}
+
+ @since version 3.6.0
+ */
+ bool empty() const noexcept
+ {
+ return reference_tokens.empty();
+ }
+
+ private:
+ /*!
+ @param[in] s reference token to be converted into an array index
+
+ @return integer representation of @a s
+
+ @throw out_of_range.404 if string @a s could not be converted to an integer
+ */
+ static int array_index(const std::string& s)
+ {
+ // error condition (cf. RFC 6901, Sect. 4)
+ if (JSON_HEDLEY_UNLIKELY(s.size() > 1 and s[0] == '0'))
+ {
+ JSON_THROW(detail::parse_error::create(106, 0,
+ "array index '" + s +
+ "' must not begin with '0'"));
+ }
+
+ // error condition (cf. RFC 6901, Sect. 4)
+ if (JSON_HEDLEY_UNLIKELY(s.size() > 1 and not (s[0] >= '1' and s[0] <= '9')))
+ {
+ JSON_THROW(detail::parse_error::create(109, 0, "array index '" + s + "' is not a number"));
+ }
+
+ std::size_t processed_chars = 0;
+ int res = 0;
+ JSON_TRY
+ {
+ res = std::stoi(s, &processed_chars);
+ }
+ JSON_CATCH(std::out_of_range&)
+ {
+ JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + s + "'"));
+ }
+
+ // check if the string was completely read
+ if (JSON_HEDLEY_UNLIKELY(processed_chars != s.size()))
+ {
+ JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + s + "'"));
+ }
+
+ return res;
+ }
+
+ json_pointer top() const
+ {
+ if (JSON_HEDLEY_UNLIKELY(empty()))
+ {
+ JSON_THROW(detail::out_of_range::create(405, "JSON pointer has no parent"));
+ }
+
+ json_pointer result = *this;
+ result.reference_tokens = {reference_tokens[0]};
+ return result;
+ }
+
+ /*!
+ @brief create and return a reference to the pointed to value
+
+ @complexity Linear in the number of reference tokens.
+
+ @throw parse_error.109 if array index is not a number
+ @throw type_error.313 if value cannot be unflattened
+ */
+ BasicJsonType& get_and_create(BasicJsonType& j) const
+ {
+ using size_type = typename BasicJsonType::size_type;
+ auto result = &j;
+
+ // in case no reference tokens exist, return a reference to the JSON value
+ // j which will be overwritten by a primitive value
+ for (const auto& reference_token : reference_tokens)
+ {
+ switch (result->type())
+ {
+ case detail::value_t::null:
+ {
+ if (reference_token == "0")
+ {
+ // start a new array if reference token is 0
+ result = &result->operator[](0);
+ }
+ else
+ {
+ // start a new object otherwise
+ result = &result->operator[](reference_token);
+ }
+ break;
+ }
+
+ case detail::value_t::object:
+ {
+ // create an entry in the object
+ result = &result->operator[](reference_token);
+ break;
+ }
+
+ case detail::value_t::array:
+ {
+ // create an entry in the array
+ result = &result->operator[](static_cast<size_type>(array_index(reference_token)));
+ break;
+ }
+
+ /*
+ The following code is only reached if there exists a reference
+ token _and_ the current value is primitive. In this case, we have
+ an error situation, because primitive values may only occur as
+ single value; that is, with an empty list of reference tokens.
+ */
+ default:
+ JSON_THROW(detail::type_error::create(313, "invalid value to unflatten"));
+ }
+ }
+
+ return *result;
+ }
+
+ /*!
+ @brief return a reference to the pointed to value
+
+ @note This version does not throw if a value is not present, but tries to
+ create nested values instead. For instance, calling this function
+ with pointer `"/this/that"` on a null value is equivalent to calling
+ `operator[]("this").operator[]("that")` on that value, effectively
+ changing the null value to an object.
+
+ @param[in] ptr a JSON value
+
+ @return reference to the JSON value pointed to by the JSON pointer
+
+ @complexity Linear in the length of the JSON pointer.
+
+ @throw parse_error.106 if an array index begins with '0'
+ @throw parse_error.109 if an array index was not a number
+ @throw out_of_range.404 if the JSON pointer can not be resolved
+ */
+ BasicJsonType& get_unchecked(BasicJsonType* ptr) const
+ {
+ using size_type = typename BasicJsonType::size_type;
+ for (const auto& reference_token : reference_tokens)
+ {
+ // convert null values to arrays or objects before continuing
+ if (ptr->is_null())
+ {
+ // check if reference token is a number
+ const bool nums =
+ std::all_of(reference_token.begin(), reference_token.end(),
+ [](const unsigned char x)
+ {
+ return std::isdigit(x);
+ });
+
+ // change value to array for numbers or "-" or to object otherwise
+ *ptr = (nums or reference_token == "-")
+ ? detail::value_t::array
+ : detail::value_t::object;
+ }
+
+ switch (ptr->type())
+ {
+ case detail::value_t::object:
+ {
+ // use unchecked object access
+ ptr = &ptr->operator[](reference_token);
+ break;
+ }
+
+ case detail::value_t::array:
+ {
+ if (reference_token == "-")
+ {
+ // explicitly treat "-" as index beyond the end
+ ptr = &ptr->operator[](ptr->m_value.array->size());
+ }
+ else
+ {
+ // convert array index to number; unchecked access
+ ptr = &ptr->operator[](
+ static_cast<size_type>(array_index(reference_token)));
+ }
+ break;
+ }
+
+ default:
+ JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'"));
+ }
+ }
+
+ return *ptr;
+ }
+
+ /*!
+ @throw parse_error.106 if an array index begins with '0'
+ @throw parse_error.109 if an array index was not a number
+ @throw out_of_range.402 if the array index '-' is used
+ @throw out_of_range.404 if the JSON pointer can not be resolved
+ */
+ BasicJsonType& get_checked(BasicJsonType* ptr) const
+ {
+ using size_type = typename BasicJsonType::size_type;
+ for (const auto& reference_token : reference_tokens)
+ {
+ switch (ptr->type())
+ {
+ case detail::value_t::object:
+ {
+ // note: at performs range check
+ ptr = &ptr->at(reference_token);
+ break;
+ }
+
+ case detail::value_t::array:
+ {
+ if (JSON_HEDLEY_UNLIKELY(reference_token == "-"))
+ {
+ // "-" always fails the range check
+ JSON_THROW(detail::out_of_range::create(402,
+ "array index '-' (" + std::to_string(ptr->m_value.array->size()) +
+ ") is out of range"));
+ }
+
+ // note: at performs range check
+ ptr = &ptr->at(static_cast<size_type>(array_index(reference_token)));
+ break;
+ }
+
+ default:
+ JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'"));
+ }
+ }
+
+ return *ptr;
+ }
+
+ /*!
+ @brief return a const reference to the pointed to value
+
+ @param[in] ptr a JSON value
+
+ @return const reference to the JSON value pointed to by the JSON
+ pointer
+
+ @throw parse_error.106 if an array index begins with '0'
+ @throw parse_error.109 if an array index was not a number
+ @throw out_of_range.402 if the array index '-' is used
+ @throw out_of_range.404 if the JSON pointer can not be resolved
+ */
+ const BasicJsonType& get_unchecked(const BasicJsonType* ptr) const
+ {
+ using size_type = typename BasicJsonType::size_type;
+ for (const auto& reference_token : reference_tokens)
+ {
+ switch (ptr->type())
+ {
+ case detail::value_t::object:
+ {
+ // use unchecked object access
+ ptr = &ptr->operator[](reference_token);
+ break;
+ }
+
+ case detail::value_t::array:
+ {
+ if (JSON_HEDLEY_UNLIKELY(reference_token == "-"))
+ {
+ // "-" cannot be used for const access
+ JSON_THROW(detail::out_of_range::create(402,
+ "array index '-' (" + std::to_string(ptr->m_value.array->size()) +
+ ") is out of range"));
+ }
+
+ // use unchecked array access
+ ptr = &ptr->operator[](
+ static_cast<size_type>(array_index(reference_token)));
+ break;
+ }
+
+ default:
+ JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'"));
+ }
+ }
+
+ return *ptr;
+ }
+
+ /*!
+ @throw parse_error.106 if an array index begins with '0'
+ @throw parse_error.109 if an array index was not a number
+ @throw out_of_range.402 if the array index '-' is used
+ @throw out_of_range.404 if the JSON pointer can not be resolved
+ */
+ const BasicJsonType& get_checked(const BasicJsonType* ptr) const
+ {
+ using size_type = typename BasicJsonType::size_type;
+ for (const auto& reference_token : reference_tokens)
+ {
+ switch (ptr->type())
+ {
+ case detail::value_t::object:
+ {
+ // note: at performs range check
+ ptr = &ptr->at(reference_token);
+ break;
+ }
+
+ case detail::value_t::array:
+ {
+ if (JSON_HEDLEY_UNLIKELY(reference_token == "-"))
+ {
+ // "-" always fails the range check
+ JSON_THROW(detail::out_of_range::create(402,
+ "array index '-' (" + std::to_string(ptr->m_value.array->size()) +
+ ") is out of range"));
+ }
+
+ // note: at performs range check
+ ptr = &ptr->at(static_cast<size_type>(array_index(reference_token)));
+ break;
+ }
+
+ default:
+ JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'"));
+ }
+ }
+
+ return *ptr;
+ }
+
+ /*!
+ @throw parse_error.106 if an array index begins with '0'
+ @throw parse_error.109 if an array index was not a number
+ */
+ bool contains(const BasicJsonType* ptr) const
+ {
+ using size_type = typename BasicJsonType::size_type;
+ for (const auto& reference_token : reference_tokens)
+ {
+ switch (ptr->type())
+ {
+ case detail::value_t::object:
+ {
+ if (not ptr->contains(reference_token))
+ {
+ // we did not find the key in the object
+ return false;
+ }
+
+ ptr = &ptr->operator[](reference_token);
+ break;
+ }
+
+ case detail::value_t::array:
+ {
+ if (JSON_HEDLEY_UNLIKELY(reference_token == "-"))
+ {
+ // "-" always fails the range check
+ return false;
+ }
+ if (JSON_HEDLEY_UNLIKELY(reference_token.size() == 1 and not ("0" <= reference_token and reference_token <= "9")))
+ {
+ // invalid char
+ return false;
+ }
+ if (JSON_HEDLEY_UNLIKELY(reference_token.size() > 1))
+ {
+ if (JSON_HEDLEY_UNLIKELY(not ('1' <= reference_token[0] and reference_token[0] <= '9')))
+ {
+ // first char should be between '1' and '9'
+ return false;
+ }
+ for (std::size_t i = 1; i < reference_token.size(); i++)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not ('0' <= reference_token[i] and reference_token[i] <= '9')))
+ {
+ // other char should be between '0' and '9'
+ return false;
+ }
+ }
+ }
+
+ const auto idx = static_cast<size_type>(array_index(reference_token));
+ if (idx >= ptr->size())
+ {
+ // index out of range
+ return false;
+ }
+
+ ptr = &ptr->operator[](idx);
+ break;
+ }
+
+ default:
+ {
+ // we do not expect primitive values if there is still a
+ // reference token to process
+ return false;
+ }
+ }
+ }
+
+ // no reference token left means we found a primitive value
+ return true;
+ }
+
+ /*!
+ @brief split the string input to reference tokens
+
+ @note This function is only called by the json_pointer constructor.
+ All exceptions below are documented there.
+
+ @throw parse_error.107 if the pointer is not empty or begins with '/'
+ @throw parse_error.108 if character '~' is not followed by '0' or '1'
+ */
+ static std::vector<std::string> split(const std::string& reference_string)
+ {
+ std::vector<std::string> result;
+
+ // special case: empty reference string -> no reference tokens
+ if (reference_string.empty())
+ {
+ return result;
+ }
+
+ // check if nonempty reference string begins with slash
+ if (JSON_HEDLEY_UNLIKELY(reference_string[0] != '/'))
+ {
+ JSON_THROW(detail::parse_error::create(107, 1,
+ "JSON pointer must be empty or begin with '/' - was: '" +
+ reference_string + "'"));
+ }
+
+ // extract the reference tokens:
+ // - slash: position of the last read slash (or end of string)
+ // - start: position after the previous slash
+ for (
+ // search for the first slash after the first character
+ std::size_t slash = reference_string.find_first_of('/', 1),
+ // set the beginning of the first reference token
+ start = 1;
+ // we can stop if start == 0 (if slash == std::string::npos)
+ start != 0;
+ // set the beginning of the next reference token
+ // (will eventually be 0 if slash == std::string::npos)
+ start = (slash == std::string::npos) ? 0 : slash + 1,
+ // find next slash
+ slash = reference_string.find_first_of('/', start))
+ {
+ // use the text between the beginning of the reference token
+ // (start) and the last slash (slash).
+ auto reference_token = reference_string.substr(start, slash - start);
+
+ // check reference tokens are properly escaped
+ for (std::size_t pos = reference_token.find_first_of('~');
+ pos != std::string::npos;
+ pos = reference_token.find_first_of('~', pos + 1))
+ {
+ assert(reference_token[pos] == '~');
+
+ // ~ must be followed by 0 or 1
+ if (JSON_HEDLEY_UNLIKELY(pos == reference_token.size() - 1 or
+ (reference_token[pos + 1] != '0' and
+ reference_token[pos + 1] != '1')))
+ {
+ JSON_THROW(detail::parse_error::create(108, 0, "escape character '~' must be followed with '0' or '1'"));
+ }
+ }
+
+ // finally, store the reference token
+ unescape(reference_token);
+ result.push_back(reference_token);
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief replace all occurrences of a substring by another string
+
+ @param[in,out] s the string to manipulate; changed so that all
+ occurrences of @a f are replaced with @a t
+ @param[in] f the substring to replace with @a t
+ @param[in] t the string to replace @a f
+
+ @pre The search string @a f must not be empty. **This precondition is
+ enforced with an assertion.**
+
+ @since version 2.0.0
+ */
+ static void replace_substring(std::string& s, const std::string& f,
+ const std::string& t)
+ {
+ assert(not f.empty());
+ for (auto pos = s.find(f); // find first occurrence of f
+ pos != std::string::npos; // make sure f was found
+ s.replace(pos, f.size(), t), // replace with t, and
+ pos = s.find(f, pos + t.size())) // find next occurrence of f
+ {}
+ }
+
+ /// escape "~" to "~0" and "/" to "~1"
+ static std::string escape(std::string s)
+ {
+ replace_substring(s, "~", "~0");
+ replace_substring(s, "/", "~1");
+ return s;
+ }
+
+ /// unescape "~1" to tilde and "~0" to slash (order is important!)
+ static void unescape(std::string& s)
+ {
+ replace_substring(s, "~1", "/");
+ replace_substring(s, "~0", "~");
+ }
+
+ /*!
+ @param[in] reference_string the reference string to the current value
+ @param[in] value the value to consider
+ @param[in,out] result the result object to insert values to
+
+ @note Empty objects or arrays are flattened to `null`.
+ */
+ static void flatten(const std::string& reference_string,
+ const BasicJsonType& value,
+ BasicJsonType& result)
+ {
+ switch (value.type())
+ {
+ case detail::value_t::array:
+ {
+ if (value.m_value.array->empty())
+ {
+ // flatten empty array as null
+ result[reference_string] = nullptr;
+ }
+ else
+ {
+ // iterate array and use index as reference string
+ for (std::size_t i = 0; i < value.m_value.array->size(); ++i)
+ {
+ flatten(reference_string + "/" + std::to_string(i),
+ value.m_value.array->operator[](i), result);
+ }
+ }
+ break;
+ }
+
+ case detail::value_t::object:
+ {
+ if (value.m_value.object->empty())
+ {
+ // flatten empty object as null
+ result[reference_string] = nullptr;
+ }
+ else
+ {
+ // iterate object and use keys as reference string
+ for (const auto& element : *value.m_value.object)
+ {
+ flatten(reference_string + "/" + escape(element.first), element.second, result);
+ }
+ }
+ break;
+ }
+
+ default:
+ {
+ // add primitive value with its reference string
+ result[reference_string] = value;
+ break;
+ }
+ }
+ }
+
+ /*!
+ @param[in] value flattened JSON
+
+ @return unflattened JSON
+
+ @throw parse_error.109 if array index is not a number
+ @throw type_error.314 if value is not an object
+ @throw type_error.315 if object values are not primitive
+ @throw type_error.313 if value cannot be unflattened
+ */
+ static BasicJsonType
+ unflatten(const BasicJsonType& value)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not value.is_object()))
+ {
+ JSON_THROW(detail::type_error::create(314, "only objects can be unflattened"));
+ }
+
+ BasicJsonType result;
+
+ // iterate the JSON object values
+ for (const auto& element : *value.m_value.object)
+ {
+ if (JSON_HEDLEY_UNLIKELY(not element.second.is_primitive()))
+ {
+ JSON_THROW(detail::type_error::create(315, "values in object must be primitive"));
+ }
+
+ // assign value to reference pointed to by JSON pointer; Note that if
+ // the JSON pointer is "" (i.e., points to the whole value), function
+ // get_and_create returns a reference to result itself. An assignment
+ // will then create a primitive value.
+ json_pointer(element.first).get_and_create(result) = element.second;
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief compares two JSON pointers for equality
+
+ @param[in] lhs JSON pointer to compare
+ @param[in] rhs JSON pointer to compare
+ @return whether @a lhs is equal to @a rhs
+
+ @complexity Linear in the length of the JSON pointer
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+ */
+ friend bool operator==(json_pointer const& lhs,
+ json_pointer const& rhs) noexcept
+ {
+ return lhs.reference_tokens == rhs.reference_tokens;
+ }
+
+ /*!
+ @brief compares two JSON pointers for inequality
+
+ @param[in] lhs JSON pointer to compare
+ @param[in] rhs JSON pointer to compare
+ @return whether @a lhs is not equal @a rhs
+
+ @complexity Linear in the length of the JSON pointer
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+ */
+ friend bool operator!=(json_pointer const& lhs,
+ json_pointer const& rhs) noexcept
+ {
+ return not (lhs == rhs);
+ }
+
+ /// the reference tokens
+ std::vector<std::string> reference_tokens;
+};
+} // namespace nlohmann
+
+// #include <nlohmann/detail/json_ref.hpp>
+
+
+#include <initializer_list>
+#include <utility>
+
+// #include <nlohmann/detail/meta/type_traits.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+template<typename BasicJsonType>
+class json_ref
+{
+ public:
+ using value_type = BasicJsonType;
+
+ json_ref(value_type&& value)
+ : owned_value(std::move(value)), value_ref(&owned_value), is_rvalue(true)
+ {}
+
+ json_ref(const value_type& value)
+ : value_ref(const_cast<value_type*>(&value)), is_rvalue(false)
+ {}
+
+ json_ref(std::initializer_list<json_ref> init)
+ : owned_value(init), value_ref(&owned_value), is_rvalue(true)
+ {}
+
+ template <
+ class... Args,
+ enable_if_t<std::is_constructible<value_type, Args...>::value, int> = 0 >
+ json_ref(Args && ... args)
+ : owned_value(std::forward<Args>(args)...), value_ref(&owned_value),
+ is_rvalue(true) {}
+
+ // class should be movable only
+ json_ref(json_ref&&) = default;
+ json_ref(const json_ref&) = delete;
+ json_ref& operator=(const json_ref&) = delete;
+ json_ref& operator=(json_ref&&) = delete;
+ ~json_ref() = default;
+
+ value_type moved_or_copied() const
+ {
+ if (is_rvalue)
+ {
+ return std::move(*value_ref);
+ }
+ return *value_ref;
+ }
+
+ value_type const& operator*() const
+ {
+ return *static_cast<value_type const*>(value_ref);
+ }
+
+ value_type const* operator->() const
+ {
+ return static_cast<value_type const*>(value_ref);
+ }
+
+ private:
+ mutable value_type owned_value = nullptr;
+ value_type* value_ref = nullptr;
+ const bool is_rvalue;
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/meta/cpp_future.hpp>
+
+// #include <nlohmann/detail/meta/type_traits.hpp>
+
+// #include <nlohmann/detail/output/binary_writer.hpp>
+
+
+#include <algorithm> // reverse
+#include <array> // array
+#include <cstdint> // uint8_t, uint16_t, uint32_t, uint64_t
+#include <cstring> // memcpy
+#include <limits> // numeric_limits
+#include <string> // string
+#include <cmath> // isnan, isinf
+
+// #include <nlohmann/detail/input/binary_reader.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/output/output_adapters.hpp>
+
+
+#include <algorithm> // copy
+#include <cstddef> // size_t
+#include <ios> // streamsize
+#include <iterator> // back_inserter
+#include <memory> // shared_ptr, make_shared
+#include <ostream> // basic_ostream
+#include <string> // basic_string
+#include <vector> // vector
+// #include <nlohmann/detail/macro_scope.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+/// abstract output adapter interface
+template<typename CharType> struct output_adapter_protocol
+{
+ virtual void write_character(CharType c) = 0;
+ virtual void write_characters(const CharType* s, std::size_t length) = 0;
+ virtual ~output_adapter_protocol() = default;
+};
+
+/// a type to simplify interfaces
+template<typename CharType>
+using output_adapter_t = std::shared_ptr<output_adapter_protocol<CharType>>;
+
+/// output adapter for byte vectors
+template<typename CharType>
+class output_vector_adapter : public output_adapter_protocol<CharType>
+{
+ public:
+ explicit output_vector_adapter(std::vector<CharType>& vec) noexcept
+ : v(vec)
+ {}
+
+ void write_character(CharType c) override
+ {
+ v.push_back(c);
+ }
+
+ JSON_HEDLEY_NON_NULL(2)
+ void write_characters(const CharType* s, std::size_t length) override
+ {
+ std::copy(s, s + length, std::back_inserter(v));
+ }
+
+ private:
+ std::vector<CharType>& v;
+};
+
+/// output adapter for output streams
+template<typename CharType>
+class output_stream_adapter : public output_adapter_protocol<CharType>
+{
+ public:
+ explicit output_stream_adapter(std::basic_ostream<CharType>& s) noexcept
+ : stream(s)
+ {}
+
+ void write_character(CharType c) override
+ {
+ stream.put(c);
+ }
+
+ JSON_HEDLEY_NON_NULL(2)
+ void write_characters(const CharType* s, std::size_t length) override
+ {
+ stream.write(s, static_cast<std::streamsize>(length));
+ }
+
+ private:
+ std::basic_ostream<CharType>& stream;
+};
+
+/// output adapter for basic_string
+template<typename CharType, typename StringType = std::basic_string<CharType>>
+class output_string_adapter : public output_adapter_protocol<CharType>
+{
+ public:
+ explicit output_string_adapter(StringType& s) noexcept
+ : str(s)
+ {}
+
+ void write_character(CharType c) override
+ {
+ str.push_back(c);
+ }
+
+ JSON_HEDLEY_NON_NULL(2)
+ void write_characters(const CharType* s, std::size_t length) override
+ {
+ str.append(s, length);
+ }
+
+ private:
+ StringType& str;
+};
+
+template<typename CharType, typename StringType = std::basic_string<CharType>>
+class output_adapter
+{
+ public:
+ output_adapter(std::vector<CharType>& vec)
+ : oa(std::make_shared<output_vector_adapter<CharType>>(vec)) {}
+
+ output_adapter(std::basic_ostream<CharType>& s)
+ : oa(std::make_shared<output_stream_adapter<CharType>>(s)) {}
+
+ output_adapter(StringType& s)
+ : oa(std::make_shared<output_string_adapter<CharType, StringType>>(s)) {}
+
+ operator output_adapter_t<CharType>()
+ {
+ return oa;
+ }
+
+ private:
+ output_adapter_t<CharType> oa = nullptr;
+};
+} // namespace detail
+} // namespace nlohmann
+
+
+namespace nlohmann
+{
+namespace detail
+{
+///////////////////
+// binary writer //
+///////////////////
+
+/*!
+@brief serialization to CBOR and MessagePack values
+*/
+template<typename BasicJsonType, typename CharType>
+class binary_writer
+{
+ using string_t = typename BasicJsonType::string_t;
+ using binary_t = typename BasicJsonType::binary_t;
+
+ public:
+ /*!
+ @brief create a binary writer
+
+ @param[in] adapter output adapter to write to
+ */
+ explicit binary_writer(output_adapter_t<CharType> adapter) : oa(adapter)
+ {
+ assert(oa);
+ }
+
+ /*!
+ @param[in] j JSON value to serialize
+ @pre j.type() == value_t::object
+ */
+ void write_bson(const BasicJsonType& j)
+ {
+ switch (j.type())
+ {
+ case value_t::object:
+ {
+ write_bson_object(*j.m_value.object);
+ break;
+ }
+
+ default:
+ {
+ JSON_THROW(type_error::create(317, "to serialize to BSON, top-level type must be object, but is " + std::string(j.type_name())));
+ }
+ }
+ }
+
+ /*!
+ @param[in] j JSON value to serialize
+ */
+ void write_cbor(const BasicJsonType& j)
+ {
+ switch (j.type())
+ {
+ case value_t::null:
+ {
+ oa->write_character(to_char_type(0xF6));
+ break;
+ }
+
+ case value_t::boolean:
+ {
+ oa->write_character(j.m_value.boolean
+ ? to_char_type(0xF5)
+ : to_char_type(0xF4));
+ break;
+ }
+
+ case value_t::number_integer:
+ {
+ if (j.m_value.number_integer >= 0)
+ {
+ // CBOR does not differentiate between positive signed
+ // integers and unsigned integers. Therefore, we used the
+ // code from the value_t::number_unsigned case here.
+ if (j.m_value.number_integer <= 0x17)
+ {
+ write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_integer <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ oa->write_character(to_char_type(0x18));
+ write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_integer <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ oa->write_character(to_char_type(0x19));
+ write_number(static_cast<std::uint16_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_integer <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ oa->write_character(to_char_type(0x1A));
+ write_number(static_cast<std::uint32_t>(j.m_value.number_integer));
+ }
+ else
+ {
+ oa->write_character(to_char_type(0x1B));
+ write_number(static_cast<std::uint64_t>(j.m_value.number_integer));
+ }
+ }
+ else
+ {
+ // The conversions below encode the sign in the first
+ // byte, and the value is converted to a positive number.
+ const auto positive_number = -1 - j.m_value.number_integer;
+ if (j.m_value.number_integer >= -24)
+ {
+ write_number(static_cast<std::uint8_t>(0x20 + positive_number));
+ }
+ else if (positive_number <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ oa->write_character(to_char_type(0x38));
+ write_number(static_cast<std::uint8_t>(positive_number));
+ }
+ else if (positive_number <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ oa->write_character(to_char_type(0x39));
+ write_number(static_cast<std::uint16_t>(positive_number));
+ }
+ else if (positive_number <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ oa->write_character(to_char_type(0x3A));
+ write_number(static_cast<std::uint32_t>(positive_number));
+ }
+ else
+ {
+ oa->write_character(to_char_type(0x3B));
+ write_number(static_cast<std::uint64_t>(positive_number));
+ }
+ }
+ break;
+ }
+
+ case value_t::number_unsigned:
+ {
+ if (j.m_value.number_unsigned <= 0x17)
+ {
+ write_number(static_cast<std::uint8_t>(j.m_value.number_unsigned));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ oa->write_character(to_char_type(0x18));
+ write_number(static_cast<std::uint8_t>(j.m_value.number_unsigned));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ oa->write_character(to_char_type(0x19));
+ write_number(static_cast<std::uint16_t>(j.m_value.number_unsigned));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ oa->write_character(to_char_type(0x1A));
+ write_number(static_cast<std::uint32_t>(j.m_value.number_unsigned));
+ }
+ else
+ {
+ oa->write_character(to_char_type(0x1B));
+ write_number(static_cast<std::uint64_t>(j.m_value.number_unsigned));
+ }
+ break;
+ }
+
+ case value_t::number_float:
+ {
+ if (std::isnan(j.m_value.number_float))
+ {
+ // NaN is 0xf97e00 in CBOR
+ oa->write_character(to_char_type(0xF9));
+ oa->write_character(to_char_type(0x7E));
+ oa->write_character(to_char_type(0x00));
+ }
+ else if (std::isinf(j.m_value.number_float))
+ {
+ // Infinity is 0xf97c00, -Infinity is 0xf9fc00
+ oa->write_character(to_char_type(0xf9));
+ oa->write_character(j.m_value.number_float > 0 ? to_char_type(0x7C) : to_char_type(0xFC));
+ oa->write_character(to_char_type(0x00));
+ }
+ else
+ {
+ if (static_cast<double>(j.m_value.number_float) >= static_cast<double>(std::numeric_limits<float>::lowest()) and
+ static_cast<double>(j.m_value.number_float) <= static_cast<double>((std::numeric_limits<float>::max)()) and
+ static_cast<double>(static_cast<float>(j.m_value.number_float)) == static_cast<double>(j.m_value.number_float))
+ {
+ oa->write_character(get_cbor_float_prefix(static_cast<float>(j.m_value.number_float)));
+ write_number(static_cast<float>(j.m_value.number_float));
+ }
+ else
+ {
+ oa->write_character(get_cbor_float_prefix(j.m_value.number_float));
+ write_number(j.m_value.number_float);
+ }
+ }
+ break;
+ }
+
+ case value_t::string:
+ {
+ // step 1: write control byte and the string length
+ const auto N = j.m_value.string->size();
+ if (N <= 0x17)
+ {
+ write_number(static_cast<std::uint8_t>(0x60 + N));
+ }
+ else if (N <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ oa->write_character(to_char_type(0x78));
+ write_number(static_cast<std::uint8_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ oa->write_character(to_char_type(0x79));
+ write_number(static_cast<std::uint16_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ oa->write_character(to_char_type(0x7A));
+ write_number(static_cast<std::uint32_t>(N));
+ }
+ // LCOV_EXCL_START
+ else if (N <= (std::numeric_limits<std::uint64_t>::max)())
+ {
+ oa->write_character(to_char_type(0x7B));
+ write_number(static_cast<std::uint64_t>(N));
+ }
+ // LCOV_EXCL_STOP
+
+ // step 2: write the string
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(j.m_value.string->c_str()),
+ j.m_value.string->size());
+ break;
+ }
+
+ case value_t::array:
+ {
+ // step 1: write control byte and the array size
+ const auto N = j.m_value.array->size();
+ if (N <= 0x17)
+ {
+ write_number(static_cast<std::uint8_t>(0x80 + N));
+ }
+ else if (N <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ oa->write_character(to_char_type(0x98));
+ write_number(static_cast<std::uint8_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ oa->write_character(to_char_type(0x99));
+ write_number(static_cast<std::uint16_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ oa->write_character(to_char_type(0x9A));
+ write_number(static_cast<std::uint32_t>(N));
+ }
+ // LCOV_EXCL_START
+ else if (N <= (std::numeric_limits<std::uint64_t>::max)())
+ {
+ oa->write_character(to_char_type(0x9B));
+ write_number(static_cast<std::uint64_t>(N));
+ }
+ // LCOV_EXCL_STOP
+
+ // step 2: write each element
+ for (const auto& el : *j.m_value.array)
+ {
+ write_cbor(el);
+ }
+ break;
+ }
+
+ case value_t::binary:
+ {
+ // step 1: write control byte and the binary array size
+ const auto N = j.m_value.binary->size();
+ if (N <= 0x17)
+ {
+ write_number(static_cast<std::uint8_t>(0x40 + N));
+ }
+ else if (N <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ oa->write_character(to_char_type(0x58));
+ write_number(static_cast<std::uint8_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ oa->write_character(to_char_type(0x59));
+ write_number(static_cast<std::uint16_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ oa->write_character(to_char_type(0x5A));
+ write_number(static_cast<std::uint32_t>(N));
+ }
+ // LCOV_EXCL_START
+ else if (N <= (std::numeric_limits<std::uint64_t>::max)())
+ {
+ oa->write_character(to_char_type(0x5B));
+ write_number(static_cast<std::uint64_t>(N));
+ }
+ // LCOV_EXCL_STOP
+
+ // step 2: write each element
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(j.m_value.binary->data()),
+ N);
+
+ break;
+ }
+
+ case value_t::object:
+ {
+ // step 1: write control byte and the object size
+ const auto N = j.m_value.object->size();
+ if (N <= 0x17)
+ {
+ write_number(static_cast<std::uint8_t>(0xA0 + N));
+ }
+ else if (N <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ oa->write_character(to_char_type(0xB8));
+ write_number(static_cast<std::uint8_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ oa->write_character(to_char_type(0xB9));
+ write_number(static_cast<std::uint16_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ oa->write_character(to_char_type(0xBA));
+ write_number(static_cast<std::uint32_t>(N));
+ }
+ // LCOV_EXCL_START
+ else if (N <= (std::numeric_limits<std::uint64_t>::max)())
+ {
+ oa->write_character(to_char_type(0xBB));
+ write_number(static_cast<std::uint64_t>(N));
+ }
+ // LCOV_EXCL_STOP
+
+ // step 2: write each element
+ for (const auto& el : *j.m_value.object)
+ {
+ write_cbor(el.first);
+ write_cbor(el.second);
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ /*!
+ @param[in] j JSON value to serialize
+ */
+ void write_msgpack(const BasicJsonType& j)
+ {
+ switch (j.type())
+ {
+ case value_t::null: // nil
+ {
+ oa->write_character(to_char_type(0xC0));
+ break;
+ }
+
+ case value_t::boolean: // true and false
+ {
+ oa->write_character(j.m_value.boolean
+ ? to_char_type(0xC3)
+ : to_char_type(0xC2));
+ break;
+ }
+
+ case value_t::number_integer:
+ {
+ if (j.m_value.number_integer >= 0)
+ {
+ // MessagePack does not differentiate between positive
+ // signed integers and unsigned integers. Therefore, we used
+ // the code from the value_t::number_unsigned case here.
+ if (j.m_value.number_unsigned < 128)
+ {
+ // positive fixnum
+ write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ // uint 8
+ oa->write_character(to_char_type(0xCC));
+ write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ // uint 16
+ oa->write_character(to_char_type(0xCD));
+ write_number(static_cast<std::uint16_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ // uint 32
+ oa->write_character(to_char_type(0xCE));
+ write_number(static_cast<std::uint32_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint64_t>::max)())
+ {
+ // uint 64
+ oa->write_character(to_char_type(0xCF));
+ write_number(static_cast<std::uint64_t>(j.m_value.number_integer));
+ }
+ }
+ else
+ {
+ if (j.m_value.number_integer >= -32)
+ {
+ // negative fixnum
+ write_number(static_cast<std::int8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_integer >= (std::numeric_limits<std::int8_t>::min)() and
+ j.m_value.number_integer <= (std::numeric_limits<std::int8_t>::max)())
+ {
+ // int 8
+ oa->write_character(to_char_type(0xD0));
+ write_number(static_cast<std::int8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_integer >= (std::numeric_limits<std::int16_t>::min)() and
+ j.m_value.number_integer <= (std::numeric_limits<std::int16_t>::max)())
+ {
+ // int 16
+ oa->write_character(to_char_type(0xD1));
+ write_number(static_cast<std::int16_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_integer >= (std::numeric_limits<std::int32_t>::min)() and
+ j.m_value.number_integer <= (std::numeric_limits<std::int32_t>::max)())
+ {
+ // int 32
+ oa->write_character(to_char_type(0xD2));
+ write_number(static_cast<std::int32_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_integer >= (std::numeric_limits<std::int64_t>::min)() and
+ j.m_value.number_integer <= (std::numeric_limits<std::int64_t>::max)())
+ {
+ // int 64
+ oa->write_character(to_char_type(0xD3));
+ write_number(static_cast<std::int64_t>(j.m_value.number_integer));
+ }
+ }
+ break;
+ }
+
+ case value_t::number_unsigned:
+ {
+ if (j.m_value.number_unsigned < 128)
+ {
+ // positive fixnum
+ write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ // uint 8
+ oa->write_character(to_char_type(0xCC));
+ write_number(static_cast<std::uint8_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ // uint 16
+ oa->write_character(to_char_type(0xCD));
+ write_number(static_cast<std::uint16_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ // uint 32
+ oa->write_character(to_char_type(0xCE));
+ write_number(static_cast<std::uint32_t>(j.m_value.number_integer));
+ }
+ else if (j.m_value.number_unsigned <= (std::numeric_limits<std::uint64_t>::max)())
+ {
+ // uint 64
+ oa->write_character(to_char_type(0xCF));
+ write_number(static_cast<std::uint64_t>(j.m_value.number_integer));
+ }
+ break;
+ }
+
+ case value_t::number_float:
+ {
+ oa->write_character(get_msgpack_float_prefix(j.m_value.number_float));
+ write_number(j.m_value.number_float);
+ break;
+ }
+
+ case value_t::string:
+ {
+ // step 1: write control byte and the string length
+ const auto N = j.m_value.string->size();
+ if (N <= 31)
+ {
+ // fixstr
+ write_number(static_cast<std::uint8_t>(0xA0 | N));
+ }
+ else if (N <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ // str 8
+ oa->write_character(to_char_type(0xD9));
+ write_number(static_cast<std::uint8_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ // str 16
+ oa->write_character(to_char_type(0xDA));
+ write_number(static_cast<std::uint16_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ // str 32
+ oa->write_character(to_char_type(0xDB));
+ write_number(static_cast<std::uint32_t>(N));
+ }
+
+ // step 2: write the string
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(j.m_value.string->c_str()),
+ j.m_value.string->size());
+ break;
+ }
+
+ case value_t::array:
+ {
+ // step 1: write control byte and the array size
+ const auto N = j.m_value.array->size();
+ if (N <= 15)
+ {
+ // fixarray
+ write_number(static_cast<std::uint8_t>(0x90 | N));
+ }
+ else if (N <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ // array 16
+ oa->write_character(to_char_type(0xDC));
+ write_number(static_cast<std::uint16_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ // array 32
+ oa->write_character(to_char_type(0xDD));
+ write_number(static_cast<std::uint32_t>(N));
+ }
+
+ // step 2: write each element
+ for (const auto& el : *j.m_value.array)
+ {
+ write_msgpack(el);
+ }
+ break;
+ }
+
+ case value_t::binary:
+ {
+ // step 0: determine if the binary type has a set subtype to
+ // determine whether or not to use the ext or fixext types
+ const bool use_ext = j.m_value.binary->has_subtype();
+
+ // step 1: write control byte and the byte string length
+ const auto N = j.m_value.binary->size();
+ if (N <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ std::uint8_t output_type;
+ bool fixed = true;
+ if (use_ext)
+ {
+ switch (N)
+ {
+ case 1:
+ output_type = 0xD4; // fixext 1
+ break;
+ case 2:
+ output_type = 0xD5; // fixext 2
+ break;
+ case 4:
+ output_type = 0xD6; // fixext 4
+ break;
+ case 8:
+ output_type = 0xD7; // fixext 8
+ break;
+ case 16:
+ output_type = 0xD8; // fixext 16
+ break;
+ default:
+ output_type = 0xC7; // ext 8
+ fixed = false;
+ break;
+ }
+
+ }
+ else
+ {
+ output_type = 0xC4; // bin 8
+ fixed = false;
+ }
+
+ oa->write_character(to_char_type(output_type));
+ if (not fixed)
+ {
+ write_number(static_cast<std::uint8_t>(N));
+ }
+ }
+ else if (N <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ std::uint8_t output_type;
+ if (use_ext)
+ {
+ output_type = 0xC8; // ext 16
+ }
+ else
+ {
+ output_type = 0xC5; // bin 16
+ }
+
+ oa->write_character(to_char_type(output_type));
+ write_number(static_cast<std::uint16_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ std::uint8_t output_type;
+ if (use_ext)
+ {
+ output_type = 0xC9; // ext 32
+ }
+ else
+ {
+ output_type = 0xC6; // bin 32
+ }
+
+ oa->write_character(to_char_type(output_type));
+ write_number(static_cast<std::uint32_t>(N));
+ }
+
+ // step 1.5: if this is an ext type, write the subtype
+ if (use_ext)
+ {
+ write_number(static_cast<std::int8_t>(j.m_value.binary->subtype()));
+ }
+
+ // step 2: write the byte string
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(j.m_value.binary->data()),
+ N);
+
+ break;
+ }
+
+ case value_t::object:
+ {
+ // step 1: write control byte and the object size
+ const auto N = j.m_value.object->size();
+ if (N <= 15)
+ {
+ // fixmap
+ write_number(static_cast<std::uint8_t>(0x80 | (N & 0xF)));
+ }
+ else if (N <= (std::numeric_limits<std::uint16_t>::max)())
+ {
+ // map 16
+ oa->write_character(to_char_type(0xDE));
+ write_number(static_cast<std::uint16_t>(N));
+ }
+ else if (N <= (std::numeric_limits<std::uint32_t>::max)())
+ {
+ // map 32
+ oa->write_character(to_char_type(0xDF));
+ write_number(static_cast<std::uint32_t>(N));
+ }
+
+ // step 2: write each element
+ for (const auto& el : *j.m_value.object)
+ {
+ write_msgpack(el.first);
+ write_msgpack(el.second);
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ /*!
+ @param[in] j JSON value to serialize
+ @param[in] use_count whether to use '#' prefixes (optimized format)
+ @param[in] use_type whether to use '$' prefixes (optimized format)
+ @param[in] add_prefix whether prefixes need to be used for this value
+ */
+ void write_ubjson(const BasicJsonType& j, const bool use_count,
+ const bool use_type, const bool add_prefix = true)
+ {
+ switch (j.type())
+ {
+ case value_t::null:
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('Z'));
+ }
+ break;
+ }
+
+ case value_t::boolean:
+ {
+ if (add_prefix)
+ {
+ oa->write_character(j.m_value.boolean
+ ? to_char_type('T')
+ : to_char_type('F'));
+ }
+ break;
+ }
+
+ case value_t::number_integer:
+ {
+ write_number_with_ubjson_prefix(j.m_value.number_integer, add_prefix);
+ break;
+ }
+
+ case value_t::number_unsigned:
+ {
+ write_number_with_ubjson_prefix(j.m_value.number_unsigned, add_prefix);
+ break;
+ }
+
+ case value_t::number_float:
+ {
+ write_number_with_ubjson_prefix(j.m_value.number_float, add_prefix);
+ break;
+ }
+
+ case value_t::string:
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('S'));
+ }
+ write_number_with_ubjson_prefix(j.m_value.string->size(), true);
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(j.m_value.string->c_str()),
+ j.m_value.string->size());
+ break;
+ }
+
+ case value_t::array:
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('['));
+ }
+
+ bool prefix_required = true;
+ if (use_type and not j.m_value.array->empty())
+ {
+ assert(use_count);
+ const CharType first_prefix = ubjson_prefix(j.front());
+ const bool same_prefix = std::all_of(j.begin() + 1, j.end(),
+ [this, first_prefix](const BasicJsonType & v)
+ {
+ return ubjson_prefix(v) == first_prefix;
+ });
+
+ if (same_prefix)
+ {
+ prefix_required = false;
+ oa->write_character(to_char_type('$'));
+ oa->write_character(first_prefix);
+ }
+ }
+
+ if (use_count)
+ {
+ oa->write_character(to_char_type('#'));
+ write_number_with_ubjson_prefix(j.m_value.array->size(), true);
+ }
+
+ for (const auto& el : *j.m_value.array)
+ {
+ write_ubjson(el, use_count, use_type, prefix_required);
+ }
+
+ if (not use_count)
+ {
+ oa->write_character(to_char_type(']'));
+ }
+
+ break;
+ }
+
+ case value_t::binary:
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('['));
+ }
+
+ if (use_type and not j.m_value.binary->empty())
+ {
+ assert(use_count);
+ oa->write_character(to_char_type('$'));
+ oa->write_character('U');
+ }
+
+ if (use_count)
+ {
+ oa->write_character(to_char_type('#'));
+ write_number_with_ubjson_prefix(j.m_value.binary->size(), true);
+ }
+
+ if (use_type)
+ {
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(j.m_value.binary->data()),
+ j.m_value.binary->size());
+ }
+ else
+ {
+ for (size_t i = 0; i < j.m_value.binary->size(); ++i)
+ {
+ oa->write_character(to_char_type('U'));
+ oa->write_character(j.m_value.binary->data()[i]);
+ }
+ }
+
+ if (not use_count)
+ {
+ oa->write_character(to_char_type(']'));
+ }
+
+ break;
+ }
+
+ case value_t::object:
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('{'));
+ }
+
+ bool prefix_required = true;
+ if (use_type and not j.m_value.object->empty())
+ {
+ assert(use_count);
+ const CharType first_prefix = ubjson_prefix(j.front());
+ const bool same_prefix = std::all_of(j.begin(), j.end(),
+ [this, first_prefix](const BasicJsonType & v)
+ {
+ return ubjson_prefix(v) == first_prefix;
+ });
+
+ if (same_prefix)
+ {
+ prefix_required = false;
+ oa->write_character(to_char_type('$'));
+ oa->write_character(first_prefix);
+ }
+ }
+
+ if (use_count)
+ {
+ oa->write_character(to_char_type('#'));
+ write_number_with_ubjson_prefix(j.m_value.object->size(), true);
+ }
+
+ for (const auto& el : *j.m_value.object)
+ {
+ write_number_with_ubjson_prefix(el.first.size(), true);
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(el.first.c_str()),
+ el.first.size());
+ write_ubjson(el.second, use_count, use_type, prefix_required);
+ }
+
+ if (not use_count)
+ {
+ oa->write_character(to_char_type('}'));
+ }
+
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ private:
+ //////////
+ // BSON //
+ //////////
+
+ /*!
+ @return The size of a BSON document entry header, including the id marker
+ and the entry name size (and its null-terminator).
+ */
+ static std::size_t calc_bson_entry_header_size(const string_t& name)
+ {
+ const auto it = name.find(static_cast<typename string_t::value_type>(0));
+ if (JSON_HEDLEY_UNLIKELY(it != BasicJsonType::string_t::npos))
+ {
+ JSON_THROW(out_of_range::create(409,
+ "BSON key cannot contain code point U+0000 (at byte " + std::to_string(it) + ")"));
+ }
+
+ return /*id*/ 1ul + name.size() + /*zero-terminator*/1u;
+ }
+
+ /*!
+ @brief Writes the given @a element_type and @a name to the output adapter
+ */
+ void write_bson_entry_header(const string_t& name,
+ const std::uint8_t element_type)
+ {
+ oa->write_character(to_char_type(element_type)); // boolean
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(name.c_str()),
+ name.size() + 1u);
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and boolean value @a value
+ */
+ void write_bson_boolean(const string_t& name,
+ const bool value)
+ {
+ write_bson_entry_header(name, 0x08);
+ oa->write_character(value ? to_char_type(0x01) : to_char_type(0x00));
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and double value @a value
+ */
+ void write_bson_double(const string_t& name,
+ const double value)
+ {
+ write_bson_entry_header(name, 0x01);
+ write_number<double, true>(value);
+ }
+
+ /*!
+ @return The size of the BSON-encoded string in @a value
+ */
+ static std::size_t calc_bson_string_size(const string_t& value)
+ {
+ return sizeof(std::int32_t) + value.size() + 1ul;
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and string value @a value
+ */
+ void write_bson_string(const string_t& name,
+ const string_t& value)
+ {
+ write_bson_entry_header(name, 0x02);
+
+ write_number<std::int32_t, true>(static_cast<std::int32_t>(value.size() + 1ul));
+ oa->write_characters(
+ reinterpret_cast<const CharType*>(value.c_str()),
+ value.size() + 1);
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and null value
+ */
+ void write_bson_null(const string_t& name)
+ {
+ write_bson_entry_header(name, 0x0A);
+ }
+
+ /*!
+ @return The size of the BSON-encoded integer @a value
+ */
+ static std::size_t calc_bson_integer_size(const std::int64_t value)
+ {
+ return (std::numeric_limits<std::int32_t>::min)() <= value and value <= (std::numeric_limits<std::int32_t>::max)()
+ ? sizeof(std::int32_t)
+ : sizeof(std::int64_t);
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and integer @a value
+ */
+ void write_bson_integer(const string_t& name,
+ const std::int64_t value)
+ {
+ if ((std::numeric_limits<std::int32_t>::min)() <= value and value <= (std::numeric_limits<std::int32_t>::max)())
+ {
+ write_bson_entry_header(name, 0x10); // int32
+ write_number<std::int32_t, true>(static_cast<std::int32_t>(value));
+ }
+ else
+ {
+ write_bson_entry_header(name, 0x12); // int64
+ write_number<std::int64_t, true>(static_cast<std::int64_t>(value));
+ }
+ }
+
+ /*!
+ @return The size of the BSON-encoded unsigned integer in @a j
+ */
+ static constexpr std::size_t calc_bson_unsigned_size(const std::uint64_t value) noexcept
+ {
+ return (value <= static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))
+ ? sizeof(std::int32_t)
+ : sizeof(std::int64_t);
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and unsigned @a value
+ */
+ void write_bson_unsigned(const string_t& name,
+ const std::uint64_t value)
+ {
+ if (value <= static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))
+ {
+ write_bson_entry_header(name, 0x10 /* int32 */);
+ write_number<std::int32_t, true>(static_cast<std::int32_t>(value));
+ }
+ else if (value <= static_cast<std::uint64_t>((std::numeric_limits<std::int64_t>::max)()))
+ {
+ write_bson_entry_header(name, 0x12 /* int64 */);
+ write_number<std::int64_t, true>(static_cast<std::int64_t>(value));
+ }
+ else
+ {
+ JSON_THROW(out_of_range::create(407, "integer number " + std::to_string(value) + " cannot be represented by BSON as it does not fit int64"));
+ }
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and object @a value
+ */
+ void write_bson_object_entry(const string_t& name,
+ const typename BasicJsonType::object_t& value)
+ {
+ write_bson_entry_header(name, 0x03); // object
+ write_bson_object(value);
+ }
+
+ /*!
+ @return The size of the BSON-encoded array @a value
+ */
+ static std::size_t calc_bson_array_size(const typename BasicJsonType::array_t& value)
+ {
+ std::size_t array_index = 0ul;
+
+ const std::size_t embedded_document_size = std::accumulate(std::begin(value), std::end(value), std::size_t(0), [&array_index](std::size_t result, const typename BasicJsonType::array_t::value_type & el)
+ {
+ return result + calc_bson_element_size(std::to_string(array_index++), el);
+ });
+
+ return sizeof(std::int32_t) + embedded_document_size + 1ul;
+ }
+
+ /*!
+ @return The size of the BSON-encoded binary array @a value
+ */
+ static std::size_t calc_bson_binary_size(const typename BasicJsonType::binary_t& value)
+ {
+ return sizeof(std::int32_t) + value.size() + 1ul;
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and array @a value
+ */
+ void write_bson_array(const string_t& name,
+ const typename BasicJsonType::array_t& value)
+ {
+ write_bson_entry_header(name, 0x04); // array
+ write_number<std::int32_t, true>(static_cast<std::int32_t>(calc_bson_array_size(value)));
+
+ std::size_t array_index = 0ul;
+
+ for (const auto& el : value)
+ {
+ write_bson_element(std::to_string(array_index++), el);
+ }
+
+ oa->write_character(to_char_type(0x00));
+ }
+
+ /*!
+ @brief Writes a BSON element with key @a name and binary value @a value
+ */
+ void write_bson_binary(const string_t& name,
+ const binary_t& value)
+ {
+ write_bson_entry_header(name, 0x05);
+
+ write_number<std::int32_t, true>(static_cast<std::int32_t>(value.size()));
+ write_number(value.has_subtype() ? value.subtype() : std::uint8_t(0x00));
+
+ oa->write_characters(reinterpret_cast<const CharType*>(value.data()), value.size());
+ }
+
+ /*!
+ @brief Calculates the size necessary to serialize the JSON value @a j with its @a name
+ @return The calculated size for the BSON document entry for @a j with the given @a name.
+ */
+ static std::size_t calc_bson_element_size(const string_t& name,
+ const BasicJsonType& j)
+ {
+ const auto header_size = calc_bson_entry_header_size(name);
+ switch (j.type())
+ {
+ case value_t::object:
+ return header_size + calc_bson_object_size(*j.m_value.object);
+
+ case value_t::array:
+ return header_size + calc_bson_array_size(*j.m_value.array);
+
+ case value_t::binary:
+ return header_size + calc_bson_binary_size(*j.m_value.binary);
+
+ case value_t::boolean:
+ return header_size + 1ul;
+
+ case value_t::number_float:
+ return header_size + 8ul;
+
+ case value_t::number_integer:
+ return header_size + calc_bson_integer_size(j.m_value.number_integer);
+
+ case value_t::number_unsigned:
+ return header_size + calc_bson_unsigned_size(j.m_value.number_unsigned);
+
+ case value_t::string:
+ return header_size + calc_bson_string_size(*j.m_value.string);
+
+ case value_t::null:
+ return header_size + 0ul;
+
+ // LCOV_EXCL_START
+ default:
+ assert(false);
+ return 0ul;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ /*!
+ @brief Serializes the JSON value @a j to BSON and associates it with the
+ key @a name.
+ @param name The name to associate with the JSON entity @a j within the
+ current BSON document
+ @return The size of the BSON entry
+ */
+ void write_bson_element(const string_t& name,
+ const BasicJsonType& j)
+ {
+ switch (j.type())
+ {
+ case value_t::object:
+ return write_bson_object_entry(name, *j.m_value.object);
+
+ case value_t::array:
+ return write_bson_array(name, *j.m_value.array);
+
+ case value_t::binary:
+ return write_bson_binary(name, *j.m_value.binary);
+
+ case value_t::boolean:
+ return write_bson_boolean(name, j.m_value.boolean);
+
+ case value_t::number_float:
+ return write_bson_double(name, j.m_value.number_float);
+
+ case value_t::number_integer:
+ return write_bson_integer(name, j.m_value.number_integer);
+
+ case value_t::number_unsigned:
+ return write_bson_unsigned(name, j.m_value.number_unsigned);
+
+ case value_t::string:
+ return write_bson_string(name, *j.m_value.string);
+
+ case value_t::null:
+ return write_bson_null(name);
+
+ // LCOV_EXCL_START
+ default:
+ assert(false);
+ return;
+ // LCOV_EXCL_STOP
+ }
+ }
+
+ /*!
+ @brief Calculates the size of the BSON serialization of the given
+ JSON-object @a j.
+ @param[in] j JSON value to serialize
+ @pre j.type() == value_t::object
+ */
+ static std::size_t calc_bson_object_size(const typename BasicJsonType::object_t& value)
+ {
+ std::size_t document_size = std::accumulate(value.begin(), value.end(), std::size_t(0),
+ [](size_t result, const typename BasicJsonType::object_t::value_type & el)
+ {
+ return result += calc_bson_element_size(el.first, el.second);
+ });
+
+ return sizeof(std::int32_t) + document_size + 1ul;
+ }
+
+ /*!
+ @param[in] j JSON value to serialize
+ @pre j.type() == value_t::object
+ */
+ void write_bson_object(const typename BasicJsonType::object_t& value)
+ {
+ write_number<std::int32_t, true>(static_cast<std::int32_t>(calc_bson_object_size(value)));
+
+ for (const auto& el : value)
+ {
+ write_bson_element(el.first, el.second);
+ }
+
+ oa->write_character(to_char_type(0x00));
+ }
+
+ //////////
+ // CBOR //
+ //////////
+
+ static constexpr CharType get_cbor_float_prefix(float /*unused*/)
+ {
+ return to_char_type(0xFA); // Single-Precision Float
+ }
+
+ static constexpr CharType get_cbor_float_prefix(double /*unused*/)
+ {
+ return to_char_type(0xFB); // Double-Precision Float
+ }
+
+ /////////////
+ // MsgPack //
+ /////////////
+
+ static constexpr CharType get_msgpack_float_prefix(float /*unused*/)
+ {
+ return to_char_type(0xCA); // float 32
+ }
+
+ static constexpr CharType get_msgpack_float_prefix(double /*unused*/)
+ {
+ return to_char_type(0xCB); // float 64
+ }
+
+ ////////////
+ // UBJSON //
+ ////////////
+
+ // UBJSON: write number (floating point)
+ template<typename NumberType, typename std::enable_if<
+ std::is_floating_point<NumberType>::value, int>::type = 0>
+ void write_number_with_ubjson_prefix(const NumberType n,
+ const bool add_prefix)
+ {
+ if (add_prefix)
+ {
+ oa->write_character(get_ubjson_float_prefix(n));
+ }
+ write_number(n);
+ }
+
+ // UBJSON: write number (unsigned integer)
+ template<typename NumberType, typename std::enable_if<
+ std::is_unsigned<NumberType>::value, int>::type = 0>
+ void write_number_with_ubjson_prefix(const NumberType n,
+ const bool add_prefix)
+ {
+ if (n <= static_cast<std::uint64_t>((std::numeric_limits<std::int8_t>::max)()))
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('i')); // int8
+ }
+ write_number(static_cast<std::uint8_t>(n));
+ }
+ else if (n <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('U')); // uint8
+ }
+ write_number(static_cast<std::uint8_t>(n));
+ }
+ else if (n <= static_cast<std::uint64_t>((std::numeric_limits<std::int16_t>::max)()))
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('I')); // int16
+ }
+ write_number(static_cast<std::int16_t>(n));
+ }
+ else if (n <= static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('l')); // int32
+ }
+ write_number(static_cast<std::int32_t>(n));
+ }
+ else if (n <= static_cast<std::uint64_t>((std::numeric_limits<std::int64_t>::max)()))
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('L')); // int64
+ }
+ write_number(static_cast<std::int64_t>(n));
+ }
+ else
+ {
+ JSON_THROW(out_of_range::create(407, "integer number " + std::to_string(n) + " cannot be represented by UBJSON as it does not fit int64"));
+ }
+ }
+
+ // UBJSON: write number (signed integer)
+ template<typename NumberType, typename std::enable_if<
+ std::is_signed<NumberType>::value and
+ not std::is_floating_point<NumberType>::value, int>::type = 0>
+ void write_number_with_ubjson_prefix(const NumberType n,
+ const bool add_prefix)
+ {
+ if ((std::numeric_limits<std::int8_t>::min)() <= n and n <= (std::numeric_limits<std::int8_t>::max)())
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('i')); // int8
+ }
+ write_number(static_cast<std::int8_t>(n));
+ }
+ else if (static_cast<std::int64_t>((std::numeric_limits<std::uint8_t>::min)()) <= n and n <= static_cast<std::int64_t>((std::numeric_limits<std::uint8_t>::max)()))
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('U')); // uint8
+ }
+ write_number(static_cast<std::uint8_t>(n));
+ }
+ else if ((std::numeric_limits<std::int16_t>::min)() <= n and n <= (std::numeric_limits<std::int16_t>::max)())
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('I')); // int16
+ }
+ write_number(static_cast<std::int16_t>(n));
+ }
+ else if ((std::numeric_limits<std::int32_t>::min)() <= n and n <= (std::numeric_limits<std::int32_t>::max)())
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('l')); // int32
+ }
+ write_number(static_cast<std::int32_t>(n));
+ }
+ else if ((std::numeric_limits<std::int64_t>::min)() <= n and n <= (std::numeric_limits<std::int64_t>::max)())
+ {
+ if (add_prefix)
+ {
+ oa->write_character(to_char_type('L')); // int64
+ }
+ write_number(static_cast<std::int64_t>(n));
+ }
+ // LCOV_EXCL_START
+ else
+ {
+ JSON_THROW(out_of_range::create(407, "integer number " + std::to_string(n) + " cannot be represented by UBJSON as it does not fit int64"));
+ }
+ // LCOV_EXCL_STOP
+ }
+
+ /*!
+ @brief determine the type prefix of container values
+
+ @note This function does not need to be 100% accurate when it comes to
+ integer limits. In case a number exceeds the limits of int64_t,
+ this will be detected by a later call to function
+ write_number_with_ubjson_prefix. Therefore, we return 'L' for any
+ value that does not fit the previous limits.
+ */
+ CharType ubjson_prefix(const BasicJsonType& j) const noexcept
+ {
+ switch (j.type())
+ {
+ case value_t::null:
+ return 'Z';
+
+ case value_t::boolean:
+ return j.m_value.boolean ? 'T' : 'F';
+
+ case value_t::number_integer:
+ {
+ if ((std::numeric_limits<std::int8_t>::min)() <= j.m_value.number_integer and j.m_value.number_integer <= (std::numeric_limits<std::int8_t>::max)())
+ {
+ return 'i';
+ }
+ if ((std::numeric_limits<std::uint8_t>::min)() <= j.m_value.number_integer and j.m_value.number_integer <= (std::numeric_limits<std::uint8_t>::max)())
+ {
+ return 'U';
+ }
+ if ((std::numeric_limits<std::int16_t>::min)() <= j.m_value.number_integer and j.m_value.number_integer <= (std::numeric_limits<std::int16_t>::max)())
+ {
+ return 'I';
+ }
+ if ((std::numeric_limits<std::int32_t>::min)() <= j.m_value.number_integer and j.m_value.number_integer <= (std::numeric_limits<std::int32_t>::max)())
+ {
+ return 'l';
+ }
+ // no check and assume int64_t (see note above)
+ return 'L';
+ }
+
+ case value_t::number_unsigned:
+ {
+ if (j.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::int8_t>::max)()))
+ {
+ return 'i';
+ }
+ if (j.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::uint8_t>::max)()))
+ {
+ return 'U';
+ }
+ if (j.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::int16_t>::max)()))
+ {
+ return 'I';
+ }
+ if (j.m_value.number_unsigned <= static_cast<std::uint64_t>((std::numeric_limits<std::int32_t>::max)()))
+ {
+ return 'l';
+ }
+ // no check and assume int64_t (see note above)
+ return 'L';
+ }
+
+ case value_t::number_float:
+ return get_ubjson_float_prefix(j.m_value.number_float);
+
+ case value_t::string:
+ return 'S';
+
+ case value_t::array: // fallthrough
+ case value_t::binary:
+ return '[';
+
+ case value_t::object:
+ return '{';
+
+ default: // discarded values
+ return 'N';
+ }
+ }
+
+ static constexpr CharType get_ubjson_float_prefix(float /*unused*/)
+ {
+ return 'd'; // float 32
+ }
+
+ static constexpr CharType get_ubjson_float_prefix(double /*unused*/)
+ {
+ return 'D'; // float 64
+ }
+
+ ///////////////////////
+ // Utility functions //
+ ///////////////////////
+
+ /*
+ @brief write a number to output input
+ @param[in] n number of type @a NumberType
+ @tparam NumberType the type of the number
+ @tparam OutputIsLittleEndian Set to true if output data is
+ required to be little endian
+
+ @note This function needs to respect the system's endianess, because bytes
+ in CBOR, MessagePack, and UBJSON are stored in network order (big
+ endian) and therefore need reordering on little endian systems.
+ */
+ template<typename NumberType, bool OutputIsLittleEndian = false>
+ void write_number(const NumberType n)
+ {
+ // step 1: write number to array of length NumberType
+ std::array<CharType, sizeof(NumberType)> vec;
+ std::memcpy(vec.data(), &n, sizeof(NumberType));
+
+ // step 2: write array to output (with possible reordering)
+ if (is_little_endian != OutputIsLittleEndian)
+ {
+ // reverse byte order prior to conversion if necessary
+ std::reverse(vec.begin(), vec.end());
+ }
+
+ oa->write_characters(vec.data(), sizeof(NumberType));
+ }
+
+ public:
+ // The following to_char_type functions are implement the conversion
+ // between uint8_t and CharType. In case CharType is not unsigned,
+ // such a conversion is required to allow values greater than 128.
+ // See <https://github.com/nlohmann/json/issues/1286> for a discussion.
+ template < typename C = CharType,
+ enable_if_t < std::is_signed<C>::value and std::is_signed<char>::value > * = nullptr >
+ static constexpr CharType to_char_type(std::uint8_t x) noexcept
+ {
+ return *reinterpret_cast<char*>(&x);
+ }
+
+ template < typename C = CharType,
+ enable_if_t < std::is_signed<C>::value and std::is_unsigned<char>::value > * = nullptr >
+ static CharType to_char_type(std::uint8_t x) noexcept
+ {
+ static_assert(sizeof(std::uint8_t) == sizeof(CharType), "size of CharType must be equal to std::uint8_t");
+ static_assert(std::is_trivial<CharType>::value, "CharType must be trivial");
+ CharType result;
+ std::memcpy(&result, &x, sizeof(x));
+ return result;
+ }
+
+ template<typename C = CharType,
+ enable_if_t<std::is_unsigned<C>::value>* = nullptr>
+ static constexpr CharType to_char_type(std::uint8_t x) noexcept
+ {
+ return x;
+ }
+
+ template < typename InputCharType, typename C = CharType,
+ enable_if_t <
+ std::is_signed<C>::value and
+ std::is_signed<char>::value and
+ std::is_same<char, typename std::remove_cv<InputCharType>::type>::value
+ > * = nullptr >
+ static constexpr CharType to_char_type(InputCharType x) noexcept
+ {
+ return x;
+ }
+
+ private:
+ /// whether we can assume little endianess
+ const bool is_little_endian = little_endianess();
+
+ /// the output
+ output_adapter_t<CharType> oa = nullptr;
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/output/output_adapters.hpp>
+
+// #include <nlohmann/detail/output/serializer.hpp>
+
+
+#include <algorithm> // reverse, remove, fill, find, none_of
+#include <array> // array
+#include <cassert> // assert
+#include <clocale> // localeconv, lconv
+#include <cmath> // labs, isfinite, isnan, signbit
+#include <cstddef> // size_t, ptrdiff_t
+#include <cstdint> // uint8_t
+#include <cstdio> // snprintf
+#include <limits> // numeric_limits
+#include <string> // string
+#include <type_traits> // is_same
+#include <utility> // move
+
+// #include <nlohmann/detail/boolean_operators.hpp>
+
+// #include <nlohmann/detail/conversions/to_chars.hpp>
+
+
+#include <array> // array
+#include <cassert> // assert
+#include <cmath> // signbit, isfinite
+#include <cstdint> // intN_t, uintN_t
+#include <cstring> // memcpy, memmove
+#include <limits> // numeric_limits
+#include <type_traits> // conditional
+
+// #include <nlohmann/detail/boolean_operators.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+
+/*!
+@brief implements the Grisu2 algorithm for binary to decimal floating-point
+conversion.
+
+This implementation is a slightly modified version of the reference
+implementation which may be obtained from
+http://florian.loitsch.com/publications (bench.tar.gz).
+
+The code is distributed under the MIT license, Copyright (c) 2009 Florian Loitsch.
+
+For a detailed description of the algorithm see:
+
+[1] Loitsch, "Printing Floating-Point Numbers Quickly and Accurately with
+ Integers", Proceedings of the ACM SIGPLAN 2010 Conference on Programming
+ Language Design and Implementation, PLDI 2010
+[2] Burger, Dybvig, "Printing Floating-Point Numbers Quickly and Accurately",
+ Proceedings of the ACM SIGPLAN 1996 Conference on Programming Language
+ Design and Implementation, PLDI 1996
+*/
+namespace dtoa_impl
+{
+
+template <typename Target, typename Source>
+Target reinterpret_bits(const Source source)
+{
+ static_assert(sizeof(Target) == sizeof(Source), "size mismatch");
+
+ Target target;
+ std::memcpy(&target, &source, sizeof(Source));
+ return target;
+}
+
+struct diyfp // f * 2^e
+{
+ static constexpr int kPrecision = 64; // = q
+
+ std::uint64_t f = 0;
+ int e = 0;
+
+ constexpr diyfp(std::uint64_t f_, int e_) noexcept : f(f_), e(e_) {}
+
+ /*!
+ @brief returns x - y
+ @pre x.e == y.e and x.f >= y.f
+ */
+ static diyfp sub(const diyfp& x, const diyfp& y) noexcept
+ {
+ assert(x.e == y.e);
+ assert(x.f >= y.f);
+
+ return {x.f - y.f, x.e};
+ }
+
+ /*!
+ @brief returns x * y
+ @note The result is rounded. (Only the upper q bits are returned.)
+ */
+ static diyfp mul(const diyfp& x, const diyfp& y) noexcept
+ {
+ static_assert(kPrecision == 64, "internal error");
+
+ // Computes:
+ // f = round((x.f * y.f) / 2^q)
+ // e = x.e + y.e + q
+
+ // Emulate the 64-bit * 64-bit multiplication:
+ //
+ // p = u * v
+ // = (u_lo + 2^32 u_hi) (v_lo + 2^32 v_hi)
+ // = (u_lo v_lo ) + 2^32 ((u_lo v_hi ) + (u_hi v_lo )) + 2^64 (u_hi v_hi )
+ // = (p0 ) + 2^32 ((p1 ) + (p2 )) + 2^64 (p3 )
+ // = (p0_lo + 2^32 p0_hi) + 2^32 ((p1_lo + 2^32 p1_hi) + (p2_lo + 2^32 p2_hi)) + 2^64 (p3 )
+ // = (p0_lo ) + 2^32 (p0_hi + p1_lo + p2_lo ) + 2^64 (p1_hi + p2_hi + p3)
+ // = (p0_lo ) + 2^32 (Q ) + 2^64 (H )
+ // = (p0_lo ) + 2^32 (Q_lo + 2^32 Q_hi ) + 2^64 (H )
+ //
+ // (Since Q might be larger than 2^32 - 1)
+ //
+ // = (p0_lo + 2^32 Q_lo) + 2^64 (Q_hi + H)
+ //
+ // (Q_hi + H does not overflow a 64-bit int)
+ //
+ // = p_lo + 2^64 p_hi
+
+ const std::uint64_t u_lo = x.f & 0xFFFFFFFFu;
+ const std::uint64_t u_hi = x.f >> 32u;
+ const std::uint64_t v_lo = y.f & 0xFFFFFFFFu;
+ const std::uint64_t v_hi = y.f >> 32u;
+
+ const std::uint64_t p0 = u_lo * v_lo;
+ const std::uint64_t p1 = u_lo * v_hi;
+ const std::uint64_t p2 = u_hi * v_lo;
+ const std::uint64_t p3 = u_hi * v_hi;
+
+ const std::uint64_t p0_hi = p0 >> 32u;
+ const std::uint64_t p1_lo = p1 & 0xFFFFFFFFu;
+ const std::uint64_t p1_hi = p1 >> 32u;
+ const std::uint64_t p2_lo = p2 & 0xFFFFFFFFu;
+ const std::uint64_t p2_hi = p2 >> 32u;
+
+ std::uint64_t Q = p0_hi + p1_lo + p2_lo;
+
+ // The full product might now be computed as
+ //
+ // p_hi = p3 + p2_hi + p1_hi + (Q >> 32)
+ // p_lo = p0_lo + (Q << 32)
+ //
+ // But in this particular case here, the full p_lo is not required.
+ // Effectively we only need to add the highest bit in p_lo to p_hi (and
+ // Q_hi + 1 does not overflow).
+
+ Q += std::uint64_t{1} << (64u - 32u - 1u); // round, ties up
+
+ const std::uint64_t h = p3 + p2_hi + p1_hi + (Q >> 32u);
+
+ return {h, x.e + y.e + 64};
+ }
+
+ /*!
+ @brief normalize x such that the significand is >= 2^(q-1)
+ @pre x.f != 0
+ */
+ static diyfp normalize(diyfp x) noexcept
+ {
+ assert(x.f != 0);
+
+ while ((x.f >> 63u) == 0)
+ {
+ x.f <<= 1u;
+ x.e--;
+ }
+
+ return x;
+ }
+
+ /*!
+ @brief normalize x such that the result has the exponent E
+ @pre e >= x.e and the upper e - x.e bits of x.f must be zero.
+ */
+ static diyfp normalize_to(const diyfp& x, const int target_exponent) noexcept
+ {
+ const int delta = x.e - target_exponent;
+
+ assert(delta >= 0);
+ assert(((x.f << delta) >> delta) == x.f);
+
+ return {x.f << delta, target_exponent};
+ }
+};
+
+struct boundaries
+{
+ diyfp w;
+ diyfp minus;
+ diyfp plus;
+};
+
+/*!
+Compute the (normalized) diyfp representing the input number 'value' and its
+boundaries.
+
+@pre value must be finite and positive
+*/
+template <typename FloatType>
+boundaries compute_boundaries(FloatType value)
+{
+ assert(std::isfinite(value));
+ assert(value > 0);
+
+ // Convert the IEEE representation into a diyfp.
+ //
+ // If v is denormal:
+ // value = 0.F * 2^(1 - bias) = ( F) * 2^(1 - bias - (p-1))
+ // If v is normalized:
+ // value = 1.F * 2^(E - bias) = (2^(p-1) + F) * 2^(E - bias - (p-1))
+
+ static_assert(std::numeric_limits<FloatType>::is_iec559,
+ "internal error: dtoa_short requires an IEEE-754 floating-point implementation");
+
+ constexpr int kPrecision = std::numeric_limits<FloatType>::digits; // = p (includes the hidden bit)
+ constexpr int kBias = std::numeric_limits<FloatType>::max_exponent - 1 + (kPrecision - 1);
+ constexpr int kMinExp = 1 - kBias;
+ constexpr std::uint64_t kHiddenBit = std::uint64_t{1} << (kPrecision - 1); // = 2^(p-1)
+
+ using bits_type = typename std::conditional<kPrecision == 24, std::uint32_t, std::uint64_t >::type;
+
+ const std::uint64_t bits = reinterpret_bits<bits_type>(value);
+ const std::uint64_t E = bits >> (kPrecision - 1);
+ const std::uint64_t F = bits & (kHiddenBit - 1);
+
+ const bool is_denormal = E == 0;
+ const diyfp v = is_denormal
+ ? diyfp(F, kMinExp)
+ : diyfp(F + kHiddenBit, static_cast<int>(E) - kBias);
+
+ // Compute the boundaries m- and m+ of the floating-point value
+ // v = f * 2^e.
+ //
+ // Determine v- and v+, the floating-point predecessor and successor if v,
+ // respectively.
+ //
+ // v- = v - 2^e if f != 2^(p-1) or e == e_min (A)
+ // = v - 2^(e-1) if f == 2^(p-1) and e > e_min (B)
+ //
+ // v+ = v + 2^e
+ //
+ // Let m- = (v- + v) / 2 and m+ = (v + v+) / 2. All real numbers _strictly_
+ // between m- and m+ round to v, regardless of how the input rounding
+ // algorithm breaks ties.
+ //
+ // ---+-------------+-------------+-------------+-------------+--- (A)
+ // v- m- v m+ v+
+ //
+ // -----------------+------+------+-------------+-------------+--- (B)
+ // v- m- v m+ v+
+
+ const bool lower_boundary_is_closer = F == 0 and E > 1;
+ const diyfp m_plus = diyfp(2 * v.f + 1, v.e - 1);
+ const diyfp m_minus = lower_boundary_is_closer
+ ? diyfp(4 * v.f - 1, v.e - 2) // (B)
+ : diyfp(2 * v.f - 1, v.e - 1); // (A)
+
+ // Determine the normalized w+ = m+.
+ const diyfp w_plus = diyfp::normalize(m_plus);
+
+ // Determine w- = m- such that e_(w-) = e_(w+).
+ const diyfp w_minus = diyfp::normalize_to(m_minus, w_plus.e);
+
+ return {diyfp::normalize(v), w_minus, w_plus};
+}
+
+// Given normalized diyfp w, Grisu needs to find a (normalized) cached
+// power-of-ten c, such that the exponent of the product c * w = f * 2^e lies
+// within a certain range [alpha, gamma] (Definition 3.2 from [1])
+//
+// alpha <= e = e_c + e_w + q <= gamma
+//
+// or
+//
+// f_c * f_w * 2^alpha <= f_c 2^(e_c) * f_w 2^(e_w) * 2^q
+// <= f_c * f_w * 2^gamma
+//
+// Since c and w are normalized, i.e. 2^(q-1) <= f < 2^q, this implies
+//
+// 2^(q-1) * 2^(q-1) * 2^alpha <= c * w * 2^q < 2^q * 2^q * 2^gamma
+//
+// or
+//
+// 2^(q - 2 + alpha) <= c * w < 2^(q + gamma)
+//
+// The choice of (alpha,gamma) determines the size of the table and the form of
+// the digit generation procedure. Using (alpha,gamma)=(-60,-32) works out well
+// in practice:
+//
+// The idea is to cut the number c * w = f * 2^e into two parts, which can be
+// processed independently: An integral part p1, and a fractional part p2:
+//
+// f * 2^e = ( (f div 2^-e) * 2^-e + (f mod 2^-e) ) * 2^e
+// = (f div 2^-e) + (f mod 2^-e) * 2^e
+// = p1 + p2 * 2^e
+//
+// The conversion of p1 into decimal form requires a series of divisions and
+// modulos by (a power of) 10. These operations are faster for 32-bit than for
+// 64-bit integers, so p1 should ideally fit into a 32-bit integer. This can be
+// achieved by choosing
+//
+// -e >= 32 or e <= -32 := gamma
+//
+// In order to convert the fractional part
+//
+// p2 * 2^e = p2 / 2^-e = d[-1] / 10^1 + d[-2] / 10^2 + ...
+//
+// into decimal form, the fraction is repeatedly multiplied by 10 and the digits
+// d[-i] are extracted in order:
+//
+// (10 * p2) div 2^-e = d[-1]
+// (10 * p2) mod 2^-e = d[-2] / 10^1 + ...
+//
+// The multiplication by 10 must not overflow. It is sufficient to choose
+//
+// 10 * p2 < 16 * p2 = 2^4 * p2 <= 2^64.
+//
+// Since p2 = f mod 2^-e < 2^-e,
+//
+// -e <= 60 or e >= -60 := alpha
+
+constexpr int kAlpha = -60;
+constexpr int kGamma = -32;
+
+struct cached_power // c = f * 2^e ~= 10^k
+{
+ std::uint64_t f;
+ int e;
+ int k;
+};
+
+/*!
+For a normalized diyfp w = f * 2^e, this function returns a (normalized) cached
+power-of-ten c = f_c * 2^e_c, such that the exponent of the product w * c
+satisfies (Definition 3.2 from [1])
+
+ alpha <= e_c + e + q <= gamma.
+*/
+inline cached_power get_cached_power_for_binary_exponent(int e)
+{
+ // Now
+ //
+ // alpha <= e_c + e + q <= gamma (1)
+ // ==> f_c * 2^alpha <= c * 2^e * 2^q
+ //
+ // and since the c's are normalized, 2^(q-1) <= f_c,
+ //
+ // ==> 2^(q - 1 + alpha) <= c * 2^(e + q)
+ // ==> 2^(alpha - e - 1) <= c
+ //
+ // If c were an exact power of ten, i.e. c = 10^k, one may determine k as
+ //
+ // k = ceil( log_10( 2^(alpha - e - 1) ) )
+ // = ceil( (alpha - e - 1) * log_10(2) )
+ //
+ // From the paper:
+ // "In theory the result of the procedure could be wrong since c is rounded,
+ // and the computation itself is approximated [...]. In practice, however,
+ // this simple function is sufficient."
+ //
+ // For IEEE double precision floating-point numbers converted into
+ // normalized diyfp's w = f * 2^e, with q = 64,
+ //
+ // e >= -1022 (min IEEE exponent)
+ // -52 (p - 1)
+ // -52 (p - 1, possibly normalize denormal IEEE numbers)
+ // -11 (normalize the diyfp)
+ // = -1137
+ //
+ // and
+ //
+ // e <= +1023 (max IEEE exponent)
+ // -52 (p - 1)
+ // -11 (normalize the diyfp)
+ // = 960
+ //
+ // This binary exponent range [-1137,960] results in a decimal exponent
+ // range [-307,324]. One does not need to store a cached power for each
+ // k in this range. For each such k it suffices to find a cached power
+ // such that the exponent of the product lies in [alpha,gamma].
+ // This implies that the difference of the decimal exponents of adjacent
+ // table entries must be less than or equal to
+ //
+ // floor( (gamma - alpha) * log_10(2) ) = 8.
+ //
+ // (A smaller distance gamma-alpha would require a larger table.)
+
+ // NB:
+ // Actually this function returns c, such that -60 <= e_c + e + 64 <= -34.
+
+ constexpr int kCachedPowersMinDecExp = -300;
+ constexpr int kCachedPowersDecStep = 8;
+
+ static constexpr std::array<cached_power, 79> kCachedPowers =
+ {
+ {
+ { 0xAB70FE17C79AC6CA, -1060, -300 },
+ { 0xFF77B1FCBEBCDC4F, -1034, -292 },
+ { 0xBE5691EF416BD60C, -1007, -284 },
+ { 0x8DD01FAD907FFC3C, -980, -276 },
+ { 0xD3515C2831559A83, -954, -268 },
+ { 0x9D71AC8FADA6C9B5, -927, -260 },
+ { 0xEA9C227723EE8BCB, -901, -252 },
+ { 0xAECC49914078536D, -874, -244 },
+ { 0x823C12795DB6CE57, -847, -236 },
+ { 0xC21094364DFB5637, -821, -228 },
+ { 0x9096EA6F3848984F, -794, -220 },
+ { 0xD77485CB25823AC7, -768, -212 },
+ { 0xA086CFCD97BF97F4, -741, -204 },
+ { 0xEF340A98172AACE5, -715, -196 },
+ { 0xB23867FB2A35B28E, -688, -188 },
+ { 0x84C8D4DFD2C63F3B, -661, -180 },
+ { 0xC5DD44271AD3CDBA, -635, -172 },
+ { 0x936B9FCEBB25C996, -608, -164 },
+ { 0xDBAC6C247D62A584, -582, -156 },
+ { 0xA3AB66580D5FDAF6, -555, -148 },
+ { 0xF3E2F893DEC3F126, -529, -140 },
+ { 0xB5B5ADA8AAFF80B8, -502, -132 },
+ { 0x87625F056C7C4A8B, -475, -124 },
+ { 0xC9BCFF6034C13053, -449, -116 },
+ { 0x964E858C91BA2655, -422, -108 },
+ { 0xDFF9772470297EBD, -396, -100 },
+ { 0xA6DFBD9FB8E5B88F, -369, -92 },
+ { 0xF8A95FCF88747D94, -343, -84 },
+ { 0xB94470938FA89BCF, -316, -76 },
+ { 0x8A08F0F8BF0F156B, -289, -68 },
+ { 0xCDB02555653131B6, -263, -60 },
+ { 0x993FE2C6D07B7FAC, -236, -52 },
+ { 0xE45C10C42A2B3B06, -210, -44 },
+ { 0xAA242499697392D3, -183, -36 },
+ { 0xFD87B5F28300CA0E, -157, -28 },
+ { 0xBCE5086492111AEB, -130, -20 },
+ { 0x8CBCCC096F5088CC, -103, -12 },
+ { 0xD1B71758E219652C, -77, -4 },
+ { 0x9C40000000000000, -50, 4 },
+ { 0xE8D4A51000000000, -24, 12 },
+ { 0xAD78EBC5AC620000, 3, 20 },
+ { 0x813F3978F8940984, 30, 28 },
+ { 0xC097CE7BC90715B3, 56, 36 },
+ { 0x8F7E32CE7BEA5C70, 83, 44 },
+ { 0xD5D238A4ABE98068, 109, 52 },
+ { 0x9F4F2726179A2245, 136, 60 },
+ { 0xED63A231D4C4FB27, 162, 68 },
+ { 0xB0DE65388CC8ADA8, 189, 76 },
+ { 0x83C7088E1AAB65DB, 216, 84 },
+ { 0xC45D1DF942711D9A, 242, 92 },
+ { 0x924D692CA61BE758, 269, 100 },
+ { 0xDA01EE641A708DEA, 295, 108 },
+ { 0xA26DA3999AEF774A, 322, 116 },
+ { 0xF209787BB47D6B85, 348, 124 },
+ { 0xB454E4A179DD1877, 375, 132 },
+ { 0x865B86925B9BC5C2, 402, 140 },
+ { 0xC83553C5C8965D3D, 428, 148 },
+ { 0x952AB45CFA97A0B3, 455, 156 },
+ { 0xDE469FBD99A05FE3, 481, 164 },
+ { 0xA59BC234DB398C25, 508, 172 },
+ { 0xF6C69A72A3989F5C, 534, 180 },
+ { 0xB7DCBF5354E9BECE, 561, 188 },
+ { 0x88FCF317F22241E2, 588, 196 },
+ { 0xCC20CE9BD35C78A5, 614, 204 },
+ { 0x98165AF37B2153DF, 641, 212 },
+ { 0xE2A0B5DC971F303A, 667, 220 },
+ { 0xA8D9D1535CE3B396, 694, 228 },
+ { 0xFB9B7CD9A4A7443C, 720, 236 },
+ { 0xBB764C4CA7A44410, 747, 244 },
+ { 0x8BAB8EEFB6409C1A, 774, 252 },
+ { 0xD01FEF10A657842C, 800, 260 },
+ { 0x9B10A4E5E9913129, 827, 268 },
+ { 0xE7109BFBA19C0C9D, 853, 276 },
+ { 0xAC2820D9623BF429, 880, 284 },
+ { 0x80444B5E7AA7CF85, 907, 292 },
+ { 0xBF21E44003ACDD2D, 933, 300 },
+ { 0x8E679C2F5E44FF8F, 960, 308 },
+ { 0xD433179D9C8CB841, 986, 316 },
+ { 0x9E19DB92B4E31BA9, 1013, 324 },
+ }
+ };
+
+ // This computation gives exactly the same results for k as
+ // k = ceil((kAlpha - e - 1) * 0.30102999566398114)
+ // for |e| <= 1500, but doesn't require floating-point operations.
+ // NB: log_10(2) ~= 78913 / 2^18
+ assert(e >= -1500);
+ assert(e <= 1500);
+ const int f = kAlpha - e - 1;
+ const int k = (f * 78913) / (1 << 18) + static_cast<int>(f > 0);
+
+ const int index = (-kCachedPowersMinDecExp + k + (kCachedPowersDecStep - 1)) / kCachedPowersDecStep;
+ assert(index >= 0);
+ assert(static_cast<std::size_t>(index) < kCachedPowers.size());
+
+ const cached_power cached = kCachedPowers[static_cast<std::size_t>(index)];
+ assert(kAlpha <= cached.e + e + 64);
+ assert(kGamma >= cached.e + e + 64);
+
+ return cached;
+}
+
+/*!
+For n != 0, returns k, such that pow10 := 10^(k-1) <= n < 10^k.
+For n == 0, returns 1 and sets pow10 := 1.
+*/
+inline int find_largest_pow10(const std::uint32_t n, std::uint32_t& pow10)
+{
+ // LCOV_EXCL_START
+ if (n >= 1000000000)
+ {
+ pow10 = 1000000000;
+ return 10;
+ }
+ // LCOV_EXCL_STOP
+ else if (n >= 100000000)
+ {
+ pow10 = 100000000;
+ return 9;
+ }
+ else if (n >= 10000000)
+ {
+ pow10 = 10000000;
+ return 8;
+ }
+ else if (n >= 1000000)
+ {
+ pow10 = 1000000;
+ return 7;
+ }
+ else if (n >= 100000)
+ {
+ pow10 = 100000;
+ return 6;
+ }
+ else if (n >= 10000)
+ {
+ pow10 = 10000;
+ return 5;
+ }
+ else if (n >= 1000)
+ {
+ pow10 = 1000;
+ return 4;
+ }
+ else if (n >= 100)
+ {
+ pow10 = 100;
+ return 3;
+ }
+ else if (n >= 10)
+ {
+ pow10 = 10;
+ return 2;
+ }
+ else
+ {
+ pow10 = 1;
+ return 1;
+ }
+}
+
+inline void grisu2_round(char* buf, int len, std::uint64_t dist, std::uint64_t delta,
+ std::uint64_t rest, std::uint64_t ten_k)
+{
+ assert(len >= 1);
+ assert(dist <= delta);
+ assert(rest <= delta);
+ assert(ten_k > 0);
+
+ // <--------------------------- delta ---->
+ // <---- dist --------->
+ // --------------[------------------+-------------------]--------------
+ // M- w M+
+ //
+ // ten_k
+ // <------>
+ // <---- rest ---->
+ // --------------[------------------+----+--------------]--------------
+ // w V
+ // = buf * 10^k
+ //
+ // ten_k represents a unit-in-the-last-place in the decimal representation
+ // stored in buf.
+ // Decrement buf by ten_k while this takes buf closer to w.
+
+ // The tests are written in this order to avoid overflow in unsigned
+ // integer arithmetic.
+
+ while (rest < dist
+ and delta - rest >= ten_k
+ and (rest + ten_k < dist or dist - rest > rest + ten_k - dist))
+ {
+ assert(buf[len - 1] != '0');
+ buf[len - 1]--;
+ rest += ten_k;
+ }
+}
+
+/*!
+Generates V = buffer * 10^decimal_exponent, such that M- <= V <= M+.
+M- and M+ must be normalized and share the same exponent -60 <= e <= -32.
+*/
+inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent,
+ diyfp M_minus, diyfp w, diyfp M_plus)
+{
+ static_assert(kAlpha >= -60, "internal error");
+ static_assert(kGamma <= -32, "internal error");
+
+ // Generates the digits (and the exponent) of a decimal floating-point
+ // number V = buffer * 10^decimal_exponent in the range [M-, M+]. The diyfp's
+ // w, M- and M+ share the same exponent e, which satisfies alpha <= e <= gamma.
+ //
+ // <--------------------------- delta ---->
+ // <---- dist --------->
+ // --------------[------------------+-------------------]--------------
+ // M- w M+
+ //
+ // Grisu2 generates the digits of M+ from left to right and stops as soon as
+ // V is in [M-,M+].
+
+ assert(M_plus.e >= kAlpha);
+ assert(M_plus.e <= kGamma);
+
+ std::uint64_t delta = diyfp::sub(M_plus, M_minus).f; // (significand of (M+ - M-), implicit exponent is e)
+ std::uint64_t dist = diyfp::sub(M_plus, w ).f; // (significand of (M+ - w ), implicit exponent is e)
+
+ // Split M+ = f * 2^e into two parts p1 and p2 (note: e < 0):
+ //
+ // M+ = f * 2^e
+ // = ((f div 2^-e) * 2^-e + (f mod 2^-e)) * 2^e
+ // = ((p1 ) * 2^-e + (p2 )) * 2^e
+ // = p1 + p2 * 2^e
+
+ const diyfp one(std::uint64_t{1} << -M_plus.e, M_plus.e);
+
+ auto p1 = static_cast<std::uint32_t>(M_plus.f >> -one.e); // p1 = f div 2^-e (Since -e >= 32, p1 fits into a 32-bit int.)
+ std::uint64_t p2 = M_plus.f & (one.f - 1); // p2 = f mod 2^-e
+
+ // 1)
+ //
+ // Generate the digits of the integral part p1 = d[n-1]...d[1]d[0]
+
+ assert(p1 > 0);
+
+ std::uint32_t pow10;
+ const int k = find_largest_pow10(p1, pow10);
+
+ // 10^(k-1) <= p1 < 10^k, pow10 = 10^(k-1)
+ //
+ // p1 = (p1 div 10^(k-1)) * 10^(k-1) + (p1 mod 10^(k-1))
+ // = (d[k-1] ) * 10^(k-1) + (p1 mod 10^(k-1))
+ //
+ // M+ = p1 + p2 * 2^e
+ // = d[k-1] * 10^(k-1) + (p1 mod 10^(k-1)) + p2 * 2^e
+ // = d[k-1] * 10^(k-1) + ((p1 mod 10^(k-1)) * 2^-e + p2) * 2^e
+ // = d[k-1] * 10^(k-1) + ( rest) * 2^e
+ //
+ // Now generate the digits d[n] of p1 from left to right (n = k-1,...,0)
+ //
+ // p1 = d[k-1]...d[n] * 10^n + d[n-1]...d[0]
+ //
+ // but stop as soon as
+ //
+ // rest * 2^e = (d[n-1]...d[0] * 2^-e + p2) * 2^e <= delta * 2^e
+
+ int n = k;
+ while (n > 0)
+ {
+ // Invariants:
+ // M+ = buffer * 10^n + (p1 + p2 * 2^e) (buffer = 0 for n = k)
+ // pow10 = 10^(n-1) <= p1 < 10^n
+ //
+ const std::uint32_t d = p1 / pow10; // d = p1 div 10^(n-1)
+ const std::uint32_t r = p1 % pow10; // r = p1 mod 10^(n-1)
+ //
+ // M+ = buffer * 10^n + (d * 10^(n-1) + r) + p2 * 2^e
+ // = (buffer * 10 + d) * 10^(n-1) + (r + p2 * 2^e)
+ //
+ assert(d <= 9);
+ buffer[length++] = static_cast<char>('0' + d); // buffer := buffer * 10 + d
+ //
+ // M+ = buffer * 10^(n-1) + (r + p2 * 2^e)
+ //
+ p1 = r;
+ n--;
+ //
+ // M+ = buffer * 10^n + (p1 + p2 * 2^e)
+ // pow10 = 10^n
+ //
+
+ // Now check if enough digits have been generated.
+ // Compute
+ //
+ // p1 + p2 * 2^e = (p1 * 2^-e + p2) * 2^e = rest * 2^e
+ //
+ // Note:
+ // Since rest and delta share the same exponent e, it suffices to
+ // compare the significands.
+ const std::uint64_t rest = (std::uint64_t{p1} << -one.e) + p2;
+ if (rest <= delta)
+ {
+ // V = buffer * 10^n, with M- <= V <= M+.
+
+ decimal_exponent += n;
+
+ // We may now just stop. But instead look if the buffer could be
+ // decremented to bring V closer to w.
+ //
+ // pow10 = 10^n is now 1 ulp in the decimal representation V.
+ // The rounding procedure works with diyfp's with an implicit
+ // exponent of e.
+ //
+ // 10^n = (10^n * 2^-e) * 2^e = ulp * 2^e
+ //
+ const std::uint64_t ten_n = std::uint64_t{pow10} << -one.e;
+ grisu2_round(buffer, length, dist, delta, rest, ten_n);
+
+ return;
+ }
+
+ pow10 /= 10;
+ //
+ // pow10 = 10^(n-1) <= p1 < 10^n
+ // Invariants restored.
+ }
+
+ // 2)
+ //
+ // The digits of the integral part have been generated:
+ //
+ // M+ = d[k-1]...d[1]d[0] + p2 * 2^e
+ // = buffer + p2 * 2^e
+ //
+ // Now generate the digits of the fractional part p2 * 2^e.
+ //
+ // Note:
+ // No decimal point is generated: the exponent is adjusted instead.
+ //
+ // p2 actually represents the fraction
+ //
+ // p2 * 2^e
+ // = p2 / 2^-e
+ // = d[-1] / 10^1 + d[-2] / 10^2 + ...
+ //
+ // Now generate the digits d[-m] of p1 from left to right (m = 1,2,...)
+ //
+ // p2 * 2^e = d[-1]d[-2]...d[-m] * 10^-m
+ // + 10^-m * (d[-m-1] / 10^1 + d[-m-2] / 10^2 + ...)
+ //
+ // using
+ //
+ // 10^m * p2 = ((10^m * p2) div 2^-e) * 2^-e + ((10^m * p2) mod 2^-e)
+ // = ( d) * 2^-e + ( r)
+ //
+ // or
+ // 10^m * p2 * 2^e = d + r * 2^e
+ //
+ // i.e.
+ //
+ // M+ = buffer + p2 * 2^e
+ // = buffer + 10^-m * (d + r * 2^e)
+ // = (buffer * 10^m + d) * 10^-m + 10^-m * r * 2^e
+ //
+ // and stop as soon as 10^-m * r * 2^e <= delta * 2^e
+
+ assert(p2 > delta);
+
+ int m = 0;
+ for (;;)
+ {
+ // Invariant:
+ // M+ = buffer * 10^-m + 10^-m * (d[-m-1] / 10 + d[-m-2] / 10^2 + ...) * 2^e
+ // = buffer * 10^-m + 10^-m * (p2 ) * 2^e
+ // = buffer * 10^-m + 10^-m * (1/10 * (10 * p2) ) * 2^e
+ // = buffer * 10^-m + 10^-m * (1/10 * ((10*p2 div 2^-e) * 2^-e + (10*p2 mod 2^-e)) * 2^e
+ //
+ assert(p2 <= (std::numeric_limits<std::uint64_t>::max)() / 10);
+ p2 *= 10;
+ const std::uint64_t d = p2 >> -one.e; // d = (10 * p2) div 2^-e
+ const std::uint64_t r = p2 & (one.f - 1); // r = (10 * p2) mod 2^-e
+ //
+ // M+ = buffer * 10^-m + 10^-m * (1/10 * (d * 2^-e + r) * 2^e
+ // = buffer * 10^-m + 10^-m * (1/10 * (d + r * 2^e))
+ // = (buffer * 10 + d) * 10^(-m-1) + 10^(-m-1) * r * 2^e
+ //
+ assert(d <= 9);
+ buffer[length++] = static_cast<char>('0' + d); // buffer := buffer * 10 + d
+ //
+ // M+ = buffer * 10^(-m-1) + 10^(-m-1) * r * 2^e
+ //
+ p2 = r;
+ m++;
+ //
+ // M+ = buffer * 10^-m + 10^-m * p2 * 2^e
+ // Invariant restored.
+
+ // Check if enough digits have been generated.
+ //
+ // 10^-m * p2 * 2^e <= delta * 2^e
+ // p2 * 2^e <= 10^m * delta * 2^e
+ // p2 <= 10^m * delta
+ delta *= 10;
+ dist *= 10;
+ if (p2 <= delta)
+ {
+ break;
+ }
+ }
+
+ // V = buffer * 10^-m, with M- <= V <= M+.
+
+ decimal_exponent -= m;
+
+ // 1 ulp in the decimal representation is now 10^-m.
+ // Since delta and dist are now scaled by 10^m, we need to do the
+ // same with ulp in order to keep the units in sync.
+ //
+ // 10^m * 10^-m = 1 = 2^-e * 2^e = ten_m * 2^e
+ //
+ const std::uint64_t ten_m = one.f;
+ grisu2_round(buffer, length, dist, delta, p2, ten_m);
+
+ // By construction this algorithm generates the shortest possible decimal
+ // number (Loitsch, Theorem 6.2) which rounds back to w.
+ // For an input number of precision p, at least
+ //
+ // N = 1 + ceil(p * log_10(2))
+ //
+ // decimal digits are sufficient to identify all binary floating-point
+ // numbers (Matula, "In-and-Out conversions").
+ // This implies that the algorithm does not produce more than N decimal
+ // digits.
+ //
+ // N = 17 for p = 53 (IEEE double precision)
+ // N = 9 for p = 24 (IEEE single precision)
+}
+
+/*!
+v = buf * 10^decimal_exponent
+len is the length of the buffer (number of decimal digits)
+The buffer must be large enough, i.e. >= max_digits10.
+*/
+JSON_HEDLEY_NON_NULL(1)
+inline void grisu2(char* buf, int& len, int& decimal_exponent,
+ diyfp m_minus, diyfp v, diyfp m_plus)
+{
+ assert(m_plus.e == m_minus.e);
+ assert(m_plus.e == v.e);
+
+ // --------(-----------------------+-----------------------)-------- (A)
+ // m- v m+
+ //
+ // --------------------(-----------+-----------------------)-------- (B)
+ // m- v m+
+ //
+ // First scale v (and m- and m+) such that the exponent is in the range
+ // [alpha, gamma].
+
+ const cached_power cached = get_cached_power_for_binary_exponent(m_plus.e);
+
+ const diyfp c_minus_k(cached.f, cached.e); // = c ~= 10^-k
+
+ // The exponent of the products is = v.e + c_minus_k.e + q and is in the range [alpha,gamma]
+ const diyfp w = diyfp::mul(v, c_minus_k);
+ const diyfp w_minus = diyfp::mul(m_minus, c_minus_k);
+ const diyfp w_plus = diyfp::mul(m_plus, c_minus_k);
+
+ // ----(---+---)---------------(---+---)---------------(---+---)----
+ // w- w w+
+ // = c*m- = c*v = c*m+
+ //
+ // diyfp::mul rounds its result and c_minus_k is approximated too. w, w- and
+ // w+ are now off by a small amount.
+ // In fact:
+ //
+ // w - v * 10^k < 1 ulp
+ //
+ // To account for this inaccuracy, add resp. subtract 1 ulp.
+ //
+ // --------+---[---------------(---+---)---------------]---+--------
+ // w- M- w M+ w+
+ //
+ // Now any number in [M-, M+] (bounds included) will round to w when input,
+ // regardless of how the input rounding algorithm breaks ties.
+ //
+ // And digit_gen generates the shortest possible such number in [M-, M+].
+ // Note that this does not mean that Grisu2 always generates the shortest
+ // possible number in the interval (m-, m+).
+ const diyfp M_minus(w_minus.f + 1, w_minus.e);
+ const diyfp M_plus (w_plus.f - 1, w_plus.e );
+
+ decimal_exponent = -cached.k; // = -(-k) = k
+
+ grisu2_digit_gen(buf, len, decimal_exponent, M_minus, w, M_plus);
+}
+
+/*!
+v = buf * 10^decimal_exponent
+len is the length of the buffer (number of decimal digits)
+The buffer must be large enough, i.e. >= max_digits10.
+*/
+template <typename FloatType>
+JSON_HEDLEY_NON_NULL(1)
+void grisu2(char* buf, int& len, int& decimal_exponent, FloatType value)
+{
+ static_assert(diyfp::kPrecision >= std::numeric_limits<FloatType>::digits + 3,
+ "internal error: not enough precision");
+
+ assert(std::isfinite(value));
+ assert(value > 0);
+
+ // If the neighbors (and boundaries) of 'value' are always computed for double-precision
+ // numbers, all float's can be recovered using strtod (and strtof). However, the resulting
+ // decimal representations are not exactly "short".
+ //
+ // The documentation for 'std::to_chars' (https://en.cppreference.com/w/cpp/utility/to_chars)
+ // says "value is converted to a string as if by std::sprintf in the default ("C") locale"
+ // and since sprintf promotes float's to double's, I think this is exactly what 'std::to_chars'
+ // does.
+ // On the other hand, the documentation for 'std::to_chars' requires that "parsing the
+ // representation using the corresponding std::from_chars function recovers value exactly". That
+ // indicates that single precision floating-point numbers should be recovered using
+ // 'std::strtof'.
+ //
+ // NB: If the neighbors are computed for single-precision numbers, there is a single float
+ // (7.0385307e-26f) which can't be recovered using strtod. The resulting double precision
+ // value is off by 1 ulp.
+#if 0
+ const boundaries w = compute_boundaries(static_cast<double>(value));
+#else
+ const boundaries w = compute_boundaries(value);
+#endif
+
+ grisu2(buf, len, decimal_exponent, w.minus, w.w, w.plus);
+}
+
+/*!
+@brief appends a decimal representation of e to buf
+@return a pointer to the element following the exponent.
+@pre -1000 < e < 1000
+*/
+JSON_HEDLEY_NON_NULL(1)
+JSON_HEDLEY_RETURNS_NON_NULL
+inline char* append_exponent(char* buf, int e)
+{
+ assert(e > -1000);
+ assert(e < 1000);
+
+ if (e < 0)
+ {
+ e = -e;
+ *buf++ = '-';
+ }
+ else
+ {
+ *buf++ = '+';
+ }
+
+ auto k = static_cast<std::uint32_t>(e);
+ if (k < 10)
+ {
+ // Always print at least two digits in the exponent.
+ // This is for compatibility with printf("%g").
+ *buf++ = '0';
+ *buf++ = static_cast<char>('0' + k);
+ }
+ else if (k < 100)
+ {
+ *buf++ = static_cast<char>('0' + k / 10);
+ k %= 10;
+ *buf++ = static_cast<char>('0' + k);
+ }
+ else
+ {
+ *buf++ = static_cast<char>('0' + k / 100);
+ k %= 100;
+ *buf++ = static_cast<char>('0' + k / 10);
+ k %= 10;
+ *buf++ = static_cast<char>('0' + k);
+ }
+
+ return buf;
+}
+
+/*!
+@brief prettify v = buf * 10^decimal_exponent
+
+If v is in the range [10^min_exp, 10^max_exp) it will be printed in fixed-point
+notation. Otherwise it will be printed in exponential notation.
+
+@pre min_exp < 0
+@pre max_exp > 0
+*/
+JSON_HEDLEY_NON_NULL(1)
+JSON_HEDLEY_RETURNS_NON_NULL
+inline char* format_buffer(char* buf, int len, int decimal_exponent,
+ int min_exp, int max_exp)
+{
+ assert(min_exp < 0);
+ assert(max_exp > 0);
+
+ const int k = len;
+ const int n = len + decimal_exponent;
+
+ // v = buf * 10^(n-k)
+ // k is the length of the buffer (number of decimal digits)
+ // n is the position of the decimal point relative to the start of the buffer.
+
+ if (k <= n and n <= max_exp)
+ {
+ // digits[000]
+ // len <= max_exp + 2
+
+ std::memset(buf + k, '0', static_cast<size_t>(n) - static_cast<size_t>(k));
+ // Make it look like a floating-point number (#362, #378)
+ buf[n + 0] = '.';
+ buf[n + 1] = '0';
+ return buf + (static_cast<size_t>(n) + 2);
+ }
+
+ if (0 < n and n <= max_exp)
+ {
+ // dig.its
+ // len <= max_digits10 + 1
+
+ assert(k > n);
+
+ std::memmove(buf + (static_cast<size_t>(n) + 1), buf + n, static_cast<size_t>(k) - static_cast<size_t>(n));
+ buf[n] = '.';
+ return buf + (static_cast<size_t>(k) + 1U);
+ }
+
+ if (min_exp < n and n <= 0)
+ {
+ // 0.[000]digits
+ // len <= 2 + (-min_exp - 1) + max_digits10
+
+ std::memmove(buf + (2 + static_cast<size_t>(-n)), buf, static_cast<size_t>(k));
+ buf[0] = '0';
+ buf[1] = '.';
+ std::memset(buf + 2, '0', static_cast<size_t>(-n));
+ return buf + (2U + static_cast<size_t>(-n) + static_cast<size_t>(k));
+ }
+
+ if (k == 1)
+ {
+ // dE+123
+ // len <= 1 + 5
+
+ buf += 1;
+ }
+ else
+ {
+ // d.igitsE+123
+ // len <= max_digits10 + 1 + 5
+
+ std::memmove(buf + 2, buf + 1, static_cast<size_t>(k) - 1);
+ buf[1] = '.';
+ buf += 1 + static_cast<size_t>(k);
+ }
+
+ *buf++ = 'e';
+ return append_exponent(buf, n - 1);
+}
+
+} // namespace dtoa_impl
+
+/*!
+@brief generates a decimal representation of the floating-point number value in [first, last).
+
+The format of the resulting decimal representation is similar to printf's %g
+format. Returns an iterator pointing past-the-end of the decimal representation.
+
+@note The input number must be finite, i.e. NaN's and Inf's are not supported.
+@note The buffer must be large enough.
+@note The result is NOT null-terminated.
+*/
+template <typename FloatType>
+JSON_HEDLEY_NON_NULL(1, 2)
+JSON_HEDLEY_RETURNS_NON_NULL
+char* to_chars(char* first, const char* last, FloatType value)
+{
+ static_cast<void>(last); // maybe unused - fix warning
+ assert(std::isfinite(value));
+
+ // Use signbit(value) instead of (value < 0) since signbit works for -0.
+ if (std::signbit(value))
+ {
+ value = -value;
+ *first++ = '-';
+ }
+
+ if (value == 0) // +-0
+ {
+ *first++ = '0';
+ // Make it look like a floating-point number (#362, #378)
+ *first++ = '.';
+ *first++ = '0';
+ return first;
+ }
+
+ assert(last - first >= std::numeric_limits<FloatType>::max_digits10);
+
+ // Compute v = buffer * 10^decimal_exponent.
+ // The decimal digits are stored in the buffer, which needs to be interpreted
+ // as an unsigned decimal integer.
+ // len is the length of the buffer, i.e. the number of decimal digits.
+ int len = 0;
+ int decimal_exponent = 0;
+ dtoa_impl::grisu2(first, len, decimal_exponent, value);
+
+ assert(len <= std::numeric_limits<FloatType>::max_digits10);
+
+ // Format the buffer like printf("%.*g", prec, value)
+ constexpr int kMinExp = -4;
+ // Use digits10 here to increase compatibility with version 2.
+ constexpr int kMaxExp = std::numeric_limits<FloatType>::digits10;
+
+ assert(last - first >= kMaxExp + 2);
+ assert(last - first >= 2 + (-kMinExp - 1) + std::numeric_limits<FloatType>::max_digits10);
+ assert(last - first >= std::numeric_limits<FloatType>::max_digits10 + 6);
+
+ return dtoa_impl::format_buffer(first, len, decimal_exponent, kMinExp, kMaxExp);
+}
+
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/exceptions.hpp>
+
+// #include <nlohmann/detail/macro_scope.hpp>
+
+// #include <nlohmann/detail/meta/cpp_future.hpp>
+
+// #include <nlohmann/detail/output/binary_writer.hpp>
+
+// #include <nlohmann/detail/output/output_adapters.hpp>
+
+// #include <nlohmann/detail/value_t.hpp>
+
+
+namespace nlohmann
+{
+namespace detail
+{
+///////////////////
+// serialization //
+///////////////////
+
+/// how to treat decoding errors
+enum class error_handler_t
+{
+ strict, ///< throw a type_error exception in case of invalid UTF-8
+ replace, ///< replace invalid UTF-8 sequences with U+FFFD
+ ignore ///< ignore invalid UTF-8 sequences
+};
+
+template<typename BasicJsonType>
+class serializer
+{
+ using string_t = typename BasicJsonType::string_t;
+ using number_float_t = typename BasicJsonType::number_float_t;
+ using number_integer_t = typename BasicJsonType::number_integer_t;
+ using number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using binary_char_t = typename BasicJsonType::binary_t::value_type;
+ static constexpr std::uint8_t UTF8_ACCEPT = 0;
+ static constexpr std::uint8_t UTF8_REJECT = 1;
+
+ public:
+ /*!
+ @param[in] s output stream to serialize to
+ @param[in] ichar indentation character to use
+ @param[in] error_handler_ how to react on decoding errors
+ */
+ serializer(output_adapter_t<char> s, const char ichar,
+ error_handler_t error_handler_ = error_handler_t::strict)
+ : o(std::move(s))
+ , loc(std::localeconv())
+ , thousands_sep(loc->thousands_sep == nullptr ? '\0' : * (loc->thousands_sep))
+ , decimal_point(loc->decimal_point == nullptr ? '\0' : * (loc->decimal_point))
+ , indent_char(ichar)
+ , indent_string(512, indent_char)
+ , error_handler(error_handler_)
+ {}
+
+ // delete because of pointer members
+ serializer(const serializer&) = delete;
+ serializer& operator=(const serializer&) = delete;
+ serializer(serializer&&) = delete;
+ serializer& operator=(serializer&&) = delete;
+ ~serializer() = default;
+
+ /*!
+ @brief internal implementation of the serialization function
+
+ This function is called by the public member function dump and organizes
+ the serialization internally. The indentation level is propagated as
+ additional parameter. In case of arrays and objects, the function is
+ called recursively.
+
+ - strings and object keys are escaped using `escape_string()`
+ - integer numbers are converted implicitly via `operator<<`
+ - floating-point numbers are converted to a string using `"%g"` format
+ - binary values are serialized as objects containing the subtype and the
+ byte array
+
+ @param[in] val value to serialize
+ @param[in] pretty_print whether the output shall be pretty-printed
+ @param[in] ensure_ascii If @a ensure_ascii is true, all non-ASCII characters
+ in the output are escaped with `\uXXXX` sequences, and the result consists
+ of ASCII characters only.
+ @param[in] indent_step the indent level
+ @param[in] current_indent the current indent level (only used internally)
+ */
+ void dump(const BasicJsonType& val,
+ const bool pretty_print,
+ const bool ensure_ascii,
+ const unsigned int indent_step,
+ const unsigned int current_indent = 0)
+ {
+ switch (val.m_type)
+ {
+ case value_t::object:
+ {
+ if (val.m_value.object->empty())
+ {
+ o->write_characters("{}", 2);
+ return;
+ }
+
+ if (pretty_print)
+ {
+ o->write_characters("{\n", 2);
+
+ // variable to hold indentation for recursive calls
+ const auto new_indent = current_indent + indent_step;
+ if (JSON_HEDLEY_UNLIKELY(indent_string.size() < new_indent))
+ {
+ indent_string.resize(indent_string.size() * 2, ' ');
+ }
+
+ // first n-1 elements
+ auto i = val.m_value.object->cbegin();
+ for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)
+ {
+ o->write_characters(indent_string.c_str(), new_indent);
+ o->write_character('\"');
+ dump_escaped(i->first, ensure_ascii);
+ o->write_characters("\": ", 3);
+ dump(i->second, true, ensure_ascii, indent_step, new_indent);
+ o->write_characters(",\n", 2);
+ }
+
+ // last element
+ assert(i != val.m_value.object->cend());
+ assert(std::next(i) == val.m_value.object->cend());
+ o->write_characters(indent_string.c_str(), new_indent);
+ o->write_character('\"');
+ dump_escaped(i->first, ensure_ascii);
+ o->write_characters("\": ", 3);
+ dump(i->second, true, ensure_ascii, indent_step, new_indent);
+
+ o->write_character('\n');
+ o->write_characters(indent_string.c_str(), current_indent);
+ o->write_character('}');
+ }
+ else
+ {
+ o->write_character('{');
+
+ // first n-1 elements
+ auto i = val.m_value.object->cbegin();
+ for (std::size_t cnt = 0; cnt < val.m_value.object->size() - 1; ++cnt, ++i)
+ {
+ o->write_character('\"');
+ dump_escaped(i->first, ensure_ascii);
+ o->write_characters("\":", 2);
+ dump(i->second, false, ensure_ascii, indent_step, current_indent);
+ o->write_character(',');
+ }
+
+ // last element
+ assert(i != val.m_value.object->cend());
+ assert(std::next(i) == val.m_value.object->cend());
+ o->write_character('\"');
+ dump_escaped(i->first, ensure_ascii);
+ o->write_characters("\":", 2);
+ dump(i->second, false, ensure_ascii, indent_step, current_indent);
+
+ o->write_character('}');
+ }
+
+ return;
+ }
+
+ case value_t::array:
+ {
+ if (val.m_value.array->empty())
+ {
+ o->write_characters("[]", 2);
+ return;
+ }
+
+ if (pretty_print)
+ {
+ o->write_characters("[\n", 2);
+
+ // variable to hold indentation for recursive calls
+ const auto new_indent = current_indent + indent_step;
+ if (JSON_HEDLEY_UNLIKELY(indent_string.size() < new_indent))
+ {
+ indent_string.resize(indent_string.size() * 2, ' ');
+ }
+
+ // first n-1 elements
+ for (auto i = val.m_value.array->cbegin();
+ i != val.m_value.array->cend() - 1; ++i)
+ {
+ o->write_characters(indent_string.c_str(), new_indent);
+ dump(*i, true, ensure_ascii, indent_step, new_indent);
+ o->write_characters(",\n", 2);
+ }
+
+ // last element
+ assert(not val.m_value.array->empty());
+ o->write_characters(indent_string.c_str(), new_indent);
+ dump(val.m_value.array->back(), true, ensure_ascii, indent_step, new_indent);
+
+ o->write_character('\n');
+ o->write_characters(indent_string.c_str(), current_indent);
+ o->write_character(']');
+ }
+ else
+ {
+ o->write_character('[');
+
+ // first n-1 elements
+ for (auto i = val.m_value.array->cbegin();
+ i != val.m_value.array->cend() - 1; ++i)
+ {
+ dump(*i, false, ensure_ascii, indent_step, current_indent);
+ o->write_character(',');
+ }
+
+ // last element
+ assert(not val.m_value.array->empty());
+ dump(val.m_value.array->back(), false, ensure_ascii, indent_step, current_indent);
+
+ o->write_character(']');
+ }
+
+ return;
+ }
+
+ case value_t::string:
+ {
+ o->write_character('\"');
+ dump_escaped(*val.m_value.string, ensure_ascii);
+ o->write_character('\"');
+ return;
+ }
+
+ case value_t::binary:
+ {
+ if (pretty_print)
+ {
+ o->write_characters("{\n", 2);
+
+ // variable to hold indentation for recursive calls
+ const auto new_indent = current_indent + indent_step;
+ if (JSON_HEDLEY_UNLIKELY(indent_string.size() < new_indent))
+ {
+ indent_string.resize(indent_string.size() * 2, ' ');
+ }
+
+ o->write_characters(indent_string.c_str(), new_indent);
+
+ o->write_characters("\"bytes\": [", 10);
+
+ if (not val.m_value.binary->empty())
+ {
+ for (auto i = val.m_value.binary->cbegin();
+ i != val.m_value.binary->cend() - 1; ++i)
+ {
+ dump_integer(*i);
+ o->write_characters(", ", 2);
+ }
+ dump_integer(val.m_value.binary->back());
+ }
+
+ o->write_characters("],\n", 3);
+ o->write_characters(indent_string.c_str(), new_indent);
+
+ o->write_characters("\"subtype\": ", 11);
+ if (val.m_value.binary->has_subtype())
+ {
+ dump_integer(val.m_value.binary->subtype());
+ }
+ else
+ {
+ o->write_characters("null", 4);
+ }
+ o->write_character('\n');
+ o->write_characters(indent_string.c_str(), current_indent);
+ o->write_character('}');
+ }
+ else
+ {
+ o->write_characters("{\"bytes\":[", 10);
+
+ if (not val.m_value.binary->empty())
+ {
+ for (auto i = val.m_value.binary->cbegin();
+ i != val.m_value.binary->cend() - 1; ++i)
+ {
+ dump_integer(*i);
+ o->write_character(',');
+ }
+ dump_integer(val.m_value.binary->back());
+ }
+
+ o->write_characters("],\"subtype\":", 12);
+ if (val.m_value.binary->has_subtype())
+ {
+ dump_integer(val.m_value.binary->subtype());
+ o->write_character('}');
+ }
+ else
+ {
+ o->write_characters("null}", 5);
+ }
+ }
+ return;
+ }
+
+ case value_t::boolean:
+ {
+ if (val.m_value.boolean)
+ {
+ o->write_characters("true", 4);
+ }
+ else
+ {
+ o->write_characters("false", 5);
+ }
+ return;
+ }
+
+ case value_t::number_integer:
+ {
+ dump_integer(val.m_value.number_integer);
+ return;
+ }
+
+ case value_t::number_unsigned:
+ {
+ dump_integer(val.m_value.number_unsigned);
+ return;
+ }
+
+ case value_t::number_float:
+ {
+ dump_float(val.m_value.number_float);
+ return;
+ }
+
+ case value_t::discarded:
+ {
+ o->write_characters("<discarded>", 11);
+ return;
+ }
+
+ case value_t::null:
+ {
+ o->write_characters("null", 4);
+ return;
+ }
+
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+ }
+
+ private:
+ /*!
+ @brief dump escaped string
+
+ Escape a string by replacing certain special characters by a sequence of an
+ escape character (backslash) and another character and other control
+ characters by a sequence of "\u" followed by a four-digit hex
+ representation. The escaped string is written to output stream @a o.
+
+ @param[in] s the string to escape
+ @param[in] ensure_ascii whether to escape non-ASCII characters with
+ \uXXXX sequences
+
+ @complexity Linear in the length of string @a s.
+ */
+ void dump_escaped(const string_t& s, const bool ensure_ascii)
+ {
+ std::uint32_t codepoint;
+ std::uint8_t state = UTF8_ACCEPT;
+ std::size_t bytes = 0; // number of bytes written to string_buffer
+
+ // number of bytes written at the point of the last valid byte
+ std::size_t bytes_after_last_accept = 0;
+ std::size_t undumped_chars = 0;
+
+ for (std::size_t i = 0; i < s.size(); ++i)
+ {
+ const auto byte = static_cast<uint8_t>(s[i]);
+
+ switch (decode(state, codepoint, byte))
+ {
+ case UTF8_ACCEPT: // decode found a new code point
+ {
+ switch (codepoint)
+ {
+ case 0x08: // backspace
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = 'b';
+ break;
+ }
+
+ case 0x09: // horizontal tab
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = 't';
+ break;
+ }
+
+ case 0x0A: // newline
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = 'n';
+ break;
+ }
+
+ case 0x0C: // formfeed
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = 'f';
+ break;
+ }
+
+ case 0x0D: // carriage return
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = 'r';
+ break;
+ }
+
+ case 0x22: // quotation mark
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = '\"';
+ break;
+ }
+
+ case 0x5C: // reverse solidus
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = '\\';
+ break;
+ }
+
+ default:
+ {
+ // escape control characters (0x00..0x1F) or, if
+ // ensure_ascii parameter is used, non-ASCII characters
+ if ((codepoint <= 0x1F) or (ensure_ascii and (codepoint >= 0x7F)))
+ {
+ if (codepoint <= 0xFFFF)
+ {
+ (std::snprintf)(string_buffer.data() + bytes, 7, "\\u%04x",
+ static_cast<std::uint16_t>(codepoint));
+ bytes += 6;
+ }
+ else
+ {
+ (std::snprintf)(string_buffer.data() + bytes, 13, "\\u%04x\\u%04x",
+ static_cast<std::uint16_t>(0xD7C0u + (codepoint >> 10u)),
+ static_cast<std::uint16_t>(0xDC00u + (codepoint & 0x3FFu)));
+ bytes += 12;
+ }
+ }
+ else
+ {
+ // copy byte to buffer (all previous bytes
+ // been copied have in default case above)
+ string_buffer[bytes++] = s[i];
+ }
+ break;
+ }
+ }
+
+ // write buffer and reset index; there must be 13 bytes
+ // left, as this is the maximal number of bytes to be
+ // written ("\uxxxx\uxxxx\0") for one code point
+ if (string_buffer.size() - bytes < 13)
+ {
+ o->write_characters(string_buffer.data(), bytes);
+ bytes = 0;
+ }
+
+ // remember the byte position of this accept
+ bytes_after_last_accept = bytes;
+ undumped_chars = 0;
+ break;
+ }
+
+ case UTF8_REJECT: // decode found invalid UTF-8 byte
+ {
+ switch (error_handler)
+ {
+ case error_handler_t::strict:
+ {
+ std::string sn(3, '\0');
+ (std::snprintf)(&sn[0], sn.size(), "%.2X", byte);
+ JSON_THROW(type_error::create(316, "invalid UTF-8 byte at index " + std::to_string(i) + ": 0x" + sn));
+ }
+
+ case error_handler_t::ignore:
+ case error_handler_t::replace:
+ {
+ // in case we saw this character the first time, we
+ // would like to read it again, because the byte
+ // may be OK for itself, but just not OK for the
+ // previous sequence
+ if (undumped_chars > 0)
+ {
+ --i;
+ }
+
+ // reset length buffer to the last accepted index;
+ // thus removing/ignoring the invalid characters
+ bytes = bytes_after_last_accept;
+
+ if (error_handler == error_handler_t::replace)
+ {
+ // add a replacement character
+ if (ensure_ascii)
+ {
+ string_buffer[bytes++] = '\\';
+ string_buffer[bytes++] = 'u';
+ string_buffer[bytes++] = 'f';
+ string_buffer[bytes++] = 'f';
+ string_buffer[bytes++] = 'f';
+ string_buffer[bytes++] = 'd';
+ }
+ else
+ {
+ string_buffer[bytes++] = detail::binary_writer<BasicJsonType, char>::to_char_type('\xEF');
+ string_buffer[bytes++] = detail::binary_writer<BasicJsonType, char>::to_char_type('\xBF');
+ string_buffer[bytes++] = detail::binary_writer<BasicJsonType, char>::to_char_type('\xBD');
+ }
+
+ // write buffer and reset index; there must be 13 bytes
+ // left, as this is the maximal number of bytes to be
+ // written ("\uxxxx\uxxxx\0") for one code point
+ if (string_buffer.size() - bytes < 13)
+ {
+ o->write_characters(string_buffer.data(), bytes);
+ bytes = 0;
+ }
+
+ bytes_after_last_accept = bytes;
+ }
+
+ undumped_chars = 0;
+
+ // continue processing the string
+ state = UTF8_ACCEPT;
+ break;
+ }
+
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+ break;
+ }
+
+ default: // decode found yet incomplete multi-byte code point
+ {
+ if (not ensure_ascii)
+ {
+ // code point will not be escaped - copy byte to buffer
+ string_buffer[bytes++] = s[i];
+ }
+ ++undumped_chars;
+ break;
+ }
+ }
+ }
+
+ // we finished processing the string
+ if (JSON_HEDLEY_LIKELY(state == UTF8_ACCEPT))
+ {
+ // write buffer
+ if (bytes > 0)
+ {
+ o->write_characters(string_buffer.data(), bytes);
+ }
+ }
+ else
+ {
+ // we finish reading, but do not accept: string was incomplete
+ switch (error_handler)
+ {
+ case error_handler_t::strict:
+ {
+ std::string sn(3, '\0');
+ (std::snprintf)(&sn[0], sn.size(), "%.2X", static_cast<std::uint8_t>(s.back()));
+ JSON_THROW(type_error::create(316, "incomplete UTF-8 string; last byte: 0x" + sn));
+ }
+
+ case error_handler_t::ignore:
+ {
+ // write all accepted bytes
+ o->write_characters(string_buffer.data(), bytes_after_last_accept);
+ break;
+ }
+
+ case error_handler_t::replace:
+ {
+ // write all accepted bytes
+ o->write_characters(string_buffer.data(), bytes_after_last_accept);
+ // add a replacement character
+ if (ensure_ascii)
+ {
+ o->write_characters("\\ufffd", 6);
+ }
+ else
+ {
+ o->write_characters("\xEF\xBF\xBD", 3);
+ }
+ break;
+ }
+
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+ }
+ }
+
+ /*!
+ @brief count digits
+
+ Count the number of decimal (base 10) digits for an input unsigned integer.
+
+ @param[in] x unsigned integer number to count its digits
+ @return number of decimal digits
+ */
+ inline unsigned int count_digits(number_unsigned_t x) noexcept
+ {
+ unsigned int n_digits = 1;
+ for (;;)
+ {
+ if (x < 10)
+ {
+ return n_digits;
+ }
+ if (x < 100)
+ {
+ return n_digits + 1;
+ }
+ if (x < 1000)
+ {
+ return n_digits + 2;
+ }
+ if (x < 10000)
+ {
+ return n_digits + 3;
+ }
+ x = x / 10000u;
+ n_digits += 4;
+ }
+ }
+
+ /*!
+ @brief dump an integer
+
+ Dump a given integer to output stream @a o. Works internally with
+ @a number_buffer.
+
+ @param[in] x integer number (signed or unsigned) to dump
+ @tparam NumberType either @a number_integer_t or @a number_unsigned_t
+ */
+ template<typename NumberType, detail::enable_if_t<
+ std::is_same<NumberType, number_unsigned_t>::value or
+ std::is_same<NumberType, number_integer_t>::value or
+ std::is_same<NumberType, binary_char_t>::value,
+ int> = 0>
+ void dump_integer(NumberType x)
+ {
+ static constexpr std::array<std::array<char, 2>, 100> digits_to_99
+ {
+ {
+ {{'0', '0'}}, {{'0', '1'}}, {{'0', '2'}}, {{'0', '3'}}, {{'0', '4'}}, {{'0', '5'}}, {{'0', '6'}}, {{'0', '7'}}, {{'0', '8'}}, {{'0', '9'}},
+ {{'1', '0'}}, {{'1', '1'}}, {{'1', '2'}}, {{'1', '3'}}, {{'1', '4'}}, {{'1', '5'}}, {{'1', '6'}}, {{'1', '7'}}, {{'1', '8'}}, {{'1', '9'}},
+ {{'2', '0'}}, {{'2', '1'}}, {{'2', '2'}}, {{'2', '3'}}, {{'2', '4'}}, {{'2', '5'}}, {{'2', '6'}}, {{'2', '7'}}, {{'2', '8'}}, {{'2', '9'}},
+ {{'3', '0'}}, {{'3', '1'}}, {{'3', '2'}}, {{'3', '3'}}, {{'3', '4'}}, {{'3', '5'}}, {{'3', '6'}}, {{'3', '7'}}, {{'3', '8'}}, {{'3', '9'}},
+ {{'4', '0'}}, {{'4', '1'}}, {{'4', '2'}}, {{'4', '3'}}, {{'4', '4'}}, {{'4', '5'}}, {{'4', '6'}}, {{'4', '7'}}, {{'4', '8'}}, {{'4', '9'}},
+ {{'5', '0'}}, {{'5', '1'}}, {{'5', '2'}}, {{'5', '3'}}, {{'5', '4'}}, {{'5', '5'}}, {{'5', '6'}}, {{'5', '7'}}, {{'5', '8'}}, {{'5', '9'}},
+ {{'6', '0'}}, {{'6', '1'}}, {{'6', '2'}}, {{'6', '3'}}, {{'6', '4'}}, {{'6', '5'}}, {{'6', '6'}}, {{'6', '7'}}, {{'6', '8'}}, {{'6', '9'}},
+ {{'7', '0'}}, {{'7', '1'}}, {{'7', '2'}}, {{'7', '3'}}, {{'7', '4'}}, {{'7', '5'}}, {{'7', '6'}}, {{'7', '7'}}, {{'7', '8'}}, {{'7', '9'}},
+ {{'8', '0'}}, {{'8', '1'}}, {{'8', '2'}}, {{'8', '3'}}, {{'8', '4'}}, {{'8', '5'}}, {{'8', '6'}}, {{'8', '7'}}, {{'8', '8'}}, {{'8', '9'}},
+ {{'9', '0'}}, {{'9', '1'}}, {{'9', '2'}}, {{'9', '3'}}, {{'9', '4'}}, {{'9', '5'}}, {{'9', '6'}}, {{'9', '7'}}, {{'9', '8'}}, {{'9', '9'}},
+ }
+ };
+
+ // special case for "0"
+ if (x == 0)
+ {
+ o->write_character('0');
+ return;
+ }
+
+ // use a pointer to fill the buffer
+ auto buffer_ptr = number_buffer.begin();
+
+ const bool is_negative = std::is_same<NumberType, number_integer_t>::value and not(x >= 0); // see issue #755
+ number_unsigned_t abs_value;
+
+ unsigned int n_chars;
+
+ if (is_negative)
+ {
+ *buffer_ptr = '-';
+ abs_value = remove_sign(static_cast<number_integer_t>(x));
+
+ // account one more byte for the minus sign
+ n_chars = 1 + count_digits(abs_value);
+ }
+ else
+ {
+ abs_value = static_cast<number_unsigned_t>(x);
+ n_chars = count_digits(abs_value);
+ }
+
+ // spare 1 byte for '\0'
+ assert(n_chars < number_buffer.size() - 1);
+
+ // jump to the end to generate the string from backward
+ // so we later avoid reversing the result
+ buffer_ptr += n_chars;
+
+ // Fast int2ascii implementation inspired by "Fastware" talk by Andrei Alexandrescu
+ // See: https://www.youtube.com/watch?v=o4-CwDo2zpg
+ while (abs_value >= 100)
+ {
+ const auto digits_index = static_cast<unsigned>((abs_value % 100));
+ abs_value /= 100;
+ *(--buffer_ptr) = digits_to_99[digits_index][1];
+ *(--buffer_ptr) = digits_to_99[digits_index][0];
+ }
+
+ if (abs_value >= 10)
+ {
+ const auto digits_index = static_cast<unsigned>(abs_value);
+ *(--buffer_ptr) = digits_to_99[digits_index][1];
+ *(--buffer_ptr) = digits_to_99[digits_index][0];
+ }
+ else
+ {
+ *(--buffer_ptr) = static_cast<char>('0' + abs_value);
+ }
+
+ o->write_characters(number_buffer.data(), n_chars);
+ }
+
+ /*!
+ @brief dump a floating-point number
+
+ Dump a given floating-point number to output stream @a o. Works internally
+ with @a number_buffer.
+
+ @param[in] x floating-point number to dump
+ */
+ void dump_float(number_float_t x)
+ {
+ // NaN / inf
+ if (not std::isfinite(x))
+ {
+ o->write_characters("null", 4);
+ return;
+ }
+
+ // If number_float_t is an IEEE-754 single or double precision number,
+ // use the Grisu2 algorithm to produce short numbers which are
+ // guaranteed to round-trip, using strtof and strtod, resp.
+ //
+ // NB: The test below works if <long double> == <double>.
+ static constexpr bool is_ieee_single_or_double
+ = (std::numeric_limits<number_float_t>::is_iec559 and std::numeric_limits<number_float_t>::digits == 24 and std::numeric_limits<number_float_t>::max_exponent == 128) or
+ (std::numeric_limits<number_float_t>::is_iec559 and std::numeric_limits<number_float_t>::digits == 53 and std::numeric_limits<number_float_t>::max_exponent == 1024);
+
+ dump_float(x, std::integral_constant<bool, is_ieee_single_or_double>());
+ }
+
+ void dump_float(number_float_t x, std::true_type /*is_ieee_single_or_double*/)
+ {
+ char* begin = number_buffer.data();
+ char* end = ::nlohmann::detail::to_chars(begin, begin + number_buffer.size(), x);
+
+ o->write_characters(begin, static_cast<size_t>(end - begin));
+ }
+
+ void dump_float(number_float_t x, std::false_type /*is_ieee_single_or_double*/)
+ {
+ // get number of digits for a float -> text -> float round-trip
+ static constexpr auto d = std::numeric_limits<number_float_t>::max_digits10;
+
+ // the actual conversion
+ std::ptrdiff_t len = (std::snprintf)(number_buffer.data(), number_buffer.size(), "%.*g", d, x);
+
+ // negative value indicates an error
+ assert(len > 0);
+ // check if buffer was large enough
+ assert(static_cast<std::size_t>(len) < number_buffer.size());
+
+ // erase thousands separator
+ if (thousands_sep != '\0')
+ {
+ const auto end = std::remove(number_buffer.begin(),
+ number_buffer.begin() + len, thousands_sep);
+ std::fill(end, number_buffer.end(), '\0');
+ assert((end - number_buffer.begin()) <= len);
+ len = (end - number_buffer.begin());
+ }
+
+ // convert decimal point to '.'
+ if (decimal_point != '\0' and decimal_point != '.')
+ {
+ const auto dec_pos = std::find(number_buffer.begin(), number_buffer.end(), decimal_point);
+ if (dec_pos != number_buffer.end())
+ {
+ *dec_pos = '.';
+ }
+ }
+
+ o->write_characters(number_buffer.data(), static_cast<std::size_t>(len));
+
+ // determine if need to append ".0"
+ const bool value_is_int_like =
+ std::none_of(number_buffer.begin(), number_buffer.begin() + len + 1,
+ [](char c)
+ {
+ return c == '.' or c == 'e';
+ });
+
+ if (value_is_int_like)
+ {
+ o->write_characters(".0", 2);
+ }
+ }
+
+ /*!
+ @brief check whether a string is UTF-8 encoded
+
+ The function checks each byte of a string whether it is UTF-8 encoded. The
+ result of the check is stored in the @a state parameter. The function must
+ be called initially with state 0 (accept). State 1 means the string must
+ be rejected, because the current byte is not allowed. If the string is
+ completely processed, but the state is non-zero, the string ended
+ prematurely; that is, the last byte indicated more bytes should have
+ followed.
+
+ @param[in,out] state the state of the decoding
+ @param[in,out] codep codepoint (valid only if resulting state is UTF8_ACCEPT)
+ @param[in] byte next byte to decode
+ @return new state
+
+ @note The function has been edited: a std::array is used.
+
+ @copyright Copyright (c) 2008-2009 Bjoern Hoehrmann <bjoern@hoehrmann.de>
+ @sa http://bjoern.hoehrmann.de/utf-8/decoder/dfa/
+ */
+ static std::uint8_t decode(std::uint8_t& state, std::uint32_t& codep, const std::uint8_t byte) noexcept
+ {
+ static const std::array<std::uint8_t, 400> utf8d =
+ {
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 00..1F
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 20..3F
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 40..5F
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 60..7F
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, // 80..9F
+ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, // A0..BF
+ 8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // C0..DF
+ 0xA, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x3, 0x4, 0x3, 0x3, // E0..EF
+ 0xB, 0x6, 0x6, 0x6, 0x5, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, 0x8, // F0..FF
+ 0x0, 0x1, 0x2, 0x3, 0x5, 0x8, 0x7, 0x1, 0x1, 0x1, 0x4, 0x6, 0x1, 0x1, 0x1, 0x1, // s0..s0
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, // s1..s2
+ 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, // s3..s4
+ 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, // s5..s6
+ 1, 3, 1, 1, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // s7..s8
+ }
+ };
+
+ const std::uint8_t type = utf8d[byte];
+
+ codep = (state != UTF8_ACCEPT)
+ ? (byte & 0x3fu) | (codep << 6u)
+ : (0xFFu >> type) & (byte);
+
+ std::size_t index = 256u + static_cast<size_t>(state) * 16u + static_cast<size_t>(type);
+ assert(index < 400);
+ state = utf8d[index];
+ return state;
+ }
+
+ /*
+ * Overload to make the compiler happy while it is instantiating
+ * dump_integer for number_unsigned_t.
+ * Must never be called.
+ */
+ number_unsigned_t remove_sign(number_unsigned_t x)
+ {
+ assert(false); // LCOV_EXCL_LINE
+ return x; // LCOV_EXCL_LINE
+ }
+
+ /*
+ * Helper function for dump_integer
+ *
+ * This function takes a negative signed integer and returns its absolute
+ * value as unsigned integer. The plus/minus shuffling is necessary as we can
+ * not directly remove the sign of an arbitrary signed integer as the
+ * absolute values of INT_MIN and INT_MAX are usually not the same. See
+ * #1708 for details.
+ */
+ inline number_unsigned_t remove_sign(number_integer_t x) noexcept
+ {
+ assert(x < 0 and x < (std::numeric_limits<number_integer_t>::max)());
+ return static_cast<number_unsigned_t>(-(x + 1)) + 1;
+ }
+
+ private:
+ /// the output of the serializer
+ output_adapter_t<char> o = nullptr;
+
+ /// a (hopefully) large enough character buffer
+ std::array<char, 64> number_buffer{{}};
+
+ /// the locale
+ const std::lconv* loc = nullptr;
+ /// the locale's thousand separator character
+ const char thousands_sep = '\0';
+ /// the locale's decimal point character
+ const char decimal_point = '\0';
+
+ /// string buffer
+ std::array<char, 512> string_buffer{{}};
+
+ /// the indentation character
+ const char indent_char;
+ /// the indentation string
+ string_t indent_string;
+
+ /// error_handler how to react on decoding errors
+ const error_handler_t error_handler;
+};
+} // namespace detail
+} // namespace nlohmann
+
+// #include <nlohmann/detail/value_t.hpp>
+
+// #include <nlohmann/json_fwd.hpp>
+
+
+/*!
+@brief namespace for Niels Lohmann
+@see https://github.com/nlohmann
+@since version 1.0.0
+*/
+namespace nlohmann
+{
+
+/*!
+@brief a class to store JSON values
+
+@tparam ObjectType type for JSON objects (`std::map` by default; will be used
+in @ref object_t)
+@tparam ArrayType type for JSON arrays (`std::vector` by default; will be used
+in @ref array_t)
+@tparam StringType type for JSON strings and object keys (`std::string` by
+default; will be used in @ref string_t)
+@tparam BooleanType type for JSON booleans (`bool` by default; will be used
+in @ref boolean_t)
+@tparam NumberIntegerType type for JSON integer numbers (`int64_t` by
+default; will be used in @ref number_integer_t)
+@tparam NumberUnsignedType type for JSON unsigned integer numbers (@c
+`uint64_t` by default; will be used in @ref number_unsigned_t)
+@tparam NumberFloatType type for JSON floating-point numbers (`double` by
+default; will be used in @ref number_float_t)
+@tparam BinaryType type for packed binary data for compatibility with binary
+serialization formats (`std::vector<std::uint8_t>` by default; will be used in
+@ref binary_t)
+@tparam AllocatorType type of the allocator to use (`std::allocator` by
+default)
+@tparam JSONSerializer the serializer to resolve internal calls to `to_json()`
+and `from_json()` (@ref adl_serializer by default)
+
+@requirement The class satisfies the following concept requirements:
+- Basic
+ - [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible):
+ JSON values can be default constructed. The result will be a JSON null
+ value.
+ - [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible):
+ A JSON value can be constructed from an rvalue argument.
+ - [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible):
+ A JSON value can be copy-constructed from an lvalue expression.
+ - [MoveAssignable](https://en.cppreference.com/w/cpp/named_req/MoveAssignable):
+ A JSON value van be assigned from an rvalue argument.
+ - [CopyAssignable](https://en.cppreference.com/w/cpp/named_req/CopyAssignable):
+ A JSON value can be copy-assigned from an lvalue expression.
+ - [Destructible](https://en.cppreference.com/w/cpp/named_req/Destructible):
+ JSON values can be destructed.
+- Layout
+ - [StandardLayoutType](https://en.cppreference.com/w/cpp/named_req/StandardLayoutType):
+ JSON values have
+ [standard layout](https://en.cppreference.com/w/cpp/language/data_members#Standard_layout):
+ All non-static data members are private and standard layout types, the
+ class has no virtual functions or (virtual) base classes.
+- Library-wide
+ - [EqualityComparable](https://en.cppreference.com/w/cpp/named_req/EqualityComparable):
+ JSON values can be compared with `==`, see @ref
+ operator==(const_reference,const_reference).
+ - [LessThanComparable](https://en.cppreference.com/w/cpp/named_req/LessThanComparable):
+ JSON values can be compared with `<`, see @ref
+ operator<(const_reference,const_reference).
+ - [Swappable](https://en.cppreference.com/w/cpp/named_req/Swappable):
+ Any JSON lvalue or rvalue of can be swapped with any lvalue or rvalue of
+ other compatible types, using unqualified function call @ref swap().
+ - [NullablePointer](https://en.cppreference.com/w/cpp/named_req/NullablePointer):
+ JSON values can be compared against `std::nullptr_t` objects which are used
+ to model the `null` value.
+- Container
+ - [Container](https://en.cppreference.com/w/cpp/named_req/Container):
+ JSON values can be used like STL containers and provide iterator access.
+ - [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer);
+ JSON values can be used like STL containers and provide reverse iterator
+ access.
+
+@invariant The member variables @a m_value and @a m_type have the following
+relationship:
+- If `m_type == value_t::object`, then `m_value.object != nullptr`.
+- If `m_type == value_t::array`, then `m_value.array != nullptr`.
+- If `m_type == value_t::string`, then `m_value.string != nullptr`.
+The invariants are checked by member function assert_invariant().
+
+@internal
+@note ObjectType trick from https://stackoverflow.com/a/9860911
+@endinternal
+
+@see [RFC 7159: The JavaScript Object Notation (JSON) Data Interchange
+Format](http://rfc7159.net/rfc7159)
+
+@since version 1.0.0
+
+@nosubgrouping
+*/
+NLOHMANN_BASIC_JSON_TPL_DECLARATION
+class basic_json
+{
+ private:
+ template<detail::value_t> friend struct detail::external_constructor;
+ friend ::nlohmann::json_pointer<basic_json>;
+
+ template<typename BasicJsonType, typename InputType>
+ friend class ::nlohmann::detail::parser;
+ friend ::nlohmann::detail::serializer<basic_json>;
+ template<typename BasicJsonType>
+ friend class ::nlohmann::detail::iter_impl;
+ template<typename BasicJsonType, typename CharType>
+ friend class ::nlohmann::detail::binary_writer;
+ template<typename BasicJsonType, typename InputType, typename SAX>
+ friend class ::nlohmann::detail::binary_reader;
+ template<typename BasicJsonType>
+ friend class ::nlohmann::detail::json_sax_dom_parser;
+ template<typename BasicJsonType>
+ friend class ::nlohmann::detail::json_sax_dom_callback_parser;
+
+ /// workaround type for MSVC
+ using basic_json_t = NLOHMANN_BASIC_JSON_TPL;
+
+ // convenience aliases for types residing in namespace detail;
+ using lexer = ::nlohmann::detail::lexer_base<basic_json>;
+
+ template<typename InputAdapterType>
+ static ::nlohmann::detail::parser<basic_json, InputAdapterType> parser(
+ InputAdapterType adapter,
+ detail::parser_callback_t<basic_json>cb = nullptr,
+ bool allow_exceptions = true
+ )
+ {
+ return ::nlohmann::detail::parser<basic_json, InputAdapterType>(std::move(adapter), std::move(cb), allow_exceptions);
+ }
+
+ using primitive_iterator_t = ::nlohmann::detail::primitive_iterator_t;
+ template<typename BasicJsonType>
+ using internal_iterator = ::nlohmann::detail::internal_iterator<BasicJsonType>;
+ template<typename BasicJsonType>
+ using iter_impl = ::nlohmann::detail::iter_impl<BasicJsonType>;
+ template<typename Iterator>
+ using iteration_proxy = ::nlohmann::detail::iteration_proxy<Iterator>;
+ template<typename Base> using json_reverse_iterator = ::nlohmann::detail::json_reverse_iterator<Base>;
+
+ template<typename CharType>
+ using output_adapter_t = ::nlohmann::detail::output_adapter_t<CharType>;
+
+ template<typename InputType>
+ using binary_reader = ::nlohmann::detail::binary_reader<basic_json, InputType>;
+ template<typename CharType> using binary_writer = ::nlohmann::detail::binary_writer<basic_json, CharType>;
+
+ using serializer = ::nlohmann::detail::serializer<basic_json>;
+
+ public:
+ using value_t = detail::value_t;
+ /// JSON Pointer, see @ref nlohmann::json_pointer
+ using json_pointer = ::nlohmann::json_pointer<basic_json>;
+ template<typename T, typename SFINAE>
+ using json_serializer = JSONSerializer<T, SFINAE>;
+ /// how to treat decoding errors
+ using error_handler_t = detail::error_handler_t;
+ /// helper type for initializer lists of basic_json values
+ using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
+
+ using input_format_t = detail::input_format_t;
+ /// SAX interface type, see @ref nlohmann::json_sax
+ using json_sax_t = json_sax<basic_json>;
+
+ ////////////////
+ // exceptions //
+ ////////////////
+
+ /// @name exceptions
+ /// Classes to implement user-defined exceptions.
+ /// @{
+
+ /// @copydoc detail::exception
+ using exception = detail::exception;
+ /// @copydoc detail::parse_error
+ using parse_error = detail::parse_error;
+ /// @copydoc detail::invalid_iterator
+ using invalid_iterator = detail::invalid_iterator;
+ /// @copydoc detail::type_error
+ using type_error = detail::type_error;
+ /// @copydoc detail::out_of_range
+ using out_of_range = detail::out_of_range;
+ /// @copydoc detail::other_error
+ using other_error = detail::other_error;
+
+ /// @}
+
+
+ /////////////////////
+ // container types //
+ /////////////////////
+
+ /// @name container types
+ /// The canonic container types to use @ref basic_json like any other STL
+ /// container.
+ /// @{
+
+ /// the type of elements in a basic_json container
+ using value_type = basic_json;
+
+ /// the type of an element reference
+ using reference = value_type&;
+ /// the type of an element const reference
+ using const_reference = const value_type&;
+
+ /// a type to represent differences between iterators
+ using difference_type = std::ptrdiff_t;
+ /// a type to represent container sizes
+ using size_type = std::size_t;
+
+ /// the allocator type
+ using allocator_type = AllocatorType<basic_json>;
+
+ /// the type of an element pointer
+ using pointer = typename std::allocator_traits<allocator_type>::pointer;
+ /// the type of an element const pointer
+ using const_pointer = typename std::allocator_traits<allocator_type>::const_pointer;
+
+ /// an iterator for a basic_json container
+ using iterator = iter_impl<basic_json>;
+ /// a const iterator for a basic_json container
+ using const_iterator = iter_impl<const basic_json>;
+ /// a reverse iterator for a basic_json container
+ using reverse_iterator = json_reverse_iterator<typename basic_json::iterator>;
+ /// a const reverse iterator for a basic_json container
+ using const_reverse_iterator = json_reverse_iterator<typename basic_json::const_iterator>;
+
+ /// @}
+
+
+ /*!
+ @brief returns the allocator associated with the container
+ */
+ static allocator_type get_allocator()
+ {
+ return allocator_type();
+ }
+
+ /*!
+ @brief returns version information on the library
+
+ This function returns a JSON object with information about the library,
+ including the version number and information on the platform and compiler.
+
+ @return JSON object holding version information
+ key | description
+ ----------- | ---------------
+ `compiler` | Information on the used compiler. It is an object with the following keys: `c++` (the used C++ standard), `family` (the compiler family; possible values are `clang`, `icc`, `gcc`, `ilecpp`, `msvc`, `pgcpp`, `sunpro`, and `unknown`), and `version` (the compiler version).
+ `copyright` | The copyright line for the library as string.
+ `name` | The name of the library as string.
+ `platform` | The used platform as string. Possible values are `win32`, `linux`, `apple`, `unix`, and `unknown`.
+ `url` | The URL of the project as string.
+ `version` | The version of the library. It is an object with the following keys: `major`, `minor`, and `patch` as defined by [Semantic Versioning](http://semver.org), and `string` (the version string).
+
+ @liveexample{The following code shows an example output of the `meta()`
+ function.,meta}
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @complexity Constant.
+
+ @since 2.1.0
+ */
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json meta()
+ {
+ basic_json result;
+
+ result["copyright"] = "(C) 2013-2017 Niels Lohmann";
+ result["name"] = "JSON for Modern C++";
+ result["url"] = "https://github.com/nlohmann/json";
+ result["version"]["string"] =
+ std::to_string(NLOHMANN_JSON_VERSION_MAJOR) + "." +
+ std::to_string(NLOHMANN_JSON_VERSION_MINOR) + "." +
+ std::to_string(NLOHMANN_JSON_VERSION_PATCH);
+ result["version"]["major"] = NLOHMANN_JSON_VERSION_MAJOR;
+ result["version"]["minor"] = NLOHMANN_JSON_VERSION_MINOR;
+ result["version"]["patch"] = NLOHMANN_JSON_VERSION_PATCH;
+
+#ifdef _WIN32
+ result["platform"] = "win32";
+#elif defined __linux__
+ result["platform"] = "linux";
+#elif defined __APPLE__
+ result["platform"] = "apple";
+#elif defined __unix__
+ result["platform"] = "unix";
+#else
+ result["platform"] = "unknown";
+#endif
+
+#if defined(__ICC) || defined(__INTEL_COMPILER)
+ result["compiler"] = {{"family", "icc"}, {"version", __INTEL_COMPILER}};
+#elif defined(__clang__)
+ result["compiler"] = {{"family", "clang"}, {"version", __clang_version__}};
+#elif defined(__GNUC__) || defined(__GNUG__)
+ result["compiler"] = {{"family", "gcc"}, {"version", std::to_string(__GNUC__) + "." + std::to_string(__GNUC_MINOR__) + "." + std::to_string(__GNUC_PATCHLEVEL__)}};
+#elif defined(__HP_cc) || defined(__HP_aCC)
+ result["compiler"] = "hp"
+#elif defined(__IBMCPP__)
+ result["compiler"] = {{"family", "ilecpp"}, {"version", __IBMCPP__}};
+#elif defined(_MSC_VER)
+ result["compiler"] = {{"family", "msvc"}, {"version", _MSC_VER}};
+#elif defined(__PGI)
+ result["compiler"] = {{"family", "pgcpp"}, {"version", __PGI}};
+#elif defined(__SUNPRO_CC)
+ result["compiler"] = {{"family", "sunpro"}, {"version", __SUNPRO_CC}};
+#else
+ result["compiler"] = {{"family", "unknown"}, {"version", "unknown"}};
+#endif
+
+#ifdef __cplusplus
+ result["compiler"]["c++"] = std::to_string(__cplusplus);
+#else
+ result["compiler"]["c++"] = "unknown";
+#endif
+ return result;
+ }
+
+
+ ///////////////////////////
+ // JSON value data types //
+ ///////////////////////////
+
+ /// @name JSON value data types
+ /// The data types to store a JSON value. These types are derived from
+ /// the template arguments passed to class @ref basic_json.
+ /// @{
+
+#if defined(JSON_HAS_CPP_14)
+ // Use transparent comparator if possible, combined with perfect forwarding
+ // on find() and count() calls prevents unnecessary string construction.
+ using object_comparator_t = std::less<>;
+#else
+ using object_comparator_t = std::less<StringType>;
+#endif
+
+ /*!
+ @brief a type for an object
+
+ [RFC 7159](http://rfc7159.net/rfc7159) describes JSON objects as follows:
+ > An object is an unordered collection of zero or more name/value pairs,
+ > where a name is a string and a value is a string, number, boolean, null,
+ > object, or array.
+
+ To store objects in C++, a type is defined by the template parameters
+ described below.
+
+ @tparam ObjectType the container to store objects (e.g., `std::map` or
+ `std::unordered_map`)
+ @tparam StringType the type of the keys or names (e.g., `std::string`).
+ The comparison function `std::less<StringType>` is used to order elements
+ inside the container.
+ @tparam AllocatorType the allocator to use for objects (e.g.,
+ `std::allocator`)
+
+ #### Default type
+
+ With the default values for @a ObjectType (`std::map`), @a StringType
+ (`std::string`), and @a AllocatorType (`std::allocator`), the default
+ value for @a object_t is:
+
+ @code {.cpp}
+ std::map<
+ std::string, // key_type
+ basic_json, // value_type
+ std::less<std::string>, // key_compare
+ std::allocator<std::pair<const std::string, basic_json>> // allocator_type
+ >
+ @endcode
+
+ #### Behavior
+
+ The choice of @a object_t influences the behavior of the JSON class. With
+ the default type, objects have the following behavior:
+
+ - When all names are unique, objects will be interoperable in the sense
+ that all software implementations receiving that object will agree on
+ the name-value mappings.
+ - When the names within an object are not unique, it is unspecified which
+ one of the values for a given key will be chosen. For instance,
+ `{"key": 2, "key": 1}` could be equal to either `{"key": 1}` or
+ `{"key": 2}`.
+ - Internally, name/value pairs are stored in lexicographical order of the
+ names. Objects will also be serialized (see @ref dump) in this order.
+ For instance, `{"b": 1, "a": 2}` and `{"a": 2, "b": 1}` will be stored
+ and serialized as `{"a": 2, "b": 1}`.
+ - When comparing objects, the order of the name/value pairs is irrelevant.
+ This makes objects interoperable in the sense that they will not be
+ affected by these differences. For instance, `{"b": 1, "a": 2}` and
+ `{"a": 2, "b": 1}` will be treated as equal.
+
+ #### Limits
+
+ [RFC 7159](http://rfc7159.net/rfc7159) specifies:
+ > An implementation may set limits on the maximum depth of nesting.
+
+ In this class, the object's limit of nesting is not explicitly constrained.
+ However, a maximum depth of nesting may be introduced by the compiler or
+ runtime environment. A theoretical limit can be queried by calling the
+ @ref max_size function of a JSON object.
+
+ #### Storage
+
+ Objects are stored as pointers in a @ref basic_json type. That is, for any
+ access to object values, a pointer of type `object_t*` must be
+ dereferenced.
+
+ @sa @ref array_t -- type for an array value
+
+ @since version 1.0.0
+
+ @note The order name/value pairs are added to the object is *not*
+ preserved by the library. Therefore, iterating an object may return
+ name/value pairs in a different order than they were originally stored. In
+ fact, keys will be traversed in alphabetical order as `std::map` with
+ `std::less` is used by default. Please note this behavior conforms to [RFC
+ 7159](http://rfc7159.net/rfc7159), because any order implements the
+ specified "unordered" nature of JSON objects.
+ */
+ using object_t = ObjectType<StringType,
+ basic_json,
+ object_comparator_t,
+ AllocatorType<std::pair<const StringType,
+ basic_json>>>;
+
+ /*!
+ @brief a type for an array
+
+ [RFC 7159](http://rfc7159.net/rfc7159) describes JSON arrays as follows:
+ > An array is an ordered sequence of zero or more values.
+
+ To store objects in C++, a type is defined by the template parameters
+ explained below.
+
+ @tparam ArrayType container type to store arrays (e.g., `std::vector` or
+ `std::list`)
+ @tparam AllocatorType allocator to use for arrays (e.g., `std::allocator`)
+
+ #### Default type
+
+ With the default values for @a ArrayType (`std::vector`) and @a
+ AllocatorType (`std::allocator`), the default value for @a array_t is:
+
+ @code {.cpp}
+ std::vector<
+ basic_json, // value_type
+ std::allocator<basic_json> // allocator_type
+ >
+ @endcode
+
+ #### Limits
+
+ [RFC 7159](http://rfc7159.net/rfc7159) specifies:
+ > An implementation may set limits on the maximum depth of nesting.
+
+ In this class, the array's limit of nesting is not explicitly constrained.
+ However, a maximum depth of nesting may be introduced by the compiler or
+ runtime environment. A theoretical limit can be queried by calling the
+ @ref max_size function of a JSON array.
+
+ #### Storage
+
+ Arrays are stored as pointers in a @ref basic_json type. That is, for any
+ access to array values, a pointer of type `array_t*` must be dereferenced.
+
+ @sa @ref object_t -- type for an object value
+
+ @since version 1.0.0
+ */
+ using array_t = ArrayType<basic_json, AllocatorType<basic_json>>;
+
+ /*!
+ @brief a type for a string
+
+ [RFC 7159](http://rfc7159.net/rfc7159) describes JSON strings as follows:
+ > A string is a sequence of zero or more Unicode characters.
+
+ To store objects in C++, a type is defined by the template parameter
+ described below. Unicode values are split by the JSON class into
+ byte-sized characters during deserialization.
+
+ @tparam StringType the container to store strings (e.g., `std::string`).
+ Note this container is used for keys/names in objects, see @ref object_t.
+
+ #### Default type
+
+ With the default values for @a StringType (`std::string`), the default
+ value for @a string_t is:
+
+ @code {.cpp}
+ std::string
+ @endcode
+
+ #### Encoding
+
+ Strings are stored in UTF-8 encoding. Therefore, functions like
+ `std::string::size()` or `std::string::length()` return the number of
+ bytes in the string rather than the number of characters or glyphs.
+
+ #### String comparison
+
+ [RFC 7159](http://rfc7159.net/rfc7159) states:
+ > Software implementations are typically required to test names of object
+ > members for equality. Implementations that transform the textual
+ > representation into sequences of Unicode code units and then perform the
+ > comparison numerically, code unit by code unit, are interoperable in the
+ > sense that implementations will agree in all cases on equality or
+ > inequality of two strings. For example, implementations that compare
+ > strings with escaped characters unconverted may incorrectly find that
+ > `"a\\b"` and `"a\u005Cb"` are not equal.
+
+ This implementation is interoperable as it does compare strings code unit
+ by code unit.
+
+ #### Storage
+
+ String values are stored as pointers in a @ref basic_json type. That is,
+ for any access to string values, a pointer of type `string_t*` must be
+ dereferenced.
+
+ @since version 1.0.0
+ */
+ using string_t = StringType;
+
+ /*!
+ @brief a type for a boolean
+
+ [RFC 7159](http://rfc7159.net/rfc7159) implicitly describes a boolean as a
+ type which differentiates the two literals `true` and `false`.
+
+ To store objects in C++, a type is defined by the template parameter @a
+ BooleanType which chooses the type to use.
+
+ #### Default type
+
+ With the default values for @a BooleanType (`bool`), the default value for
+ @a boolean_t is:
+
+ @code {.cpp}
+ bool
+ @endcode
+
+ #### Storage
+
+ Boolean values are stored directly inside a @ref basic_json type.
+
+ @since version 1.0.0
+ */
+ using boolean_t = BooleanType;
+
+ /*!
+ @brief a type for a number (integer)
+
+ [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows:
+ > The representation of numbers is similar to that used in most
+ > programming languages. A number is represented in base 10 using decimal
+ > digits. It contains an integer component that may be prefixed with an
+ > optional minus sign, which may be followed by a fraction part and/or an
+ > exponent part. Leading zeros are not allowed. (...) Numeric values that
+ > cannot be represented in the grammar below (such as Infinity and NaN)
+ > are not permitted.
+
+ This description includes both integer and floating-point numbers.
+ However, C++ allows more precise storage if it is known whether the number
+ is a signed integer, an unsigned integer or a floating-point number.
+ Therefore, three different types, @ref number_integer_t, @ref
+ number_unsigned_t and @ref number_float_t are used.
+
+ To store integer numbers in C++, a type is defined by the template
+ parameter @a NumberIntegerType which chooses the type to use.
+
+ #### Default type
+
+ With the default values for @a NumberIntegerType (`int64_t`), the default
+ value for @a number_integer_t is:
+
+ @code {.cpp}
+ int64_t
+ @endcode
+
+ #### Default behavior
+
+ - The restrictions about leading zeros is not enforced in C++. Instead,
+ leading zeros in integer literals lead to an interpretation as octal
+ number. Internally, the value will be stored as decimal number. For
+ instance, the C++ integer literal `010` will be serialized to `8`.
+ During deserialization, leading zeros yield an error.
+ - Not-a-number (NaN) values will be serialized to `null`.
+
+ #### Limits
+
+ [RFC 7159](http://rfc7159.net/rfc7159) specifies:
+ > An implementation may set limits on the range and precision of numbers.
+
+ When the default type is used, the maximal integer number that can be
+ stored is `9223372036854775807` (INT64_MAX) and the minimal integer number
+ that can be stored is `-9223372036854775808` (INT64_MIN). Integer numbers
+ that are out of range will yield over/underflow when used in a
+ constructor. During deserialization, too large or small integer numbers
+ will be automatically be stored as @ref number_unsigned_t or @ref
+ number_float_t.
+
+ [RFC 7159](http://rfc7159.net/rfc7159) further states:
+ > Note that when such software is used, numbers that are integers and are
+ > in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are interoperable in the sense
+ > that implementations will agree exactly on their numeric values.
+
+ As this range is a subrange of the exactly supported range [INT64_MIN,
+ INT64_MAX], this class's integer type is interoperable.
+
+ #### Storage
+
+ Integer number values are stored directly inside a @ref basic_json type.
+
+ @sa @ref number_float_t -- type for number values (floating-point)
+
+ @sa @ref number_unsigned_t -- type for number values (unsigned integer)
+
+ @since version 1.0.0
+ */
+ using number_integer_t = NumberIntegerType;
+
+ /*!
+ @brief a type for a number (unsigned)
+
+ [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows:
+ > The representation of numbers is similar to that used in most
+ > programming languages. A number is represented in base 10 using decimal
+ > digits. It contains an integer component that may be prefixed with an
+ > optional minus sign, which may be followed by a fraction part and/or an
+ > exponent part. Leading zeros are not allowed. (...) Numeric values that
+ > cannot be represented in the grammar below (such as Infinity and NaN)
+ > are not permitted.
+
+ This description includes both integer and floating-point numbers.
+ However, C++ allows more precise storage if it is known whether the number
+ is a signed integer, an unsigned integer or a floating-point number.
+ Therefore, three different types, @ref number_integer_t, @ref
+ number_unsigned_t and @ref number_float_t are used.
+
+ To store unsigned integer numbers in C++, a type is defined by the
+ template parameter @a NumberUnsignedType which chooses the type to use.
+
+ #### Default type
+
+ With the default values for @a NumberUnsignedType (`uint64_t`), the
+ default value for @a number_unsigned_t is:
+
+ @code {.cpp}
+ uint64_t
+ @endcode
+
+ #### Default behavior
+
+ - The restrictions about leading zeros is not enforced in C++. Instead,
+ leading zeros in integer literals lead to an interpretation as octal
+ number. Internally, the value will be stored as decimal number. For
+ instance, the C++ integer literal `010` will be serialized to `8`.
+ During deserialization, leading zeros yield an error.
+ - Not-a-number (NaN) values will be serialized to `null`.
+
+ #### Limits
+
+ [RFC 7159](http://rfc7159.net/rfc7159) specifies:
+ > An implementation may set limits on the range and precision of numbers.
+
+ When the default type is used, the maximal integer number that can be
+ stored is `18446744073709551615` (UINT64_MAX) and the minimal integer
+ number that can be stored is `0`. Integer numbers that are out of range
+ will yield over/underflow when used in a constructor. During
+ deserialization, too large or small integer numbers will be automatically
+ be stored as @ref number_integer_t or @ref number_float_t.
+
+ [RFC 7159](http://rfc7159.net/rfc7159) further states:
+ > Note that when such software is used, numbers that are integers and are
+ > in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are interoperable in the sense
+ > that implementations will agree exactly on their numeric values.
+
+ As this range is a subrange (when considered in conjunction with the
+ number_integer_t type) of the exactly supported range [0, UINT64_MAX],
+ this class's integer type is interoperable.
+
+ #### Storage
+
+ Integer number values are stored directly inside a @ref basic_json type.
+
+ @sa @ref number_float_t -- type for number values (floating-point)
+ @sa @ref number_integer_t -- type for number values (integer)
+
+ @since version 2.0.0
+ */
+ using number_unsigned_t = NumberUnsignedType;
+
+ /*!
+ @brief a type for a number (floating-point)
+
+ [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows:
+ > The representation of numbers is similar to that used in most
+ > programming languages. A number is represented in base 10 using decimal
+ > digits. It contains an integer component that may be prefixed with an
+ > optional minus sign, which may be followed by a fraction part and/or an
+ > exponent part. Leading zeros are not allowed. (...) Numeric values that
+ > cannot be represented in the grammar below (such as Infinity and NaN)
+ > are not permitted.
+
+ This description includes both integer and floating-point numbers.
+ However, C++ allows more precise storage if it is known whether the number
+ is a signed integer, an unsigned integer or a floating-point number.
+ Therefore, three different types, @ref number_integer_t, @ref
+ number_unsigned_t and @ref number_float_t are used.
+
+ To store floating-point numbers in C++, a type is defined by the template
+ parameter @a NumberFloatType which chooses the type to use.
+
+ #### Default type
+
+ With the default values for @a NumberFloatType (`double`), the default
+ value for @a number_float_t is:
+
+ @code {.cpp}
+ double
+ @endcode
+
+ #### Default behavior
+
+ - The restrictions about leading zeros is not enforced in C++. Instead,
+ leading zeros in floating-point literals will be ignored. Internally,
+ the value will be stored as decimal number. For instance, the C++
+ floating-point literal `01.2` will be serialized to `1.2`. During
+ deserialization, leading zeros yield an error.
+ - Not-a-number (NaN) values will be serialized to `null`.
+
+ #### Limits
+
+ [RFC 7159](http://rfc7159.net/rfc7159) states:
+ > This specification allows implementations to set limits on the range and
+ > precision of numbers accepted. Since software that implements IEEE
+ > 754-2008 binary64 (double precision) numbers is generally available and
+ > widely used, good interoperability can be achieved by implementations
+ > that expect no more precision or range than these provide, in the sense
+ > that implementations will approximate JSON numbers within the expected
+ > precision.
+
+ This implementation does exactly follow this approach, as it uses double
+ precision floating-point numbers. Note values smaller than
+ `-1.79769313486232e+308` and values greater than `1.79769313486232e+308`
+ will be stored as NaN internally and be serialized to `null`.
+
+ #### Storage
+
+ Floating-point number values are stored directly inside a @ref basic_json
+ type.
+
+ @sa @ref number_integer_t -- type for number values (integer)
+
+ @sa @ref number_unsigned_t -- type for number values (unsigned integer)
+
+ @since version 1.0.0
+ */
+ using number_float_t = NumberFloatType;
+
+ /*!
+ @brief a type for a packed binary type
+
+ This type is a type designed to carry binary data that appears in various
+ serialized formats, such as CBOR's Major Type 2, MessagePack's bin, and
+ BSON's generic binary subtype. This type is NOT a part of standard JSON and
+ exists solely for compatibility with these binary types. As such, it is
+ simply defined as an ordered sequence of zero or more byte values.
+
+ Additionally, as an implementation detail, the subtype of the binary data is
+ carried around as a `std::uint8_t`, which is compatible with both of the
+ binary data formats that use binary subtyping, (though the specific
+ numbering is incompatible with each other, and it is up to the user to
+ translate between them).
+
+ [CBOR's RFC 7049](https://tools.ietf.org/html/rfc7049) describes this type
+ as:
+ > Major type 2: a byte string. The string's length in bytes is represented
+ > following the rules for positive integers (major type 0).
+
+ [MessagePack's documentation on the bin type
+ family](https://github.com/msgpack/msgpack/blob/master/spec.md#bin-format-family)
+ describes this type as:
+ > Bin format family stores an byte array in 2, 3, or 5 bytes of extra bytes
+ > in addition to the size of the byte array.
+
+ [BSON's specifications](http://bsonspec.org/spec.html) describe several
+ binary types; however, this type is intended to represent the generic binary
+ type which has the description:
+ > Generic binary subtype - This is the most commonly used binary subtype and
+ > should be the 'default' for drivers and tools.
+
+ None of these impose any limitations on the internal representation other
+ than the basic unit of storage be some type of array whose parts are
+ decomposable into bytes.
+
+ The default representation of this binary format is a
+ `std::vector<std::uint8_t>`, which is a very common way to represent a byte
+ array in modern C++.
+
+ #### Default type
+
+ The default values for @a BinaryType is `std::vector<std::uint8_t>`
+
+ #### Storage
+
+ Binary Arrays are stored as pointers in a @ref basic_json type. That is,
+ for any access to array values, a pointer of the type `binary_t*` must be
+ dereferenced.
+
+ #### Notes on subtypes
+
+ - CBOR
+ - Binary values are represented as byte strings. No subtypes are
+ supported and will be ignored when CBOR is written.
+ - MessagePack
+ - If a subtype is given and the binary array contains exactly 1, 2, 4, 8,
+ or 16 elements, the fixext family (fixext1, fixext2, fixext4, fixext8)
+ is used. For other sizes, the ext family (ext8, ext16, ext32) is used.
+ The subtype is then added as singed 8-bit integer.
+ - If no subtype is given, the bin family (bin8, bin16, bin32) is used.
+ - BSON
+ - If a subtype is given, it is used and added as unsigned 8-bit integer.
+ - If no subtype is given, the generic binary subtype 0x00 is used.
+
+ @sa @ref binary -- create a binary array
+
+ @since version 3.8.0
+ */
+ using binary_t = nlohmann::byte_container_with_subtype<BinaryType>;
+ /// @}
+
+ private:
+
+ /// helper for exception-safe object creation
+ template<typename T, typename... Args>
+ JSON_HEDLEY_RETURNS_NON_NULL
+ static T* create(Args&& ... args)
+ {
+ AllocatorType<T> alloc;
+ using AllocatorTraits = std::allocator_traits<AllocatorType<T>>;
+
+ auto deleter = [&](T * object)
+ {
+ AllocatorTraits::deallocate(alloc, object, 1);
+ };
+ std::unique_ptr<T, decltype(deleter)> object(AllocatorTraits::allocate(alloc, 1), deleter);
+ AllocatorTraits::construct(alloc, object.get(), std::forward<Args>(args)...);
+ assert(object != nullptr);
+ return object.release();
+ }
+
+ ////////////////////////
+ // JSON value storage //
+ ////////////////////////
+
+ /*!
+ @brief a JSON value
+
+ The actual storage for a JSON value of the @ref basic_json class. This
+ union combines the different storage types for the JSON value types
+ defined in @ref value_t.
+
+ JSON type | value_t type | used type
+ --------- | --------------- | ------------------------
+ object | object | pointer to @ref object_t
+ array | array | pointer to @ref array_t
+ string | string | pointer to @ref string_t
+ boolean | boolean | @ref boolean_t
+ number | number_integer | @ref number_integer_t
+ number | number_unsigned | @ref number_unsigned_t
+ number | number_float | @ref number_float_t
+ binary | binary | pointer to @ref binary_t
+ null | null | *no value is stored*
+
+ @note Variable-length types (objects, arrays, and strings) are stored as
+ pointers. The size of the union should not exceed 64 bits if the default
+ value types are used.
+
+ @since version 1.0.0
+ */
+ union json_value
+ {
+ /// object (stored with pointer to save storage)
+ object_t* object;
+ /// array (stored with pointer to save storage)
+ array_t* array;
+ /// string (stored with pointer to save storage)
+ string_t* string;
+ /// binary (stored with pointer to save storage)
+ binary_t* binary;
+ /// boolean
+ boolean_t boolean;
+ /// number (integer)
+ number_integer_t number_integer;
+ /// number (unsigned integer)
+ number_unsigned_t number_unsigned;
+ /// number (floating-point)
+ number_float_t number_float;
+
+ /// default constructor (for null values)
+ json_value() = default;
+ /// constructor for booleans
+ json_value(boolean_t v) noexcept : boolean(v) {}
+ /// constructor for numbers (integer)
+ json_value(number_integer_t v) noexcept : number_integer(v) {}
+ /// constructor for numbers (unsigned)
+ json_value(number_unsigned_t v) noexcept : number_unsigned(v) {}
+ /// constructor for numbers (floating-point)
+ json_value(number_float_t v) noexcept : number_float(v) {}
+ /// constructor for empty values of a given type
+ json_value(value_t t)
+ {
+ switch (t)
+ {
+ case value_t::object:
+ {
+ object = create<object_t>();
+ break;
+ }
+
+ case value_t::array:
+ {
+ array = create<array_t>();
+ break;
+ }
+
+ case value_t::string:
+ {
+ string = create<string_t>("");
+ break;
+ }
+
+ case value_t::binary:
+ {
+ binary = create<binary_t>();
+ break;
+ }
+
+ case value_t::boolean:
+ {
+ boolean = boolean_t(false);
+ break;
+ }
+
+ case value_t::number_integer:
+ {
+ number_integer = number_integer_t(0);
+ break;
+ }
+
+ case value_t::number_unsigned:
+ {
+ number_unsigned = number_unsigned_t(0);
+ break;
+ }
+
+ case value_t::number_float:
+ {
+ number_float = number_float_t(0.0);
+ break;
+ }
+
+ case value_t::null:
+ {
+ object = nullptr; // silence warning, see #821
+ break;
+ }
+
+ default:
+ {
+ object = nullptr; // silence warning, see #821
+ if (JSON_HEDLEY_UNLIKELY(t == value_t::null))
+ {
+ JSON_THROW(other_error::create(500, "961c151d2e87f2686a955a9be24d316f1362bf21 3.8.0")); // LCOV_EXCL_LINE
+ }
+ break;
+ }
+ }
+ }
+
+ /// constructor for strings
+ json_value(const string_t& value)
+ {
+ string = create<string_t>(value);
+ }
+
+ /// constructor for rvalue strings
+ json_value(string_t&& value)
+ {
+ string = create<string_t>(std::move(value));
+ }
+
+ /// constructor for objects
+ json_value(const object_t& value)
+ {
+ object = create<object_t>(value);
+ }
+
+ /// constructor for rvalue objects
+ json_value(object_t&& value)
+ {
+ object = create<object_t>(std::move(value));
+ }
+
+ /// constructor for arrays
+ json_value(const array_t& value)
+ {
+ array = create<array_t>(value);
+ }
+
+ /// constructor for rvalue arrays
+ json_value(array_t&& value)
+ {
+ array = create<array_t>(std::move(value));
+ }
+
+ /// constructor for binary arrays
+ json_value(const typename binary_t::container_type& value)
+ {
+ binary = create<binary_t>(value);
+ }
+
+ /// constructor for rvalue binary arrays
+ json_value(typename binary_t::container_type&& value)
+ {
+ binary = create<binary_t>(std::move(value));
+ }
+
+ /// constructor for binary arrays (internal type)
+ json_value(const binary_t& value)
+ {
+ binary = create<binary_t>(value);
+ }
+
+ /// constructor for rvalue binary arrays (internal type)
+ json_value(binary_t&& value)
+ {
+ binary = create<binary_t>(std::move(value));
+ }
+
+ void destroy(value_t t) noexcept
+ {
+ // flatten the current json_value to a heap-allocated stack
+ std::vector<basic_json> stack;
+
+ // move the top-level items to stack
+ if (t == value_t::array)
+ {
+ stack.reserve(array->size());
+ std::move(array->begin(), array->end(), std::back_inserter(stack));
+ }
+ else if (t == value_t::object)
+ {
+ stack.reserve(object->size());
+ for (auto&& it : *object)
+ {
+ stack.push_back(std::move(it.second));
+ }
+ }
+
+ while (not stack.empty())
+ {
+ // move the last item to local variable to be processed
+ basic_json current_item(std::move(stack.back()));
+ stack.pop_back();
+
+ // if current_item is array/object, move
+ // its children to the stack to be processed later
+ if (current_item.is_array())
+ {
+ std::move(current_item.m_value.array->begin(), current_item.m_value.array->end(),
+ std::back_inserter(stack));
+
+ current_item.m_value.array->clear();
+ }
+ else if (current_item.is_object())
+ {
+ for (auto&& it : *current_item.m_value.object)
+ {
+ stack.push_back(std::move(it.second));
+ }
+
+ current_item.m_value.object->clear();
+ }
+
+ // it's now safe that current_item get destructed
+ // since it doesn't have any children
+ }
+
+ switch (t)
+ {
+ case value_t::object:
+ {
+ AllocatorType<object_t> alloc;
+ std::allocator_traits<decltype(alloc)>::destroy(alloc, object);
+ std::allocator_traits<decltype(alloc)>::deallocate(alloc, object, 1);
+ break;
+ }
+
+ case value_t::array:
+ {
+ AllocatorType<array_t> alloc;
+ std::allocator_traits<decltype(alloc)>::destroy(alloc, array);
+ std::allocator_traits<decltype(alloc)>::deallocate(alloc, array, 1);
+ break;
+ }
+
+ case value_t::string:
+ {
+ AllocatorType<string_t> alloc;
+ std::allocator_traits<decltype(alloc)>::destroy(alloc, string);
+ std::allocator_traits<decltype(alloc)>::deallocate(alloc, string, 1);
+ break;
+ }
+
+ case value_t::binary:
+ {
+ AllocatorType<binary_t> alloc;
+ std::allocator_traits<decltype(alloc)>::destroy(alloc, binary);
+ std::allocator_traits<decltype(alloc)>::deallocate(alloc, binary, 1);
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
+ }
+ }
+ };
+
+ /*!
+ @brief checks the class invariants
+
+ This function asserts the class invariants. It needs to be called at the
+ end of every constructor to make sure that created objects respect the
+ invariant. Furthermore, it has to be called each time the type of a JSON
+ value is changed, because the invariant expresses a relationship between
+ @a m_type and @a m_value.
+ */
+ void assert_invariant() const noexcept
+ {
+ assert(m_type != value_t::object or m_value.object != nullptr);
+ assert(m_type != value_t::array or m_value.array != nullptr);
+ assert(m_type != value_t::string or m_value.string != nullptr);
+ assert(m_type != value_t::binary or m_value.binary != nullptr);
+ }
+
+ public:
+ //////////////////////////
+ // JSON parser callback //
+ //////////////////////////
+
+ /*!
+ @brief parser event types
+
+ The parser callback distinguishes the following events:
+ - `object_start`: the parser read `{` and started to process a JSON object
+ - `key`: the parser read a key of a value in an object
+ - `object_end`: the parser read `}` and finished processing a JSON object
+ - `array_start`: the parser read `[` and started to process a JSON array
+ - `array_end`: the parser read `]` and finished processing a JSON array
+ - `value`: the parser finished reading a JSON value
+
+ @image html callback_events.png "Example when certain parse events are triggered"
+
+ @sa @ref parser_callback_t for more information and examples
+ */
+ using parse_event_t = detail::parse_event_t;
+
+ /*!
+ @brief per-element parser callback type
+
+ With a parser callback function, the result of parsing a JSON text can be
+ influenced. When passed to @ref parse, it is called on certain events
+ (passed as @ref parse_event_t via parameter @a event) with a set recursion
+ depth @a depth and context JSON value @a parsed. The return value of the
+ callback function is a boolean indicating whether the element that emitted
+ the callback shall be kept or not.
+
+ We distinguish six scenarios (determined by the event type) in which the
+ callback function can be called. The following table describes the values
+ of the parameters @a depth, @a event, and @a parsed.
+
+ parameter @a event | description | parameter @a depth | parameter @a parsed
+ ------------------ | ----------- | ------------------ | -------------------
+ parse_event_t::object_start | the parser read `{` and started to process a JSON object | depth of the parent of the JSON object | a JSON value with type discarded
+ parse_event_t::key | the parser read a key of a value in an object | depth of the currently parsed JSON object | a JSON string containing the key
+ parse_event_t::object_end | the parser read `}` and finished processing a JSON object | depth of the parent of the JSON object | the parsed JSON object
+ parse_event_t::array_start | the parser read `[` and started to process a JSON array | depth of the parent of the JSON array | a JSON value with type discarded
+ parse_event_t::array_end | the parser read `]` and finished processing a JSON array | depth of the parent of the JSON array | the parsed JSON array
+ parse_event_t::value | the parser finished reading a JSON value | depth of the value | the parsed JSON value
+
+ @image html callback_events.png "Example when certain parse events are triggered"
+
+ Discarding a value (i.e., returning `false`) has different effects
+ depending on the context in which function was called:
+
+ - Discarded values in structured types are skipped. That is, the parser
+ will behave as if the discarded value was never read.
+ - In case a value outside a structured type is skipped, it is replaced
+ with `null`. This case happens if the top-level element is skipped.
+
+ @param[in] depth the depth of the recursion during parsing
+
+ @param[in] event an event of type parse_event_t indicating the context in
+ the callback function has been called
+
+ @param[in,out] parsed the current intermediate parse result; note that
+ writing to this value has no effect for parse_event_t::key events
+
+ @return Whether the JSON value which called the function during parsing
+ should be kept (`true`) or not (`false`). In the latter case, it is either
+ skipped completely or replaced by an empty discarded object.
+
+ @sa @ref parse for examples
+
+ @since version 1.0.0
+ */
+ using parser_callback_t = detail::parser_callback_t<basic_json>;
+
+ //////////////////
+ // constructors //
+ //////////////////
+
+ /// @name constructors and destructors
+ /// Constructors of class @ref basic_json, copy/move constructor, copy
+ /// assignment, static functions creating objects, and the destructor.
+ /// @{
+
+ /*!
+ @brief create an empty value with a given type
+
+ Create an empty JSON value with a given type. The value will be default
+ initialized with an empty value which depends on the type:
+
+ Value type | initial value
+ ----------- | -------------
+ null | `null`
+ boolean | `false`
+ string | `""`
+ number | `0`
+ object | `{}`
+ array | `[]`
+ binary | empty array
+
+ @param[in] v the type of the value to create
+
+ @complexity Constant.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @liveexample{The following code shows the constructor for different @ref
+ value_t values,basic_json__value_t}
+
+ @sa @ref clear() -- restores the postcondition of this constructor
+
+ @since version 1.0.0
+ */
+ basic_json(const value_t v)
+ : m_type(v), m_value(v)
+ {
+ assert_invariant();
+ }
+
+ /*!
+ @brief create a null object
+
+ Create a `null` JSON value. It either takes a null pointer as parameter
+ (explicitly creating `null`) or no parameter (implicitly creating `null`).
+ The passed null pointer itself is not read -- it is only used to choose
+ the right constructor.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this constructor never throws
+ exceptions.
+
+ @liveexample{The following code shows the constructor with and without a
+ null pointer parameter.,basic_json__nullptr_t}
+
+ @since version 1.0.0
+ */
+ basic_json(std::nullptr_t = nullptr) noexcept
+ : basic_json(value_t::null)
+ {
+ assert_invariant();
+ }
+
+ /*!
+ @brief create a JSON value
+
+ This is a "catch all" constructor for all compatible JSON types; that is,
+ types for which a `to_json()` method exists. The constructor forwards the
+ parameter @a val to that method (to `json_serializer<U>::to_json` method
+ with `U = uncvref_t<CompatibleType>`, to be exact).
+
+ Template type @a CompatibleType includes, but is not limited to, the
+ following types:
+ - **arrays**: @ref array_t and all kinds of compatible containers such as
+ `std::vector`, `std::deque`, `std::list`, `std::forward_list`,
+ `std::array`, `std::valarray`, `std::set`, `std::unordered_set`,
+ `std::multiset`, and `std::unordered_multiset` with a `value_type` from
+ which a @ref basic_json value can be constructed.
+ - **objects**: @ref object_t and all kinds of compatible associative
+ containers such as `std::map`, `std::unordered_map`, `std::multimap`,
+ and `std::unordered_multimap` with a `key_type` compatible to
+ @ref string_t and a `value_type` from which a @ref basic_json value can
+ be constructed.
+ - **strings**: @ref string_t, string literals, and all compatible string
+ containers can be used.
+ - **numbers**: @ref number_integer_t, @ref number_unsigned_t,
+ @ref number_float_t, and all convertible number types such as `int`,
+ `size_t`, `int64_t`, `float` or `double` can be used.
+ - **boolean**: @ref boolean_t / `bool` can be used.
+ - **binary**: @ref binary_t / `std::vector<uint8_t>` may be used,
+ unfortunately because string literals cannot be distinguished from binary
+ character arrays by the C++ type system, all types compatible with `const
+ char*` will be directed to the string constructor instead. This is both
+ for backwards compatibility, and due to the fact that a binary type is not
+ a standard JSON type.
+
+ See the examples below.
+
+ @tparam CompatibleType a type such that:
+ - @a CompatibleType is not derived from `std::istream`,
+ - @a CompatibleType is not @ref basic_json (to avoid hijacking copy/move
+ constructors),
+ - @a CompatibleType is not a different @ref basic_json type (i.e. with different template arguments)
+ - @a CompatibleType is not a @ref basic_json nested type (e.g.,
+ @ref json_pointer, @ref iterator, etc ...)
+ - @ref @ref json_serializer<U> has a
+ `to_json(basic_json_t&, CompatibleType&&)` method
+
+ @tparam U = `uncvref_t<CompatibleType>`
+
+ @param[in] val the value to be forwarded to the respective constructor
+
+ @complexity Usually linear in the size of the passed @a val, also
+ depending on the implementation of the called `to_json()`
+ method.
+
+ @exceptionsafety Depends on the called constructor. For types directly
+ supported by the library (i.e., all types for which no `to_json()` function
+ was provided), strong guarantee holds: if an exception is thrown, there are
+ no changes to any JSON value.
+
+ @liveexample{The following code shows the constructor with several
+ compatible types.,basic_json__CompatibleType}
+
+ @since version 2.1.0
+ */
+ template <typename CompatibleType,
+ typename U = detail::uncvref_t<CompatibleType>,
+ detail::enable_if_t<
+ not detail::is_basic_json<U>::value and detail::is_compatible_type<basic_json_t, U>::value, int> = 0>
+ basic_json(CompatibleType && val) noexcept(noexcept(
+ JSONSerializer<U>::to_json(std::declval<basic_json_t&>(),
+ std::forward<CompatibleType>(val))))
+ {
+ JSONSerializer<U>::to_json(*this, std::forward<CompatibleType>(val));
+ assert_invariant();
+ }
+
+ /*!
+ @brief create a JSON value from an existing one
+
+ This is a constructor for existing @ref basic_json types.
+ It does not hijack copy/move constructors, since the parameter has different
+ template arguments than the current ones.
+
+ The constructor tries to convert the internal @ref m_value of the parameter.
+
+ @tparam BasicJsonType a type such that:
+ - @a BasicJsonType is a @ref basic_json type.
+ - @a BasicJsonType has different template arguments than @ref basic_json_t.
+
+ @param[in] val the @ref basic_json value to be converted.
+
+ @complexity Usually linear in the size of the passed @a val, also
+ depending on the implementation of the called `to_json()`
+ method.
+
+ @exceptionsafety Depends on the called constructor. For types directly
+ supported by the library (i.e., all types for which no `to_json()` function
+ was provided), strong guarantee holds: if an exception is thrown, there are
+ no changes to any JSON value.
+
+ @since version 3.2.0
+ */
+ template <typename BasicJsonType,
+ detail::enable_if_t<
+ detail::is_basic_json<BasicJsonType>::value and not std::is_same<basic_json, BasicJsonType>::value, int> = 0>
+ basic_json(const BasicJsonType& val)
+ {
+ using other_boolean_t = typename BasicJsonType::boolean_t;
+ using other_number_float_t = typename BasicJsonType::number_float_t;
+ using other_number_integer_t = typename BasicJsonType::number_integer_t;
+ using other_number_unsigned_t = typename BasicJsonType::number_unsigned_t;
+ using other_string_t = typename BasicJsonType::string_t;
+ using other_object_t = typename BasicJsonType::object_t;
+ using other_array_t = typename BasicJsonType::array_t;
+ using other_binary_t = typename BasicJsonType::binary_t;
+
+ switch (val.type())
+ {
+ case value_t::boolean:
+ JSONSerializer<other_boolean_t>::to_json(*this, val.template get<other_boolean_t>());
+ break;
+ case value_t::number_float:
+ JSONSerializer<other_number_float_t>::to_json(*this, val.template get<other_number_float_t>());
+ break;
+ case value_t::number_integer:
+ JSONSerializer<other_number_integer_t>::to_json(*this, val.template get<other_number_integer_t>());
+ break;
+ case value_t::number_unsigned:
+ JSONSerializer<other_number_unsigned_t>::to_json(*this, val.template get<other_number_unsigned_t>());
+ break;
+ case value_t::string:
+ JSONSerializer<other_string_t>::to_json(*this, val.template get_ref<const other_string_t&>());
+ break;
+ case value_t::object:
+ JSONSerializer<other_object_t>::to_json(*this, val.template get_ref<const other_object_t&>());
+ break;
+ case value_t::array:
+ JSONSerializer<other_array_t>::to_json(*this, val.template get_ref<const other_array_t&>());
+ break;
+ case value_t::binary:
+ JSONSerializer<other_binary_t>::to_json(*this, val.template get_ref<const other_binary_t&>());
+ break;
+ case value_t::null:
+ *this = nullptr;
+ break;
+ case value_t::discarded:
+ m_type = value_t::discarded;
+ break;
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+ assert_invariant();
+ }
+
+ /*!
+ @brief create a container (array or object) from an initializer list
+
+ Creates a JSON value of type array or object from the passed initializer
+ list @a init. In case @a type_deduction is `true` (default), the type of
+ the JSON value to be created is deducted from the initializer list @a init
+ according to the following rules:
+
+ 1. If the list is empty, an empty JSON object value `{}` is created.
+ 2. If the list consists of pairs whose first element is a string, a JSON
+ object value is created where the first elements of the pairs are
+ treated as keys and the second elements are as values.
+ 3. In all other cases, an array is created.
+
+ The rules aim to create the best fit between a C++ initializer list and
+ JSON values. The rationale is as follows:
+
+ 1. The empty initializer list is written as `{}` which is exactly an empty
+ JSON object.
+ 2. C++ has no way of describing mapped types other than to list a list of
+ pairs. As JSON requires that keys must be of type string, rule 2 is the
+ weakest constraint one can pose on initializer lists to interpret them
+ as an object.
+ 3. In all other cases, the initializer list could not be interpreted as
+ JSON object type, so interpreting it as JSON array type is safe.
+
+ With the rules described above, the following JSON values cannot be
+ expressed by an initializer list:
+
+ - the empty array (`[]`): use @ref array(initializer_list_t)
+ with an empty initializer list in this case
+ - arrays whose elements satisfy rule 2: use @ref
+ array(initializer_list_t) with the same initializer list
+ in this case
+
+ @note When used without parentheses around an empty initializer list, @ref
+ basic_json() is called instead of this function, yielding the JSON null
+ value.
+
+ @param[in] init initializer list with JSON values
+
+ @param[in] type_deduction internal parameter; when set to `true`, the type
+ of the JSON value is deducted from the initializer list @a init; when set
+ to `false`, the type provided via @a manual_type is forced. This mode is
+ used by the functions @ref array(initializer_list_t) and
+ @ref object(initializer_list_t).
+
+ @param[in] manual_type internal parameter; when @a type_deduction is set
+ to `false`, the created JSON value will use the provided type (only @ref
+ value_t::array and @ref value_t::object are valid); when @a type_deduction
+ is set to `true`, this parameter has no effect
+
+ @throw type_error.301 if @a type_deduction is `false`, @a manual_type is
+ `value_t::object`, but @a init contains an element which is not a pair
+ whose first element is a string. In this case, the constructor could not
+ create an object. If @a type_deduction would have be `true`, an array
+ would have been created. See @ref object(initializer_list_t)
+ for an example.
+
+ @complexity Linear in the size of the initializer list @a init.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @liveexample{The example below shows how JSON values are created from
+ initializer lists.,basic_json__list_init_t}
+
+ @sa @ref array(initializer_list_t) -- create a JSON array
+ value from an initializer list
+ @sa @ref object(initializer_list_t) -- create a JSON object
+ value from an initializer list
+
+ @since version 1.0.0
+ */
+ basic_json(initializer_list_t init,
+ bool type_deduction = true,
+ value_t manual_type = value_t::array)
+ {
+ // check if each element is an array with two elements whose first
+ // element is a string
+ bool is_an_object = std::all_of(init.begin(), init.end(),
+ [](const detail::json_ref<basic_json>& element_ref)
+ {
+ return element_ref->is_array() and element_ref->size() == 2 and (*element_ref)[0].is_string();
+ });
+
+ // adjust type if type deduction is not wanted
+ if (not type_deduction)
+ {
+ // if array is wanted, do not create an object though possible
+ if (manual_type == value_t::array)
+ {
+ is_an_object = false;
+ }
+
+ // if object is wanted but impossible, throw an exception
+ if (JSON_HEDLEY_UNLIKELY(manual_type == value_t::object and not is_an_object))
+ {
+ JSON_THROW(type_error::create(301, "cannot create object from initializer list"));
+ }
+ }
+
+ if (is_an_object)
+ {
+ // the initializer list is a list of pairs -> create object
+ m_type = value_t::object;
+ m_value = value_t::object;
+
+ std::for_each(init.begin(), init.end(), [this](const detail::json_ref<basic_json>& element_ref)
+ {
+ auto element = element_ref.moved_or_copied();
+ m_value.object->emplace(
+ std::move(*((*element.m_value.array)[0].m_value.string)),
+ std::move((*element.m_value.array)[1]));
+ });
+ }
+ else
+ {
+ // the initializer list describes an array -> create array
+ m_type = value_t::array;
+ m_value.array = create<array_t>(init.begin(), init.end());
+ }
+
+ assert_invariant();
+ }
+
+ /*!
+ @brief explicitly create a binary array (without subtype)
+
+ Creates a JSON binary array value from a given binary container. Binary
+ values are part of various binary formats, such as CBOR, MessagePack, and
+ BSON. This constructor is used to create a value for serialization to those
+ formats.
+
+ @note Note, this function exists because of the difficulty in correctly
+ specifying the correct template overload in the standard value ctor, as both
+ JSON arrays and JSON binary arrays are backed with some form of a
+ `std::vector`. Because JSON binary arrays are a non-standard extension it
+ was decided that it would be best to prevent automatic initialization of a
+ binary array type, for backwards compatibility and so it does not happen on
+ accident.
+
+ @param[in] init container containing bytes to use as binary type
+
+ @return JSON binary array value
+
+ @complexity Linear in the size of @a init.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @since version 3.8.0
+ */
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json binary(const typename binary_t::container_type& init)
+ {
+ auto res = basic_json();
+ res.m_type = value_t::binary;
+ res.m_value = init;
+ return res;
+ }
+
+ /*!
+ @brief explicitly create a binary array (with subtype)
+
+ Creates a JSON binary array value from a given binary container. Binary
+ values are part of various binary formats, such as CBOR, MessagePack, and
+ BSON. This constructor is used to create a value for serialization to those
+ formats.
+
+ @note Note, this function exists because of the difficulty in correctly
+ specifying the correct template overload in the standard value ctor, as both
+ JSON arrays and JSON binary arrays are backed with some form of a
+ `std::vector`. Because JSON binary arrays are a non-standard extension it
+ was decided that it would be best to prevent automatic initialization of a
+ binary array type, for backwards compatibility and so it does not happen on
+ accident.
+
+ @param[in] init container containing bytes to use as binary type
+ @param[in] subtype subtype to use in MessagePack and BSON
+
+ @return JSON binary array value
+
+ @complexity Linear in the size of @a init.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @since version 3.8.0
+ */
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json binary(const typename binary_t::container_type& init, std::uint8_t subtype)
+ {
+ auto res = basic_json();
+ res.m_type = value_t::binary;
+ res.m_value = binary_t(init, subtype);
+ return res;
+ }
+
+ /// @copydoc binary(const typename binary_t::container_type&)
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json binary(typename binary_t::container_type&& init)
+ {
+ auto res = basic_json();
+ res.m_type = value_t::binary;
+ res.m_value = std::move(init);
+ return res;
+ }
+
+ /// @copydoc binary(const typename binary_t::container_type&, std::uint8_t)
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json binary(typename binary_t::container_type&& init, std::uint8_t subtype)
+ {
+ auto res = basic_json();
+ res.m_type = value_t::binary;
+ res.m_value = binary_t(std::move(init), subtype);
+ return res;
+ }
+
+ /*!
+ @brief explicitly create an array from an initializer list
+
+ Creates a JSON array value from a given initializer list. That is, given a
+ list of values `a, b, c`, creates the JSON value `[a, b, c]`. If the
+ initializer list is empty, the empty array `[]` is created.
+
+ @note This function is only needed to express two edge cases that cannot
+ be realized with the initializer list constructor (@ref
+ basic_json(initializer_list_t, bool, value_t)). These cases
+ are:
+ 1. creating an array whose elements are all pairs whose first element is a
+ string -- in this case, the initializer list constructor would create an
+ object, taking the first elements as keys
+ 2. creating an empty array -- passing the empty initializer list to the
+ initializer list constructor yields an empty object
+
+ @param[in] init initializer list with JSON values to create an array from
+ (optional)
+
+ @return JSON array value
+
+ @complexity Linear in the size of @a init.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @liveexample{The following code shows an example for the `array`
+ function.,array}
+
+ @sa @ref basic_json(initializer_list_t, bool, value_t) --
+ create a JSON value from an initializer list
+ @sa @ref object(initializer_list_t) -- create a JSON object
+ value from an initializer list
+
+ @since version 1.0.0
+ */
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json array(initializer_list_t init = {})
+ {
+ return basic_json(init, false, value_t::array);
+ }
+
+ /*!
+ @brief explicitly create an object from an initializer list
+
+ Creates a JSON object value from a given initializer list. The initializer
+ lists elements must be pairs, and their first elements must be strings. If
+ the initializer list is empty, the empty object `{}` is created.
+
+ @note This function is only added for symmetry reasons. In contrast to the
+ related function @ref array(initializer_list_t), there are
+ no cases which can only be expressed by this function. That is, any
+ initializer list @a init can also be passed to the initializer list
+ constructor @ref basic_json(initializer_list_t, bool, value_t).
+
+ @param[in] init initializer list to create an object from (optional)
+
+ @return JSON object value
+
+ @throw type_error.301 if @a init is not a list of pairs whose first
+ elements are strings. In this case, no object can be created. When such a
+ value is passed to @ref basic_json(initializer_list_t, bool, value_t),
+ an array would have been created from the passed initializer list @a init.
+ See example below.
+
+ @complexity Linear in the size of @a init.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @liveexample{The following code shows an example for the `object`
+ function.,object}
+
+ @sa @ref basic_json(initializer_list_t, bool, value_t) --
+ create a JSON value from an initializer list
+ @sa @ref array(initializer_list_t) -- create a JSON array
+ value from an initializer list
+
+ @since version 1.0.0
+ */
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json object(initializer_list_t init = {})
+ {
+ return basic_json(init, false, value_t::object);
+ }
+
+ /*!
+ @brief construct an array with count copies of given value
+
+ Constructs a JSON array value by creating @a cnt copies of a passed value.
+ In case @a cnt is `0`, an empty array is created.
+
+ @param[in] cnt the number of JSON copies of @a val to create
+ @param[in] val the JSON value to copy
+
+ @post `std::distance(begin(),end()) == cnt` holds.
+
+ @complexity Linear in @a cnt.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @liveexample{The following code shows examples for the @ref
+ basic_json(size_type\, const basic_json&)
+ constructor.,basic_json__size_type_basic_json}
+
+ @since version 1.0.0
+ */
+ basic_json(size_type cnt, const basic_json& val)
+ : m_type(value_t::array)
+ {
+ m_value.array = create<array_t>(cnt, val);
+ assert_invariant();
+ }
+
+ /*!
+ @brief construct a JSON container given an iterator range
+
+ Constructs the JSON value with the contents of the range `[first, last)`.
+ The semantics depends on the different types a JSON value can have:
+ - In case of a null type, invalid_iterator.206 is thrown.
+ - In case of other primitive types (number, boolean, or string), @a first
+ must be `begin()` and @a last must be `end()`. In this case, the value is
+ copied. Otherwise, invalid_iterator.204 is thrown.
+ - In case of structured types (array, object), the constructor behaves as
+ similar versions for `std::vector` or `std::map`; that is, a JSON array
+ or object is constructed from the values in the range.
+
+ @tparam InputIT an input iterator type (@ref iterator or @ref
+ const_iterator)
+
+ @param[in] first begin of the range to copy from (included)
+ @param[in] last end of the range to copy from (excluded)
+
+ @pre Iterators @a first and @a last must be initialized. **This
+ precondition is enforced with an assertion (see warning).** If
+ assertions are switched off, a violation of this precondition yields
+ undefined behavior.
+
+ @pre Range `[first, last)` is valid. Usually, this precondition cannot be
+ checked efficiently. Only certain edge cases are detected; see the
+ description of the exceptions below. A violation of this precondition
+ yields undefined behavior.
+
+ @warning A precondition is enforced with a runtime assertion that will
+ result in calling `std::abort` if this precondition is not met.
+ Assertions can be disabled by defining `NDEBUG` at compile time.
+ See https://en.cppreference.com/w/cpp/error/assert for more
+ information.
+
+ @throw invalid_iterator.201 if iterators @a first and @a last are not
+ compatible (i.e., do not belong to the same JSON value). In this case,
+ the range `[first, last)` is undefined.
+ @throw invalid_iterator.204 if iterators @a first and @a last belong to a
+ primitive type (number, boolean, or string), but @a first does not point
+ to the first element any more. In this case, the range `[first, last)` is
+ undefined. See example code below.
+ @throw invalid_iterator.206 if iterators @a first and @a last belong to a
+ null value. In this case, the range `[first, last)` is undefined.
+
+ @complexity Linear in distance between @a first and @a last.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @liveexample{The example below shows several ways to create JSON values by
+ specifying a subrange with iterators.,basic_json__InputIt_InputIt}
+
+ @since version 1.0.0
+ */
+ template<class InputIT, typename std::enable_if<
+ std::is_same<InputIT, typename basic_json_t::iterator>::value or
+ std::is_same<InputIT, typename basic_json_t::const_iterator>::value, int>::type = 0>
+ basic_json(InputIT first, InputIT last)
+ {
+ assert(first.m_object != nullptr);
+ assert(last.m_object != nullptr);
+
+ // make sure iterator fits the current value
+ if (JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(201, "iterators are not compatible"));
+ }
+
+ // copy type from first iterator
+ m_type = first.m_object->m_type;
+
+ // check if iterator range is complete for primitive values
+ switch (m_type)
+ {
+ case value_t::boolean:
+ case value_t::number_float:
+ case value_t::number_integer:
+ case value_t::number_unsigned:
+ case value_t::string:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not first.m_it.primitive_iterator.is_begin()
+ or not last.m_it.primitive_iterator.is_end()))
+ {
+ JSON_THROW(invalid_iterator::create(204, "iterators out of range"));
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ switch (m_type)
+ {
+ case value_t::number_integer:
+ {
+ m_value.number_integer = first.m_object->m_value.number_integer;
+ break;
+ }
+
+ case value_t::number_unsigned:
+ {
+ m_value.number_unsigned = first.m_object->m_value.number_unsigned;
+ break;
+ }
+
+ case value_t::number_float:
+ {
+ m_value.number_float = first.m_object->m_value.number_float;
+ break;
+ }
+
+ case value_t::boolean:
+ {
+ m_value.boolean = first.m_object->m_value.boolean;
+ break;
+ }
+
+ case value_t::string:
+ {
+ m_value = *first.m_object->m_value.string;
+ break;
+ }
+
+ case value_t::object:
+ {
+ m_value.object = create<object_t>(first.m_it.object_iterator,
+ last.m_it.object_iterator);
+ break;
+ }
+
+ case value_t::array:
+ {
+ m_value.array = create<array_t>(first.m_it.array_iterator,
+ last.m_it.array_iterator);
+ break;
+ }
+
+ case value_t::binary:
+ {
+ m_value = *first.m_object->m_value.binary;
+ break;
+ }
+
+ default:
+ JSON_THROW(invalid_iterator::create(206, "cannot construct with iterators from " +
+ std::string(first.m_object->type_name())));
+ }
+
+ assert_invariant();
+ }
+
+
+ ///////////////////////////////////////
+ // other constructors and destructor //
+ ///////////////////////////////////////
+
+ template <typename JsonRef,
+ detail::enable_if_t<detail::conjunction<detail::is_json_ref<JsonRef>,
+ std::is_same<typename JsonRef::value_type, basic_json>>::value, int> = 0 >
+ basic_json(const JsonRef& ref) : basic_json(ref.moved_or_copied()) {}
+
+ /*!
+ @brief copy constructor
+
+ Creates a copy of a given JSON value.
+
+ @param[in] other the JSON value to copy
+
+ @post `*this == other`
+
+ @complexity Linear in the size of @a other.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes to any JSON value.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is linear.
+ - As postcondition, it holds: `other == basic_json(other)`.
+
+ @liveexample{The following code shows an example for the copy
+ constructor.,basic_json__basic_json}
+
+ @since version 1.0.0
+ */
+ basic_json(const basic_json& other)
+ : m_type(other.m_type)
+ {
+ // check of passed value is valid
+ other.assert_invariant();
+
+ switch (m_type)
+ {
+ case value_t::object:
+ {
+ m_value = *other.m_value.object;
+ break;
+ }
+
+ case value_t::array:
+ {
+ m_value = *other.m_value.array;
+ break;
+ }
+
+ case value_t::string:
+ {
+ m_value = *other.m_value.string;
+ break;
+ }
+
+ case value_t::boolean:
+ {
+ m_value = other.m_value.boolean;
+ break;
+ }
+
+ case value_t::number_integer:
+ {
+ m_value = other.m_value.number_integer;
+ break;
+ }
+
+ case value_t::number_unsigned:
+ {
+ m_value = other.m_value.number_unsigned;
+ break;
+ }
+
+ case value_t::number_float:
+ {
+ m_value = other.m_value.number_float;
+ break;
+ }
+
+ case value_t::binary:
+ {
+ m_value = *other.m_value.binary;
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ assert_invariant();
+ }
+
+ /*!
+ @brief move constructor
+
+ Move constructor. Constructs a JSON value with the contents of the given
+ value @a other using move semantics. It "steals" the resources from @a
+ other and leaves it as JSON null value.
+
+ @param[in,out] other value to move to this object
+
+ @post `*this` has the same value as @a other before the call.
+ @post @a other is a JSON null value.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this constructor never throws
+ exceptions.
+
+ @requirement This function helps `basic_json` satisfying the
+ [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible)
+ requirements.
+
+ @liveexample{The code below shows the move constructor explicitly called
+ via std::move.,basic_json__moveconstructor}
+
+ @since version 1.0.0
+ */
+ basic_json(basic_json&& other) noexcept
+ : m_type(std::move(other.m_type)),
+ m_value(std::move(other.m_value))
+ {
+ // check that passed value is valid
+ other.assert_invariant();
+
+ // invalidate payload
+ other.m_type = value_t::null;
+ other.m_value = {};
+
+ assert_invariant();
+ }
+
+ /*!
+ @brief copy assignment
+
+ Copy assignment operator. Copies a JSON value via the "copy and swap"
+ strategy: It is expressed in terms of the copy constructor, destructor,
+ and the `swap()` member function.
+
+ @param[in] other value to copy from
+
+ @complexity Linear.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is linear.
+
+ @liveexample{The code below shows and example for the copy assignment. It
+ creates a copy of value `a` which is then swapped with `b`. Finally\, the
+ copy of `a` (which is the null value after the swap) is
+ destroyed.,basic_json__copyassignment}
+
+ @since version 1.0.0
+ */
+ basic_json& operator=(basic_json other) noexcept (
+ std::is_nothrow_move_constructible<value_t>::value and
+ std::is_nothrow_move_assignable<value_t>::value and
+ std::is_nothrow_move_constructible<json_value>::value and
+ std::is_nothrow_move_assignable<json_value>::value
+ )
+ {
+ // check that passed value is valid
+ other.assert_invariant();
+
+ using std::swap;
+ swap(m_type, other.m_type);
+ swap(m_value, other.m_value);
+
+ assert_invariant();
+ return *this;
+ }
+
+ /*!
+ @brief destructor
+
+ Destroys the JSON value and frees all allocated memory.
+
+ @complexity Linear.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is linear.
+ - All stored elements are destroyed and all memory is freed.
+
+ @since version 1.0.0
+ */
+ ~basic_json() noexcept
+ {
+ assert_invariant();
+ m_value.destroy(m_type);
+ }
+
+ /// @}
+
+ public:
+ ///////////////////////
+ // object inspection //
+ ///////////////////////
+
+ /// @name object inspection
+ /// Functions to inspect the type of a JSON value.
+ /// @{
+
+ /*!
+ @brief serialization
+
+ Serialization function for JSON values. The function tries to mimic
+ Python's `json.dumps()` function, and currently supports its @a indent
+ and @a ensure_ascii parameters.
+
+ @param[in] indent If indent is nonnegative, then array elements and object
+ members will be pretty-printed with that indent level. An indent level of
+ `0` will only insert newlines. `-1` (the default) selects the most compact
+ representation.
+ @param[in] indent_char The character to use for indentation if @a indent is
+ greater than `0`. The default is ` ` (space).
+ @param[in] ensure_ascii If @a ensure_ascii is true, all non-ASCII characters
+ in the output are escaped with `\uXXXX` sequences, and the result consists
+ of ASCII characters only.
+ @param[in] error_handler how to react on decoding errors; there are three
+ possible values: `strict` (throws and exception in case a decoding error
+ occurs; default), `replace` (replace invalid UTF-8 sequences with U+FFFD),
+ and `ignore` (ignore invalid UTF-8 sequences during serialization).
+
+ @return string containing the serialization of the JSON value
+
+ @throw type_error.316 if a string stored inside the JSON value is not
+ UTF-8 encoded and @a error_handler is set to strict
+
+ @note Binary values are serialized as object containing two keys:
+ - "bytes": an array of bytes as integers
+ - "subtype": the subtype as integer or "null" if the binary has no subtype
+
+ @complexity Linear.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @liveexample{The following example shows the effect of different @a indent\,
+ @a indent_char\, and @a ensure_ascii parameters to the result of the
+ serialization.,dump}
+
+ @see https://docs.python.org/2/library/json.html#json.dump
+
+ @since version 1.0.0; indentation character @a indent_char, option
+ @a ensure_ascii and exceptions added in version 3.0.0; error
+ handlers added in version 3.4.0; serialization of binary values added
+ in version 3.8.0.
+ */
+ string_t dump(const int indent = -1,
+ const char indent_char = ' ',
+ const bool ensure_ascii = false,
+ const error_handler_t error_handler = error_handler_t::strict) const
+ {
+ string_t result;
+ serializer s(detail::output_adapter<char, string_t>(result), indent_char, error_handler);
+
+ if (indent >= 0)
+ {
+ s.dump(*this, true, ensure_ascii, static_cast<unsigned int>(indent));
+ }
+ else
+ {
+ s.dump(*this, false, ensure_ascii, 0);
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief return the type of the JSON value (explicit)
+
+ Return the type of the JSON value as a value from the @ref value_t
+ enumeration.
+
+ @return the type of the JSON value
+ Value type | return value
+ ------------------------- | -------------------------
+ null | value_t::null
+ boolean | value_t::boolean
+ string | value_t::string
+ number (integer) | value_t::number_integer
+ number (unsigned integer) | value_t::number_unsigned
+ number (floating-point) | value_t::number_float
+ object | value_t::object
+ array | value_t::array
+ binary | value_t::binary
+ discarded | value_t::discarded
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `type()` for all JSON
+ types.,type}
+
+ @sa @ref operator value_t() -- return the type of the JSON value (implicit)
+ @sa @ref type_name() -- return the type as string
+
+ @since version 1.0.0
+ */
+ constexpr value_t type() const noexcept
+ {
+ return m_type;
+ }
+
+ /*!
+ @brief return whether type is primitive
+
+ This function returns true if and only if the JSON type is primitive
+ (string, number, boolean, or null).
+
+ @return `true` if type is primitive (string, number, boolean, or null),
+ `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_primitive()` for all JSON
+ types.,is_primitive}
+
+ @sa @ref is_structured() -- returns whether JSON value is structured
+ @sa @ref is_null() -- returns whether JSON value is `null`
+ @sa @ref is_string() -- returns whether JSON value is a string
+ @sa @ref is_boolean() -- returns whether JSON value is a boolean
+ @sa @ref is_number() -- returns whether JSON value is a number
+ @sa @ref is_binary() -- returns whether JSON value is a binary array
+
+ @since version 1.0.0
+ */
+ constexpr bool is_primitive() const noexcept
+ {
+ return is_null() or is_string() or is_boolean() or is_number() or is_binary();
+ }
+
+ /*!
+ @brief return whether type is structured
+
+ This function returns true if and only if the JSON type is structured
+ (array or object).
+
+ @return `true` if type is structured (array or object), `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_structured()` for all JSON
+ types.,is_structured}
+
+ @sa @ref is_primitive() -- returns whether value is primitive
+ @sa @ref is_array() -- returns whether value is an array
+ @sa @ref is_object() -- returns whether value is an object
+
+ @since version 1.0.0
+ */
+ constexpr bool is_structured() const noexcept
+ {
+ return is_array() or is_object();
+ }
+
+ /*!
+ @brief return whether value is null
+
+ This function returns true if and only if the JSON value is null.
+
+ @return `true` if type is null, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_null()` for all JSON
+ types.,is_null}
+
+ @since version 1.0.0
+ */
+ constexpr bool is_null() const noexcept
+ {
+ return m_type == value_t::null;
+ }
+
+ /*!
+ @brief return whether value is a boolean
+
+ This function returns true if and only if the JSON value is a boolean.
+
+ @return `true` if type is boolean, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_boolean()` for all JSON
+ types.,is_boolean}
+
+ @since version 1.0.0
+ */
+ constexpr bool is_boolean() const noexcept
+ {
+ return m_type == value_t::boolean;
+ }
+
+ /*!
+ @brief return whether value is a number
+
+ This function returns true if and only if the JSON value is a number. This
+ includes both integer (signed and unsigned) and floating-point values.
+
+ @return `true` if type is number (regardless whether integer, unsigned
+ integer or floating-type), `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_number()` for all JSON
+ types.,is_number}
+
+ @sa @ref is_number_integer() -- check if value is an integer or unsigned
+ integer number
+ @sa @ref is_number_unsigned() -- check if value is an unsigned integer
+ number
+ @sa @ref is_number_float() -- check if value is a floating-point number
+
+ @since version 1.0.0
+ */
+ constexpr bool is_number() const noexcept
+ {
+ return is_number_integer() or is_number_float();
+ }
+
+ /*!
+ @brief return whether value is an integer number
+
+ This function returns true if and only if the JSON value is a signed or
+ unsigned integer number. This excludes floating-point values.
+
+ @return `true` if type is an integer or unsigned integer number, `false`
+ otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_number_integer()` for all
+ JSON types.,is_number_integer}
+
+ @sa @ref is_number() -- check if value is a number
+ @sa @ref is_number_unsigned() -- check if value is an unsigned integer
+ number
+ @sa @ref is_number_float() -- check if value is a floating-point number
+
+ @since version 1.0.0
+ */
+ constexpr bool is_number_integer() const noexcept
+ {
+ return m_type == value_t::number_integer or m_type == value_t::number_unsigned;
+ }
+
+ /*!
+ @brief return whether value is an unsigned integer number
+
+ This function returns true if and only if the JSON value is an unsigned
+ integer number. This excludes floating-point and signed integer values.
+
+ @return `true` if type is an unsigned integer number, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_number_unsigned()` for all
+ JSON types.,is_number_unsigned}
+
+ @sa @ref is_number() -- check if value is a number
+ @sa @ref is_number_integer() -- check if value is an integer or unsigned
+ integer number
+ @sa @ref is_number_float() -- check if value is a floating-point number
+
+ @since version 2.0.0
+ */
+ constexpr bool is_number_unsigned() const noexcept
+ {
+ return m_type == value_t::number_unsigned;
+ }
+
+ /*!
+ @brief return whether value is a floating-point number
+
+ This function returns true if and only if the JSON value is a
+ floating-point number. This excludes signed and unsigned integer values.
+
+ @return `true` if type is a floating-point number, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_number_float()` for all
+ JSON types.,is_number_float}
+
+ @sa @ref is_number() -- check if value is number
+ @sa @ref is_number_integer() -- check if value is an integer number
+ @sa @ref is_number_unsigned() -- check if value is an unsigned integer
+ number
+
+ @since version 1.0.0
+ */
+ constexpr bool is_number_float() const noexcept
+ {
+ return m_type == value_t::number_float;
+ }
+
+ /*!
+ @brief return whether value is an object
+
+ This function returns true if and only if the JSON value is an object.
+
+ @return `true` if type is object, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_object()` for all JSON
+ types.,is_object}
+
+ @since version 1.0.0
+ */
+ constexpr bool is_object() const noexcept
+ {
+ return m_type == value_t::object;
+ }
+
+ /*!
+ @brief return whether value is an array
+
+ This function returns true if and only if the JSON value is an array.
+
+ @return `true` if type is array, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_array()` for all JSON
+ types.,is_array}
+
+ @since version 1.0.0
+ */
+ constexpr bool is_array() const noexcept
+ {
+ return m_type == value_t::array;
+ }
+
+ /*!
+ @brief return whether value is a string
+
+ This function returns true if and only if the JSON value is a string.
+
+ @return `true` if type is string, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_string()` for all JSON
+ types.,is_string}
+
+ @since version 1.0.0
+ */
+ constexpr bool is_string() const noexcept
+ {
+ return m_type == value_t::string;
+ }
+
+ /*!
+ @brief return whether value is a binary array
+
+ This function returns true if and only if the JSON value is a binary array.
+
+ @return `true` if type is binary array, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_binary()` for all JSON
+ types.,is_binary}
+
+ @since version 3.8.0
+ */
+ constexpr bool is_binary() const noexcept
+ {
+ return m_type == value_t::binary;
+ }
+
+ /*!
+ @brief return whether value is discarded
+
+ This function returns true if and only if the JSON value was discarded
+ during parsing with a callback function (see @ref parser_callback_t).
+
+ @note This function will always be `false` for JSON values after parsing.
+ That is, discarded values can only occur during parsing, but will be
+ removed when inside a structured value or replaced by null in other cases.
+
+ @return `true` if type is discarded, `false` otherwise.
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies `is_discarded()` for all JSON
+ types.,is_discarded}
+
+ @since version 1.0.0
+ */
+ constexpr bool is_discarded() const noexcept
+ {
+ return m_type == value_t::discarded;
+ }
+
+ /*!
+ @brief return the type of the JSON value (implicit)
+
+ Implicitly return the type of the JSON value as a value from the @ref
+ value_t enumeration.
+
+ @return the type of the JSON value
+
+ @complexity Constant.
+
+ @exceptionsafety No-throw guarantee: this member function never throws
+ exceptions.
+
+ @liveexample{The following code exemplifies the @ref value_t operator for
+ all JSON types.,operator__value_t}
+
+ @sa @ref type() -- return the type of the JSON value (explicit)
+ @sa @ref type_name() -- return the type as string
+
+ @since version 1.0.0
+ */
+ constexpr operator value_t() const noexcept
+ {
+ return m_type;
+ }
+
+ /// @}
+
+ private:
+ //////////////////
+ // value access //
+ //////////////////
+
+ /// get a boolean (explicit)
+ boolean_t get_impl(boolean_t* /*unused*/) const
+ {
+ if (JSON_HEDLEY_LIKELY(is_boolean()))
+ {
+ return m_value.boolean;
+ }
+
+ JSON_THROW(type_error::create(302, "type must be boolean, but is " + std::string(type_name())));
+ }
+
+ /// get a pointer to the value (object)
+ object_t* get_impl_ptr(object_t* /*unused*/) noexcept
+ {
+ return is_object() ? m_value.object : nullptr;
+ }
+
+ /// get a pointer to the value (object)
+ constexpr const object_t* get_impl_ptr(const object_t* /*unused*/) const noexcept
+ {
+ return is_object() ? m_value.object : nullptr;
+ }
+
+ /// get a pointer to the value (array)
+ array_t* get_impl_ptr(array_t* /*unused*/) noexcept
+ {
+ return is_array() ? m_value.array : nullptr;
+ }
+
+ /// get a pointer to the value (array)
+ constexpr const array_t* get_impl_ptr(const array_t* /*unused*/) const noexcept
+ {
+ return is_array() ? m_value.array : nullptr;
+ }
+
+ /// get a pointer to the value (string)
+ string_t* get_impl_ptr(string_t* /*unused*/) noexcept
+ {
+ return is_string() ? m_value.string : nullptr;
+ }
+
+ /// get a pointer to the value (string)
+ constexpr const string_t* get_impl_ptr(const string_t* /*unused*/) const noexcept
+ {
+ return is_string() ? m_value.string : nullptr;
+ }
+
+ /// get a pointer to the value (boolean)
+ boolean_t* get_impl_ptr(boolean_t* /*unused*/) noexcept
+ {
+ return is_boolean() ? &m_value.boolean : nullptr;
+ }
+
+ /// get a pointer to the value (boolean)
+ constexpr const boolean_t* get_impl_ptr(const boolean_t* /*unused*/) const noexcept
+ {
+ return is_boolean() ? &m_value.boolean : nullptr;
+ }
+
+ /// get a pointer to the value (integer number)
+ number_integer_t* get_impl_ptr(number_integer_t* /*unused*/) noexcept
+ {
+ return is_number_integer() ? &m_value.number_integer : nullptr;
+ }
+
+ /// get a pointer to the value (integer number)
+ constexpr const number_integer_t* get_impl_ptr(const number_integer_t* /*unused*/) const noexcept
+ {
+ return is_number_integer() ? &m_value.number_integer : nullptr;
+ }
+
+ /// get a pointer to the value (unsigned number)
+ number_unsigned_t* get_impl_ptr(number_unsigned_t* /*unused*/) noexcept
+ {
+ return is_number_unsigned() ? &m_value.number_unsigned : nullptr;
+ }
+
+ /// get a pointer to the value (unsigned number)
+ constexpr const number_unsigned_t* get_impl_ptr(const number_unsigned_t* /*unused*/) const noexcept
+ {
+ return is_number_unsigned() ? &m_value.number_unsigned : nullptr;
+ }
+
+ /// get a pointer to the value (floating-point number)
+ number_float_t* get_impl_ptr(number_float_t* /*unused*/) noexcept
+ {
+ return is_number_float() ? &m_value.number_float : nullptr;
+ }
+
+ /// get a pointer to the value (floating-point number)
+ constexpr const number_float_t* get_impl_ptr(const number_float_t* /*unused*/) const noexcept
+ {
+ return is_number_float() ? &m_value.number_float : nullptr;
+ }
+
+ /// get a pointer to the value (binary)
+ binary_t* get_impl_ptr(binary_t* /*unused*/) noexcept
+ {
+ return is_binary() ? m_value.binary : nullptr;
+ }
+
+ /// get a pointer to the value (binary)
+ constexpr const binary_t* get_impl_ptr(const binary_t* /*unused*/) const noexcept
+ {
+ return is_binary() ? m_value.binary : nullptr;
+ }
+
+ /*!
+ @brief helper function to implement get_ref()
+
+ This function helps to implement get_ref() without code duplication for
+ const and non-const overloads
+
+ @tparam ThisType will be deduced as `basic_json` or `const basic_json`
+
+ @throw type_error.303 if ReferenceType does not match underlying value
+ type of the current JSON
+ */
+ template<typename ReferenceType, typename ThisType>
+ static ReferenceType get_ref_impl(ThisType& obj)
+ {
+ // delegate the call to get_ptr<>()
+ auto ptr = obj.template get_ptr<typename std::add_pointer<ReferenceType>::type>();
+
+ if (JSON_HEDLEY_LIKELY(ptr != nullptr))
+ {
+ return *ptr;
+ }
+
+ JSON_THROW(type_error::create(303, "incompatible ReferenceType for get_ref, actual type is " + std::string(obj.type_name())));
+ }
+
+ public:
+ /// @name value access
+ /// Direct access to the stored value of a JSON value.
+ /// @{
+
+ /*!
+ @brief get special-case overload
+
+ This overloads avoids a lot of template boilerplate, it can be seen as the
+ identity method
+
+ @tparam BasicJsonType == @ref basic_json
+
+ @return a copy of *this
+
+ @complexity Constant.
+
+ @since version 2.1.0
+ */
+ template<typename BasicJsonType, detail::enable_if_t<
+ std::is_same<typename std::remove_const<BasicJsonType>::type, basic_json_t>::value,
+ int> = 0>
+ basic_json get() const
+ {
+ return *this;
+ }
+
+ /*!
+ @brief get special-case overload
+
+ This overloads converts the current @ref basic_json in a different
+ @ref basic_json type
+
+ @tparam BasicJsonType == @ref basic_json
+
+ @return a copy of *this, converted into @tparam BasicJsonType
+
+ @complexity Depending on the implementation of the called `from_json()`
+ method.
+
+ @since version 3.2.0
+ */
+ template<typename BasicJsonType, detail::enable_if_t<
+ not std::is_same<BasicJsonType, basic_json>::value and
+ detail::is_basic_json<BasicJsonType>::value, int> = 0>
+ BasicJsonType get() const
+ {
+ return *this;
+ }
+
+ /*!
+ @brief get a value (explicit)
+
+ Explicit type conversion between the JSON value and a compatible value
+ which is [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible)
+ and [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible).
+ The value is converted by calling the @ref json_serializer<ValueType>
+ `from_json()` method.
+
+ The function is equivalent to executing
+ @code {.cpp}
+ ValueType ret;
+ JSONSerializer<ValueType>::from_json(*this, ret);
+ return ret;
+ @endcode
+
+ This overloads is chosen if:
+ - @a ValueType is not @ref basic_json,
+ - @ref json_serializer<ValueType> has a `from_json()` method of the form
+ `void from_json(const basic_json&, ValueType&)`, and
+ - @ref json_serializer<ValueType> does not have a `from_json()` method of
+ the form `ValueType from_json(const basic_json&)`
+
+ @tparam ValueTypeCV the provided value type
+ @tparam ValueType the returned value type
+
+ @return copy of the JSON value, converted to @a ValueType
+
+ @throw what @ref json_serializer<ValueType> `from_json()` method throws
+
+ @liveexample{The example below shows several conversions from JSON values
+ to other types. There a few things to note: (1) Floating-point numbers can
+ be converted to integers\, (2) A JSON array can be converted to a standard
+ `std::vector<short>`\, (3) A JSON object can be converted to C++
+ associative containers such as `std::unordered_map<std::string\,
+ json>`.,get__ValueType_const}
+
+ @since version 2.1.0
+ */
+ template<typename ValueTypeCV, typename ValueType = detail::uncvref_t<ValueTypeCV>,
+ detail::enable_if_t <
+ not detail::is_basic_json<ValueType>::value and
+ detail::has_from_json<basic_json_t, ValueType>::value and
+ not detail::has_non_default_from_json<basic_json_t, ValueType>::value,
+ int> = 0>
+ ValueType get() const noexcept(noexcept(
+ JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), std::declval<ValueType&>())))
+ {
+ // we cannot static_assert on ValueTypeCV being non-const, because
+ // there is support for get<const basic_json_t>(), which is why we
+ // still need the uncvref
+ static_assert(not std::is_reference<ValueTypeCV>::value,
+ "get() cannot be used with reference types, you might want to use get_ref()");
+ static_assert(std::is_default_constructible<ValueType>::value,
+ "types must be DefaultConstructible when used with get()");
+
+ ValueType ret;
+ JSONSerializer<ValueType>::from_json(*this, ret);
+ return ret;
+ }
+
+ /*!
+ @brief get a value (explicit); special case
+
+ Explicit type conversion between the JSON value and a compatible value
+ which is **not** [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible)
+ and **not** [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible).
+ The value is converted by calling the @ref json_serializer<ValueType>
+ `from_json()` method.
+
+ The function is equivalent to executing
+ @code {.cpp}
+ return JSONSerializer<ValueTypeCV>::from_json(*this);
+ @endcode
+
+ This overloads is chosen if:
+ - @a ValueType is not @ref basic_json and
+ - @ref json_serializer<ValueType> has a `from_json()` method of the form
+ `ValueType from_json(const basic_json&)`
+
+ @note If @ref json_serializer<ValueType> has both overloads of
+ `from_json()`, this one is chosen.
+
+ @tparam ValueTypeCV the provided value type
+ @tparam ValueType the returned value type
+
+ @return copy of the JSON value, converted to @a ValueType
+
+ @throw what @ref json_serializer<ValueType> `from_json()` method throws
+
+ @since version 2.1.0
+ */
+ template<typename ValueTypeCV, typename ValueType = detail::uncvref_t<ValueTypeCV>,
+ detail::enable_if_t<not std::is_same<basic_json_t, ValueType>::value and
+ detail::has_non_default_from_json<basic_json_t, ValueType>::value,
+ int> = 0>
+ ValueType get() const noexcept(noexcept(
+ JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>())))
+ {
+ static_assert(not std::is_reference<ValueTypeCV>::value,
+ "get() cannot be used with reference types, you might want to use get_ref()");
+ return JSONSerializer<ValueType>::from_json(*this);
+ }
+
+ /*!
+ @brief get a value (explicit)
+
+ Explicit type conversion between the JSON value and a compatible value.
+ The value is filled into the input parameter by calling the @ref json_serializer<ValueType>
+ `from_json()` method.
+
+ The function is equivalent to executing
+ @code {.cpp}
+ ValueType v;
+ JSONSerializer<ValueType>::from_json(*this, v);
+ @endcode
+
+ This overloads is chosen if:
+ - @a ValueType is not @ref basic_json,
+ - @ref json_serializer<ValueType> has a `from_json()` method of the form
+ `void from_json(const basic_json&, ValueType&)`, and
+
+ @tparam ValueType the input parameter type.
+
+ @return the input parameter, allowing chaining calls.
+
+ @throw what @ref json_serializer<ValueType> `from_json()` method throws
+
+ @liveexample{The example below shows several conversions from JSON values
+ to other types. There a few things to note: (1) Floating-point numbers can
+ be converted to integers\, (2) A JSON array can be converted to a standard
+ `std::vector<short>`\, (3) A JSON object can be converted to C++
+ associative containers such as `std::unordered_map<std::string\,
+ json>`.,get_to}
+
+ @since version 3.3.0
+ */
+ template<typename ValueType,
+ detail::enable_if_t <
+ not detail::is_basic_json<ValueType>::value and
+ detail::has_from_json<basic_json_t, ValueType>::value,
+ int> = 0>
+ ValueType & get_to(ValueType& v) const noexcept(noexcept(
+ JSONSerializer<ValueType>::from_json(std::declval<const basic_json_t&>(), v)))
+ {
+ JSONSerializer<ValueType>::from_json(*this, v);
+ return v;
+ }
+
+ template <
+ typename T, std::size_t N,
+ typename Array = T (&)[N],
+ detail::enable_if_t <
+ detail::has_from_json<basic_json_t, Array>::value, int > = 0 >
+ Array get_to(T (&v)[N]) const
+ noexcept(noexcept(JSONSerializer<Array>::from_json(
+ std::declval<const basic_json_t&>(), v)))
+ {
+ JSONSerializer<Array>::from_json(*this, v);
+ return v;
+ }
+
+
+ /*!
+ @brief get a pointer value (implicit)
+
+ Implicit pointer access to the internally stored JSON value. No copies are
+ made.
+
+ @warning Writing data to the pointee of the result yields an undefined
+ state.
+
+ @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref
+ object_t, @ref string_t, @ref boolean_t, @ref number_integer_t,
+ @ref number_unsigned_t, or @ref number_float_t. Enforced by a static
+ assertion.
+
+ @return pointer to the internally stored JSON value if the requested
+ pointer type @a PointerType fits to the JSON value; `nullptr` otherwise
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how pointers to internal values of a
+ JSON value can be requested. Note that no type conversions are made and a
+ `nullptr` is returned if the value and the requested pointer type does not
+ match.,get_ptr}
+
+ @since version 1.0.0
+ */
+ template<typename PointerType, typename std::enable_if<
+ std::is_pointer<PointerType>::value, int>::type = 0>
+ auto get_ptr() noexcept -> decltype(std::declval<basic_json_t&>().get_impl_ptr(std::declval<PointerType>()))
+ {
+ // delegate the call to get_impl_ptr<>()
+ return get_impl_ptr(static_cast<PointerType>(nullptr));
+ }
+
+ /*!
+ @brief get a pointer value (implicit)
+ @copydoc get_ptr()
+ */
+ template<typename PointerType, typename std::enable_if<
+ std::is_pointer<PointerType>::value and
+ std::is_const<typename std::remove_pointer<PointerType>::type>::value, int>::type = 0>
+ constexpr auto get_ptr() const noexcept -> decltype(std::declval<const basic_json_t&>().get_impl_ptr(std::declval<PointerType>()))
+ {
+ // delegate the call to get_impl_ptr<>() const
+ return get_impl_ptr(static_cast<PointerType>(nullptr));
+ }
+
+ /*!
+ @brief get a pointer value (explicit)
+
+ Explicit pointer access to the internally stored JSON value. No copies are
+ made.
+
+ @warning The pointer becomes invalid if the underlying JSON object
+ changes.
+
+ @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref
+ object_t, @ref string_t, @ref boolean_t, @ref number_integer_t,
+ @ref number_unsigned_t, or @ref number_float_t.
+
+ @return pointer to the internally stored JSON value if the requested
+ pointer type @a PointerType fits to the JSON value; `nullptr` otherwise
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how pointers to internal values of a
+ JSON value can be requested. Note that no type conversions are made and a
+ `nullptr` is returned if the value and the requested pointer type does not
+ match.,get__PointerType}
+
+ @sa @ref get_ptr() for explicit pointer-member access
+
+ @since version 1.0.0
+ */
+ template<typename PointerType, typename std::enable_if<
+ std::is_pointer<PointerType>::value, int>::type = 0>
+ auto get() noexcept -> decltype(std::declval<basic_json_t&>().template get_ptr<PointerType>())
+ {
+ // delegate the call to get_ptr
+ return get_ptr<PointerType>();
+ }
+
+ /*!
+ @brief get a pointer value (explicit)
+ @copydoc get()
+ */
+ template<typename PointerType, typename std::enable_if<
+ std::is_pointer<PointerType>::value, int>::type = 0>
+ constexpr auto get() const noexcept -> decltype(std::declval<const basic_json_t&>().template get_ptr<PointerType>())
+ {
+ // delegate the call to get_ptr
+ return get_ptr<PointerType>();
+ }
+
+ /*!
+ @brief get a reference value (implicit)
+
+ Implicit reference access to the internally stored JSON value. No copies
+ are made.
+
+ @warning Writing data to the referee of the result yields an undefined
+ state.
+
+ @tparam ReferenceType reference type; must be a reference to @ref array_t,
+ @ref object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or
+ @ref number_float_t. Enforced by static assertion.
+
+ @return reference to the internally stored JSON value if the requested
+ reference type @a ReferenceType fits to the JSON value; throws
+ type_error.303 otherwise
+
+ @throw type_error.303 in case passed type @a ReferenceType is incompatible
+ with the stored JSON value; see example below
+
+ @complexity Constant.
+
+ @liveexample{The example shows several calls to `get_ref()`.,get_ref}
+
+ @since version 1.1.0
+ */
+ template<typename ReferenceType, typename std::enable_if<
+ std::is_reference<ReferenceType>::value, int>::type = 0>
+ ReferenceType get_ref()
+ {
+ // delegate call to get_ref_impl
+ return get_ref_impl<ReferenceType>(*this);
+ }
+
+ /*!
+ @brief get a reference value (implicit)
+ @copydoc get_ref()
+ */
+ template<typename ReferenceType, typename std::enable_if<
+ std::is_reference<ReferenceType>::value and
+ std::is_const<typename std::remove_reference<ReferenceType>::type>::value, int>::type = 0>
+ ReferenceType get_ref() const
+ {
+ // delegate call to get_ref_impl
+ return get_ref_impl<ReferenceType>(*this);
+ }
+
+ /*!
+ @brief get a value (implicit)
+
+ Implicit type conversion between the JSON value and a compatible value.
+ The call is realized by calling @ref get() const.
+
+ @tparam ValueType non-pointer type compatible to the JSON value, for
+ instance `int` for JSON integer numbers, `bool` for JSON booleans, or
+ `std::vector` types for JSON arrays. The character type of @ref string_t
+ as well as an initializer list of this type is excluded to avoid
+ ambiguities as these types implicitly convert to `std::string`.
+
+ @return copy of the JSON value, converted to type @a ValueType
+
+ @throw type_error.302 in case passed type @a ValueType is incompatible
+ to the JSON value type (e.g., the JSON value is of type boolean, but a
+ string is requested); see example below
+
+ @complexity Linear in the size of the JSON value.
+
+ @liveexample{The example below shows several conversions from JSON values
+ to other types. There a few things to note: (1) Floating-point numbers can
+ be converted to integers\, (2) A JSON array can be converted to a standard
+ `std::vector<short>`\, (3) A JSON object can be converted to C++
+ associative containers such as `std::unordered_map<std::string\,
+ json>`.,operator__ValueType}
+
+ @since version 1.0.0
+ */
+ template < typename ValueType, typename std::enable_if <
+ not std::is_pointer<ValueType>::value and
+ not std::is_same<ValueType, detail::json_ref<basic_json>>::value and
+ not std::is_same<ValueType, typename string_t::value_type>::value and
+ not detail::is_basic_json<ValueType>::value
+ and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value
+#if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) and _MSC_VER >= 1910 and _MSC_VER <= 1914))
+ and not std::is_same<ValueType, typename std::string_view>::value
+#endif
+ and detail::is_detected<detail::get_template_function, const basic_json_t&, ValueType>::value
+ , int >::type = 0 >
+ operator ValueType() const
+ {
+ // delegate the call to get<>() const
+ return get<ValueType>();
+ }
+
+ /*!
+ @return reference to the binary value
+
+ @throw type_error.302 if the value is not binary
+
+ @sa @ref is_binary() to check if the value is binary
+
+ @since version 3.8.0
+ */
+ binary_t& get_binary()
+ {
+ if (not is_binary())
+ {
+ JSON_THROW(type_error::create(302, "type must be binary, but is " + std::string(type_name())));
+ }
+
+ return *get_ptr<binary_t*>();
+ }
+
+ /// @copydoc get_binary()
+ const binary_t& get_binary() const
+ {
+ if (not is_binary())
+ {
+ JSON_THROW(type_error::create(302, "type must be binary, but is " + std::string(type_name())));
+ }
+
+ return *get_ptr<const binary_t*>();
+ }
+
+ /// @}
+
+
+ ////////////////////
+ // element access //
+ ////////////////////
+
+ /// @name element access
+ /// Access to the JSON value.
+ /// @{
+
+ /*!
+ @brief access specified array element with bounds checking
+
+ Returns a reference to the element at specified location @a idx, with
+ bounds checking.
+
+ @param[in] idx index of the element to access
+
+ @return reference to the element at index @a idx
+
+ @throw type_error.304 if the JSON value is not an array; in this case,
+ calling `at` with an index makes no sense. See example below.
+ @throw out_of_range.401 if the index @a idx is out of range of the array;
+ that is, `idx >= size()`. See example below.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Constant.
+
+ @since version 1.0.0
+
+ @liveexample{The example below shows how array elements can be read and
+ written using `at()`. It also demonstrates the different exceptions that
+ can be thrown.,at__size_type}
+ */
+ reference at(size_type idx)
+ {
+ // at only works for arrays
+ if (JSON_HEDLEY_LIKELY(is_array()))
+ {
+ JSON_TRY
+ {
+ return m_value.array->at(idx);
+ }
+ JSON_CATCH (std::out_of_range&)
+ {
+ // create better exception explanation
+ JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range"));
+ }
+ }
+ else
+ {
+ JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name())));
+ }
+ }
+
+ /*!
+ @brief access specified array element with bounds checking
+
+ Returns a const reference to the element at specified location @a idx,
+ with bounds checking.
+
+ @param[in] idx index of the element to access
+
+ @return const reference to the element at index @a idx
+
+ @throw type_error.304 if the JSON value is not an array; in this case,
+ calling `at` with an index makes no sense. See example below.
+ @throw out_of_range.401 if the index @a idx is out of range of the array;
+ that is, `idx >= size()`. See example below.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Constant.
+
+ @since version 1.0.0
+
+ @liveexample{The example below shows how array elements can be read using
+ `at()`. It also demonstrates the different exceptions that can be thrown.,
+ at__size_type_const}
+ */
+ const_reference at(size_type idx) const
+ {
+ // at only works for arrays
+ if (JSON_HEDLEY_LIKELY(is_array()))
+ {
+ JSON_TRY
+ {
+ return m_value.array->at(idx);
+ }
+ JSON_CATCH (std::out_of_range&)
+ {
+ // create better exception explanation
+ JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range"));
+ }
+ }
+ else
+ {
+ JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name())));
+ }
+ }
+
+ /*!
+ @brief access specified object element with bounds checking
+
+ Returns a reference to the element at with specified key @a key, with
+ bounds checking.
+
+ @param[in] key key of the element to access
+
+ @return reference to the element at key @a key
+
+ @throw type_error.304 if the JSON value is not an object; in this case,
+ calling `at` with a key makes no sense. See example below.
+ @throw out_of_range.403 if the key @a key is is not stored in the object;
+ that is, `find(key) == end()`. See example below.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Logarithmic in the size of the container.
+
+ @sa @ref operator[](const typename object_t::key_type&) for unchecked
+ access by reference
+ @sa @ref value() for access by value with a default value
+
+ @since version 1.0.0
+
+ @liveexample{The example below shows how object elements can be read and
+ written using `at()`. It also demonstrates the different exceptions that
+ can be thrown.,at__object_t_key_type}
+ */
+ reference at(const typename object_t::key_type& key)
+ {
+ // at only works for objects
+ if (JSON_HEDLEY_LIKELY(is_object()))
+ {
+ JSON_TRY
+ {
+ return m_value.object->at(key);
+ }
+ JSON_CATCH (std::out_of_range&)
+ {
+ // create better exception explanation
+ JSON_THROW(out_of_range::create(403, "key '" + key + "' not found"));
+ }
+ }
+ else
+ {
+ JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name())));
+ }
+ }
+
+ /*!
+ @brief access specified object element with bounds checking
+
+ Returns a const reference to the element at with specified key @a key,
+ with bounds checking.
+
+ @param[in] key key of the element to access
+
+ @return const reference to the element at key @a key
+
+ @throw type_error.304 if the JSON value is not an object; in this case,
+ calling `at` with a key makes no sense. See example below.
+ @throw out_of_range.403 if the key @a key is is not stored in the object;
+ that is, `find(key) == end()`. See example below.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Logarithmic in the size of the container.
+
+ @sa @ref operator[](const typename object_t::key_type&) for unchecked
+ access by reference
+ @sa @ref value() for access by value with a default value
+
+ @since version 1.0.0
+
+ @liveexample{The example below shows how object elements can be read using
+ `at()`. It also demonstrates the different exceptions that can be thrown.,
+ at__object_t_key_type_const}
+ */
+ const_reference at(const typename object_t::key_type& key) const
+ {
+ // at only works for objects
+ if (JSON_HEDLEY_LIKELY(is_object()))
+ {
+ JSON_TRY
+ {
+ return m_value.object->at(key);
+ }
+ JSON_CATCH (std::out_of_range&)
+ {
+ // create better exception explanation
+ JSON_THROW(out_of_range::create(403, "key '" + key + "' not found"));
+ }
+ }
+ else
+ {
+ JSON_THROW(type_error::create(304, "cannot use at() with " + std::string(type_name())));
+ }
+ }
+
+ /*!
+ @brief access specified array element
+
+ Returns a reference to the element at specified location @a idx.
+
+ @note If @a idx is beyond the range of the array (i.e., `idx >= size()`),
+ then the array is silently filled up with `null` values to make `idx` a
+ valid reference to the last stored element.
+
+ @param[in] idx index of the element to access
+
+ @return reference to the element at index @a idx
+
+ @throw type_error.305 if the JSON value is not an array or null; in that
+ cases, using the [] operator with an index makes no sense.
+
+ @complexity Constant if @a idx is in the range of the array. Otherwise
+ linear in `idx - size()`.
+
+ @liveexample{The example below shows how array elements can be read and
+ written using `[]` operator. Note the addition of `null`
+ values.,operatorarray__size_type}
+
+ @since version 1.0.0
+ */
+ reference operator[](size_type idx)
+ {
+ // implicitly convert null value to an empty array
+ if (is_null())
+ {
+ m_type = value_t::array;
+ m_value.array = create<array_t>();
+ assert_invariant();
+ }
+
+ // operator[] only works for arrays
+ if (JSON_HEDLEY_LIKELY(is_array()))
+ {
+ // fill up array with null values if given idx is outside range
+ if (idx >= m_value.array->size())
+ {
+ m_value.array->insert(m_value.array->end(),
+ idx - m_value.array->size() + 1,
+ basic_json());
+ }
+
+ return m_value.array->operator[](idx);
+ }
+
+ JSON_THROW(type_error::create(305, "cannot use operator[] with a numeric argument with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief access specified array element
+
+ Returns a const reference to the element at specified location @a idx.
+
+ @param[in] idx index of the element to access
+
+ @return const reference to the element at index @a idx
+
+ @throw type_error.305 if the JSON value is not an array; in that case,
+ using the [] operator with an index makes no sense.
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how array elements can be read using
+ the `[]` operator.,operatorarray__size_type_const}
+
+ @since version 1.0.0
+ */
+ const_reference operator[](size_type idx) const
+ {
+ // const operator[] only works for arrays
+ if (JSON_HEDLEY_LIKELY(is_array()))
+ {
+ return m_value.array->operator[](idx);
+ }
+
+ JSON_THROW(type_error::create(305, "cannot use operator[] with a numeric argument with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief access specified object element
+
+ Returns a reference to the element at with specified key @a key.
+
+ @note If @a key is not found in the object, then it is silently added to
+ the object and filled with a `null` value to make `key` a valid reference.
+ In case the value was `null` before, it is converted to an object.
+
+ @param[in] key key of the element to access
+
+ @return reference to the element at key @a key
+
+ @throw type_error.305 if the JSON value is not an object or null; in that
+ cases, using the [] operator with a key makes no sense.
+
+ @complexity Logarithmic in the size of the container.
+
+ @liveexample{The example below shows how object elements can be read and
+ written using the `[]` operator.,operatorarray__key_type}
+
+ @sa @ref at(const typename object_t::key_type&) for access by reference
+ with range checking
+ @sa @ref value() for access by value with a default value
+
+ @since version 1.0.0
+ */
+ reference operator[](const typename object_t::key_type& key)
+ {
+ // implicitly convert null value to an empty object
+ if (is_null())
+ {
+ m_type = value_t::object;
+ m_value.object = create<object_t>();
+ assert_invariant();
+ }
+
+ // operator[] only works for objects
+ if (JSON_HEDLEY_LIKELY(is_object()))
+ {
+ return m_value.object->operator[](key);
+ }
+
+ JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief read-only access specified object element
+
+ Returns a const reference to the element at with specified key @a key. No
+ bounds checking is performed.
+
+ @warning If the element with key @a key does not exist, the behavior is
+ undefined.
+
+ @param[in] key key of the element to access
+
+ @return const reference to the element at key @a key
+
+ @pre The element with key @a key must exist. **This precondition is
+ enforced with an assertion.**
+
+ @throw type_error.305 if the JSON value is not an object; in that case,
+ using the [] operator with a key makes no sense.
+
+ @complexity Logarithmic in the size of the container.
+
+ @liveexample{The example below shows how object elements can be read using
+ the `[]` operator.,operatorarray__key_type_const}
+
+ @sa @ref at(const typename object_t::key_type&) for access by reference
+ with range checking
+ @sa @ref value() for access by value with a default value
+
+ @since version 1.0.0
+ */
+ const_reference operator[](const typename object_t::key_type& key) const
+ {
+ // const operator[] only works for objects
+ if (JSON_HEDLEY_LIKELY(is_object()))
+ {
+ assert(m_value.object->find(key) != m_value.object->end());
+ return m_value.object->find(key)->second;
+ }
+
+ JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief access specified object element
+
+ Returns a reference to the element at with specified key @a key.
+
+ @note If @a key is not found in the object, then it is silently added to
+ the object and filled with a `null` value to make `key` a valid reference.
+ In case the value was `null` before, it is converted to an object.
+
+ @param[in] key key of the element to access
+
+ @return reference to the element at key @a key
+
+ @throw type_error.305 if the JSON value is not an object or null; in that
+ cases, using the [] operator with a key makes no sense.
+
+ @complexity Logarithmic in the size of the container.
+
+ @liveexample{The example below shows how object elements can be read and
+ written using the `[]` operator.,operatorarray__key_type}
+
+ @sa @ref at(const typename object_t::key_type&) for access by reference
+ with range checking
+ @sa @ref value() for access by value with a default value
+
+ @since version 1.1.0
+ */
+ template<typename T>
+ JSON_HEDLEY_NON_NULL(2)
+ reference operator[](T* key)
+ {
+ // implicitly convert null to object
+ if (is_null())
+ {
+ m_type = value_t::object;
+ m_value = value_t::object;
+ assert_invariant();
+ }
+
+ // at only works for objects
+ if (JSON_HEDLEY_LIKELY(is_object()))
+ {
+ return m_value.object->operator[](key);
+ }
+
+ JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief read-only access specified object element
+
+ Returns a const reference to the element at with specified key @a key. No
+ bounds checking is performed.
+
+ @warning If the element with key @a key does not exist, the behavior is
+ undefined.
+
+ @param[in] key key of the element to access
+
+ @return const reference to the element at key @a key
+
+ @pre The element with key @a key must exist. **This precondition is
+ enforced with an assertion.**
+
+ @throw type_error.305 if the JSON value is not an object; in that case,
+ using the [] operator with a key makes no sense.
+
+ @complexity Logarithmic in the size of the container.
+
+ @liveexample{The example below shows how object elements can be read using
+ the `[]` operator.,operatorarray__key_type_const}
+
+ @sa @ref at(const typename object_t::key_type&) for access by reference
+ with range checking
+ @sa @ref value() for access by value with a default value
+
+ @since version 1.1.0
+ */
+ template<typename T>
+ JSON_HEDLEY_NON_NULL(2)
+ const_reference operator[](T* key) const
+ {
+ // at only works for objects
+ if (JSON_HEDLEY_LIKELY(is_object()))
+ {
+ assert(m_value.object->find(key) != m_value.object->end());
+ return m_value.object->find(key)->second;
+ }
+
+ JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief access specified object element with default value
+
+ Returns either a copy of an object's element at the specified key @a key
+ or a given default value if no element with key @a key exists.
+
+ The function is basically equivalent to executing
+ @code {.cpp}
+ try {
+ return at(key);
+ } catch(out_of_range) {
+ return default_value;
+ }
+ @endcode
+
+ @note Unlike @ref at(const typename object_t::key_type&), this function
+ does not throw if the given key @a key was not found.
+
+ @note Unlike @ref operator[](const typename object_t::key_type& key), this
+ function does not implicitly add an element to the position defined by @a
+ key. This function is furthermore also applicable to const objects.
+
+ @param[in] key key of the element to access
+ @param[in] default_value the value to return if @a key is not found
+
+ @tparam ValueType type compatible to JSON values, for instance `int` for
+ JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for
+ JSON arrays. Note the type of the expected value at @a key and the default
+ value @a default_value must be compatible.
+
+ @return copy of the element at key @a key or @a default_value if @a key
+ is not found
+
+ @throw type_error.302 if @a default_value does not match the type of the
+ value at @a key
+ @throw type_error.306 if the JSON value is not an object; in that case,
+ using `value()` with a key makes no sense.
+
+ @complexity Logarithmic in the size of the container.
+
+ @liveexample{The example below shows how object elements can be queried
+ with a default value.,basic_json__value}
+
+ @sa @ref at(const typename object_t::key_type&) for access by reference
+ with range checking
+ @sa @ref operator[](const typename object_t::key_type&) for unchecked
+ access by reference
+
+ @since version 1.0.0
+ */
+ template<class ValueType, typename std::enable_if<
+ std::is_convertible<basic_json_t, ValueType>::value
+ and not std::is_same<value_t, ValueType>::value, int>::type = 0>
+ ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const
+ {
+ // at only works for objects
+ if (JSON_HEDLEY_LIKELY(is_object()))
+ {
+ // if key is found, return value and given default value otherwise
+ const auto it = find(key);
+ if (it != end())
+ {
+ return *it;
+ }
+
+ return default_value;
+ }
+
+ JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief overload for a default value of type const char*
+ @copydoc basic_json::value(const typename object_t::key_type&, const ValueType&) const
+ */
+ string_t value(const typename object_t::key_type& key, const char* default_value) const
+ {
+ return value(key, string_t(default_value));
+ }
+
+ /*!
+ @brief access specified object element via JSON Pointer with default value
+
+ Returns either a copy of an object's element at the specified key @a key
+ or a given default value if no element with key @a key exists.
+
+ The function is basically equivalent to executing
+ @code {.cpp}
+ try {
+ return at(ptr);
+ } catch(out_of_range) {
+ return default_value;
+ }
+ @endcode
+
+ @note Unlike @ref at(const json_pointer&), this function does not throw
+ if the given key @a key was not found.
+
+ @param[in] ptr a JSON pointer to the element to access
+ @param[in] default_value the value to return if @a ptr found no value
+
+ @tparam ValueType type compatible to JSON values, for instance `int` for
+ JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for
+ JSON arrays. Note the type of the expected value at @a key and the default
+ value @a default_value must be compatible.
+
+ @return copy of the element at key @a key or @a default_value if @a key
+ is not found
+
+ @throw type_error.302 if @a default_value does not match the type of the
+ value at @a ptr
+ @throw type_error.306 if the JSON value is not an object; in that case,
+ using `value()` with a key makes no sense.
+
+ @complexity Logarithmic in the size of the container.
+
+ @liveexample{The example below shows how object elements can be queried
+ with a default value.,basic_json__value_ptr}
+
+ @sa @ref operator[](const json_pointer&) for unchecked access by reference
+
+ @since version 2.0.2
+ */
+ template<class ValueType, typename std::enable_if<
+ std::is_convertible<basic_json_t, ValueType>::value, int>::type = 0>
+ ValueType value(const json_pointer& ptr, const ValueType& default_value) const
+ {
+ // at only works for objects
+ if (JSON_HEDLEY_LIKELY(is_object()))
+ {
+ // if pointer resolves a value, return it or use default value
+ JSON_TRY
+ {
+ return ptr.get_checked(this);
+ }
+ JSON_INTERNAL_CATCH (out_of_range&)
+ {
+ return default_value;
+ }
+ }
+
+ JSON_THROW(type_error::create(306, "cannot use value() with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief overload for a default value of type const char*
+ @copydoc basic_json::value(const json_pointer&, ValueType) const
+ */
+ JSON_HEDLEY_NON_NULL(3)
+ string_t value(const json_pointer& ptr, const char* default_value) const
+ {
+ return value(ptr, string_t(default_value));
+ }
+
+ /*!
+ @brief access the first element
+
+ Returns a reference to the first element in the container. For a JSON
+ container `c`, the expression `c.front()` is equivalent to `*c.begin()`.
+
+ @return In case of a structured type (array or object), a reference to the
+ first element is returned. In case of number, string, boolean, or binary
+ values, a reference to the value is returned.
+
+ @complexity Constant.
+
+ @pre The JSON value must not be `null` (would throw `std::out_of_range`)
+ or an empty array or object (undefined behavior, **guarded by
+ assertions**).
+ @post The JSON value remains unchanged.
+
+ @throw invalid_iterator.214 when called on `null` value
+
+ @liveexample{The following code shows an example for `front()`.,front}
+
+ @sa @ref back() -- access the last element
+
+ @since version 1.0.0
+ */
+ reference front()
+ {
+ return *begin();
+ }
+
+ /*!
+ @copydoc basic_json::front()
+ */
+ const_reference front() const
+ {
+ return *cbegin();
+ }
+
+ /*!
+ @brief access the last element
+
+ Returns a reference to the last element in the container. For a JSON
+ container `c`, the expression `c.back()` is equivalent to
+ @code {.cpp}
+ auto tmp = c.end();
+ --tmp;
+ return *tmp;
+ @endcode
+
+ @return In case of a structured type (array or object), a reference to the
+ last element is returned. In case of number, string, boolean, or binary
+ values, a reference to the value is returned.
+
+ @complexity Constant.
+
+ @pre The JSON value must not be `null` (would throw `std::out_of_range`)
+ or an empty array or object (undefined behavior, **guarded by
+ assertions**).
+ @post The JSON value remains unchanged.
+
+ @throw invalid_iterator.214 when called on a `null` value. See example
+ below.
+
+ @liveexample{The following code shows an example for `back()`.,back}
+
+ @sa @ref front() -- access the first element
+
+ @since version 1.0.0
+ */
+ reference back()
+ {
+ auto tmp = end();
+ --tmp;
+ return *tmp;
+ }
+
+ /*!
+ @copydoc basic_json::back()
+ */
+ const_reference back() const
+ {
+ auto tmp = cend();
+ --tmp;
+ return *tmp;
+ }
+
+ /*!
+ @brief remove element given an iterator
+
+ Removes the element specified by iterator @a pos. The iterator @a pos must
+ be valid and dereferenceable. Thus the `end()` iterator (which is valid,
+ but is not dereferenceable) cannot be used as a value for @a pos.
+
+ If called on a primitive type other than `null`, the resulting JSON value
+ will be `null`.
+
+ @param[in] pos iterator to the element to remove
+ @return Iterator following the last removed element. If the iterator @a
+ pos refers to the last element, the `end()` iterator is returned.
+
+ @tparam IteratorType an @ref iterator or @ref const_iterator
+
+ @post Invalidates iterators and references at or after the point of the
+ erase, including the `end()` iterator.
+
+ @throw type_error.307 if called on a `null` value; example: `"cannot use
+ erase() with null"`
+ @throw invalid_iterator.202 if called on an iterator which does not belong
+ to the current JSON value; example: `"iterator does not fit current
+ value"`
+ @throw invalid_iterator.205 if called on a primitive type with invalid
+ iterator (i.e., any iterator which is not `begin()`); example: `"iterator
+ out of range"`
+
+ @complexity The complexity depends on the type:
+ - objects: amortized constant
+ - arrays: linear in distance between @a pos and the end of the container
+ - strings and binary: linear in the length of the member
+ - other types: constant
+
+ @liveexample{The example shows the result of `erase()` for different JSON
+ types.,erase__IteratorType}
+
+ @sa @ref erase(IteratorType, IteratorType) -- removes the elements in
+ the given range
+ @sa @ref erase(const typename object_t::key_type&) -- removes the element
+ from an object at the given key
+ @sa @ref erase(const size_type) -- removes the element from an array at
+ the given index
+
+ @since version 1.0.0
+ */
+ template<class IteratorType, typename std::enable_if<
+ std::is_same<IteratorType, typename basic_json_t::iterator>::value or
+ std::is_same<IteratorType, typename basic_json_t::const_iterator>::value, int>::type
+ = 0>
+ IteratorType erase(IteratorType pos)
+ {
+ // make sure iterator fits the current value
+ if (JSON_HEDLEY_UNLIKELY(this != pos.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
+ }
+
+ IteratorType result = end();
+
+ switch (m_type)
+ {
+ case value_t::boolean:
+ case value_t::number_float:
+ case value_t::number_integer:
+ case value_t::number_unsigned:
+ case value_t::string:
+ case value_t::binary:
+ {
+ if (JSON_HEDLEY_UNLIKELY(not pos.m_it.primitive_iterator.is_begin()))
+ {
+ JSON_THROW(invalid_iterator::create(205, "iterator out of range"));
+ }
+
+ if (is_string())
+ {
+ AllocatorType<string_t> alloc;
+ std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.string);
+ std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.string, 1);
+ m_value.string = nullptr;
+ }
+ else if (is_binary())
+ {
+ AllocatorType<binary_t> alloc;
+ std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.binary);
+ std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.binary, 1);
+ m_value.binary = nullptr;
+ }
+
+ m_type = value_t::null;
+ assert_invariant();
+ break;
+ }
+
+ case value_t::object:
+ {
+ result.m_it.object_iterator = m_value.object->erase(pos.m_it.object_iterator);
+ break;
+ }
+
+ case value_t::array:
+ {
+ result.m_it.array_iterator = m_value.array->erase(pos.m_it.array_iterator);
+ break;
+ }
+
+ default:
+ JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name())));
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief remove elements given an iterator range
+
+ Removes the element specified by the range `[first; last)`. The iterator
+ @a first does not need to be dereferenceable if `first == last`: erasing
+ an empty range is a no-op.
+
+ If called on a primitive type other than `null`, the resulting JSON value
+ will be `null`.
+
+ @param[in] first iterator to the beginning of the range to remove
+ @param[in] last iterator past the end of the range to remove
+ @return Iterator following the last removed element. If the iterator @a
+ second refers to the last element, the `end()` iterator is returned.
+
+ @tparam IteratorType an @ref iterator or @ref const_iterator
+
+ @post Invalidates iterators and references at or after the point of the
+ erase, including the `end()` iterator.
+
+ @throw type_error.307 if called on a `null` value; example: `"cannot use
+ erase() with null"`
+ @throw invalid_iterator.203 if called on iterators which does not belong
+ to the current JSON value; example: `"iterators do not fit current value"`
+ @throw invalid_iterator.204 if called on a primitive type with invalid
+ iterators (i.e., if `first != begin()` and `last != end()`); example:
+ `"iterators out of range"`
+
+ @complexity The complexity depends on the type:
+ - objects: `log(size()) + std::distance(first, last)`
+ - arrays: linear in the distance between @a first and @a last, plus linear
+ in the distance between @a last and end of the container
+ - strings and binary: linear in the length of the member
+ - other types: constant
+
+ @liveexample{The example shows the result of `erase()` for different JSON
+ types.,erase__IteratorType_IteratorType}
+
+ @sa @ref erase(IteratorType) -- removes the element at a given position
+ @sa @ref erase(const typename object_t::key_type&) -- removes the element
+ from an object at the given key
+ @sa @ref erase(const size_type) -- removes the element from an array at
+ the given index
+
+ @since version 1.0.0
+ */
+ template<class IteratorType, typename std::enable_if<
+ std::is_same<IteratorType, typename basic_json_t::iterator>::value or
+ std::is_same<IteratorType, typename basic_json_t::const_iterator>::value, int>::type
+ = 0>
+ IteratorType erase(IteratorType first, IteratorType last)
+ {
+ // make sure iterator fits the current value
+ if (JSON_HEDLEY_UNLIKELY(this != first.m_object or this != last.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(203, "iterators do not fit current value"));
+ }
+
+ IteratorType result = end();
+
+ switch (m_type)
+ {
+ case value_t::boolean:
+ case value_t::number_float:
+ case value_t::number_integer:
+ case value_t::number_unsigned:
+ case value_t::string:
+ case value_t::binary:
+ {
+ if (JSON_HEDLEY_LIKELY(not first.m_it.primitive_iterator.is_begin()
+ or not last.m_it.primitive_iterator.is_end()))
+ {
+ JSON_THROW(invalid_iterator::create(204, "iterators out of range"));
+ }
+
+ if (is_string())
+ {
+ AllocatorType<string_t> alloc;
+ std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.string);
+ std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.string, 1);
+ m_value.string = nullptr;
+ }
+ else if (is_binary())
+ {
+ AllocatorType<binary_t> alloc;
+ std::allocator_traits<decltype(alloc)>::destroy(alloc, m_value.binary);
+ std::allocator_traits<decltype(alloc)>::deallocate(alloc, m_value.binary, 1);
+ m_value.binary = nullptr;
+ }
+
+ m_type = value_t::null;
+ assert_invariant();
+ break;
+ }
+
+ case value_t::object:
+ {
+ result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator,
+ last.m_it.object_iterator);
+ break;
+ }
+
+ case value_t::array:
+ {
+ result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator,
+ last.m_it.array_iterator);
+ break;
+ }
+
+ default:
+ JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name())));
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief remove element from a JSON object given a key
+
+ Removes elements from a JSON object with the key value @a key.
+
+ @param[in] key value of the elements to remove
+
+ @return Number of elements removed. If @a ObjectType is the default
+ `std::map` type, the return value will always be `0` (@a key was not
+ found) or `1` (@a key was found).
+
+ @post References and iterators to the erased elements are invalidated.
+ Other references and iterators are not affected.
+
+ @throw type_error.307 when called on a type other than JSON object;
+ example: `"cannot use erase() with null"`
+
+ @complexity `log(size()) + count(key)`
+
+ @liveexample{The example shows the effect of `erase()`.,erase__key_type}
+
+ @sa @ref erase(IteratorType) -- removes the element at a given position
+ @sa @ref erase(IteratorType, IteratorType) -- removes the elements in
+ the given range
+ @sa @ref erase(const size_type) -- removes the element from an array at
+ the given index
+
+ @since version 1.0.0
+ */
+ size_type erase(const typename object_t::key_type& key)
+ {
+ // this erase only works for objects
+ if (JSON_HEDLEY_LIKELY(is_object()))
+ {
+ return m_value.object->erase(key);
+ }
+
+ JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief remove element from a JSON array given an index
+
+ Removes element from a JSON array at the index @a idx.
+
+ @param[in] idx index of the element to remove
+
+ @throw type_error.307 when called on a type other than JSON object;
+ example: `"cannot use erase() with null"`
+ @throw out_of_range.401 when `idx >= size()`; example: `"array index 17
+ is out of range"`
+
+ @complexity Linear in distance between @a idx and the end of the container.
+
+ @liveexample{The example shows the effect of `erase()`.,erase__size_type}
+
+ @sa @ref erase(IteratorType) -- removes the element at a given position
+ @sa @ref erase(IteratorType, IteratorType) -- removes the elements in
+ the given range
+ @sa @ref erase(const typename object_t::key_type&) -- removes the element
+ from an object at the given key
+
+ @since version 1.0.0
+ */
+ void erase(const size_type idx)
+ {
+ // this erase only works for arrays
+ if (JSON_HEDLEY_LIKELY(is_array()))
+ {
+ if (JSON_HEDLEY_UNLIKELY(idx >= size()))
+ {
+ JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range"));
+ }
+
+ m_value.array->erase(m_value.array->begin() + static_cast<difference_type>(idx));
+ }
+ else
+ {
+ JSON_THROW(type_error::create(307, "cannot use erase() with " + std::string(type_name())));
+ }
+ }
+
+ /// @}
+
+
+ ////////////
+ // lookup //
+ ////////////
+
+ /// @name lookup
+ /// @{
+
+ /*!
+ @brief find an element in a JSON object
+
+ Finds an element in a JSON object with key equivalent to @a key. If the
+ element is not found or the JSON value is not an object, end() is
+ returned.
+
+ @note This method always returns @ref end() when executed on a JSON type
+ that is not an object.
+
+ @param[in] key key value of the element to search for.
+
+ @return Iterator to an element with key equivalent to @a key. If no such
+ element is found or the JSON value is not an object, past-the-end (see
+ @ref end()) iterator is returned.
+
+ @complexity Logarithmic in the size of the JSON object.
+
+ @liveexample{The example shows how `find()` is used.,find__key_type}
+
+ @sa @ref contains(KeyT&&) const -- checks whether a key exists
+
+ @since version 1.0.0
+ */
+ template<typename KeyT>
+ iterator find(KeyT&& key)
+ {
+ auto result = end();
+
+ if (is_object())
+ {
+ result.m_it.object_iterator = m_value.object->find(std::forward<KeyT>(key));
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief find an element in a JSON object
+ @copydoc find(KeyT&&)
+ */
+ template<typename KeyT>
+ const_iterator find(KeyT&& key) const
+ {
+ auto result = cend();
+
+ if (is_object())
+ {
+ result.m_it.object_iterator = m_value.object->find(std::forward<KeyT>(key));
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief returns the number of occurrences of a key in a JSON object
+
+ Returns the number of elements with key @a key. If ObjectType is the
+ default `std::map` type, the return value will always be `0` (@a key was
+ not found) or `1` (@a key was found).
+
+ @note This method always returns `0` when executed on a JSON type that is
+ not an object.
+
+ @param[in] key key value of the element to count
+
+ @return Number of elements with key @a key. If the JSON value is not an
+ object, the return value will be `0`.
+
+ @complexity Logarithmic in the size of the JSON object.
+
+ @liveexample{The example shows how `count()` is used.,count}
+
+ @since version 1.0.0
+ */
+ template<typename KeyT>
+ size_type count(KeyT&& key) const
+ {
+ // return 0 for all nonobject types
+ return is_object() ? m_value.object->count(std::forward<KeyT>(key)) : 0;
+ }
+
+ /*!
+ @brief check the existence of an element in a JSON object
+
+ Check whether an element exists in a JSON object with key equivalent to
+ @a key. If the element is not found or the JSON value is not an object,
+ false is returned.
+
+ @note This method always returns false when executed on a JSON type
+ that is not an object.
+
+ @param[in] key key value to check its existence.
+
+ @return true if an element with specified @a key exists. If no such
+ element with such key is found or the JSON value is not an object,
+ false is returned.
+
+ @complexity Logarithmic in the size of the JSON object.
+
+ @liveexample{The following code shows an example for `contains()`.,contains}
+
+ @sa @ref find(KeyT&&) -- returns an iterator to an object element
+ @sa @ref contains(const json_pointer&) const -- checks the existence for a JSON pointer
+
+ @since version 3.6.0
+ */
+ template<typename KeyT, typename std::enable_if<
+ not std::is_same<typename std::decay<KeyT>::type, json_pointer>::value, int>::type = 0>
+ bool contains(KeyT && key) const
+ {
+ return is_object() and m_value.object->find(std::forward<KeyT>(key)) != m_value.object->end();
+ }
+
+ /*!
+ @brief check the existence of an element in a JSON object given a JSON pointer
+
+ Check whether the given JSON pointer @a ptr can be resolved in the current
+ JSON value.
+
+ @note This method can be executed on any JSON value type.
+
+ @param[in] ptr JSON pointer to check its existence.
+
+ @return true if the JSON pointer can be resolved to a stored value, false
+ otherwise.
+
+ @post If `j.contains(ptr)` returns true, it is safe to call `j[ptr]`.
+
+ @throw parse_error.106 if an array index begins with '0'
+ @throw parse_error.109 if an array index was not a number
+
+ @complexity Logarithmic in the size of the JSON object.
+
+ @liveexample{The following code shows an example for `contains()`.,contains_json_pointer}
+
+ @sa @ref contains(KeyT &&) const -- checks the existence of a key
+
+ @since version 3.7.0
+ */
+ bool contains(const json_pointer& ptr) const
+ {
+ return ptr.contains(this);
+ }
+
+ /// @}
+
+
+ ///////////////
+ // iterators //
+ ///////////////
+
+ /// @name iterators
+ /// @{
+
+ /*!
+ @brief returns an iterator to the first element
+
+ Returns an iterator to the first element.
+
+ @image html range-begin-end.svg "Illustration from cppreference.com"
+
+ @return iterator to the first element
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is constant.
+
+ @liveexample{The following code shows an example for `begin()`.,begin}
+
+ @sa @ref cbegin() -- returns a const iterator to the beginning
+ @sa @ref end() -- returns an iterator to the end
+ @sa @ref cend() -- returns a const iterator to the end
+
+ @since version 1.0.0
+ */
+ iterator begin() noexcept
+ {
+ iterator result(this);
+ result.set_begin();
+ return result;
+ }
+
+ /*!
+ @copydoc basic_json::cbegin()
+ */
+ const_iterator begin() const noexcept
+ {
+ return cbegin();
+ }
+
+ /*!
+ @brief returns a const iterator to the first element
+
+ Returns a const iterator to the first element.
+
+ @image html range-begin-end.svg "Illustration from cppreference.com"
+
+ @return const iterator to the first element
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `const_cast<const basic_json&>(*this).begin()`.
+
+ @liveexample{The following code shows an example for `cbegin()`.,cbegin}
+
+ @sa @ref begin() -- returns an iterator to the beginning
+ @sa @ref end() -- returns an iterator to the end
+ @sa @ref cend() -- returns a const iterator to the end
+
+ @since version 1.0.0
+ */
+ const_iterator cbegin() const noexcept
+ {
+ const_iterator result(this);
+ result.set_begin();
+ return result;
+ }
+
+ /*!
+ @brief returns an iterator to one past the last element
+
+ Returns an iterator to one past the last element.
+
+ @image html range-begin-end.svg "Illustration from cppreference.com"
+
+ @return iterator one past the last element
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is constant.
+
+ @liveexample{The following code shows an example for `end()`.,end}
+
+ @sa @ref cend() -- returns a const iterator to the end
+ @sa @ref begin() -- returns an iterator to the beginning
+ @sa @ref cbegin() -- returns a const iterator to the beginning
+
+ @since version 1.0.0
+ */
+ iterator end() noexcept
+ {
+ iterator result(this);
+ result.set_end();
+ return result;
+ }
+
+ /*!
+ @copydoc basic_json::cend()
+ */
+ const_iterator end() const noexcept
+ {
+ return cend();
+ }
+
+ /*!
+ @brief returns a const iterator to one past the last element
+
+ Returns a const iterator to one past the last element.
+
+ @image html range-begin-end.svg "Illustration from cppreference.com"
+
+ @return const iterator one past the last element
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `const_cast<const basic_json&>(*this).end()`.
+
+ @liveexample{The following code shows an example for `cend()`.,cend}
+
+ @sa @ref end() -- returns an iterator to the end
+ @sa @ref begin() -- returns an iterator to the beginning
+ @sa @ref cbegin() -- returns a const iterator to the beginning
+
+ @since version 1.0.0
+ */
+ const_iterator cend() const noexcept
+ {
+ const_iterator result(this);
+ result.set_end();
+ return result;
+ }
+
+ /*!
+ @brief returns an iterator to the reverse-beginning
+
+ Returns an iterator to the reverse-beginning; that is, the last element.
+
+ @image html range-rbegin-rend.svg "Illustration from cppreference.com"
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `reverse_iterator(end())`.
+
+ @liveexample{The following code shows an example for `rbegin()`.,rbegin}
+
+ @sa @ref crbegin() -- returns a const reverse iterator to the beginning
+ @sa @ref rend() -- returns a reverse iterator to the end
+ @sa @ref crend() -- returns a const reverse iterator to the end
+
+ @since version 1.0.0
+ */
+ reverse_iterator rbegin() noexcept
+ {
+ return reverse_iterator(end());
+ }
+
+ /*!
+ @copydoc basic_json::crbegin()
+ */
+ const_reverse_iterator rbegin() const noexcept
+ {
+ return crbegin();
+ }
+
+ /*!
+ @brief returns an iterator to the reverse-end
+
+ Returns an iterator to the reverse-end; that is, one before the first
+ element.
+
+ @image html range-rbegin-rend.svg "Illustration from cppreference.com"
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `reverse_iterator(begin())`.
+
+ @liveexample{The following code shows an example for `rend()`.,rend}
+
+ @sa @ref crend() -- returns a const reverse iterator to the end
+ @sa @ref rbegin() -- returns a reverse iterator to the beginning
+ @sa @ref crbegin() -- returns a const reverse iterator to the beginning
+
+ @since version 1.0.0
+ */
+ reverse_iterator rend() noexcept
+ {
+ return reverse_iterator(begin());
+ }
+
+ /*!
+ @copydoc basic_json::crend()
+ */
+ const_reverse_iterator rend() const noexcept
+ {
+ return crend();
+ }
+
+ /*!
+ @brief returns a const reverse iterator to the last element
+
+ Returns a const iterator to the reverse-beginning; that is, the last
+ element.
+
+ @image html range-rbegin-rend.svg "Illustration from cppreference.com"
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `const_cast<const basic_json&>(*this).rbegin()`.
+
+ @liveexample{The following code shows an example for `crbegin()`.,crbegin}
+
+ @sa @ref rbegin() -- returns a reverse iterator to the beginning
+ @sa @ref rend() -- returns a reverse iterator to the end
+ @sa @ref crend() -- returns a const reverse iterator to the end
+
+ @since version 1.0.0
+ */
+ const_reverse_iterator crbegin() const noexcept
+ {
+ return const_reverse_iterator(cend());
+ }
+
+ /*!
+ @brief returns a const reverse iterator to one before the first
+
+ Returns a const reverse iterator to the reverse-end; that is, one before
+ the first element.
+
+ @image html range-rbegin-rend.svg "Illustration from cppreference.com"
+
+ @complexity Constant.
+
+ @requirement This function helps `basic_json` satisfying the
+ [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `const_cast<const basic_json&>(*this).rend()`.
+
+ @liveexample{The following code shows an example for `crend()`.,crend}
+
+ @sa @ref rend() -- returns a reverse iterator to the end
+ @sa @ref rbegin() -- returns a reverse iterator to the beginning
+ @sa @ref crbegin() -- returns a const reverse iterator to the beginning
+
+ @since version 1.0.0
+ */
+ const_reverse_iterator crend() const noexcept
+ {
+ return const_reverse_iterator(cbegin());
+ }
+
+ public:
+ /*!
+ @brief wrapper to access iterator member functions in range-based for
+
+ This function allows to access @ref iterator::key() and @ref
+ iterator::value() during range-based for loops. In these loops, a
+ reference to the JSON values is returned, so there is no access to the
+ underlying iterator.
+
+ For loop without iterator_wrapper:
+
+ @code{cpp}
+ for (auto it = j_object.begin(); it != j_object.end(); ++it)
+ {
+ std::cout << "key: " << it.key() << ", value:" << it.value() << '\n';
+ }
+ @endcode
+
+ Range-based for loop without iterator proxy:
+
+ @code{cpp}
+ for (auto it : j_object)
+ {
+ // "it" is of type json::reference and has no key() member
+ std::cout << "value: " << it << '\n';
+ }
+ @endcode
+
+ Range-based for loop with iterator proxy:
+
+ @code{cpp}
+ for (auto it : json::iterator_wrapper(j_object))
+ {
+ std::cout << "key: " << it.key() << ", value:" << it.value() << '\n';
+ }
+ @endcode
+
+ @note When iterating over an array, `key()` will return the index of the
+ element as string (see example).
+
+ @param[in] ref reference to a JSON value
+ @return iteration proxy object wrapping @a ref with an interface to use in
+ range-based for loops
+
+ @liveexample{The following code shows how the wrapper is used,iterator_wrapper}
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Constant.
+
+ @note The name of this function is not yet final and may change in the
+ future.
+
+ @deprecated This stream operator is deprecated and will be removed in
+ future 4.0.0 of the library. Please use @ref items() instead;
+ that is, replace `json::iterator_wrapper(j)` with `j.items()`.
+ */
+ JSON_HEDLEY_DEPRECATED_FOR(3.1.0, items())
+ static iteration_proxy<iterator> iterator_wrapper(reference ref) noexcept
+ {
+ return ref.items();
+ }
+
+ /*!
+ @copydoc iterator_wrapper(reference)
+ */
+ JSON_HEDLEY_DEPRECATED_FOR(3.1.0, items())
+ static iteration_proxy<const_iterator> iterator_wrapper(const_reference ref) noexcept
+ {
+ return ref.items();
+ }
+
+ /*!
+ @brief helper to access iterator member functions in range-based for
+
+ This function allows to access @ref iterator::key() and @ref
+ iterator::value() during range-based for loops. In these loops, a
+ reference to the JSON values is returned, so there is no access to the
+ underlying iterator.
+
+ For loop without `items()` function:
+
+ @code{cpp}
+ for (auto it = j_object.begin(); it != j_object.end(); ++it)
+ {
+ std::cout << "key: " << it.key() << ", value:" << it.value() << '\n';
+ }
+ @endcode
+
+ Range-based for loop without `items()` function:
+
+ @code{cpp}
+ for (auto it : j_object)
+ {
+ // "it" is of type json::reference and has no key() member
+ std::cout << "value: " << it << '\n';
+ }
+ @endcode
+
+ Range-based for loop with `items()` function:
+
+ @code{cpp}
+ for (auto& el : j_object.items())
+ {
+ std::cout << "key: " << el.key() << ", value:" << el.value() << '\n';
+ }
+ @endcode
+
+ The `items()` function also allows to use
+ [structured bindings](https://en.cppreference.com/w/cpp/language/structured_binding)
+ (C++17):
+
+ @code{cpp}
+ for (auto& [key, val] : j_object.items())
+ {
+ std::cout << "key: " << key << ", value:" << val << '\n';
+ }
+ @endcode
+
+ @note When iterating over an array, `key()` will return the index of the
+ element as string (see example). For primitive types (e.g., numbers),
+ `key()` returns an empty string.
+
+ @warning Using `items()` on temporary objects is dangerous. Make sure the
+ object's lifetime exeeds the iteration. See
+ <https://github.com/nlohmann/json/issues/2040> for more
+ information.
+
+ @return iteration proxy object wrapping @a ref with an interface to use in
+ range-based for loops
+
+ @liveexample{The following code shows how the function is used.,items}
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Constant.
+
+ @since version 3.1.0, structured bindings support since 3.5.0.
+ */
+ iteration_proxy<iterator> items() noexcept
+ {
+ return iteration_proxy<iterator>(*this);
+ }
+
+ /*!
+ @copydoc items()
+ */
+ iteration_proxy<const_iterator> items() const noexcept
+ {
+ return iteration_proxy<const_iterator>(*this);
+ }
+
+ /// @}
+
+
+ //////////////
+ // capacity //
+ //////////////
+
+ /// @name capacity
+ /// @{
+
+ /*!
+ @brief checks whether the container is empty.
+
+ Checks if a JSON value has no elements (i.e. whether its @ref size is `0`).
+
+ @return The return value depends on the different types and is
+ defined as follows:
+ Value type | return value
+ ----------- | -------------
+ null | `true`
+ boolean | `false`
+ string | `false`
+ number | `false`
+ binary | `false`
+ object | result of function `object_t::empty()`
+ array | result of function `array_t::empty()`
+
+ @liveexample{The following code uses `empty()` to check if a JSON
+ object contains any elements.,empty}
+
+ @complexity Constant, as long as @ref array_t and @ref object_t satisfy
+ the Container concept; that is, their `empty()` functions have constant
+ complexity.
+
+ @iterators No changes.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @note This function does not return whether a string stored as JSON value
+ is empty - it returns whether the JSON container itself is empty which is
+ false in the case of a string.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `begin() == end()`.
+
+ @sa @ref size() -- returns the number of elements
+
+ @since version 1.0.0
+ */
+ bool empty() const noexcept
+ {
+ switch (m_type)
+ {
+ case value_t::null:
+ {
+ // null values are empty
+ return true;
+ }
+
+ case value_t::array:
+ {
+ // delegate call to array_t::empty()
+ return m_value.array->empty();
+ }
+
+ case value_t::object:
+ {
+ // delegate call to object_t::empty()
+ return m_value.object->empty();
+ }
+
+ default:
+ {
+ // all other types are nonempty
+ return false;
+ }
+ }
+ }
+
+ /*!
+ @brief returns the number of elements
+
+ Returns the number of elements in a JSON value.
+
+ @return The return value depends on the different types and is
+ defined as follows:
+ Value type | return value
+ ----------- | -------------
+ null | `0`
+ boolean | `1`
+ string | `1`
+ number | `1`
+ binary | `1`
+ object | result of function object_t::size()
+ array | result of function array_t::size()
+
+ @liveexample{The following code calls `size()` on the different value
+ types.,size}
+
+ @complexity Constant, as long as @ref array_t and @ref object_t satisfy
+ the Container concept; that is, their size() functions have constant
+ complexity.
+
+ @iterators No changes.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @note This function does not return the length of a string stored as JSON
+ value - it returns the number of elements in the JSON value which is 1 in
+ the case of a string.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of `std::distance(begin(), end())`.
+
+ @sa @ref empty() -- checks whether the container is empty
+ @sa @ref max_size() -- returns the maximal number of elements
+
+ @since version 1.0.0
+ */
+ size_type size() const noexcept
+ {
+ switch (m_type)
+ {
+ case value_t::null:
+ {
+ // null values are empty
+ return 0;
+ }
+
+ case value_t::array:
+ {
+ // delegate call to array_t::size()
+ return m_value.array->size();
+ }
+
+ case value_t::object:
+ {
+ // delegate call to object_t::size()
+ return m_value.object->size();
+ }
+
+ default:
+ {
+ // all other types have size 1
+ return 1;
+ }
+ }
+ }
+
+ /*!
+ @brief returns the maximum possible number of elements
+
+ Returns the maximum number of elements a JSON value is able to hold due to
+ system or library implementation limitations, i.e. `std::distance(begin(),
+ end())` for the JSON value.
+
+ @return The return value depends on the different types and is
+ defined as follows:
+ Value type | return value
+ ----------- | -------------
+ null | `0` (same as `size()`)
+ boolean | `1` (same as `size()`)
+ string | `1` (same as `size()`)
+ number | `1` (same as `size()`)
+ binary | `1` (same as `size()`)
+ object | result of function `object_t::max_size()`
+ array | result of function `array_t::max_size()`
+
+ @liveexample{The following code calls `max_size()` on the different value
+ types. Note the output is implementation specific.,max_size}
+
+ @complexity Constant, as long as @ref array_t and @ref object_t satisfy
+ the Container concept; that is, their `max_size()` functions have constant
+ complexity.
+
+ @iterators No changes.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @requirement This function helps `basic_json` satisfying the
+ [Container](https://en.cppreference.com/w/cpp/named_req/Container)
+ requirements:
+ - The complexity is constant.
+ - Has the semantics of returning `b.size()` where `b` is the largest
+ possible JSON value.
+
+ @sa @ref size() -- returns the number of elements
+
+ @since version 1.0.0
+ */
+ size_type max_size() const noexcept
+ {
+ switch (m_type)
+ {
+ case value_t::array:
+ {
+ // delegate call to array_t::max_size()
+ return m_value.array->max_size();
+ }
+
+ case value_t::object:
+ {
+ // delegate call to object_t::max_size()
+ return m_value.object->max_size();
+ }
+
+ default:
+ {
+ // all other types have max_size() == size()
+ return size();
+ }
+ }
+ }
+
+ /// @}
+
+
+ ///////////////
+ // modifiers //
+ ///////////////
+
+ /// @name modifiers
+ /// @{
+
+ /*!
+ @brief clears the contents
+
+ Clears the content of a JSON value and resets it to the default value as
+ if @ref basic_json(value_t) would have been called with the current value
+ type from @ref type():
+
+ Value type | initial value
+ ----------- | -------------
+ null | `null`
+ boolean | `false`
+ string | `""`
+ number | `0`
+ binary | An empty byte vector
+ object | `{}`
+ array | `[]`
+
+ @post Has the same effect as calling
+ @code {.cpp}
+ *this = basic_json(type());
+ @endcode
+
+ @liveexample{The example below shows the effect of `clear()` to different
+ JSON types.,clear}
+
+ @complexity Linear in the size of the JSON value.
+
+ @iterators All iterators, pointers and references related to this container
+ are invalidated.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @sa @ref basic_json(value_t) -- constructor that creates an object with the
+ same value than calling `clear()`
+
+ @since version 1.0.0
+ */
+ void clear() noexcept
+ {
+ switch (m_type)
+ {
+ case value_t::number_integer:
+ {
+ m_value.number_integer = 0;
+ break;
+ }
+
+ case value_t::number_unsigned:
+ {
+ m_value.number_unsigned = 0;
+ break;
+ }
+
+ case value_t::number_float:
+ {
+ m_value.number_float = 0.0;
+ break;
+ }
+
+ case value_t::boolean:
+ {
+ m_value.boolean = false;
+ break;
+ }
+
+ case value_t::string:
+ {
+ m_value.string->clear();
+ break;
+ }
+
+ case value_t::binary:
+ {
+ m_value.binary->clear();
+ break;
+ }
+
+ case value_t::array:
+ {
+ m_value.array->clear();
+ break;
+ }
+
+ case value_t::object:
+ {
+ m_value.object->clear();
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ /*!
+ @brief add an object to an array
+
+ Appends the given element @a val to the end of the JSON value. If the
+ function is called on a JSON null value, an empty array is created before
+ appending @a val.
+
+ @param[in] val the value to add to the JSON array
+
+ @throw type_error.308 when called on a type other than JSON array or
+ null; example: `"cannot use push_back() with number"`
+
+ @complexity Amortized constant.
+
+ @liveexample{The example shows how `push_back()` and `+=` can be used to
+ add elements to a JSON array. Note how the `null` value was silently
+ converted to a JSON array.,push_back}
+
+ @since version 1.0.0
+ */
+ void push_back(basic_json&& val)
+ {
+ // push_back only works for null objects or arrays
+ if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_array())))
+ {
+ JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name())));
+ }
+
+ // transform null object into an array
+ if (is_null())
+ {
+ m_type = value_t::array;
+ m_value = value_t::array;
+ assert_invariant();
+ }
+
+ // add element to array (move semantics)
+ m_value.array->push_back(std::move(val));
+ // if val is moved from, basic_json move constructor marks it null so we do not call the destructor
+ }
+
+ /*!
+ @brief add an object to an array
+ @copydoc push_back(basic_json&&)
+ */
+ reference operator+=(basic_json&& val)
+ {
+ push_back(std::move(val));
+ return *this;
+ }
+
+ /*!
+ @brief add an object to an array
+ @copydoc push_back(basic_json&&)
+ */
+ void push_back(const basic_json& val)
+ {
+ // push_back only works for null objects or arrays
+ if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_array())))
+ {
+ JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name())));
+ }
+
+ // transform null object into an array
+ if (is_null())
+ {
+ m_type = value_t::array;
+ m_value = value_t::array;
+ assert_invariant();
+ }
+
+ // add element to array
+ m_value.array->push_back(val);
+ }
+
+ /*!
+ @brief add an object to an array
+ @copydoc push_back(basic_json&&)
+ */
+ reference operator+=(const basic_json& val)
+ {
+ push_back(val);
+ return *this;
+ }
+
+ /*!
+ @brief add an object to an object
+
+ Inserts the given element @a val to the JSON object. If the function is
+ called on a JSON null value, an empty object is created before inserting
+ @a val.
+
+ @param[in] val the value to add to the JSON object
+
+ @throw type_error.308 when called on a type other than JSON object or
+ null; example: `"cannot use push_back() with number"`
+
+ @complexity Logarithmic in the size of the container, O(log(`size()`)).
+
+ @liveexample{The example shows how `push_back()` and `+=` can be used to
+ add elements to a JSON object. Note how the `null` value was silently
+ converted to a JSON object.,push_back__object_t__value}
+
+ @since version 1.0.0
+ */
+ void push_back(const typename object_t::value_type& val)
+ {
+ // push_back only works for null objects or objects
+ if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_object())))
+ {
+ JSON_THROW(type_error::create(308, "cannot use push_back() with " + std::string(type_name())));
+ }
+
+ // transform null object into an object
+ if (is_null())
+ {
+ m_type = value_t::object;
+ m_value = value_t::object;
+ assert_invariant();
+ }
+
+ // add element to array
+ m_value.object->insert(val);
+ }
+
+ /*!
+ @brief add an object to an object
+ @copydoc push_back(const typename object_t::value_type&)
+ */
+ reference operator+=(const typename object_t::value_type& val)
+ {
+ push_back(val);
+ return *this;
+ }
+
+ /*!
+ @brief add an object to an object
+
+ This function allows to use `push_back` with an initializer list. In case
+
+ 1. the current value is an object,
+ 2. the initializer list @a init contains only two elements, and
+ 3. the first element of @a init is a string,
+
+ @a init is converted into an object element and added using
+ @ref push_back(const typename object_t::value_type&). Otherwise, @a init
+ is converted to a JSON value and added using @ref push_back(basic_json&&).
+
+ @param[in] init an initializer list
+
+ @complexity Linear in the size of the initializer list @a init.
+
+ @note This function is required to resolve an ambiguous overload error,
+ because pairs like `{"key", "value"}` can be both interpreted as
+ `object_t::value_type` or `std::initializer_list<basic_json>`, see
+ https://github.com/nlohmann/json/issues/235 for more information.
+
+ @liveexample{The example shows how initializer lists are treated as
+ objects when possible.,push_back__initializer_list}
+ */
+ void push_back(initializer_list_t init)
+ {
+ if (is_object() and init.size() == 2 and (*init.begin())->is_string())
+ {
+ basic_json&& key = init.begin()->moved_or_copied();
+ push_back(typename object_t::value_type(
+ std::move(key.get_ref<string_t&>()), (init.begin() + 1)->moved_or_copied()));
+ }
+ else
+ {
+ push_back(basic_json(init));
+ }
+ }
+
+ /*!
+ @brief add an object to an object
+ @copydoc push_back(initializer_list_t)
+ */
+ reference operator+=(initializer_list_t init)
+ {
+ push_back(init);
+ return *this;
+ }
+
+ /*!
+ @brief add an object to an array
+
+ Creates a JSON value from the passed parameters @a args to the end of the
+ JSON value. If the function is called on a JSON null value, an empty array
+ is created before appending the value created from @a args.
+
+ @param[in] args arguments to forward to a constructor of @ref basic_json
+ @tparam Args compatible types to create a @ref basic_json object
+
+ @return reference to the inserted element
+
+ @throw type_error.311 when called on a type other than JSON array or
+ null; example: `"cannot use emplace_back() with number"`
+
+ @complexity Amortized constant.
+
+ @liveexample{The example shows how `push_back()` can be used to add
+ elements to a JSON array. Note how the `null` value was silently converted
+ to a JSON array.,emplace_back}
+
+ @since version 2.0.8, returns reference since 3.7.0
+ */
+ template<class... Args>
+ reference emplace_back(Args&& ... args)
+ {
+ // emplace_back only works for null objects or arrays
+ if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_array())))
+ {
+ JSON_THROW(type_error::create(311, "cannot use emplace_back() with " + std::string(type_name())));
+ }
+
+ // transform null object into an array
+ if (is_null())
+ {
+ m_type = value_t::array;
+ m_value = value_t::array;
+ assert_invariant();
+ }
+
+ // add element to array (perfect forwarding)
+#ifdef JSON_HAS_CPP_17
+ return m_value.array->emplace_back(std::forward<Args>(args)...);
+#else
+ m_value.array->emplace_back(std::forward<Args>(args)...);
+ return m_value.array->back();
+#endif
+ }
+
+ /*!
+ @brief add an object to an object if key does not exist
+
+ Inserts a new element into a JSON object constructed in-place with the
+ given @a args if there is no element with the key in the container. If the
+ function is called on a JSON null value, an empty object is created before
+ appending the value created from @a args.
+
+ @param[in] args arguments to forward to a constructor of @ref basic_json
+ @tparam Args compatible types to create a @ref basic_json object
+
+ @return a pair consisting of an iterator to the inserted element, or the
+ already-existing element if no insertion happened, and a bool
+ denoting whether the insertion took place.
+
+ @throw type_error.311 when called on a type other than JSON object or
+ null; example: `"cannot use emplace() with number"`
+
+ @complexity Logarithmic in the size of the container, O(log(`size()`)).
+
+ @liveexample{The example shows how `emplace()` can be used to add elements
+ to a JSON object. Note how the `null` value was silently converted to a
+ JSON object. Further note how no value is added if there was already one
+ value stored with the same key.,emplace}
+
+ @since version 2.0.8
+ */
+ template<class... Args>
+ std::pair<iterator, bool> emplace(Args&& ... args)
+ {
+ // emplace only works for null objects or arrays
+ if (JSON_HEDLEY_UNLIKELY(not(is_null() or is_object())))
+ {
+ JSON_THROW(type_error::create(311, "cannot use emplace() with " + std::string(type_name())));
+ }
+
+ // transform null object into an object
+ if (is_null())
+ {
+ m_type = value_t::object;
+ m_value = value_t::object;
+ assert_invariant();
+ }
+
+ // add element to array (perfect forwarding)
+ auto res = m_value.object->emplace(std::forward<Args>(args)...);
+ // create result iterator and set iterator to the result of emplace
+ auto it = begin();
+ it.m_it.object_iterator = res.first;
+
+ // return pair of iterator and boolean
+ return {it, res.second};
+ }
+
+ /// Helper for insertion of an iterator
+ /// @note: This uses std::distance to support GCC 4.8,
+ /// see https://github.com/nlohmann/json/pull/1257
+ template<typename... Args>
+ iterator insert_iterator(const_iterator pos, Args&& ... args)
+ {
+ iterator result(this);
+ assert(m_value.array != nullptr);
+
+ auto insert_pos = std::distance(m_value.array->begin(), pos.m_it.array_iterator);
+ m_value.array->insert(pos.m_it.array_iterator, std::forward<Args>(args)...);
+ result.m_it.array_iterator = m_value.array->begin() + insert_pos;
+
+ // This could have been written as:
+ // result.m_it.array_iterator = m_value.array->insert(pos.m_it.array_iterator, cnt, val);
+ // but the return value of insert is missing in GCC 4.8, so it is written this way instead.
+
+ return result;
+ }
+
+ /*!
+ @brief inserts element
+
+ Inserts element @a val before iterator @a pos.
+
+ @param[in] pos iterator before which the content will be inserted; may be
+ the end() iterator
+ @param[in] val element to insert
+ @return iterator pointing to the inserted @a val.
+
+ @throw type_error.309 if called on JSON values other than arrays;
+ example: `"cannot use insert() with string"`
+ @throw invalid_iterator.202 if @a pos is not an iterator of *this;
+ example: `"iterator does not fit current value"`
+
+ @complexity Constant plus linear in the distance between @a pos and end of
+ the container.
+
+ @liveexample{The example shows how `insert()` is used.,insert}
+
+ @since version 1.0.0
+ */
+ iterator insert(const_iterator pos, const basic_json& val)
+ {
+ // insert only works for arrays
+ if (JSON_HEDLEY_LIKELY(is_array()))
+ {
+ // check if iterator pos fits to this JSON value
+ if (JSON_HEDLEY_UNLIKELY(pos.m_object != this))
+ {
+ JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
+ }
+
+ // insert to array and return iterator
+ return insert_iterator(pos, val);
+ }
+
+ JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief inserts element
+ @copydoc insert(const_iterator, const basic_json&)
+ */
+ iterator insert(const_iterator pos, basic_json&& val)
+ {
+ return insert(pos, val);
+ }
+
+ /*!
+ @brief inserts elements
+
+ Inserts @a cnt copies of @a val before iterator @a pos.
+
+ @param[in] pos iterator before which the content will be inserted; may be
+ the end() iterator
+ @param[in] cnt number of copies of @a val to insert
+ @param[in] val element to insert
+ @return iterator pointing to the first element inserted, or @a pos if
+ `cnt==0`
+
+ @throw type_error.309 if called on JSON values other than arrays; example:
+ `"cannot use insert() with string"`
+ @throw invalid_iterator.202 if @a pos is not an iterator of *this;
+ example: `"iterator does not fit current value"`
+
+ @complexity Linear in @a cnt plus linear in the distance between @a pos
+ and end of the container.
+
+ @liveexample{The example shows how `insert()` is used.,insert__count}
+
+ @since version 1.0.0
+ */
+ iterator insert(const_iterator pos, size_type cnt, const basic_json& val)
+ {
+ // insert only works for arrays
+ if (JSON_HEDLEY_LIKELY(is_array()))
+ {
+ // check if iterator pos fits to this JSON value
+ if (JSON_HEDLEY_UNLIKELY(pos.m_object != this))
+ {
+ JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
+ }
+
+ // insert to array and return iterator
+ return insert_iterator(pos, cnt, val);
+ }
+
+ JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name())));
+ }
+
+ /*!
+ @brief inserts elements
+
+ Inserts elements from range `[first, last)` before iterator @a pos.
+
+ @param[in] pos iterator before which the content will be inserted; may be
+ the end() iterator
+ @param[in] first begin of the range of elements to insert
+ @param[in] last end of the range of elements to insert
+
+ @throw type_error.309 if called on JSON values other than arrays; example:
+ `"cannot use insert() with string"`
+ @throw invalid_iterator.202 if @a pos is not an iterator of *this;
+ example: `"iterator does not fit current value"`
+ @throw invalid_iterator.210 if @a first and @a last do not belong to the
+ same JSON value; example: `"iterators do not fit"`
+ @throw invalid_iterator.211 if @a first or @a last are iterators into
+ container for which insert is called; example: `"passed iterators may not
+ belong to container"`
+
+ @return iterator pointing to the first element inserted, or @a pos if
+ `first==last`
+
+ @complexity Linear in `std::distance(first, last)` plus linear in the
+ distance between @a pos and end of the container.
+
+ @liveexample{The example shows how `insert()` is used.,insert__range}
+
+ @since version 1.0.0
+ */
+ iterator insert(const_iterator pos, const_iterator first, const_iterator last)
+ {
+ // insert only works for arrays
+ if (JSON_HEDLEY_UNLIKELY(not is_array()))
+ {
+ JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name())));
+ }
+
+ // check if iterator pos fits to this JSON value
+ if (JSON_HEDLEY_UNLIKELY(pos.m_object != this))
+ {
+ JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
+ }
+
+ // check if range iterators belong to the same JSON object
+ if (JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(210, "iterators do not fit"));
+ }
+
+ if (JSON_HEDLEY_UNLIKELY(first.m_object == this))
+ {
+ JSON_THROW(invalid_iterator::create(211, "passed iterators may not belong to container"));
+ }
+
+ // insert to array and return iterator
+ return insert_iterator(pos, first.m_it.array_iterator, last.m_it.array_iterator);
+ }
+
+ /*!
+ @brief inserts elements
+
+ Inserts elements from initializer list @a ilist before iterator @a pos.
+
+ @param[in] pos iterator before which the content will be inserted; may be
+ the end() iterator
+ @param[in] ilist initializer list to insert the values from
+
+ @throw type_error.309 if called on JSON values other than arrays; example:
+ `"cannot use insert() with string"`
+ @throw invalid_iterator.202 if @a pos is not an iterator of *this;
+ example: `"iterator does not fit current value"`
+
+ @return iterator pointing to the first element inserted, or @a pos if
+ `ilist` is empty
+
+ @complexity Linear in `ilist.size()` plus linear in the distance between
+ @a pos and end of the container.
+
+ @liveexample{The example shows how `insert()` is used.,insert__ilist}
+
+ @since version 1.0.0
+ */
+ iterator insert(const_iterator pos, initializer_list_t ilist)
+ {
+ // insert only works for arrays
+ if (JSON_HEDLEY_UNLIKELY(not is_array()))
+ {
+ JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name())));
+ }
+
+ // check if iterator pos fits to this JSON value
+ if (JSON_HEDLEY_UNLIKELY(pos.m_object != this))
+ {
+ JSON_THROW(invalid_iterator::create(202, "iterator does not fit current value"));
+ }
+
+ // insert to array and return iterator
+ return insert_iterator(pos, ilist.begin(), ilist.end());
+ }
+
+ /*!
+ @brief inserts elements
+
+ Inserts elements from range `[first, last)`.
+
+ @param[in] first begin of the range of elements to insert
+ @param[in] last end of the range of elements to insert
+
+ @throw type_error.309 if called on JSON values other than objects; example:
+ `"cannot use insert() with string"`
+ @throw invalid_iterator.202 if iterator @a first or @a last does does not
+ point to an object; example: `"iterators first and last must point to
+ objects"`
+ @throw invalid_iterator.210 if @a first and @a last do not belong to the
+ same JSON value; example: `"iterators do not fit"`
+
+ @complexity Logarithmic: `O(N*log(size() + N))`, where `N` is the number
+ of elements to insert.
+
+ @liveexample{The example shows how `insert()` is used.,insert__range_object}
+
+ @since version 3.0.0
+ */
+ void insert(const_iterator first, const_iterator last)
+ {
+ // insert only works for objects
+ if (JSON_HEDLEY_UNLIKELY(not is_object()))
+ {
+ JSON_THROW(type_error::create(309, "cannot use insert() with " + std::string(type_name())));
+ }
+
+ // check if range iterators belong to the same JSON object
+ if (JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(210, "iterators do not fit"));
+ }
+
+ // passed iterators must belong to objects
+ if (JSON_HEDLEY_UNLIKELY(not first.m_object->is_object()))
+ {
+ JSON_THROW(invalid_iterator::create(202, "iterators first and last must point to objects"));
+ }
+
+ m_value.object->insert(first.m_it.object_iterator, last.m_it.object_iterator);
+ }
+
+ /*!
+ @brief updates a JSON object from another object, overwriting existing keys
+
+ Inserts all values from JSON object @a j and overwrites existing keys.
+
+ @param[in] j JSON object to read values from
+
+ @throw type_error.312 if called on JSON values other than objects; example:
+ `"cannot use update() with string"`
+
+ @complexity O(N*log(size() + N)), where N is the number of elements to
+ insert.
+
+ @liveexample{The example shows how `update()` is used.,update}
+
+ @sa https://docs.python.org/3.6/library/stdtypes.html#dict.update
+
+ @since version 3.0.0
+ */
+ void update(const_reference j)
+ {
+ // implicitly convert null value to an empty object
+ if (is_null())
+ {
+ m_type = value_t::object;
+ m_value.object = create<object_t>();
+ assert_invariant();
+ }
+
+ if (JSON_HEDLEY_UNLIKELY(not is_object()))
+ {
+ JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(type_name())));
+ }
+ if (JSON_HEDLEY_UNLIKELY(not j.is_object()))
+ {
+ JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(j.type_name())));
+ }
+
+ for (auto it = j.cbegin(); it != j.cend(); ++it)
+ {
+ m_value.object->operator[](it.key()) = it.value();
+ }
+ }
+
+ /*!
+ @brief updates a JSON object from another object, overwriting existing keys
+
+ Inserts all values from from range `[first, last)` and overwrites existing
+ keys.
+
+ @param[in] first begin of the range of elements to insert
+ @param[in] last end of the range of elements to insert
+
+ @throw type_error.312 if called on JSON values other than objects; example:
+ `"cannot use update() with string"`
+ @throw invalid_iterator.202 if iterator @a first or @a last does does not
+ point to an object; example: `"iterators first and last must point to
+ objects"`
+ @throw invalid_iterator.210 if @a first and @a last do not belong to the
+ same JSON value; example: `"iterators do not fit"`
+
+ @complexity O(N*log(size() + N)), where N is the number of elements to
+ insert.
+
+ @liveexample{The example shows how `update()` is used__range.,update}
+
+ @sa https://docs.python.org/3.6/library/stdtypes.html#dict.update
+
+ @since version 3.0.0
+ */
+ void update(const_iterator first, const_iterator last)
+ {
+ // implicitly convert null value to an empty object
+ if (is_null())
+ {
+ m_type = value_t::object;
+ m_value.object = create<object_t>();
+ assert_invariant();
+ }
+
+ if (JSON_HEDLEY_UNLIKELY(not is_object()))
+ {
+ JSON_THROW(type_error::create(312, "cannot use update() with " + std::string(type_name())));
+ }
+
+ // check if range iterators belong to the same JSON object
+ if (JSON_HEDLEY_UNLIKELY(first.m_object != last.m_object))
+ {
+ JSON_THROW(invalid_iterator::create(210, "iterators do not fit"));
+ }
+
+ // passed iterators must belong to objects
+ if (JSON_HEDLEY_UNLIKELY(not first.m_object->is_object()
+ or not last.m_object->is_object()))
+ {
+ JSON_THROW(invalid_iterator::create(202, "iterators first and last must point to objects"));
+ }
+
+ for (auto it = first; it != last; ++it)
+ {
+ m_value.object->operator[](it.key()) = it.value();
+ }
+ }
+
+ /*!
+ @brief exchanges the values
+
+ Exchanges the contents of the JSON value with those of @a other. Does not
+ invoke any move, copy, or swap operations on individual elements. All
+ iterators and references remain valid. The past-the-end iterator is
+ invalidated.
+
+ @param[in,out] other JSON value to exchange the contents with
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how JSON values can be swapped with
+ `swap()`.,swap__reference}
+
+ @since version 1.0.0
+ */
+ void swap(reference other) noexcept (
+ std::is_nothrow_move_constructible<value_t>::value and
+ std::is_nothrow_move_assignable<value_t>::value and
+ std::is_nothrow_move_constructible<json_value>::value and
+ std::is_nothrow_move_assignable<json_value>::value
+ )
+ {
+ std::swap(m_type, other.m_type);
+ std::swap(m_value, other.m_value);
+ assert_invariant();
+ }
+
+ /*!
+ @brief exchanges the values
+
+ Exchanges the contents of a JSON array with those of @a other. Does not
+ invoke any move, copy, or swap operations on individual elements. All
+ iterators and references remain valid. The past-the-end iterator is
+ invalidated.
+
+ @param[in,out] other array to exchange the contents with
+
+ @throw type_error.310 when JSON value is not an array; example: `"cannot
+ use swap() with string"`
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how arrays can be swapped with
+ `swap()`.,swap__array_t}
+
+ @since version 1.0.0
+ */
+ void swap(array_t& other)
+ {
+ // swap only works for arrays
+ if (JSON_HEDLEY_LIKELY(is_array()))
+ {
+ std::swap(*(m_value.array), other);
+ }
+ else
+ {
+ JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name())));
+ }
+ }
+
+ /*!
+ @brief exchanges the values
+
+ Exchanges the contents of a JSON object with those of @a other. Does not
+ invoke any move, copy, or swap operations on individual elements. All
+ iterators and references remain valid. The past-the-end iterator is
+ invalidated.
+
+ @param[in,out] other object to exchange the contents with
+
+ @throw type_error.310 when JSON value is not an object; example:
+ `"cannot use swap() with string"`
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how objects can be swapped with
+ `swap()`.,swap__object_t}
+
+ @since version 1.0.0
+ */
+ void swap(object_t& other)
+ {
+ // swap only works for objects
+ if (JSON_HEDLEY_LIKELY(is_object()))
+ {
+ std::swap(*(m_value.object), other);
+ }
+ else
+ {
+ JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name())));
+ }
+ }
+
+ /*!
+ @brief exchanges the values
+
+ Exchanges the contents of a JSON string with those of @a other. Does not
+ invoke any move, copy, or swap operations on individual elements. All
+ iterators and references remain valid. The past-the-end iterator is
+ invalidated.
+
+ @param[in,out] other string to exchange the contents with
+
+ @throw type_error.310 when JSON value is not a string; example: `"cannot
+ use swap() with boolean"`
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how strings can be swapped with
+ `swap()`.,swap__string_t}
+
+ @since version 1.0.0
+ */
+ void swap(string_t& other)
+ {
+ // swap only works for strings
+ if (JSON_HEDLEY_LIKELY(is_string()))
+ {
+ std::swap(*(m_value.string), other);
+ }
+ else
+ {
+ JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name())));
+ }
+ }
+
+ /*!
+ @brief exchanges the values
+
+ Exchanges the contents of a JSON string with those of @a other. Does not
+ invoke any move, copy, or swap operations on individual elements. All
+ iterators and references remain valid. The past-the-end iterator is
+ invalidated.
+
+ @param[in,out] other binary to exchange the contents with
+
+ @throw type_error.310 when JSON value is not a string; example: `"cannot
+ use swap() with boolean"`
+
+ @complexity Constant.
+
+ @liveexample{The example below shows how strings can be swapped with
+ `swap()`.,swap__binary_t}
+
+ @since version 3.8.0
+ */
+ void swap(binary_t& other)
+ {
+ // swap only works for strings
+ if (JSON_HEDLEY_LIKELY(is_binary()))
+ {
+ std::swap(*(m_value.binary), other);
+ }
+ else
+ {
+ JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name())));
+ }
+ }
+
+ /// @copydoc swap(binary_t)
+ void swap(typename binary_t::container_type& other)
+ {
+ // swap only works for strings
+ if (JSON_HEDLEY_LIKELY(is_binary()))
+ {
+ std::swap(*(m_value.binary), other);
+ }
+ else
+ {
+ JSON_THROW(type_error::create(310, "cannot use swap() with " + std::string(type_name())));
+ }
+ }
+
+ /// @}
+
+ public:
+ //////////////////////////////////////////
+ // lexicographical comparison operators //
+ //////////////////////////////////////////
+
+ /// @name lexicographical comparison operators
+ /// @{
+
+ /*!
+ @brief comparison: equal
+
+ Compares two JSON values for equality according to the following rules:
+ - Two JSON values are equal if (1) they are from the same type and (2)
+ their stored values are the same according to their respective
+ `operator==`.
+ - Integer and floating-point numbers are automatically converted before
+ comparison. Note that two NaN values are always treated as unequal.
+ - Two JSON null values are equal.
+
+ @note Floating-point inside JSON values numbers are compared with
+ `json::number_float_t::operator==` which is `double::operator==` by
+ default. To compare floating-point while respecting an epsilon, an alternative
+ [comparison function](https://github.com/mariokonrad/marnav/blob/master/include/marnav/math/floatingpoint.hpp#L34-#L39)
+ could be used, for instance
+ @code {.cpp}
+ template<typename T, typename = typename std::enable_if<std::is_floating_point<T>::value, T>::type>
+ inline bool is_same(T a, T b, T epsilon = std::numeric_limits<T>::epsilon()) noexcept
+ {
+ return std::abs(a - b) <= epsilon;
+ }
+ @endcode
+ Or you can self-defined operator equal function like this:
+ @code {.cpp}
+ bool my_equal(const_reference lhs, const_reference rhs) {
+ const auto lhs_type lhs.type();
+ const auto rhs_type rhs.type();
+ if (lhs_type == rhs_type) {
+ switch(lhs_type)
+ // self_defined case
+ case value_t::number_float:
+ return std::abs(lhs - rhs) <= std::numeric_limits<float>::epsilon();
+ // other cases remain the same with the original
+ ...
+ }
+ ...
+ }
+ @endcode
+
+ @note NaN values never compare equal to themselves or to other NaN values.
+
+ @param[in] lhs first JSON value to consider
+ @param[in] rhs second JSON value to consider
+ @return whether the values @a lhs and @a rhs are equal
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @complexity Linear.
+
+ @liveexample{The example demonstrates comparing several JSON
+ types.,operator__equal}
+
+ @since version 1.0.0
+ */
+ friend bool operator==(const_reference lhs, const_reference rhs) noexcept
+ {
+ const auto lhs_type = lhs.type();
+ const auto rhs_type = rhs.type();
+
+ if (lhs_type == rhs_type)
+ {
+ switch (lhs_type)
+ {
+ case value_t::array:
+ return *lhs.m_value.array == *rhs.m_value.array;
+
+ case value_t::object:
+ return *lhs.m_value.object == *rhs.m_value.object;
+
+ case value_t::null:
+ return true;
+
+ case value_t::string:
+ return *lhs.m_value.string == *rhs.m_value.string;
+
+ case value_t::boolean:
+ return lhs.m_value.boolean == rhs.m_value.boolean;
+
+ case value_t::number_integer:
+ return lhs.m_value.number_integer == rhs.m_value.number_integer;
+
+ case value_t::number_unsigned:
+ return lhs.m_value.number_unsigned == rhs.m_value.number_unsigned;
+
+ case value_t::number_float:
+ return lhs.m_value.number_float == rhs.m_value.number_float;
+
+ case value_t::binary:
+ return *lhs.m_value.binary == *rhs.m_value.binary;
+
+ default:
+ return false;
+ }
+ }
+ else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float)
+ {
+ return static_cast<number_float_t>(lhs.m_value.number_integer) == rhs.m_value.number_float;
+ }
+ else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer)
+ {
+ return lhs.m_value.number_float == static_cast<number_float_t>(rhs.m_value.number_integer);
+ }
+ else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_float)
+ {
+ return static_cast<number_float_t>(lhs.m_value.number_unsigned) == rhs.m_value.number_float;
+ }
+ else if (lhs_type == value_t::number_float and rhs_type == value_t::number_unsigned)
+ {
+ return lhs.m_value.number_float == static_cast<number_float_t>(rhs.m_value.number_unsigned);
+ }
+ else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_integer)
+ {
+ return static_cast<number_integer_t>(lhs.m_value.number_unsigned) == rhs.m_value.number_integer;
+ }
+ else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_unsigned)
+ {
+ return lhs.m_value.number_integer == static_cast<number_integer_t>(rhs.m_value.number_unsigned);
+ }
+
+ return false;
+ }
+
+ /*!
+ @brief comparison: equal
+ @copydoc operator==(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator==(const_reference lhs, const ScalarType rhs) noexcept
+ {
+ return lhs == basic_json(rhs);
+ }
+
+ /*!
+ @brief comparison: equal
+ @copydoc operator==(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator==(const ScalarType lhs, const_reference rhs) noexcept
+ {
+ return basic_json(lhs) == rhs;
+ }
+
+ /*!
+ @brief comparison: not equal
+
+ Compares two JSON values for inequality by calculating `not (lhs == rhs)`.
+
+ @param[in] lhs first JSON value to consider
+ @param[in] rhs second JSON value to consider
+ @return whether the values @a lhs and @a rhs are not equal
+
+ @complexity Linear.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @liveexample{The example demonstrates comparing several JSON
+ types.,operator__notequal}
+
+ @since version 1.0.0
+ */
+ friend bool operator!=(const_reference lhs, const_reference rhs) noexcept
+ {
+ return not (lhs == rhs);
+ }
+
+ /*!
+ @brief comparison: not equal
+ @copydoc operator!=(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator!=(const_reference lhs, const ScalarType rhs) noexcept
+ {
+ return lhs != basic_json(rhs);
+ }
+
+ /*!
+ @brief comparison: not equal
+ @copydoc operator!=(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator!=(const ScalarType lhs, const_reference rhs) noexcept
+ {
+ return basic_json(lhs) != rhs;
+ }
+
+ /*!
+ @brief comparison: less than
+
+ Compares whether one JSON value @a lhs is less than another JSON value @a
+ rhs according to the following rules:
+ - If @a lhs and @a rhs have the same type, the values are compared using
+ the default `<` operator.
+ - Integer and floating-point numbers are automatically converted before
+ comparison
+ - In case @a lhs and @a rhs have different types, the values are ignored
+ and the order of the types is considered, see
+ @ref operator<(const value_t, const value_t).
+
+ @param[in] lhs first JSON value to consider
+ @param[in] rhs second JSON value to consider
+ @return whether @a lhs is less than @a rhs
+
+ @complexity Linear.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @liveexample{The example demonstrates comparing several JSON
+ types.,operator__less}
+
+ @since version 1.0.0
+ */
+ friend bool operator<(const_reference lhs, const_reference rhs) noexcept
+ {
+ const auto lhs_type = lhs.type();
+ const auto rhs_type = rhs.type();
+
+ if (lhs_type == rhs_type)
+ {
+ switch (lhs_type)
+ {
+ case value_t::array:
+ // note parentheses are necessary, see
+ // https://github.com/nlohmann/json/issues/1530
+ return (*lhs.m_value.array) < (*rhs.m_value.array);
+
+ case value_t::object:
+ return (*lhs.m_value.object) < (*rhs.m_value.object);
+
+ case value_t::null:
+ return false;
+
+ case value_t::string:
+ return (*lhs.m_value.string) < (*rhs.m_value.string);
+
+ case value_t::boolean:
+ return (lhs.m_value.boolean) < (rhs.m_value.boolean);
+
+ case value_t::number_integer:
+ return (lhs.m_value.number_integer) < (rhs.m_value.number_integer);
+
+ case value_t::number_unsigned:
+ return (lhs.m_value.number_unsigned) < (rhs.m_value.number_unsigned);
+
+ case value_t::number_float:
+ return (lhs.m_value.number_float) < (rhs.m_value.number_float);
+
+ case value_t::binary:
+ return (*lhs.m_value.binary) < (*rhs.m_value.binary);
+
+ default:
+ return false;
+ }
+ }
+ else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_float)
+ {
+ return static_cast<number_float_t>(lhs.m_value.number_integer) < rhs.m_value.number_float;
+ }
+ else if (lhs_type == value_t::number_float and rhs_type == value_t::number_integer)
+ {
+ return lhs.m_value.number_float < static_cast<number_float_t>(rhs.m_value.number_integer);
+ }
+ else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_float)
+ {
+ return static_cast<number_float_t>(lhs.m_value.number_unsigned) < rhs.m_value.number_float;
+ }
+ else if (lhs_type == value_t::number_float and rhs_type == value_t::number_unsigned)
+ {
+ return lhs.m_value.number_float < static_cast<number_float_t>(rhs.m_value.number_unsigned);
+ }
+ else if (lhs_type == value_t::number_integer and rhs_type == value_t::number_unsigned)
+ {
+ return lhs.m_value.number_integer < static_cast<number_integer_t>(rhs.m_value.number_unsigned);
+ }
+ else if (lhs_type == value_t::number_unsigned and rhs_type == value_t::number_integer)
+ {
+ return static_cast<number_integer_t>(lhs.m_value.number_unsigned) < rhs.m_value.number_integer;
+ }
+
+ // We only reach this line if we cannot compare values. In that case,
+ // we compare types. Note we have to call the operator explicitly,
+ // because MSVC has problems otherwise.
+ return operator<(lhs_type, rhs_type);
+ }
+
+ /*!
+ @brief comparison: less than
+ @copydoc operator<(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator<(const_reference lhs, const ScalarType rhs) noexcept
+ {
+ return lhs < basic_json(rhs);
+ }
+
+ /*!
+ @brief comparison: less than
+ @copydoc operator<(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator<(const ScalarType lhs, const_reference rhs) noexcept
+ {
+ return basic_json(lhs) < rhs;
+ }
+
+ /*!
+ @brief comparison: less than or equal
+
+ Compares whether one JSON value @a lhs is less than or equal to another
+ JSON value by calculating `not (rhs < lhs)`.
+
+ @param[in] lhs first JSON value to consider
+ @param[in] rhs second JSON value to consider
+ @return whether @a lhs is less than or equal to @a rhs
+
+ @complexity Linear.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @liveexample{The example demonstrates comparing several JSON
+ types.,operator__greater}
+
+ @since version 1.0.0
+ */
+ friend bool operator<=(const_reference lhs, const_reference rhs) noexcept
+ {
+ return not (rhs < lhs);
+ }
+
+ /*!
+ @brief comparison: less than or equal
+ @copydoc operator<=(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator<=(const_reference lhs, const ScalarType rhs) noexcept
+ {
+ return lhs <= basic_json(rhs);
+ }
+
+ /*!
+ @brief comparison: less than or equal
+ @copydoc operator<=(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator<=(const ScalarType lhs, const_reference rhs) noexcept
+ {
+ return basic_json(lhs) <= rhs;
+ }
+
+ /*!
+ @brief comparison: greater than
+
+ Compares whether one JSON value @a lhs is greater than another
+ JSON value by calculating `not (lhs <= rhs)`.
+
+ @param[in] lhs first JSON value to consider
+ @param[in] rhs second JSON value to consider
+ @return whether @a lhs is greater than to @a rhs
+
+ @complexity Linear.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @liveexample{The example demonstrates comparing several JSON
+ types.,operator__lessequal}
+
+ @since version 1.0.0
+ */
+ friend bool operator>(const_reference lhs, const_reference rhs) noexcept
+ {
+ return not (lhs <= rhs);
+ }
+
+ /*!
+ @brief comparison: greater than
+ @copydoc operator>(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator>(const_reference lhs, const ScalarType rhs) noexcept
+ {
+ return lhs > basic_json(rhs);
+ }
+
+ /*!
+ @brief comparison: greater than
+ @copydoc operator>(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator>(const ScalarType lhs, const_reference rhs) noexcept
+ {
+ return basic_json(lhs) > rhs;
+ }
+
+ /*!
+ @brief comparison: greater than or equal
+
+ Compares whether one JSON value @a lhs is greater than or equal to another
+ JSON value by calculating `not (lhs < rhs)`.
+
+ @param[in] lhs first JSON value to consider
+ @param[in] rhs second JSON value to consider
+ @return whether @a lhs is greater than or equal to @a rhs
+
+ @complexity Linear.
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @liveexample{The example demonstrates comparing several JSON
+ types.,operator__greaterequal}
+
+ @since version 1.0.0
+ */
+ friend bool operator>=(const_reference lhs, const_reference rhs) noexcept
+ {
+ return not (lhs < rhs);
+ }
+
+ /*!
+ @brief comparison: greater than or equal
+ @copydoc operator>=(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator>=(const_reference lhs, const ScalarType rhs) noexcept
+ {
+ return lhs >= basic_json(rhs);
+ }
+
+ /*!
+ @brief comparison: greater than or equal
+ @copydoc operator>=(const_reference, const_reference)
+ */
+ template<typename ScalarType, typename std::enable_if<
+ std::is_scalar<ScalarType>::value, int>::type = 0>
+ friend bool operator>=(const ScalarType lhs, const_reference rhs) noexcept
+ {
+ return basic_json(lhs) >= rhs;
+ }
+
+ /// @}
+
+ ///////////////////
+ // serialization //
+ ///////////////////
+
+ /// @name serialization
+ /// @{
+
+ /*!
+ @brief serialize to stream
+
+ Serialize the given JSON value @a j to the output stream @a o. The JSON
+ value will be serialized using the @ref dump member function.
+
+ - The indentation of the output can be controlled with the member variable
+ `width` of the output stream @a o. For instance, using the manipulator
+ `std::setw(4)` on @a o sets the indentation level to `4` and the
+ serialization result is the same as calling `dump(4)`.
+
+ - The indentation character can be controlled with the member variable
+ `fill` of the output stream @a o. For instance, the manipulator
+ `std::setfill('\\t')` sets indentation to use a tab character rather than
+ the default space character.
+
+ @param[in,out] o stream to serialize to
+ @param[in] j JSON value to serialize
+
+ @return the stream @a o
+
+ @throw type_error.316 if a string stored inside the JSON value is not
+ UTF-8 encoded
+
+ @complexity Linear.
+
+ @liveexample{The example below shows the serialization with different
+ parameters to `width` to adjust the indentation level.,operator_serialize}
+
+ @since version 1.0.0; indentation character added in version 3.0.0
+ */
+ friend std::ostream& operator<<(std::ostream& o, const basic_json& j)
+ {
+ // read width member and use it as indentation parameter if nonzero
+ const bool pretty_print = o.width() > 0;
+ const auto indentation = pretty_print ? o.width() : 0;
+
+ // reset width to 0 for subsequent calls to this stream
+ o.width(0);
+
+ // do the actual serialization
+ serializer s(detail::output_adapter<char>(o), o.fill());
+ s.dump(j, pretty_print, false, static_cast<unsigned int>(indentation));
+ return o;
+ }
+
+ /*!
+ @brief serialize to stream
+ @deprecated This stream operator is deprecated and will be removed in
+ future 4.0.0 of the library. Please use
+ @ref operator<<(std::ostream&, const basic_json&)
+ instead; that is, replace calls like `j >> o;` with `o << j;`.
+ @since version 1.0.0; deprecated since version 3.0.0
+ */
+ JSON_HEDLEY_DEPRECATED_FOR(3.0.0, operator<<(std::ostream&, const basic_json&))
+ friend std::ostream& operator>>(const basic_json& j, std::ostream& o)
+ {
+ return o << j;
+ }
+
+ /// @}
+
+
+ /////////////////////
+ // deserialization //
+ /////////////////////
+
+ /// @name deserialization
+ /// @{
+
+ /*!
+ @brief deserialize from a compatible input
+
+ @tparam InputType A compatible input, for instance
+ - an std::istream object
+ - a FILE pointer
+ - a C-style array of characters
+ - a pointer to a null-terminated string of single byte characters
+ - an object obj for which begin(obj) and end(obj) produces a valid pair of
+ iterators.
+
+ @param[in] i input to read from
+ @param[in] cb a parser callback function of type @ref parser_callback_t
+ which is used to control the deserialization by filtering unwanted values
+ (optional)
+ @param[in] allow_exceptions whether to throw exceptions in case of a
+ parse error (optional, true by default)
+
+ @return deserialized JSON value; in case of a parse error and
+ @a allow_exceptions set to `false`, the return value will be
+ value_t::discarded.
+
+ @throw parse_error.101 if a parse error occurs; example: `""unexpected end
+ of input; expected string literal""`
+ @throw parse_error.102 if to_unicode fails or surrogate error
+ @throw parse_error.103 if to_unicode fails
+
+ @complexity Linear in the length of the input. The parser is a predictive
+ LL(1) parser. The complexity can be higher if the parser callback function
+ @a cb or reading from the input @a i has a super-linear complexity.
+
+ @note A UTF-8 byte order mark is silently ignored.
+
+ @liveexample{The example below demonstrates the `parse()` function reading
+ from an array.,parse__array__parser_callback_t}
+
+ @liveexample{The example below demonstrates the `parse()` function with
+ and without callback function.,parse__string__parser_callback_t}
+
+ @liveexample{The example below demonstrates the `parse()` function with
+ and without callback function.,parse__istream__parser_callback_t}
+
+ @liveexample{The example below demonstrates the `parse()` function reading
+ from a contiguous container.,parse__contiguouscontainer__parser_callback_t}
+
+ @since version 2.0.3 (contiguous containers)
+ */
+ template<typename InputType>
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json parse(InputType&& i,
+ const parser_callback_t cb = nullptr,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ parser(detail::input_adapter(std::forward<InputType>(i)), cb, allow_exceptions).parse(true, result);
+ return result;
+ }
+
+ /*!
+ @brief deserialize from a pair of character iterators
+
+ The value_type of the iterator must be a integral type with size of 1, 2 or
+ 4 bytes, which will be interpreted respectively as UTF-8, UTF-16 and UTF-32.
+
+ @param[in] first iterator to start of character range
+ @param[in] last iterator to end of character range
+ @param[in] cb a parser callback function of type @ref parser_callback_t
+ which is used to control the deserialization by filtering unwanted values
+ (optional)
+ @param[in] allow_exceptions whether to throw exceptions in case of a
+ parse error (optional, true by default)
+
+ @return deserialized JSON value; in case of a parse error and
+ @a allow_exceptions set to `false`, the return value will be
+ value_t::discarded.
+
+ @throw parse_error.101 if a parse error occurs; example: `""unexpected end
+ of input; expected string literal""`
+ @throw parse_error.102 if to_unicode fails or surrogate error
+ @throw parse_error.103 if to_unicode fails
+ */
+ template<typename IteratorType>
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json parse(IteratorType first,
+ IteratorType last,
+ const parser_callback_t cb = nullptr,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ parser(detail::input_adapter(std::move(first), std::move(last)), cb, allow_exceptions).parse(true, result);
+ return result;
+ }
+
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ JSON_HEDLEY_DEPRECATED_FOR(3.8.0, parse(ptr, ptr + len))
+ static basic_json parse(detail::span_input_adapter&& i,
+ const parser_callback_t cb = nullptr,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ parser(i.get(), cb, allow_exceptions).parse(true, result);
+ return result;
+ }
+
+ /*!
+ @brief check if the input is valid JSON
+
+ Unlike the @ref parse(InputType&&, const parser_callback_t,const bool)
+ function, this function neither throws an exception in case of invalid JSON
+ input (i.e., a parse error) nor creates diagnostic information.
+
+ @tparam InputType A compatible input, for instance
+ - an std::istream object
+ - a FILE pointer
+ - a C-style array of characters
+ - a pointer to a null-terminated string of single byte characters
+ - an object obj for which begin(obj) and end(obj) produces a valid pair of
+ iterators.
+
+ @param[in] i input to read from
+
+ @return Whether the input read from @a i is valid JSON.
+
+ @complexity Linear in the length of the input. The parser is a predictive
+ LL(1) parser.
+
+ @note A UTF-8 byte order mark is silently ignored.
+
+ @liveexample{The example below demonstrates the `accept()` function reading
+ from a string.,accept__string}
+ */
+ template<typename InputType>
+ static bool accept(InputType&& i)
+ {
+ return parser(detail::input_adapter(std::forward<InputType>(i))).accept(true);
+ }
+
+ template<typename IteratorType>
+ static bool accept(IteratorType first, IteratorType last)
+ {
+ return parser(detail::input_adapter(std::move(first), std::move(last))).accept(true);
+ }
+
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ JSON_HEDLEY_DEPRECATED_FOR(3.8.0, accept(ptr, ptr + len))
+ static bool accept(detail::span_input_adapter&& i)
+ {
+ return parser(i.get()).accept(true);
+ }
+
+ /*!
+ @brief generate SAX events
+
+ The SAX event lister must follow the interface of @ref json_sax.
+
+ This function reads from a compatible input. Examples are:
+ - an std::istream object
+ - a FILE pointer
+ - a C-style array of characters
+ - a pointer to a null-terminated string of single byte characters
+ - an object obj for which begin(obj) and end(obj) produces a valid pair of
+ iterators.
+
+ @param[in] i input to read from
+ @param[in,out] sax SAX event listener
+ @param[in] format the format to parse (JSON, CBOR, MessagePack, or UBJSON)
+ @param[in] strict whether the input has to be consumed completely
+
+ @return return value of the last processed SAX event
+
+ @throw parse_error.101 if a parse error occurs; example: `""unexpected end
+ of input; expected string literal""`
+ @throw parse_error.102 if to_unicode fails or surrogate error
+ @throw parse_error.103 if to_unicode fails
+
+ @complexity Linear in the length of the input. The parser is a predictive
+ LL(1) parser. The complexity can be higher if the SAX consumer @a sax has
+ a super-linear complexity.
+
+ @note A UTF-8 byte order mark is silently ignored.
+
+ @liveexample{The example below demonstrates the `sax_parse()` function
+ reading from string and processing the events with a user-defined SAX
+ event consumer.,sax_parse}
+
+ @since version 3.2.0
+ */
+ template <typename InputType, typename SAX>
+ JSON_HEDLEY_NON_NULL(2)
+ static bool sax_parse(InputType&& i, SAX* sax,
+ input_format_t format = input_format_t::json,
+ const bool strict = true)
+ {
+ auto ia = detail::input_adapter(std::forward<InputType>(i));
+ return format == input_format_t::json
+ ? parser(std::move(ia)).sax_parse(sax, strict)
+ : detail::binary_reader<basic_json, decltype(ia), SAX>(std::move(ia)).sax_parse(format, sax, strict);
+ }
+
+ template<class IteratorType, class SAX>
+ JSON_HEDLEY_NON_NULL(3)
+ static bool sax_parse(IteratorType first, IteratorType last, SAX* sax,
+ input_format_t format = input_format_t::json,
+ const bool strict = true)
+ {
+ auto ia = detail::input_adapter(std::move(first), std::move(last));
+ return format == input_format_t::json
+ ? parser(std::move(ia)).sax_parse(sax, strict)
+ : detail::binary_reader<basic_json, decltype(ia), SAX>(std::move(ia)).sax_parse(format, sax, strict);
+ }
+
+ template <typename SAX>
+ JSON_HEDLEY_DEPRECATED_FOR(3.8.0, sax_parse(ptr, ptr + len, ...))
+ JSON_HEDLEY_NON_NULL(2)
+ static bool sax_parse(detail::span_input_adapter&& i, SAX* sax,
+ input_format_t format = input_format_t::json,
+ const bool strict = true)
+ {
+ auto ia = i.get();
+ return format == input_format_t::json
+ ? parser(std::move(ia)).sax_parse(sax, strict)
+ : detail::binary_reader<basic_json, decltype(ia), SAX>(std::move(ia)).sax_parse(format, sax, strict);
+ }
+
+ /*!
+ @brief deserialize from stream
+ @deprecated This stream operator is deprecated and will be removed in
+ version 4.0.0 of the library. Please use
+ @ref operator>>(std::istream&, basic_json&)
+ instead; that is, replace calls like `j << i;` with `i >> j;`.
+ @since version 1.0.0; deprecated since version 3.0.0
+ */
+ JSON_HEDLEY_DEPRECATED_FOR(3.0.0, operator>>(std::istream&, basic_json&))
+ friend std::istream& operator<<(basic_json& j, std::istream& i)
+ {
+ return operator>>(i, j);
+ }
+
+ /*!
+ @brief deserialize from stream
+
+ Deserializes an input stream to a JSON value.
+
+ @param[in,out] i input stream to read a serialized JSON value from
+ @param[in,out] j JSON value to write the deserialized input to
+
+ @throw parse_error.101 in case of an unexpected token
+ @throw parse_error.102 if to_unicode fails or surrogate error
+ @throw parse_error.103 if to_unicode fails
+
+ @complexity Linear in the length of the input. The parser is a predictive
+ LL(1) parser.
+
+ @note A UTF-8 byte order mark is silently ignored.
+
+ @liveexample{The example below shows how a JSON value is constructed by
+ reading a serialization from a stream.,operator_deserialize}
+
+ @sa parse(std::istream&, const parser_callback_t) for a variant with a
+ parser callback function to filter values while parsing
+
+ @since version 1.0.0
+ */
+ friend std::istream& operator>>(std::istream& i, basic_json& j)
+ {
+ parser(detail::input_adapter(i)).parse(false, j);
+ return i;
+ }
+
+ /// @}
+
+ ///////////////////////////
+ // convenience functions //
+ ///////////////////////////
+
+ /*!
+ @brief return the type as string
+
+ Returns the type name as string to be used in error messages - usually to
+ indicate that a function was called on a wrong JSON type.
+
+ @return a string representation of a the @a m_type member:
+ Value type | return value
+ ----------- | -------------
+ null | `"null"`
+ boolean | `"boolean"`
+ string | `"string"`
+ number | `"number"` (for all number types)
+ object | `"object"`
+ array | `"array"`
+ binary | `"binary"`
+ discarded | `"discarded"`
+
+ @exceptionsafety No-throw guarantee: this function never throws exceptions.
+
+ @complexity Constant.
+
+ @liveexample{The following code exemplifies `type_name()` for all JSON
+ types.,type_name}
+
+ @sa @ref type() -- return the type of the JSON value
+ @sa @ref operator value_t() -- return the type of the JSON value (implicit)
+
+ @since version 1.0.0, public since 2.1.0, `const char*` and `noexcept`
+ since 3.0.0
+ */
+ JSON_HEDLEY_RETURNS_NON_NULL
+ const char* type_name() const noexcept
+ {
+ {
+ switch (m_type)
+ {
+ case value_t::null:
+ return "null";
+ case value_t::object:
+ return "object";
+ case value_t::array:
+ return "array";
+ case value_t::string:
+ return "string";
+ case value_t::boolean:
+ return "boolean";
+ case value_t::binary:
+ return "binary";
+ case value_t::discarded:
+ return "discarded";
+ default:
+ return "number";
+ }
+ }
+ }
+
+
+ private:
+ //////////////////////
+ // member variables //
+ //////////////////////
+
+ /// the type of the current element
+ value_t m_type = value_t::null;
+
+ /// the value of the current element
+ json_value m_value = {};
+
+ //////////////////////////////////////////
+ // binary serialization/deserialization //
+ //////////////////////////////////////////
+
+ /// @name binary serialization/deserialization support
+ /// @{
+
+ public:
+ /*!
+ @brief create a CBOR serialization of a given JSON value
+
+ Serializes a given JSON value @a j to a byte vector using the CBOR (Concise
+ Binary Object Representation) serialization format. CBOR is a binary
+ serialization format which aims to be more compact than JSON itself, yet
+ more efficient to parse.
+
+ The library uses the following mapping from JSON values types to
+ CBOR types according to the CBOR specification (RFC 7049):
+
+ JSON value type | value/range | CBOR type | first byte
+ --------------- | ------------------------------------------ | ---------------------------------- | ---------------
+ null | `null` | Null | 0xF6
+ boolean | `true` | True | 0xF5
+ boolean | `false` | False | 0xF4
+ number_integer | -9223372036854775808..-2147483649 | Negative integer (8 bytes follow) | 0x3B
+ number_integer | -2147483648..-32769 | Negative integer (4 bytes follow) | 0x3A
+ number_integer | -32768..-129 | Negative integer (2 bytes follow) | 0x39
+ number_integer | -128..-25 | Negative integer (1 byte follow) | 0x38
+ number_integer | -24..-1 | Negative integer | 0x20..0x37
+ number_integer | 0..23 | Integer | 0x00..0x17
+ number_integer | 24..255 | Unsigned integer (1 byte follow) | 0x18
+ number_integer | 256..65535 | Unsigned integer (2 bytes follow) | 0x19
+ number_integer | 65536..4294967295 | Unsigned integer (4 bytes follow) | 0x1A
+ number_integer | 4294967296..18446744073709551615 | Unsigned integer (8 bytes follow) | 0x1B
+ number_unsigned | 0..23 | Integer | 0x00..0x17
+ number_unsigned | 24..255 | Unsigned integer (1 byte follow) | 0x18
+ number_unsigned | 256..65535 | Unsigned integer (2 bytes follow) | 0x19
+ number_unsigned | 65536..4294967295 | Unsigned integer (4 bytes follow) | 0x1A
+ number_unsigned | 4294967296..18446744073709551615 | Unsigned integer (8 bytes follow) | 0x1B
+ number_float | *any value representable by a float* | Single-Precision Float | 0xFA
+ number_float | *any value NOT representable by a float* | Double-Precision Float | 0xFB
+ string | *length*: 0..23 | UTF-8 string | 0x60..0x77
+ string | *length*: 23..255 | UTF-8 string (1 byte follow) | 0x78
+ string | *length*: 256..65535 | UTF-8 string (2 bytes follow) | 0x79
+ string | *length*: 65536..4294967295 | UTF-8 string (4 bytes follow) | 0x7A
+ string | *length*: 4294967296..18446744073709551615 | UTF-8 string (8 bytes follow) | 0x7B
+ array | *size*: 0..23 | array | 0x80..0x97
+ array | *size*: 23..255 | array (1 byte follow) | 0x98
+ array | *size*: 256..65535 | array (2 bytes follow) | 0x99
+ array | *size*: 65536..4294967295 | array (4 bytes follow) | 0x9A
+ array | *size*: 4294967296..18446744073709551615 | array (8 bytes follow) | 0x9B
+ object | *size*: 0..23 | map | 0xA0..0xB7
+ object | *size*: 23..255 | map (1 byte follow) | 0xB8
+ object | *size*: 256..65535 | map (2 bytes follow) | 0xB9
+ object | *size*: 65536..4294967295 | map (4 bytes follow) | 0xBA
+ object | *size*: 4294967296..18446744073709551615 | map (8 bytes follow) | 0xBB
+ binary | *size*: 0..23 | byte string | 0x40..0x57
+ binary | *size*: 23..255 | byte string (1 byte follow) | 0x58
+ binary | *size*: 256..65535 | byte string (2 bytes follow) | 0x59
+ binary | *size*: 65536..4294967295 | byte string (4 bytes follow) | 0x5A
+ binary | *size*: 4294967296..18446744073709551615 | byte string (8 bytes follow) | 0x5B
+
+ @note The mapping is **complete** in the sense that any JSON value type
+ can be converted to a CBOR value.
+
+ @note If NaN or Infinity are stored inside a JSON number, they are
+ serialized properly. This behavior differs from the @ref dump()
+ function which serializes NaN or Infinity to `null`.
+
+ @note The following CBOR types are not used in the conversion:
+ - UTF-8 strings terminated by "break" (0x7F)
+ - arrays terminated by "break" (0x9F)
+ - maps terminated by "break" (0xBF)
+ - byte strings terminated by "break" (0x5F)
+ - date/time (0xC0..0xC1)
+ - bignum (0xC2..0xC3)
+ - decimal fraction (0xC4)
+ - bigfloat (0xC5)
+ - tagged items (0xC6..0xD4, 0xD8..0xDB)
+ - expected conversions (0xD5..0xD7)
+ - simple values (0xE0..0xF3, 0xF8)
+ - undefined (0xF7)
+ - half-precision floats (0xF9)
+ - break (0xFF)
+
+ @param[in] j JSON value to serialize
+ @return CBOR serialization as byte vector
+
+ @complexity Linear in the size of the JSON value @a j.
+
+ @liveexample{The example shows the serialization of a JSON value to a byte
+ vector in CBOR format.,to_cbor}
+
+ @sa http://cbor.io
+ @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool) for the
+ analogous deserialization
+ @sa @ref to_msgpack(const basic_json&) for the related MessagePack format
+ @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the
+ related UBJSON format
+
+ @since version 2.0.9; compact representation of floating-point numbers
+ since version 3.8.0
+ */
+ static std::vector<uint8_t> to_cbor(const basic_json& j)
+ {
+ std::vector<uint8_t> result;
+ to_cbor(j, result);
+ return result;
+ }
+
+ static void to_cbor(const basic_json& j, detail::output_adapter<uint8_t> o)
+ {
+ binary_writer<uint8_t>(o).write_cbor(j);
+ }
+
+ static void to_cbor(const basic_json& j, detail::output_adapter<char> o)
+ {
+ binary_writer<char>(o).write_cbor(j);
+ }
+
+ /*!
+ @brief create a MessagePack serialization of a given JSON value
+
+ Serializes a given JSON value @a j to a byte vector using the MessagePack
+ serialization format. MessagePack is a binary serialization format which
+ aims to be more compact than JSON itself, yet more efficient to parse.
+
+ The library uses the following mapping from JSON values types to
+ MessagePack types according to the MessagePack specification:
+
+ JSON value type | value/range | MessagePack type | first byte
+ --------------- | --------------------------------- | ---------------- | ----------
+ null | `null` | nil | 0xC0
+ boolean | `true` | true | 0xC3
+ boolean | `false` | false | 0xC2
+ number_integer | -9223372036854775808..-2147483649 | int64 | 0xD3
+ number_integer | -2147483648..-32769 | int32 | 0xD2
+ number_integer | -32768..-129 | int16 | 0xD1
+ number_integer | -128..-33 | int8 | 0xD0
+ number_integer | -32..-1 | negative fixint | 0xE0..0xFF
+ number_integer | 0..127 | positive fixint | 0x00..0x7F
+ number_integer | 128..255 | uint 8 | 0xCC
+ number_integer | 256..65535 | uint 16 | 0xCD
+ number_integer | 65536..4294967295 | uint 32 | 0xCE
+ number_integer | 4294967296..18446744073709551615 | uint 64 | 0xCF
+ number_unsigned | 0..127 | positive fixint | 0x00..0x7F
+ number_unsigned | 128..255 | uint 8 | 0xCC
+ number_unsigned | 256..65535 | uint 16 | 0xCD
+ number_unsigned | 65536..4294967295 | uint 32 | 0xCE
+ number_unsigned | 4294967296..18446744073709551615 | uint 64 | 0xCF
+ number_float | *any value* | float 64 | 0xCB
+ string | *length*: 0..31 | fixstr | 0xA0..0xBF
+ string | *length*: 32..255 | str 8 | 0xD9
+ string | *length*: 256..65535 | str 16 | 0xDA
+ string | *length*: 65536..4294967295 | str 32 | 0xDB
+ array | *size*: 0..15 | fixarray | 0x90..0x9F
+ array | *size*: 16..65535 | array 16 | 0xDC
+ array | *size*: 65536..4294967295 | array 32 | 0xDD
+ object | *size*: 0..15 | fix map | 0x80..0x8F
+ object | *size*: 16..65535 | map 16 | 0xDE
+ object | *size*: 65536..4294967295 | map 32 | 0xDF
+ binary | *size*: 0..255 | bin 8 | 0xC4
+ binary | *size*: 256..65535 | bin 16 | 0xC5
+ binary | *size*: 65536..4294967295 | bin 32 | 0xC6
+
+ @note The mapping is **complete** in the sense that any JSON value type
+ can be converted to a MessagePack value.
+
+ @note The following values can **not** be converted to a MessagePack value:
+ - strings with more than 4294967295 bytes
+ - byte strings with more than 4294967295 bytes
+ - arrays with more than 4294967295 elements
+ - objects with more than 4294967295 elements
+
+ @note The following MessagePack types are not used in the conversion:
+ - float 32 (0xCA)
+
+ @note Any MessagePack output created @ref to_msgpack can be successfully
+ parsed by @ref from_msgpack.
+
+ @note If NaN or Infinity are stored inside a JSON number, they are
+ serialized properly. This behavior differs from the @ref dump()
+ function which serializes NaN or Infinity to `null`.
+
+ @param[in] j JSON value to serialize
+ @return MessagePack serialization as byte vector
+
+ @complexity Linear in the size of the JSON value @a j.
+
+ @liveexample{The example shows the serialization of a JSON value to a byte
+ vector in MessagePack format.,to_msgpack}
+
+ @sa http://msgpack.org
+ @sa @ref from_msgpack for the analogous deserialization
+ @sa @ref to_cbor(const basic_json& for the related CBOR format
+ @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the
+ related UBJSON format
+
+ @since version 2.0.9
+ */
+ static std::vector<uint8_t> to_msgpack(const basic_json& j)
+ {
+ std::vector<uint8_t> result;
+ to_msgpack(j, result);
+ return result;
+ }
+
+ static void to_msgpack(const basic_json& j, detail::output_adapter<uint8_t> o)
+ {
+ binary_writer<uint8_t>(o).write_msgpack(j);
+ }
+
+ static void to_msgpack(const basic_json& j, detail::output_adapter<char> o)
+ {
+ binary_writer<char>(o).write_msgpack(j);
+ }
+
+ /*!
+ @brief create a UBJSON serialization of a given JSON value
+
+ Serializes a given JSON value @a j to a byte vector using the UBJSON
+ (Universal Binary JSON) serialization format. UBJSON aims to be more compact
+ than JSON itself, yet more efficient to parse.
+
+ The library uses the following mapping from JSON values types to
+ UBJSON types according to the UBJSON specification:
+
+ JSON value type | value/range | UBJSON type | marker
+ --------------- | --------------------------------- | ----------- | ------
+ null | `null` | null | `Z`
+ boolean | `true` | true | `T`
+ boolean | `false` | false | `F`
+ number_integer | -9223372036854775808..-2147483649 | int64 | `L`
+ number_integer | -2147483648..-32769 | int32 | `l`
+ number_integer | -32768..-129 | int16 | `I`
+ number_integer | -128..127 | int8 | `i`
+ number_integer | 128..255 | uint8 | `U`
+ number_integer | 256..32767 | int16 | `I`
+ number_integer | 32768..2147483647 | int32 | `l`
+ number_integer | 2147483648..9223372036854775807 | int64 | `L`
+ number_unsigned | 0..127 | int8 | `i`
+ number_unsigned | 128..255 | uint8 | `U`
+ number_unsigned | 256..32767 | int16 | `I`
+ number_unsigned | 32768..2147483647 | int32 | `l`
+ number_unsigned | 2147483648..9223372036854775807 | int64 | `L`
+ number_float | *any value* | float64 | `D`
+ string | *with shortest length indicator* | string | `S`
+ array | *see notes on optimized format* | array | `[`
+ object | *see notes on optimized format* | map | `{`
+
+ @note The mapping is **complete** in the sense that any JSON value type
+ can be converted to a UBJSON value.
+
+ @note The following values can **not** be converted to a UBJSON value:
+ - strings with more than 9223372036854775807 bytes (theoretical)
+ - unsigned integer numbers above 9223372036854775807
+
+ @note The following markers are not used in the conversion:
+ - `Z`: no-op values are not created.
+ - `C`: single-byte strings are serialized with `S` markers.
+
+ @note Any UBJSON output created @ref to_ubjson can be successfully parsed
+ by @ref from_ubjson.
+
+ @note If NaN or Infinity are stored inside a JSON number, they are
+ serialized properly. This behavior differs from the @ref dump()
+ function which serializes NaN or Infinity to `null`.
+
+ @note The optimized formats for containers are supported: Parameter
+ @a use_size adds size information to the beginning of a container and
+ removes the closing marker. Parameter @a use_type further checks
+ whether all elements of a container have the same type and adds the
+ type marker to the beginning of the container. The @a use_type
+ parameter must only be used together with @a use_size = true. Note
+ that @a use_size = true alone may result in larger representations -
+ the benefit of this parameter is that the receiving side is
+ immediately informed on the number of elements of the container.
+
+ @note If the JSON data contains the binary type, the value stored is a list
+ of integers, as suggested by the UBJSON documentation. In particular,
+ this means that serialization and the deserialization of a JSON
+ containing binary values into UBJSON and back will result in a
+ different JSON object.
+
+ @param[in] j JSON value to serialize
+ @param[in] use_size whether to add size annotations to container types
+ @param[in] use_type whether to add type annotations to container types
+ (must be combined with @a use_size = true)
+ @return UBJSON serialization as byte vector
+
+ @complexity Linear in the size of the JSON value @a j.
+
+ @liveexample{The example shows the serialization of a JSON value to a byte
+ vector in UBJSON format.,to_ubjson}
+
+ @sa http://ubjson.org
+ @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the
+ analogous deserialization
+ @sa @ref to_cbor(const basic_json& for the related CBOR format
+ @sa @ref to_msgpack(const basic_json&) for the related MessagePack format
+
+ @since version 3.1.0
+ */
+ static std::vector<uint8_t> to_ubjson(const basic_json& j,
+ const bool use_size = false,
+ const bool use_type = false)
+ {
+ std::vector<uint8_t> result;
+ to_ubjson(j, result, use_size, use_type);
+ return result;
+ }
+
+ static void to_ubjson(const basic_json& j, detail::output_adapter<uint8_t> o,
+ const bool use_size = false, const bool use_type = false)
+ {
+ binary_writer<uint8_t>(o).write_ubjson(j, use_size, use_type);
+ }
+
+ static void to_ubjson(const basic_json& j, detail::output_adapter<char> o,
+ const bool use_size = false, const bool use_type = false)
+ {
+ binary_writer<char>(o).write_ubjson(j, use_size, use_type);
+ }
+
+
+ /*!
+ @brief Serializes the given JSON object `j` to BSON and returns a vector
+ containing the corresponding BSON-representation.
+
+ BSON (Binary JSON) is a binary format in which zero or more ordered key/value pairs are
+ stored as a single entity (a so-called document).
+
+ The library uses the following mapping from JSON values types to BSON types:
+
+ JSON value type | value/range | BSON type | marker
+ --------------- | --------------------------------- | ----------- | ------
+ null | `null` | null | 0x0A
+ boolean | `true`, `false` | boolean | 0x08
+ number_integer | -9223372036854775808..-2147483649 | int64 | 0x12
+ number_integer | -2147483648..2147483647 | int32 | 0x10
+ number_integer | 2147483648..9223372036854775807 | int64 | 0x12
+ number_unsigned | 0..2147483647 | int32 | 0x10
+ number_unsigned | 2147483648..9223372036854775807 | int64 | 0x12
+ number_unsigned | 9223372036854775808..18446744073709551615| -- | --
+ number_float | *any value* | double | 0x01
+ string | *any value* | string | 0x02
+ array | *any value* | document | 0x04
+ object | *any value* | document | 0x03
+ binary | *any value* | binary | 0x05
+
+ @warning The mapping is **incomplete**, since only JSON-objects (and things
+ contained therein) can be serialized to BSON.
+ Also, integers larger than 9223372036854775807 cannot be serialized to BSON,
+ and the keys may not contain U+0000, since they are serialized a
+ zero-terminated c-strings.
+
+ @throw out_of_range.407 if `j.is_number_unsigned() && j.get<std::uint64_t>() > 9223372036854775807`
+ @throw out_of_range.409 if a key in `j` contains a NULL (U+0000)
+ @throw type_error.317 if `!j.is_object()`
+
+ @pre The input `j` is required to be an object: `j.is_object() == true`.
+
+ @note Any BSON output created via @ref to_bson can be successfully parsed
+ by @ref from_bson.
+
+ @param[in] j JSON value to serialize
+ @return BSON serialization as byte vector
+
+ @complexity Linear in the size of the JSON value @a j.
+
+ @liveexample{The example shows the serialization of a JSON value to a byte
+ vector in BSON format.,to_bson}
+
+ @sa http://bsonspec.org/spec.html
+ @sa @ref from_bson(detail::input_adapter&&, const bool strict) for the
+ analogous deserialization
+ @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the
+ related UBJSON format
+ @sa @ref to_cbor(const basic_json&) for the related CBOR format
+ @sa @ref to_msgpack(const basic_json&) for the related MessagePack format
+ */
+ static std::vector<uint8_t> to_bson(const basic_json& j)
+ {
+ std::vector<uint8_t> result;
+ to_bson(j, result);
+ return result;
+ }
+
+ /*!
+ @brief Serializes the given JSON object `j` to BSON and forwards the
+ corresponding BSON-representation to the given output_adapter `o`.
+ @param j The JSON object to convert to BSON.
+ @param o The output adapter that receives the binary BSON representation.
+ @pre The input `j` shall be an object: `j.is_object() == true`
+ @sa @ref to_bson(const basic_json&)
+ */
+ static void to_bson(const basic_json& j, detail::output_adapter<uint8_t> o)
+ {
+ binary_writer<uint8_t>(o).write_bson(j);
+ }
+
+ /*!
+ @copydoc to_bson(const basic_json&, detail::output_adapter<uint8_t>)
+ */
+ static void to_bson(const basic_json& j, detail::output_adapter<char> o)
+ {
+ binary_writer<char>(o).write_bson(j);
+ }
+
+
+ /*!
+ @brief create a JSON value from an input in CBOR format
+
+ Deserializes a given input @a i to a JSON value using the CBOR (Concise
+ Binary Object Representation) serialization format.
+
+ The library maps CBOR types to JSON value types as follows:
+
+ CBOR type | JSON value type | first byte
+ ---------------------- | --------------- | ----------
+ Integer | number_unsigned | 0x00..0x17
+ Unsigned integer | number_unsigned | 0x18
+ Unsigned integer | number_unsigned | 0x19
+ Unsigned integer | number_unsigned | 0x1A
+ Unsigned integer | number_unsigned | 0x1B
+ Negative integer | number_integer | 0x20..0x37
+ Negative integer | number_integer | 0x38
+ Negative integer | number_integer | 0x39
+ Negative integer | number_integer | 0x3A
+ Negative integer | number_integer | 0x3B
+ Byte string | binary | 0x40..0x57
+ Byte string | binary | 0x58
+ Byte string | binary | 0x59
+ Byte string | binary | 0x5A
+ Byte string | binary | 0x5B
+ UTF-8 string | string | 0x60..0x77
+ UTF-8 string | string | 0x78
+ UTF-8 string | string | 0x79
+ UTF-8 string | string | 0x7A
+ UTF-8 string | string | 0x7B
+ UTF-8 string | string | 0x7F
+ array | array | 0x80..0x97
+ array | array | 0x98
+ array | array | 0x99
+ array | array | 0x9A
+ array | array | 0x9B
+ array | array | 0x9F
+ map | object | 0xA0..0xB7
+ map | object | 0xB8
+ map | object | 0xB9
+ map | object | 0xBA
+ map | object | 0xBB
+ map | object | 0xBF
+ False | `false` | 0xF4
+ True | `true` | 0xF5
+ Null | `null` | 0xF6
+ Half-Precision Float | number_float | 0xF9
+ Single-Precision Float | number_float | 0xFA
+ Double-Precision Float | number_float | 0xFB
+
+ @warning The mapping is **incomplete** in the sense that not all CBOR
+ types can be converted to a JSON value. The following CBOR types
+ are not supported and will yield parse errors (parse_error.112):
+ - date/time (0xC0..0xC1)
+ - bignum (0xC2..0xC3)
+ - decimal fraction (0xC4)
+ - bigfloat (0xC5)
+ - tagged items (0xC6..0xD4, 0xD8..0xDB)
+ - expected conversions (0xD5..0xD7)
+ - simple values (0xE0..0xF3, 0xF8)
+ - undefined (0xF7)
+
+ @warning CBOR allows map keys of any type, whereas JSON only allows
+ strings as keys in object values. Therefore, CBOR maps with keys
+ other than UTF-8 strings are rejected (parse_error.113).
+
+ @note Any CBOR output created @ref to_cbor can be successfully parsed by
+ @ref from_cbor.
+
+ @param[in] i an input in CBOR format convertible to an input adapter
+ @param[in] strict whether to expect the input to be consumed until EOF
+ (true by default)
+ @param[in] allow_exceptions whether to throw exceptions in case of a
+ parse error (optional, true by default)
+
+ @return deserialized JSON value; in case of a parse error and
+ @a allow_exceptions set to `false`, the return value will be
+ value_t::discarded.
+
+ @throw parse_error.110 if the given input ends prematurely or the end of
+ file was not reached when @a strict was set to true
+ @throw parse_error.112 if unsupported features from CBOR were
+ used in the given input @a v or if the input is not valid CBOR
+ @throw parse_error.113 if a string was expected as map key, but not found
+
+ @complexity Linear in the size of the input @a i.
+
+ @liveexample{The example shows the deserialization of a byte vector in CBOR
+ format to a JSON value.,from_cbor}
+
+ @sa http://cbor.io
+ @sa @ref to_cbor(const basic_json&) for the analogous serialization
+ @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for the
+ related MessagePack format
+ @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the
+ related UBJSON format
+
+ @since version 2.0.9; parameter @a start_index since 2.1.1; changed to
+ consume input adapters, removed start_index parameter, and added
+ @a strict parameter since 3.0.0; added @a allow_exceptions parameter
+ since 3.2.0
+ */
+ template<typename InputType>
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json from_cbor(InputType&& i,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ auto ia = detail::input_adapter(std::forward<InputType>(i));
+ const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::cbor, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ /*!
+ @copydoc from_cbor(detail::input_adapter&&, const bool, const bool)
+ */
+ template<typename IteratorType>
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json from_cbor(IteratorType first, IteratorType last,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ auto ia = detail::input_adapter(std::move(first), std::move(last));
+ const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::cbor, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ template<typename T>
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_cbor(ptr, ptr + len))
+ static basic_json from_cbor(const T* ptr, std::size_t len,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ return from_cbor(ptr, ptr + len, strict, allow_exceptions);
+ }
+
+
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_cbor(ptr, ptr + len))
+ static basic_json from_cbor(detail::span_input_adapter&& i,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ auto ia = i.get();
+ const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::cbor, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ /*!
+ @brief create a JSON value from an input in MessagePack format
+
+ Deserializes a given input @a i to a JSON value using the MessagePack
+ serialization format.
+
+ The library maps MessagePack types to JSON value types as follows:
+
+ MessagePack type | JSON value type | first byte
+ ---------------- | --------------- | ----------
+ positive fixint | number_unsigned | 0x00..0x7F
+ fixmap | object | 0x80..0x8F
+ fixarray | array | 0x90..0x9F
+ fixstr | string | 0xA0..0xBF
+ nil | `null` | 0xC0
+ false | `false` | 0xC2
+ true | `true` | 0xC3
+ float 32 | number_float | 0xCA
+ float 64 | number_float | 0xCB
+ uint 8 | number_unsigned | 0xCC
+ uint 16 | number_unsigned | 0xCD
+ uint 32 | number_unsigned | 0xCE
+ uint 64 | number_unsigned | 0xCF
+ int 8 | number_integer | 0xD0
+ int 16 | number_integer | 0xD1
+ int 32 | number_integer | 0xD2
+ int 64 | number_integer | 0xD3
+ str 8 | string | 0xD9
+ str 16 | string | 0xDA
+ str 32 | string | 0xDB
+ array 16 | array | 0xDC
+ array 32 | array | 0xDD
+ map 16 | object | 0xDE
+ map 32 | object | 0xDF
+ bin 8 | binary | 0xC4
+ bin 16 | binary | 0xC5
+ bin 32 | binary | 0xC6
+ ext 8 | binary | 0xC7
+ ext 16 | binary | 0xC8
+ ext 32 | binary | 0xC9
+ fixext 1 | binary | 0xD4
+ fixext 2 | binary | 0xD5
+ fixext 4 | binary | 0xD6
+ fixext 8 | binary | 0xD7
+ fixext 16 | binary | 0xD8
+ negative fixint | number_integer | 0xE0-0xFF
+
+ @note Any MessagePack output created @ref to_msgpack can be successfully
+ parsed by @ref from_msgpack.
+
+ @param[in] i an input in MessagePack format convertible to an input
+ adapter
+ @param[in] strict whether to expect the input to be consumed until EOF
+ (true by default)
+ @param[in] allow_exceptions whether to throw exceptions in case of a
+ parse error (optional, true by default)
+
+ @return deserialized JSON value; in case of a parse error and
+ @a allow_exceptions set to `false`, the return value will be
+ value_t::discarded.
+
+ @throw parse_error.110 if the given input ends prematurely or the end of
+ file was not reached when @a strict was set to true
+ @throw parse_error.112 if unsupported features from MessagePack were
+ used in the given input @a i or if the input is not valid MessagePack
+ @throw parse_error.113 if a string was expected as map key, but not found
+
+ @complexity Linear in the size of the input @a i.
+
+ @liveexample{The example shows the deserialization of a byte vector in
+ MessagePack format to a JSON value.,from_msgpack}
+
+ @sa http://msgpack.org
+ @sa @ref to_msgpack(const basic_json&) for the analogous serialization
+ @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool) for the
+ related CBOR format
+ @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for
+ the related UBJSON format
+ @sa @ref from_bson(detail::input_adapter&&, const bool, const bool) for
+ the related BSON format
+
+ @since version 2.0.9; parameter @a start_index since 2.1.1; changed to
+ consume input adapters, removed start_index parameter, and added
+ @a strict parameter since 3.0.0; added @a allow_exceptions parameter
+ since 3.2.0
+ */
+ template<typename InputType>
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json from_msgpack(InputType&& i,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ auto ia = detail::input_adapter(std::forward<InputType>(i));
+ const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::msgpack, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ /*!
+ @copydoc from_msgpack(detail::input_adapter&&, const bool, const bool)
+ */
+ template<typename IteratorType>
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json from_msgpack(IteratorType first, IteratorType last,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ auto ia = detail::input_adapter(std::move(first), std::move(last));
+ const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::msgpack, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+
+ template<typename T>
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_msgpack(ptr, ptr + len))
+ static basic_json from_msgpack(const T* ptr, std::size_t len,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ return from_msgpack(ptr, ptr + len, strict, allow_exceptions);
+ }
+
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_msgpack(ptr, ptr + len))
+ static basic_json from_msgpack(detail::span_input_adapter&& i,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ auto ia = i.get();
+ const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::msgpack, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+
+ /*!
+ @brief create a JSON value from an input in UBJSON format
+
+ Deserializes a given input @a i to a JSON value using the UBJSON (Universal
+ Binary JSON) serialization format.
+
+ The library maps UBJSON types to JSON value types as follows:
+
+ UBJSON type | JSON value type | marker
+ ----------- | --------------------------------------- | ------
+ no-op | *no value, next value is read* | `N`
+ null | `null` | `Z`
+ false | `false` | `F`
+ true | `true` | `T`
+ float32 | number_float | `d`
+ float64 | number_float | `D`
+ uint8 | number_unsigned | `U`
+ int8 | number_integer | `i`
+ int16 | number_integer | `I`
+ int32 | number_integer | `l`
+ int64 | number_integer | `L`
+ string | string | `S`
+ char | string | `C`
+ array | array (optimized values are supported) | `[`
+ object | object (optimized values are supported) | `{`
+
+ @note The mapping is **complete** in the sense that any UBJSON value can
+ be converted to a JSON value.
+
+ @param[in] i an input in UBJSON format convertible to an input adapter
+ @param[in] strict whether to expect the input to be consumed until EOF
+ (true by default)
+ @param[in] allow_exceptions whether to throw exceptions in case of a
+ parse error (optional, true by default)
+
+ @return deserialized JSON value; in case of a parse error and
+ @a allow_exceptions set to `false`, the return value will be
+ value_t::discarded.
+
+ @throw parse_error.110 if the given input ends prematurely or the end of
+ file was not reached when @a strict was set to true
+ @throw parse_error.112 if a parse error occurs
+ @throw parse_error.113 if a string could not be parsed successfully
+
+ @complexity Linear in the size of the input @a i.
+
+ @liveexample{The example shows the deserialization of a byte vector in
+ UBJSON format to a JSON value.,from_ubjson}
+
+ @sa http://ubjson.org
+ @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the
+ analogous serialization
+ @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool) for the
+ related CBOR format
+ @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for
+ the related MessagePack format
+ @sa @ref from_bson(detail::input_adapter&&, const bool, const bool) for
+ the related BSON format
+
+ @since version 3.1.0; added @a allow_exceptions parameter since 3.2.0
+ */
+ template<typename InputType>
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json from_ubjson(InputType&& i,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ auto ia = detail::input_adapter(std::forward<InputType>(i));
+ const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::ubjson, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ /*!
+ @copydoc from_ubjson(detail::input_adapter&&, const bool, const bool)
+ */
+ template<typename IteratorType>
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json from_ubjson(IteratorType first, IteratorType last,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ auto ia = detail::input_adapter(std::move(first), std::move(last));
+ const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::ubjson, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ template<typename T>
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_ubjson(ptr, ptr + len))
+ static basic_json from_ubjson(const T* ptr, std::size_t len,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ return from_ubjson(ptr, ptr + len, strict, allow_exceptions);
+ }
+
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_ubjson(ptr, ptr + len))
+ static basic_json from_ubjson(detail::span_input_adapter&& i,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ auto ia = i.get();
+ const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::ubjson, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+
+ /*!
+ @brief Create a JSON value from an input in BSON format
+
+ Deserializes a given input @a i to a JSON value using the BSON (Binary JSON)
+ serialization format.
+
+ The library maps BSON record types to JSON value types as follows:
+
+ BSON type | BSON marker byte | JSON value type
+ --------------- | ---------------- | ---------------------------
+ double | 0x01 | number_float
+ string | 0x02 | string
+ document | 0x03 | object
+ array | 0x04 | array
+ binary | 0x05 | still unsupported
+ undefined | 0x06 | still unsupported
+ ObjectId | 0x07 | still unsupported
+ boolean | 0x08 | boolean
+ UTC Date-Time | 0x09 | still unsupported
+ null | 0x0A | null
+ Regular Expr. | 0x0B | still unsupported
+ DB Pointer | 0x0C | still unsupported
+ JavaScript Code | 0x0D | still unsupported
+ Symbol | 0x0E | still unsupported
+ JavaScript Code | 0x0F | still unsupported
+ int32 | 0x10 | number_integer
+ Timestamp | 0x11 | still unsupported
+ 128-bit decimal float | 0x13 | still unsupported
+ Max Key | 0x7F | still unsupported
+ Min Key | 0xFF | still unsupported
+
+ @warning The mapping is **incomplete**. The unsupported mappings
+ are indicated in the table above.
+
+ @param[in] i an input in BSON format convertible to an input adapter
+ @param[in] strict whether to expect the input to be consumed until EOF
+ (true by default)
+ @param[in] allow_exceptions whether to throw exceptions in case of a
+ parse error (optional, true by default)
+
+ @return deserialized JSON value; in case of a parse error and
+ @a allow_exceptions set to `false`, the return value will be
+ value_t::discarded.
+
+ @throw parse_error.114 if an unsupported BSON record type is encountered
+
+ @complexity Linear in the size of the input @a i.
+
+ @liveexample{The example shows the deserialization of a byte vector in
+ BSON format to a JSON value.,from_bson}
+
+ @sa http://bsonspec.org/spec.html
+ @sa @ref to_bson(const basic_json&) for the analogous serialization
+ @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool) for the
+ related CBOR format
+ @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for
+ the related MessagePack format
+ @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the
+ related UBJSON format
+ */
+ template<typename InputType>
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json from_bson(InputType&& i,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ auto ia = detail::input_adapter(std::forward<InputType>(i));
+ const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::bson, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ /*!
+ @copydoc from_bson(detail::input_adapter&&, const bool, const bool)
+ */
+ template<typename IteratorType>
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json from_bson(IteratorType first, IteratorType last,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ auto ia = detail::input_adapter(std::move(first), std::move(last));
+ const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::bson, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+
+ template<typename T>
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_bson(ptr, ptr + len))
+ static basic_json from_bson(const T* ptr, std::size_t len,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ return from_bson(ptr, ptr + len, strict, allow_exceptions);
+ }
+
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_bson(ptr, ptr + len))
+ static basic_json from_bson(detail::span_input_adapter&& i,
+ const bool strict = true,
+ const bool allow_exceptions = true)
+ {
+ basic_json result;
+ detail::json_sax_dom_parser<basic_json> sdp(result, allow_exceptions);
+ auto ia = i.get();
+ const bool res = binary_reader<decltype(ia)>(std::move(ia)).sax_parse(input_format_t::bson, &sdp, strict);
+ return res ? result : basic_json(value_t::discarded);
+ }
+ /// @}
+
+ //////////////////////////
+ // JSON Pointer support //
+ //////////////////////////
+
+ /// @name JSON Pointer functions
+ /// @{
+
+ /*!
+ @brief access specified element via JSON Pointer
+
+ Uses a JSON pointer to retrieve a reference to the respective JSON value.
+ No bound checking is performed. Similar to @ref operator[](const typename
+ object_t::key_type&), `null` values are created in arrays and objects if
+ necessary.
+
+ In particular:
+ - If the JSON pointer points to an object key that does not exist, it
+ is created an filled with a `null` value before a reference to it
+ is returned.
+ - If the JSON pointer points to an array index that does not exist, it
+ is created an filled with a `null` value before a reference to it
+ is returned. All indices between the current maximum and the given
+ index are also filled with `null`.
+ - The special value `-` is treated as a synonym for the index past the
+ end.
+
+ @param[in] ptr a JSON pointer
+
+ @return reference to the element pointed to by @a ptr
+
+ @complexity Constant.
+
+ @throw parse_error.106 if an array index begins with '0'
+ @throw parse_error.109 if an array index was not a number
+ @throw out_of_range.404 if the JSON pointer can not be resolved
+
+ @liveexample{The behavior is shown in the example.,operatorjson_pointer}
+
+ @since version 2.0.0
+ */
+ reference operator[](const json_pointer& ptr)
+ {
+ return ptr.get_unchecked(this);
+ }
+
+ /*!
+ @brief access specified element via JSON Pointer
+
+ Uses a JSON pointer to retrieve a reference to the respective JSON value.
+ No bound checking is performed. The function does not change the JSON
+ value; no `null` values are created. In particular, the special value
+ `-` yields an exception.
+
+ @param[in] ptr JSON pointer to the desired element
+
+ @return const reference to the element pointed to by @a ptr
+
+ @complexity Constant.
+
+ @throw parse_error.106 if an array index begins with '0'
+ @throw parse_error.109 if an array index was not a number
+ @throw out_of_range.402 if the array index '-' is used
+ @throw out_of_range.404 if the JSON pointer can not be resolved
+
+ @liveexample{The behavior is shown in the example.,operatorjson_pointer_const}
+
+ @since version 2.0.0
+ */
+ const_reference operator[](const json_pointer& ptr) const
+ {
+ return ptr.get_unchecked(this);
+ }
+
+ /*!
+ @brief access specified element via JSON Pointer
+
+ Returns a reference to the element at with specified JSON pointer @a ptr,
+ with bounds checking.
+
+ @param[in] ptr JSON pointer to the desired element
+
+ @return reference to the element pointed to by @a ptr
+
+ @throw parse_error.106 if an array index in the passed JSON pointer @a ptr
+ begins with '0'. See example below.
+
+ @throw parse_error.109 if an array index in the passed JSON pointer @a ptr
+ is not a number. See example below.
+
+ @throw out_of_range.401 if an array index in the passed JSON pointer @a ptr
+ is out of range. See example below.
+
+ @throw out_of_range.402 if the array index '-' is used in the passed JSON
+ pointer @a ptr. As `at` provides checked access (and no elements are
+ implicitly inserted), the index '-' is always invalid. See example below.
+
+ @throw out_of_range.403 if the JSON pointer describes a key of an object
+ which cannot be found. See example below.
+
+ @throw out_of_range.404 if the JSON pointer @a ptr can not be resolved.
+ See example below.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Constant.
+
+ @since version 2.0.0
+
+ @liveexample{The behavior is shown in the example.,at_json_pointer}
+ */
+ reference at(const json_pointer& ptr)
+ {
+ return ptr.get_checked(this);
+ }
+
+ /*!
+ @brief access specified element via JSON Pointer
+
+ Returns a const reference to the element at with specified JSON pointer @a
+ ptr, with bounds checking.
+
+ @param[in] ptr JSON pointer to the desired element
+
+ @return reference to the element pointed to by @a ptr
+
+ @throw parse_error.106 if an array index in the passed JSON pointer @a ptr
+ begins with '0'. See example below.
+
+ @throw parse_error.109 if an array index in the passed JSON pointer @a ptr
+ is not a number. See example below.
+
+ @throw out_of_range.401 if an array index in the passed JSON pointer @a ptr
+ is out of range. See example below.
+
+ @throw out_of_range.402 if the array index '-' is used in the passed JSON
+ pointer @a ptr. As `at` provides checked access (and no elements are
+ implicitly inserted), the index '-' is always invalid. See example below.
+
+ @throw out_of_range.403 if the JSON pointer describes a key of an object
+ which cannot be found. See example below.
+
+ @throw out_of_range.404 if the JSON pointer @a ptr can not be resolved.
+ See example below.
+
+ @exceptionsafety Strong guarantee: if an exception is thrown, there are no
+ changes in the JSON value.
+
+ @complexity Constant.
+
+ @since version 2.0.0
+
+ @liveexample{The behavior is shown in the example.,at_json_pointer_const}
+ */
+ const_reference at(const json_pointer& ptr) const
+ {
+ return ptr.get_checked(this);
+ }
+
+ /*!
+ @brief return flattened JSON value
+
+ The function creates a JSON object whose keys are JSON pointers (see [RFC
+ 6901](https://tools.ietf.org/html/rfc6901)) and whose values are all
+ primitive. The original JSON value can be restored using the @ref
+ unflatten() function.
+
+ @return an object that maps JSON pointers to primitive values
+
+ @note Empty objects and arrays are flattened to `null` and will not be
+ reconstructed correctly by the @ref unflatten() function.
+
+ @complexity Linear in the size the JSON value.
+
+ @liveexample{The following code shows how a JSON object is flattened to an
+ object whose keys consist of JSON pointers.,flatten}
+
+ @sa @ref unflatten() for the reverse function
+
+ @since version 2.0.0
+ */
+ basic_json flatten() const
+ {
+ basic_json result(value_t::object);
+ json_pointer::flatten("", *this, result);
+ return result;
+ }
+
+ /*!
+ @brief unflatten a previously flattened JSON value
+
+ The function restores the arbitrary nesting of a JSON value that has been
+ flattened before using the @ref flatten() function. The JSON value must
+ meet certain constraints:
+ 1. The value must be an object.
+ 2. The keys must be JSON pointers (see
+ [RFC 6901](https://tools.ietf.org/html/rfc6901))
+ 3. The mapped values must be primitive JSON types.
+
+ @return the original JSON from a flattened version
+
+ @note Empty objects and arrays are flattened by @ref flatten() to `null`
+ values and can not unflattened to their original type. Apart from
+ this example, for a JSON value `j`, the following is always true:
+ `j == j.flatten().unflatten()`.
+
+ @complexity Linear in the size the JSON value.
+
+ @throw type_error.314 if value is not an object
+ @throw type_error.315 if object values are not primitive
+
+ @liveexample{The following code shows how a flattened JSON object is
+ unflattened into the original nested JSON object.,unflatten}
+
+ @sa @ref flatten() for the reverse function
+
+ @since version 2.0.0
+ */
+ basic_json unflatten() const
+ {
+ return json_pointer::unflatten(*this);
+ }
+
+ /// @}
+
+ //////////////////////////
+ // JSON Patch functions //
+ //////////////////////////
+
+ /// @name JSON Patch functions
+ /// @{
+
+ /*!
+ @brief applies a JSON patch
+
+ [JSON Patch](http://jsonpatch.com) defines a JSON document structure for
+ expressing a sequence of operations to apply to a JSON) document. With
+ this function, a JSON Patch is applied to the current JSON value by
+ executing all operations from the patch.
+
+ @param[in] json_patch JSON patch document
+ @return patched document
+
+ @note The application of a patch is atomic: Either all operations succeed
+ and the patched document is returned or an exception is thrown. In
+ any case, the original value is not changed: the patch is applied
+ to a copy of the value.
+
+ @throw parse_error.104 if the JSON patch does not consist of an array of
+ objects
+
+ @throw parse_error.105 if the JSON patch is malformed (e.g., mandatory
+ attributes are missing); example: `"operation add must have member path"`
+
+ @throw out_of_range.401 if an array index is out of range.
+
+ @throw out_of_range.403 if a JSON pointer inside the patch could not be
+ resolved successfully in the current JSON value; example: `"key baz not
+ found"`
+
+ @throw out_of_range.405 if JSON pointer has no parent ("add", "remove",
+ "move")
+
+ @throw other_error.501 if "test" operation was unsuccessful
+
+ @complexity Linear in the size of the JSON value and the length of the
+ JSON patch. As usually only a fraction of the JSON value is affected by
+ the patch, the complexity can usually be neglected.
+
+ @liveexample{The following code shows how a JSON patch is applied to a
+ value.,patch}
+
+ @sa @ref diff -- create a JSON patch by comparing two JSON values
+
+ @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902)
+ @sa [RFC 6901 (JSON Pointer)](https://tools.ietf.org/html/rfc6901)
+
+ @since version 2.0.0
+ */
+ basic_json patch(const basic_json& json_patch) const
+ {
+ // make a working copy to apply the patch to
+ basic_json result = *this;
+
+ // the valid JSON Patch operations
+ enum class patch_operations {add, remove, replace, move, copy, test, invalid};
+
+ const auto get_op = [](const std::string & op)
+ {
+ if (op == "add")
+ {
+ return patch_operations::add;
+ }
+ if (op == "remove")
+ {
+ return patch_operations::remove;
+ }
+ if (op == "replace")
+ {
+ return patch_operations::replace;
+ }
+ if (op == "move")
+ {
+ return patch_operations::move;
+ }
+ if (op == "copy")
+ {
+ return patch_operations::copy;
+ }
+ if (op == "test")
+ {
+ return patch_operations::test;
+ }
+
+ return patch_operations::invalid;
+ };
+
+ // wrapper for "add" operation; add value at ptr
+ const auto operation_add = [&result](json_pointer & ptr, basic_json val)
+ {
+ // adding to the root of the target document means replacing it
+ if (ptr.empty())
+ {
+ result = val;
+ return;
+ }
+
+ // make sure the top element of the pointer exists
+ json_pointer top_pointer = ptr.top();
+ if (top_pointer != ptr)
+ {
+ result.at(top_pointer);
+ }
+
+ // get reference to parent of JSON pointer ptr
+ const auto last_path = ptr.back();
+ ptr.pop_back();
+ basic_json& parent = result[ptr];
+
+ switch (parent.m_type)
+ {
+ case value_t::null:
+ case value_t::object:
+ {
+ // use operator[] to add value
+ parent[last_path] = val;
+ break;
+ }
+
+ case value_t::array:
+ {
+ if (last_path == "-")
+ {
+ // special case: append to back
+ parent.push_back(val);
+ }
+ else
+ {
+ const auto idx = json_pointer::array_index(last_path);
+ if (JSON_HEDLEY_UNLIKELY(static_cast<size_type>(idx) > parent.size()))
+ {
+ // avoid undefined behavior
+ JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range"));
+ }
+
+ // default case: insert add offset
+ parent.insert(parent.begin() + static_cast<difference_type>(idx), val);
+ }
+ break;
+ }
+
+ // if there exists a parent it cannot be primitive
+ default: // LCOV_EXCL_LINE
+ assert(false); // LCOV_EXCL_LINE
+ }
+ };
+
+ // wrapper for "remove" operation; remove value at ptr
+ const auto operation_remove = [&result](json_pointer & ptr)
+ {
+ // get reference to parent of JSON pointer ptr
+ const auto last_path = ptr.back();
+ ptr.pop_back();
+ basic_json& parent = result.at(ptr);
+
+ // remove child
+ if (parent.is_object())
+ {
+ // perform range check
+ auto it = parent.find(last_path);
+ if (JSON_HEDLEY_LIKELY(it != parent.end()))
+ {
+ parent.erase(it);
+ }
+ else
+ {
+ JSON_THROW(out_of_range::create(403, "key '" + last_path + "' not found"));
+ }
+ }
+ else if (parent.is_array())
+ {
+ // note erase performs range check
+ parent.erase(static_cast<size_type>(json_pointer::array_index(last_path)));
+ }
+ };
+
+ // type check: top level value must be an array
+ if (JSON_HEDLEY_UNLIKELY(not json_patch.is_array()))
+ {
+ JSON_THROW(parse_error::create(104, 0, "JSON patch must be an array of objects"));
+ }
+
+ // iterate and apply the operations
+ for (const auto& val : json_patch)
+ {
+ // wrapper to get a value for an operation
+ const auto get_value = [&val](const std::string & op,
+ const std::string & member,
+ bool string_type) -> basic_json &
+ {
+ // find value
+ auto it = val.m_value.object->find(member);
+
+ // context-sensitive error message
+ const auto error_msg = (op == "op") ? "operation" : "operation '" + op + "'";
+
+ // check if desired value is present
+ if (JSON_HEDLEY_UNLIKELY(it == val.m_value.object->end()))
+ {
+ JSON_THROW(parse_error::create(105, 0, error_msg + " must have member '" + member + "'"));
+ }
+
+ // check if result is of type string
+ if (JSON_HEDLEY_UNLIKELY(string_type and not it->second.is_string()))
+ {
+ JSON_THROW(parse_error::create(105, 0, error_msg + " must have string member '" + member + "'"));
+ }
+
+ // no error: return value
+ return it->second;
+ };
+
+ // type check: every element of the array must be an object
+ if (JSON_HEDLEY_UNLIKELY(not val.is_object()))
+ {
+ JSON_THROW(parse_error::create(104, 0, "JSON patch must be an array of objects"));
+ }
+
+ // collect mandatory members
+ const std::string op = get_value("op", "op", true);
+ const std::string path = get_value(op, "path", true);
+ json_pointer ptr(path);
+
+ switch (get_op(op))
+ {
+ case patch_operations::add:
+ {
+ operation_add(ptr, get_value("add", "value", false));
+ break;
+ }
+
+ case patch_operations::remove:
+ {
+ operation_remove(ptr);
+ break;
+ }
+
+ case patch_operations::replace:
+ {
+ // the "path" location must exist - use at()
+ result.at(ptr) = get_value("replace", "value", false);
+ break;
+ }
+
+ case patch_operations::move:
+ {
+ const std::string from_path = get_value("move", "from", true);
+ json_pointer from_ptr(from_path);
+
+ // the "from" location must exist - use at()
+ basic_json v = result.at(from_ptr);
+
+ // The move operation is functionally identical to a
+ // "remove" operation on the "from" location, followed
+ // immediately by an "add" operation at the target
+ // location with the value that was just removed.
+ operation_remove(from_ptr);
+ operation_add(ptr, v);
+ break;
+ }
+
+ case patch_operations::copy:
+ {
+ const std::string from_path = get_value("copy", "from", true);
+ const json_pointer from_ptr(from_path);
+
+ // the "from" location must exist - use at()
+ basic_json v = result.at(from_ptr);
+
+ // The copy is functionally identical to an "add"
+ // operation at the target location using the value
+ // specified in the "from" member.
+ operation_add(ptr, v);
+ break;
+ }
+
+ case patch_operations::test:
+ {
+ bool success = false;
+ JSON_TRY
+ {
+ // check if "value" matches the one at "path"
+ // the "path" location must exist - use at()
+ success = (result.at(ptr) == get_value("test", "value", false));
+ }
+ JSON_INTERNAL_CATCH (out_of_range&)
+ {
+ // ignore out of range errors: success remains false
+ }
+
+ // throw an exception if test fails
+ if (JSON_HEDLEY_UNLIKELY(not success))
+ {
+ JSON_THROW(other_error::create(501, "unsuccessful: " + val.dump()));
+ }
+
+ break;
+ }
+
+ default:
+ {
+ // op must be "add", "remove", "replace", "move", "copy", or
+ // "test"
+ JSON_THROW(parse_error::create(105, 0, "operation value '" + op + "' is invalid"));
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /*!
+ @brief creates a diff as a JSON patch
+
+ Creates a [JSON Patch](http://jsonpatch.com) so that value @a source can
+ be changed into the value @a target by calling @ref patch function.
+
+ @invariant For two JSON values @a source and @a target, the following code
+ yields always `true`:
+ @code {.cpp}
+ source.patch(diff(source, target)) == target;
+ @endcode
+
+ @note Currently, only `remove`, `add`, and `replace` operations are
+ generated.
+
+ @param[in] source JSON value to compare from
+ @param[in] target JSON value to compare against
+ @param[in] path helper value to create JSON pointers
+
+ @return a JSON patch to convert the @a source to @a target
+
+ @complexity Linear in the lengths of @a source and @a target.
+
+ @liveexample{The following code shows how a JSON patch is created as a
+ diff for two JSON values.,diff}
+
+ @sa @ref patch -- apply a JSON patch
+ @sa @ref merge_patch -- apply a JSON Merge Patch
+
+ @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902)
+
+ @since version 2.0.0
+ */
+ JSON_HEDLEY_WARN_UNUSED_RESULT
+ static basic_json diff(const basic_json& source, const basic_json& target,
+ const std::string& path = "")
+ {
+ // the patch
+ basic_json result(value_t::array);
+
+ // if the values are the same, return empty patch
+ if (source == target)
+ {
+ return result;
+ }
+
+ if (source.type() != target.type())
+ {
+ // different types: replace value
+ result.push_back(
+ {
+ {"op", "replace"}, {"path", path}, {"value", target}
+ });
+ return result;
+ }
+
+ switch (source.type())
+ {
+ case value_t::array:
+ {
+ // first pass: traverse common elements
+ std::size_t i = 0;
+ while (i < source.size() and i < target.size())
+ {
+ // recursive call to compare array values at index i
+ auto temp_diff = diff(source[i], target[i], path + "/" + std::to_string(i));
+ result.insert(result.end(), temp_diff.begin(), temp_diff.end());
+ ++i;
+ }
+
+ // i now reached the end of at least one array
+ // in a second pass, traverse the remaining elements
+
+ // remove my remaining elements
+ const auto end_index = static_cast<difference_type>(result.size());
+ while (i < source.size())
+ {
+ // add operations in reverse order to avoid invalid
+ // indices
+ result.insert(result.begin() + end_index, object(
+ {
+ {"op", "remove"},
+ {"path", path + "/" + std::to_string(i)}
+ }));
+ ++i;
+ }
+
+ // add other remaining elements
+ while (i < target.size())
+ {
+ result.push_back(
+ {
+ {"op", "add"},
+ {"path", path + "/-"},
+ {"value", target[i]}
+ });
+ ++i;
+ }
+
+ break;
+ }
+
+ case value_t::object:
+ {
+ // first pass: traverse this object's elements
+ for (auto it = source.cbegin(); it != source.cend(); ++it)
+ {
+ // escape the key name to be used in a JSON patch
+ const auto key = json_pointer::escape(it.key());
+
+ if (target.find(it.key()) != target.end())
+ {
+ // recursive call to compare object values at key it
+ auto temp_diff = diff(it.value(), target[it.key()], path + "/" + key);
+ result.insert(result.end(), temp_diff.begin(), temp_diff.end());
+ }
+ else
+ {
+ // found a key that is not in o -> remove it
+ result.push_back(object(
+ {
+ {"op", "remove"}, {"path", path + "/" + key}
+ }));
+ }
+ }
+
+ // second pass: traverse other object's elements
+ for (auto it = target.cbegin(); it != target.cend(); ++it)
+ {
+ if (source.find(it.key()) == source.end())
+ {
+ // found a key that is not in this -> add it
+ const auto key = json_pointer::escape(it.key());
+ result.push_back(
+ {
+ {"op", "add"}, {"path", path + "/" + key},
+ {"value", it.value()}
+ });
+ }
+ }
+
+ break;
+ }
+
+ default:
+ {
+ // both primitive type: replace value
+ result.push_back(
+ {
+ {"op", "replace"}, {"path", path}, {"value", target}
+ });
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ /// @}
+
+ ////////////////////////////////
+ // JSON Merge Patch functions //
+ ////////////////////////////////
+
+ /// @name JSON Merge Patch functions
+ /// @{
+
+ /*!
+ @brief applies a JSON Merge Patch
+
+ The merge patch format is primarily intended for use with the HTTP PATCH
+ method as a means of describing a set of modifications to a target
+ resource's content. This function applies a merge patch to the current
+ JSON value.
+
+ The function implements the following algorithm from Section 2 of
+ [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396):
+
+ ```
+ define MergePatch(Target, Patch):
+ if Patch is an Object:
+ if Target is not an Object:
+ Target = {} // Ignore the contents and set it to an empty Object
+ for each Name/Value pair in Patch:
+ if Value is null:
+ if Name exists in Target:
+ remove the Name/Value pair from Target
+ else:
+ Target[Name] = MergePatch(Target[Name], Value)
+ return Target
+ else:
+ return Patch
+ ```
+
+ Thereby, `Target` is the current object; that is, the patch is applied to
+ the current value.
+
+ @param[in] apply_patch the patch to apply
+
+ @complexity Linear in the lengths of @a patch.
+
+ @liveexample{The following code shows how a JSON Merge Patch is applied to
+ a JSON document.,merge_patch}
+
+ @sa @ref patch -- apply a JSON patch
+ @sa [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396)
+
+ @since version 3.0.0
+ */
+ void merge_patch(const basic_json& apply_patch)
+ {
+ if (apply_patch.is_object())
+ {
+ if (not is_object())
+ {
+ *this = object();
+ }
+ for (auto it = apply_patch.begin(); it != apply_patch.end(); ++it)
+ {
+ if (it.value().is_null())
+ {
+ erase(it.key());
+ }
+ else
+ {
+ operator[](it.key()).merge_patch(it.value());
+ }
+ }
+ }
+ else
+ {
+ *this = apply_patch;
+ }
+ }
+
+ /// @}
+};
+
+/*!
+@brief user-defined to_string function for JSON values
+
+This function implements a user-defined to_string for JSON objects.
+
+@param[in] j a JSON object
+@return a std::string object
+*/
+
+NLOHMANN_BASIC_JSON_TPL_DECLARATION
+std::string to_string(const NLOHMANN_BASIC_JSON_TPL& j)
+{
+ return j.dump();
+}
+} // namespace nlohmann
+
+///////////////////////
+// nonmember support //
+///////////////////////
+
+// specialization of std::swap, and std::hash
+namespace std
+{
+
+/// hash value for JSON objects
+template<>
+struct hash<nlohmann::json>
+{
+ /*!
+ @brief return a hash value for a JSON object
+
+ @since version 1.0.0
+ */
+ std::size_t operator()(const nlohmann::json& j) const
+ {
+ // a naive hashing via the string representation
+ const auto& h = hash<nlohmann::json::string_t>();
+ return h(j.dump());
+ }
+};
+
+/// specialization for std::less<value_t>
+/// @note: do not remove the space after '<',
+/// see https://github.com/nlohmann/json/pull/679
+template<>
+struct less<::nlohmann::detail::value_t>
+{
+ /*!
+ @brief compare two value_t enum values
+ @since version 3.0.0
+ */
+ bool operator()(nlohmann::detail::value_t lhs,
+ nlohmann::detail::value_t rhs) const noexcept
+ {
+ return nlohmann::detail::operator<(lhs, rhs);
+ }
+};
+
+/*!
+@brief exchanges the values of two JSON objects
+
+@since version 1.0.0
+*/
+template<>
+inline void swap<nlohmann::json>(nlohmann::json& j1, nlohmann::json& j2) noexcept(
+ is_nothrow_move_constructible<nlohmann::json>::value and
+ is_nothrow_move_assignable<nlohmann::json>::value
+)
+{
+ j1.swap(j2);
+}
+
+} // namespace std
+
+/*!
+@brief user-defined string literal for JSON values
+
+This operator implements a user-defined string literal for JSON objects. It
+can be used by adding `"_json"` to a string literal and returns a JSON object
+if no parse error occurred.
+
+@param[in] s a string representation of a JSON object
+@param[in] n the length of string @a s
+@return a JSON object
+
+@since version 1.0.0
+*/
+JSON_HEDLEY_NON_NULL(1)
+inline nlohmann::json operator "" _json(const char* s, std::size_t n)
+{
+ return nlohmann::json::parse(s, s + n);
+}
+
+/*!
+@brief user-defined string literal for JSON pointer
+
+This operator implements a user-defined string literal for JSON Pointers. It
+can be used by adding `"_json_pointer"` to a string literal and returns a JSON pointer
+object if no parse error occurred.
+
+@param[in] s a string representation of a JSON Pointer
+@param[in] n the length of string @a s
+@return a JSON pointer object
+
+@since version 2.0.0
+*/
+JSON_HEDLEY_NON_NULL(1)
+inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t n)
+{
+ return nlohmann::json::json_pointer(std::string(s, n));
+}
+
+// #include <nlohmann/detail/macro_unscope.hpp>
+
+
+// restore GCC/clang diagnostic settings
+#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
+ #pragma GCC diagnostic pop
+#endif
+#if defined(__clang__)
+ #pragma GCC diagnostic pop
+#endif
+
+// clean up
+#undef JSON_INTERNAL_CATCH
+#undef JSON_CATCH
+#undef JSON_THROW
+#undef JSON_TRY
+#undef JSON_HAS_CPP_14
+#undef JSON_HAS_CPP_17
+#undef NLOHMANN_BASIC_JSON_TPL_DECLARATION
+#undef NLOHMANN_BASIC_JSON_TPL
+
+// #include <nlohmann/thirdparty/hedley/hedley_undef.hpp>
+#undef JSON_HEDLEY_ALWAYS_INLINE
+#undef JSON_HEDLEY_ARM_VERSION
+#undef JSON_HEDLEY_ARM_VERSION_CHECK
+#undef JSON_HEDLEY_ARRAY_PARAM
+#undef JSON_HEDLEY_ASSUME
+#undef JSON_HEDLEY_BEGIN_C_DECLS
+#undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE
+#undef JSON_HEDLEY_CLANG_HAS_BUILTIN
+#undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE
+#undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE
+#undef JSON_HEDLEY_CLANG_HAS_EXTENSION
+#undef JSON_HEDLEY_CLANG_HAS_FEATURE
+#undef JSON_HEDLEY_CLANG_HAS_WARNING
+#undef JSON_HEDLEY_COMPCERT_VERSION
+#undef JSON_HEDLEY_COMPCERT_VERSION_CHECK
+#undef JSON_HEDLEY_CONCAT
+#undef JSON_HEDLEY_CONCAT3
+#undef JSON_HEDLEY_CONCAT3_EX
+#undef JSON_HEDLEY_CONCAT_EX
+#undef JSON_HEDLEY_CONST
+#undef JSON_HEDLEY_CONSTEXPR
+#undef JSON_HEDLEY_CONST_CAST
+#undef JSON_HEDLEY_CPP_CAST
+#undef JSON_HEDLEY_CRAY_VERSION
+#undef JSON_HEDLEY_CRAY_VERSION_CHECK
+#undef JSON_HEDLEY_C_DECL
+#undef JSON_HEDLEY_DEPRECATED
+#undef JSON_HEDLEY_DEPRECATED_FOR
+#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL
+#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_
+#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
+#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES
+#undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS
+#undef JSON_HEDLEY_DIAGNOSTIC_POP
+#undef JSON_HEDLEY_DIAGNOSTIC_PUSH
+#undef JSON_HEDLEY_DMC_VERSION
+#undef JSON_HEDLEY_DMC_VERSION_CHECK
+#undef JSON_HEDLEY_EMPTY_BASES
+#undef JSON_HEDLEY_EMSCRIPTEN_VERSION
+#undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK
+#undef JSON_HEDLEY_END_C_DECLS
+#undef JSON_HEDLEY_FLAGS
+#undef JSON_HEDLEY_FLAGS_CAST
+#undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE
+#undef JSON_HEDLEY_GCC_HAS_BUILTIN
+#undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE
+#undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE
+#undef JSON_HEDLEY_GCC_HAS_EXTENSION
+#undef JSON_HEDLEY_GCC_HAS_FEATURE
+#undef JSON_HEDLEY_GCC_HAS_WARNING
+#undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK
+#undef JSON_HEDLEY_GCC_VERSION
+#undef JSON_HEDLEY_GCC_VERSION_CHECK
+#undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE
+#undef JSON_HEDLEY_GNUC_HAS_BUILTIN
+#undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE
+#undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE
+#undef JSON_HEDLEY_GNUC_HAS_EXTENSION
+#undef JSON_HEDLEY_GNUC_HAS_FEATURE
+#undef JSON_HEDLEY_GNUC_HAS_WARNING
+#undef JSON_HEDLEY_GNUC_VERSION
+#undef JSON_HEDLEY_GNUC_VERSION_CHECK
+#undef JSON_HEDLEY_HAS_ATTRIBUTE
+#undef JSON_HEDLEY_HAS_BUILTIN
+#undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE
+#undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS
+#undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE
+#undef JSON_HEDLEY_HAS_EXTENSION
+#undef JSON_HEDLEY_HAS_FEATURE
+#undef JSON_HEDLEY_HAS_WARNING
+#undef JSON_HEDLEY_IAR_VERSION
+#undef JSON_HEDLEY_IAR_VERSION_CHECK
+#undef JSON_HEDLEY_IBM_VERSION
+#undef JSON_HEDLEY_IBM_VERSION_CHECK
+#undef JSON_HEDLEY_IMPORT
+#undef JSON_HEDLEY_INLINE
+#undef JSON_HEDLEY_INTEL_VERSION
+#undef JSON_HEDLEY_INTEL_VERSION_CHECK
+#undef JSON_HEDLEY_IS_CONSTANT
+#undef JSON_HEDLEY_IS_CONSTEXPR_
+#undef JSON_HEDLEY_LIKELY
+#undef JSON_HEDLEY_MALLOC
+#undef JSON_HEDLEY_MESSAGE
+#undef JSON_HEDLEY_MSVC_VERSION
+#undef JSON_HEDLEY_MSVC_VERSION_CHECK
+#undef JSON_HEDLEY_NEVER_INLINE
+#undef JSON_HEDLEY_NON_NULL
+#undef JSON_HEDLEY_NO_ESCAPE
+#undef JSON_HEDLEY_NO_RETURN
+#undef JSON_HEDLEY_NO_THROW
+#undef JSON_HEDLEY_NULL
+#undef JSON_HEDLEY_PELLES_VERSION
+#undef JSON_HEDLEY_PELLES_VERSION_CHECK
+#undef JSON_HEDLEY_PGI_VERSION
+#undef JSON_HEDLEY_PGI_VERSION_CHECK
+#undef JSON_HEDLEY_PREDICT
+#undef JSON_HEDLEY_PRINTF_FORMAT
+#undef JSON_HEDLEY_PRIVATE
+#undef JSON_HEDLEY_PUBLIC
+#undef JSON_HEDLEY_PURE
+#undef JSON_HEDLEY_REINTERPRET_CAST
+#undef JSON_HEDLEY_REQUIRE
+#undef JSON_HEDLEY_REQUIRE_CONSTEXPR
+#undef JSON_HEDLEY_REQUIRE_MSG
+#undef JSON_HEDLEY_RESTRICT
+#undef JSON_HEDLEY_RETURNS_NON_NULL
+#undef JSON_HEDLEY_SENTINEL
+#undef JSON_HEDLEY_STATIC_ASSERT
+#undef JSON_HEDLEY_STATIC_CAST
+#undef JSON_HEDLEY_STRINGIFY
+#undef JSON_HEDLEY_STRINGIFY_EX
+#undef JSON_HEDLEY_SUNPRO_VERSION
+#undef JSON_HEDLEY_SUNPRO_VERSION_CHECK
+#undef JSON_HEDLEY_TINYC_VERSION
+#undef JSON_HEDLEY_TINYC_VERSION_CHECK
+#undef JSON_HEDLEY_TI_ARMCL_VERSION
+#undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK
+#undef JSON_HEDLEY_TI_CL2000_VERSION
+#undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK
+#undef JSON_HEDLEY_TI_CL430_VERSION
+#undef JSON_HEDLEY_TI_CL430_VERSION_CHECK
+#undef JSON_HEDLEY_TI_CL6X_VERSION
+#undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK
+#undef JSON_HEDLEY_TI_CL7X_VERSION
+#undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK
+#undef JSON_HEDLEY_TI_CLPRU_VERSION
+#undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK
+#undef JSON_HEDLEY_TI_VERSION
+#undef JSON_HEDLEY_TI_VERSION_CHECK
+#undef JSON_HEDLEY_UNAVAILABLE
+#undef JSON_HEDLEY_UNLIKELY
+#undef JSON_HEDLEY_UNPREDICTABLE
+#undef JSON_HEDLEY_UNREACHABLE
+#undef JSON_HEDLEY_UNREACHABLE_RETURN
+#undef JSON_HEDLEY_VERSION
+#undef JSON_HEDLEY_VERSION_DECODE_MAJOR
+#undef JSON_HEDLEY_VERSION_DECODE_MINOR
+#undef JSON_HEDLEY_VERSION_DECODE_REVISION
+#undef JSON_HEDLEY_VERSION_ENCODE
+#undef JSON_HEDLEY_WARNING
+#undef JSON_HEDLEY_WARN_UNUSED_RESULT
+#undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG
+#undef JSON_HEDLEY_FALL_THROUGH
+
+
+
+#endif // INCLUDE_NLOHMANN_JSON_HPP_