From cb60de9e6935a5f9a27ca04c0d8cf2304d5349df Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 10 Oct 2021 15:12:26 +0200 Subject: [PATCH] :fire: consolidate documentation --- doc/Doxyfile | 335 ------ doc/Makefile | 42 +- doc/css/mylayout.css | 26 - doc/css/mylayout_docset.css | 27 - doc/examples/README.link | 1 - doc/examples/accept__string.link | 1 - doc/examples/array.link | 1 - doc/examples/at__object_t_key_type.link | 1 - doc/examples/at__object_t_key_type_const.link | 1 - doc/examples/at__size_type.link | 1 - doc/examples/at__size_type_const.link | 1 - doc/examples/at_json_pointer.link | 1 - doc/examples/at_json_pointer_const.link | 1 - doc/examples/back.link | 1 - doc/examples/basic_json__CompatibleType.link | 1 - doc/examples/basic_json__InputIt_InputIt.link | 1 - doc/examples/basic_json__basic_json.link | 1 - doc/examples/basic_json__copyassignment.link | 1 - doc/examples/basic_json__list_init_t.link | 1 - doc/examples/basic_json__moveconstructor.link | 1 - doc/examples/basic_json__nullptr_t.link | 1 - .../basic_json__size_type_basic_json.link | 1 - doc/examples/basic_json__value.link | 1 - doc/examples/basic_json__value_ptr.link | 1 - doc/examples/basic_json__value_t.link | 1 - doc/examples/begin.link | 1 - doc/examples/cbegin.link | 1 - doc/examples/cend.link | 1 - doc/examples/clear.link | 1 - doc/examples/contains.link | 1 - doc/examples/contains_json_pointer.link | 1 - doc/examples/count.link | 1 - doc/examples/crbegin.link | 1 - doc/examples/crend.link | 1 - doc/examples/diagnostics_extended.link | 1 - doc/examples/diagnostics_standard.link | 1 - doc/examples/diff.link | 1 - doc/examples/dump.link | 1 - doc/examples/emplace.link | 1 - doc/examples/emplace_back.link | 1 - doc/examples/empty.link | 1 - doc/examples/end.link | 1 - doc/examples/erase__IteratorType.link | 1 - .../erase__IteratorType_IteratorType.link | 1 - doc/examples/erase__key_type.link | 1 - doc/examples/erase__size_type.link | 1 - doc/examples/exception.link | 1 - doc/examples/find__key_type.link | 1 - doc/examples/flatten.link | 1 - doc/examples/from_bson.link | 1 - doc/examples/from_cbor.link | 1 - doc/examples/from_msgpack.link | 1 - doc/examples/from_ubjson.link | 1 - doc/examples/front.link | 1 - doc/examples/get__PointerType.link | 1 - doc/examples/get__ValueType_const.link | 1 - doc/examples/get_ptr.link | 1 - doc/examples/get_ref.link | 1 - doc/examples/get_to.link | 1 - doc/examples/insert.link | 1 - doc/examples/insert__count.link | 1 - doc/examples/insert__ilist.link | 1 - doc/examples/insert__range.link | 1 - doc/examples/insert__range_object.link | 1 - doc/examples/invalid_iterator.link | 1 - doc/examples/is_array.link | 1 - doc/examples/is_binary.link | 1 - doc/examples/is_boolean.link | 1 - doc/examples/is_discarded.link | 1 - doc/examples/is_null.link | 1 - doc/examples/is_number.link | 1 - doc/examples/is_number_float.link | 1 - doc/examples/is_number_integer.link | 1 - doc/examples/is_number_unsigned.link | 1 - doc/examples/is_object.link | 1 - doc/examples/is_primitive.link | 1 - doc/examples/is_string.link | 1 - doc/examples/is_structured.link | 1 - doc/examples/items.link | 1 - doc/examples/iterator_wrapper.link | 1 - doc/examples/json_pointer.link | 1 - doc/examples/json_pointer__back.link | 1 - doc/examples/json_pointer__empty.link | 1 - doc/examples/json_pointer__operator_add.link | 1 - .../json_pointer__operator_add_binary.link | 1 - .../json_pointer__parent_pointer.link | 1 - doc/examples/json_pointer__pop_back.link | 1 - doc/examples/json_pointer__push_back.link | 1 - doc/examples/json_pointer__to_string.link | 1 - doc/examples/max_size.link | 1 - doc/examples/merge_patch.link | 1 - doc/examples/meta.link | 1 - doc/examples/object.link | 1 - doc/examples/operator__ValueType.link | 1 - doc/examples/operator__equal.link | 1 - doc/examples/operator__equal__nullptr_t.link | 1 - doc/examples/operator__greater.link | 1 - doc/examples/operator__greaterequal.link | 1 - doc/examples/operator__less.link | 1 - doc/examples/operator__lessequal.link | 1 - doc/examples/operator__notequal.link | 1 - .../operator__notequal__nullptr_t.link | 1 - doc/examples/operator__value_t.link | 1 - doc/examples/operator_deserialize.link | 1 - doc/examples/operator_serialize.link | 1 - doc/examples/operatorarray__key_type.link | 1 - .../operatorarray__key_type_const.link | 1 - doc/examples/operatorarray__size_type.link | 1 - .../operatorarray__size_type_const.link | 1 - doc/examples/operatorjson_pointer.link | 1 - doc/examples/operatorjson_pointer_const.link | 1 - doc/examples/other_error.link | 1 - doc/examples/out_of_range.link | 1 - doc/examples/parse__allow_exceptions.link | 1 - .../parse__array__parser_callback_t.link | 1 - ...ontiguouscontainer__parser_callback_t.link | 1 - .../parse__istream__parser_callback_t.link | 1 - ...arse__iteratortype__parser_callback_t.link | 1 - .../parse__string__parser_callback_t.link | 1 - doc/examples/parse_error.link | 1 - doc/examples/patch.link | 1 - doc/examples/push_back.link | 1 - doc/examples/push_back__initializer_list.link | 1 - doc/examples/push_back__object_t__value.link | 1 - doc/examples/rbegin.link | 1 - doc/examples/rend.link | 1 - doc/examples/sax_parse.link | 1 - doc/examples/size.link | 1 - doc/examples/swap__array_t.link | 1 - doc/examples/swap__binary_t.link | 1 - doc/examples/swap__object_t.link | 1 - doc/examples/swap__reference.link | 1 - doc/examples/swap__string_t.link | 1 - doc/examples/to_bson.link | 1 - doc/examples/to_cbor.link | 1 - doc/examples/to_msgpack.link | 1 - doc/examples/to_ubjson.link | 1 - doc/examples/type.link | 1 - doc/examples/type_error.link | 1 - doc/examples/type_name.link | 1 - doc/examples/unflatten.link | 1 - doc/examples/update.link | 1 - doc/examples/update__range.link | 1 - doc/mkdocs/Makefile | 3 +- .../docs/api/adl_serializer/from_json.md | 37 + .../index.md} | 4 +- doc/mkdocs/docs/api/adl_serializer/to_json.md | 22 + doc/mkdocs/docs/api/basic_json/array.md | 5 + doc/mkdocs/docs/api/basic_json/basic_json.md | 24 +- doc/mkdocs/docs/api/basic_json/dump.md | 17 +- .../docs/api/basic_json/get_allocator.md | 4 + doc/mkdocs/docs/api/basic_json/get_ptr.md | 4 +- doc/mkdocs/docs/api/basic_json/index.md | 2 +- doc/mkdocs/docs/api/basic_json/is_number.md | 6 + .../docs/api/basic_json/is_number_float.md | 6 + .../docs/api/basic_json/is_number_integer.md | 6 + .../docs/api/basic_json/is_number_unsigned.md | 6 + .../docs/api/basic_json/is_primitive.md | 9 + .../docs/api/basic_json/is_structured.md | 15 + .../docs/api/basic_json/json_serializer.md | 2 +- doc/mkdocs/docs/api/basic_json/meta.md | 24 +- doc/mkdocs/docs/api/basic_json/object.md | 5 + doc/mkdocs/docs/hooks.py | 10 - doc/mkdocs/mkdocs.yml | 9 +- doc/scripts/git-update-ghpages | 193 --- doc/scripts/send_to_wandbox.py | 120 -- include/nlohmann/json.hpp | 1039 ++--------------- single_include/nlohmann/json.hpp | 1039 ++--------------- 168 files changed, 318 insertions(+), 2862 deletions(-) delete mode 100644 doc/Doxyfile delete mode 100644 doc/css/mylayout.css delete mode 100644 doc/css/mylayout_docset.css delete mode 100644 doc/examples/README.link delete mode 100644 doc/examples/accept__string.link delete mode 100644 doc/examples/array.link delete mode 100644 doc/examples/at__object_t_key_type.link delete mode 100644 doc/examples/at__object_t_key_type_const.link delete mode 100644 doc/examples/at__size_type.link delete mode 100644 doc/examples/at__size_type_const.link delete mode 100644 doc/examples/at_json_pointer.link delete mode 100644 doc/examples/at_json_pointer_const.link delete mode 100644 doc/examples/back.link delete mode 100644 doc/examples/basic_json__CompatibleType.link delete mode 100644 doc/examples/basic_json__InputIt_InputIt.link delete mode 100644 doc/examples/basic_json__basic_json.link delete mode 100644 doc/examples/basic_json__copyassignment.link delete mode 100644 doc/examples/basic_json__list_init_t.link delete mode 100644 doc/examples/basic_json__moveconstructor.link delete mode 100644 doc/examples/basic_json__nullptr_t.link delete mode 100644 doc/examples/basic_json__size_type_basic_json.link delete mode 100644 doc/examples/basic_json__value.link delete mode 100644 doc/examples/basic_json__value_ptr.link delete mode 100644 doc/examples/basic_json__value_t.link delete mode 100644 doc/examples/begin.link delete mode 100644 doc/examples/cbegin.link delete mode 100644 doc/examples/cend.link delete mode 100644 doc/examples/clear.link delete mode 100644 doc/examples/contains.link delete mode 100644 doc/examples/contains_json_pointer.link delete mode 100644 doc/examples/count.link delete mode 100644 doc/examples/crbegin.link delete mode 100644 doc/examples/crend.link delete mode 100644 doc/examples/diagnostics_extended.link delete mode 100644 doc/examples/diagnostics_standard.link delete mode 100644 doc/examples/diff.link delete mode 100644 doc/examples/dump.link delete mode 100644 doc/examples/emplace.link delete mode 100644 doc/examples/emplace_back.link delete mode 100644 doc/examples/empty.link delete mode 100644 doc/examples/end.link delete mode 100644 doc/examples/erase__IteratorType.link delete mode 100644 doc/examples/erase__IteratorType_IteratorType.link delete mode 100644 doc/examples/erase__key_type.link delete mode 100644 doc/examples/erase__size_type.link delete mode 100644 doc/examples/exception.link delete mode 100644 doc/examples/find__key_type.link delete mode 100644 doc/examples/flatten.link delete mode 100644 doc/examples/from_bson.link delete mode 100644 doc/examples/from_cbor.link delete mode 100644 doc/examples/from_msgpack.link delete mode 100644 doc/examples/from_ubjson.link delete mode 100644 doc/examples/front.link delete mode 100644 doc/examples/get__PointerType.link delete mode 100644 doc/examples/get__ValueType_const.link delete mode 100644 doc/examples/get_ptr.link delete mode 100644 doc/examples/get_ref.link delete mode 100644 doc/examples/get_to.link delete mode 100644 doc/examples/insert.link delete mode 100644 doc/examples/insert__count.link delete mode 100644 doc/examples/insert__ilist.link delete mode 100644 doc/examples/insert__range.link delete mode 100644 doc/examples/insert__range_object.link delete mode 100644 doc/examples/invalid_iterator.link delete mode 100644 doc/examples/is_array.link delete mode 100644 doc/examples/is_binary.link delete mode 100644 doc/examples/is_boolean.link delete mode 100644 doc/examples/is_discarded.link delete mode 100644 doc/examples/is_null.link delete mode 100644 doc/examples/is_number.link delete mode 100644 doc/examples/is_number_float.link delete mode 100644 doc/examples/is_number_integer.link delete mode 100644 doc/examples/is_number_unsigned.link delete mode 100644 doc/examples/is_object.link delete mode 100644 doc/examples/is_primitive.link delete mode 100644 doc/examples/is_string.link delete mode 100644 doc/examples/is_structured.link delete mode 100644 doc/examples/items.link delete mode 100644 doc/examples/iterator_wrapper.link delete mode 100644 doc/examples/json_pointer.link delete mode 100644 doc/examples/json_pointer__back.link delete mode 100644 doc/examples/json_pointer__empty.link delete mode 100644 doc/examples/json_pointer__operator_add.link delete mode 100644 doc/examples/json_pointer__operator_add_binary.link delete mode 100644 doc/examples/json_pointer__parent_pointer.link delete mode 100644 doc/examples/json_pointer__pop_back.link delete mode 100644 doc/examples/json_pointer__push_back.link delete mode 100644 doc/examples/json_pointer__to_string.link delete mode 100644 doc/examples/max_size.link delete mode 100644 doc/examples/merge_patch.link delete mode 100644 doc/examples/meta.link delete mode 100644 doc/examples/object.link delete mode 100644 doc/examples/operator__ValueType.link delete mode 100644 doc/examples/operator__equal.link delete mode 100644 doc/examples/operator__equal__nullptr_t.link delete mode 100644 doc/examples/operator__greater.link delete mode 100644 doc/examples/operator__greaterequal.link delete mode 100644 doc/examples/operator__less.link delete mode 100644 doc/examples/operator__lessequal.link delete mode 100644 doc/examples/operator__notequal.link delete mode 100644 doc/examples/operator__notequal__nullptr_t.link delete mode 100644 doc/examples/operator__value_t.link delete mode 100644 doc/examples/operator_deserialize.link delete mode 100644 doc/examples/operator_serialize.link delete mode 100644 doc/examples/operatorarray__key_type.link delete mode 100644 doc/examples/operatorarray__key_type_const.link delete mode 100644 doc/examples/operatorarray__size_type.link delete mode 100644 doc/examples/operatorarray__size_type_const.link delete mode 100644 doc/examples/operatorjson_pointer.link delete mode 100644 doc/examples/operatorjson_pointer_const.link delete mode 100644 doc/examples/other_error.link delete mode 100644 doc/examples/out_of_range.link delete mode 100644 doc/examples/parse__allow_exceptions.link delete mode 100644 doc/examples/parse__array__parser_callback_t.link delete mode 100644 doc/examples/parse__contiguouscontainer__parser_callback_t.link delete mode 100644 doc/examples/parse__istream__parser_callback_t.link delete mode 100644 doc/examples/parse__iteratortype__parser_callback_t.link delete mode 100644 doc/examples/parse__string__parser_callback_t.link delete mode 100644 doc/examples/parse_error.link delete mode 100644 doc/examples/patch.link delete mode 100644 doc/examples/push_back.link delete mode 100644 doc/examples/push_back__initializer_list.link delete mode 100644 doc/examples/push_back__object_t__value.link delete mode 100644 doc/examples/rbegin.link delete mode 100644 doc/examples/rend.link delete mode 100644 doc/examples/sax_parse.link delete mode 100644 doc/examples/size.link delete mode 100644 doc/examples/swap__array_t.link delete mode 100644 doc/examples/swap__binary_t.link delete mode 100644 doc/examples/swap__object_t.link delete mode 100644 doc/examples/swap__reference.link delete mode 100644 doc/examples/swap__string_t.link delete mode 100644 doc/examples/to_bson.link delete mode 100644 doc/examples/to_cbor.link delete mode 100644 doc/examples/to_msgpack.link delete mode 100644 doc/examples/to_ubjson.link delete mode 100644 doc/examples/type.link delete mode 100644 doc/examples/type_error.link delete mode 100644 doc/examples/type_name.link delete mode 100644 doc/examples/unflatten.link delete mode 100644 doc/examples/update.link delete mode 100644 doc/examples/update__range.link create mode 100644 doc/mkdocs/docs/api/adl_serializer/from_json.md rename doc/mkdocs/docs/api/{adl_serializer.md => adl_serializer/index.md} (83%) create mode 100644 doc/mkdocs/docs/api/adl_serializer/to_json.md delete mode 100644 doc/mkdocs/docs/hooks.py delete mode 100755 doc/scripts/git-update-ghpages delete mode 100755 doc/scripts/send_to_wandbox.py diff --git a/doc/Doxyfile b/doc/Doxyfile deleted file mode 100644 index 8ed6a667a..000000000 --- a/doc/Doxyfile +++ /dev/null @@ -1,335 +0,0 @@ -# Doxyfile 1.9.1 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "JSON for Modern C++" -PROJECT_NUMBER = 3.10.3 -PROJECT_BRIEF = -PROJECT_LOGO = -OUTPUT_DIRECTORY = . -CREATE_SUBDIRS = NO -ALLOW_UNICODE_NAMES = NO -OUTPUT_LANGUAGE = English -OUTPUT_TEXT_DIRECTION = None -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = NO -ABBREVIATE_BRIEF = -ALWAYS_DETAILED_SEC = YES -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -JAVADOC_BANNER = NO -QT_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -PYTHON_DOCSTRING = YES -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = YES -TAB_SIZE = 4 -ALIASES = "complexity=@par Complexity^^" \ - "liveexample{2}=@par Example^^ \1 ^^ @includelineno \2.cpp \n Output (play with this example @htmlinclude \2.link):^^ @verbinclude \2.output ^^ The example code above can be translated with @verbatim g++ -std=c++11 -Isingle_include doc/examples/\2.cpp -o \2 @endverbatim" \ - "requirement=@par Requirements^^" \ - "exceptionsafety=@par Exception safety^^" \ - "iterators=@par Iterator validity^^" -OPTIMIZE_OUTPUT_FOR_C = NO -OPTIMIZE_OUTPUT_JAVA = NO -OPTIMIZE_FOR_FORTRAN = NO -OPTIMIZE_OUTPUT_VHDL = NO -OPTIMIZE_OUTPUT_SLICE = NO -EXTENSION_MAPPING = -MARKDOWN_SUPPORT = YES -TOC_INCLUDE_HEADINGS = 0 -AUTOLINK_SUPPORT = NO -BUILTIN_STL_SUPPORT = YES -CPP_CLI_SUPPORT = NO -SIP_SUPPORT = NO -IDL_PROPERTY_SUPPORT = YES -DISTRIBUTE_GROUP_DOC = NO -GROUP_NESTED_COMPOUNDS = NO -SUBGROUPING = YES -INLINE_GROUPED_CLASSES = NO -INLINE_SIMPLE_STRUCTS = NO -TYPEDEF_HIDES_STRUCT = NO -LOOKUP_CACHE_SIZE = 0 -NUM_PROC_THREADS = 1 -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = YES -EXTRACT_PRIVATE = NO -EXTRACT_PRIV_VIRTUAL = NO -EXTRACT_PACKAGE = YES -EXTRACT_STATIC = YES -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = YES -EXTRACT_ANON_NSPACES = YES -RESOLVE_UNNAMED_PARAMS = YES -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = NO -HIDE_SCOPE_NAMES = NO -HIDE_COMPOUND_REFERENCE= NO -SHOW_INCLUDE_FILES = YES -SHOW_GROUPED_MEMB_INC = NO -FORCE_LOCAL_INCLUDES = NO -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = YES -SORT_MEMBERS_CTORS_1ST = YES -SORT_GROUP_NAMES = NO -SORT_BY_SCOPE_NAME = NO -STRICT_PROTO_MATCHING = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = NO -SHOW_FILES = NO -SHOW_NAMESPACES = NO -FILE_VERSION_FILTER = -LAYOUT_FILE = -CITE_BIB_FILES = -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = YES -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = YES -WARN_AS_ERROR = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../single_include/nlohmann/json.hpp \ - index.md -INPUT_ENCODING = UTF-8 -FILE_PATTERNS = -RECURSIVE = NO -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXCLUDE_SYMBOLS = nlohmann::detail -EXAMPLE_PATH = examples -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = images -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -FILTER_SOURCE_PATTERNS = -USE_MDFILE_AS_MAINPAGE = index.md -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = YES -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = NO -REFERENCES_LINK_SOURCE = NO -SOURCE_TOOLTIPS = YES -USE_HTAGS = NO -VERBATIM_HEADERS = NO -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_EXTRA_STYLESHEET = css/mylayout.css -HTML_EXTRA_FILES = -HTML_COLORSTYLE_HUE = 220 -HTML_COLORSTYLE_SAT = 100 -HTML_COLORSTYLE_GAMMA = 80 -HTML_TIMESTAMP = YES -HTML_DYNAMIC_MENUS = YES -HTML_DYNAMIC_SECTIONS = YES -HTML_INDEX_NUM_ENTRIES = 100 -GENERATE_DOCSET = YES -DOCSET_FEEDNAME = "Doxygen generated docs" -DOCSET_BUNDLE_ID = me.nlohmann.json -DOCSET_PUBLISHER_ID = me.nlohmann -DOCSET_PUBLISHER_NAME = NielsLohmann -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -CHM_INDEX_ENCODING = -BINARY_TOC = NO -TOC_EXPAND = NO -GENERATE_QHP = NO -QCH_FILE = -QHP_NAMESPACE = org.doxygen.Project -QHP_VIRTUAL_FOLDER = doc -QHP_CUST_FILTER_NAME = -QHP_CUST_FILTER_ATTRS = -QHP_SECT_FILTER_ATTRS = -QHG_LOCATION = -GENERATE_ECLIPSEHELP = NO -ECLIPSE_DOC_ID = org.doxygen.Project -DISABLE_INDEX = NO -GENERATE_TREEVIEW = NO -ENUM_VALUES_PER_LINE = 4 -TREEVIEW_WIDTH = 250 -EXT_LINKS_IN_WINDOW = NO -HTML_FORMULA_FORMAT = png -FORMULA_FONTSIZE = 10 -FORMULA_TRANSPARENT = YES -FORMULA_MACROFILE = -USE_MATHJAX = NO -MATHJAX_FORMAT = HTML-CSS -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest -MATHJAX_EXTENSIONS = -MATHJAX_CODEFILE = -SEARCHENGINE = YES -SERVER_BASED_SEARCH = NO -EXTERNAL_SEARCH = NO -SEARCHENGINE_URL = -SEARCHDATA_FILE = searchdata.xml -EXTERNAL_SEARCH_ID = -EXTRA_SEARCH_MAPPINGS = -#--------------------------------------------------------------------------- -# Configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -LATEX_MAKEINDEX_CMD = \makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4 -EXTRA_PACKAGES = -LATEX_HEADER = -LATEX_FOOTER = -LATEX_EXTRA_STYLESHEET = -LATEX_EXTRA_FILES = -PDF_HYPERLINKS = YES -USE_PDFLATEX = YES -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -LATEX_SOURCE_CODE = NO -LATEX_BIB_STYLE = plain -LATEX_TIMESTAMP = NO -LATEX_EMOJI_DIRECTORY = -#--------------------------------------------------------------------------- -# Configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -RTF_SOURCE_CODE = NO -#--------------------------------------------------------------------------- -# Configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_SUBDIR = -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# Configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_PROGRAMLISTING = YES -XML_NS_MEMB_FILE_SCOPE = NO -#--------------------------------------------------------------------------- -# Configuration options related to the DOCBOOK output -#--------------------------------------------------------------------------- -GENERATE_DOCBOOK = NO -DOCBOOK_OUTPUT = docbook -DOCBOOK_PROGRAMLISTING = NO -#--------------------------------------------------------------------------- -# Configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# Configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration options related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = html/nlohmann_json.tag -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -EXTERNAL_PAGES = YES -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = NO -DIA_PATH = -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = YES -DOT_NUM_THREADS = 0 -DOT_FONTNAME = Helvetica -DOT_FONTSIZE = 10 -DOT_FONTPATH = -CLASS_GRAPH = NO -COLLABORATION_GRAPH = NO -GROUP_GRAPHS = YES -UML_LOOK = YES -UML_LIMIT_NUM_FIELDS = 10 -DOT_UML_DETAILS = NO -DOT_WRAP_THRESHOLD = 17 -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = NO -INCLUDED_BY_GRAPH = NO -CALL_GRAPH = NO -CALLER_GRAPH = NO -GRAPHICAL_HIERARCHY = NO -DIRECTORY_GRAPH = NO -DOT_IMAGE_FORMAT = svg -INTERACTIVE_SVG = YES -DOT_PATH = -DOTFILE_DIRS = -MSCFILE_DIRS = -DIAFILE_DIRS = -PLANTUML_JAR_PATH = -PLANTUML_CFG_FILE = -PLANTUML_INCLUDE_PATH = -DOT_GRAPH_MAX_NODES = 50 -MAX_DOT_GRAPH_DEPTH = 0 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = YES -DOT_CLEANUP = YES diff --git a/doc/Makefile b/doc/Makefile index 761dd4368..0de57e00f 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,8 +1,6 @@ SRCDIR = ../single_include -SED:=$(shell command -v gsed || which sed) - -all: doxygen +all: create_output ########################################################################## # example files @@ -24,49 +22,13 @@ EXAMPLES = $(wildcard examples/*.cpp) diff $@ $(<:.cpp=.output) rm $(<:.cpp=) $@ -# create links to try the code online -%.link: %.cpp - rm -fr tmp - mkdir tmp - cp -r $(SRCDIR)/nlohmann tmp - python2 scripts/send_to_wandbox.py tmp $< > $@.tmp - /bin/echo -n "online" > $@ - rm -fr tmp $@.tmp - # create output from all stand-alone example files create_output: $(EXAMPLES:.cpp=.output) -create_links: $(EXAMPLES:.cpp=.link) - # check output of all stand-alone example files check_output: $(EXAMPLES:.cpp=.test) - clean: - rm -fr me.nlohmann.json.docset html $(EXAMPLES:.cpp=) + rm -fr $(EXAMPLES:.cpp=) $(MAKE) clean -C docset $(MAKE) clean -C mkdocs - - -########################################################################## -# Doxygen HTML documentation -########################################################################## - -# create Doxygen documentation -doxygen: create_output create_links - doxygen - $(SED) -i 's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType, JSONSerializer >@@g' html/*.html - $(SED) -i 's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType JSONSerializer >@@g' html/*.html - $(SED) -i 's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >@@g' html/*.html - $(SED) -i 's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >@@g' html/*.html - $(SED) -i 's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType JSONSerializer >@@g' html/*.html - $(SED) -i 's@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>@@g' html/*.html - $(SED) -i 's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >@@g' html/*.html - $(SED) -i 's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >@@g' html/*.html - $(SED) -i 's@JSON_HEDLEY_RETURNS_NON_NULL@@g' html/*.html - $(SED) -i 's@JSON_HEDLEY_WARN_UNUSED_RESULT@@g' html/*.html - -upload: clean doxygen check_output - scripts/git-update-ghpages nlohmann/json html - rm -fr html - open http://nlohmann.github.io/json/ diff --git a/doc/css/mylayout.css b/doc/css/mylayout.css deleted file mode 100644 index fe20b82c5..000000000 --- a/doc/css/mylayout.css +++ /dev/null @@ -1,26 +0,0 @@ -/* hide lengthy template information */ -.memtemplate, .memTemplParams { - display: none; -} - -/* allow compiler information to wrap */ -/* https://css-tricks.com/snippets/css/make-pre-text-wrap/ */ -pre.fragment { - white-space: pre-wrap; /* css-3 */ - white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - word-wrap: break-word; /* Internet Explorer 5.5+ */ -} - -td.paramname { - vertical-align: top; -} - -.ok_green { - background-color: #89C35C; -} - -.nok_throws { - background-color: #ffa500; -} diff --git a/doc/css/mylayout_docset.css b/doc/css/mylayout_docset.css deleted file mode 100644 index 1a67e99df..000000000 --- a/doc/css/mylayout_docset.css +++ /dev/null @@ -1,27 +0,0 @@ -.memtemplate { - display: none; -} - -.memTemplParams { - display: none; -} - -.navtab { - display: none; -} - -#top, .footer { - display: none; -} - -td.paramname { - vertical-align: top; -} - -.ok_green { - background-color: #89C35C; -} - -.nok_throws { - background-color: #ffa500; -} diff --git a/doc/examples/README.link b/doc/examples/README.link deleted file mode 100644 index 5b5ffab81..000000000 --- a/doc/examples/README.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/accept__string.link b/doc/examples/accept__string.link deleted file mode 100644 index 8456e3bfc..000000000 --- a/doc/examples/accept__string.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/array.link b/doc/examples/array.link deleted file mode 100644 index 4c69b84ec..000000000 --- a/doc/examples/array.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/at__object_t_key_type.link b/doc/examples/at__object_t_key_type.link deleted file mode 100644 index 0518fe656..000000000 --- a/doc/examples/at__object_t_key_type.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/at__object_t_key_type_const.link b/doc/examples/at__object_t_key_type_const.link deleted file mode 100644 index a7cd73be7..000000000 --- a/doc/examples/at__object_t_key_type_const.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/at__size_type.link b/doc/examples/at__size_type.link deleted file mode 100644 index a98adcb03..000000000 --- a/doc/examples/at__size_type.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/at__size_type_const.link b/doc/examples/at__size_type_const.link deleted file mode 100644 index 73a13bb1c..000000000 --- a/doc/examples/at__size_type_const.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/at_json_pointer.link b/doc/examples/at_json_pointer.link deleted file mode 100644 index a4e2c24fc..000000000 --- a/doc/examples/at_json_pointer.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/at_json_pointer_const.link b/doc/examples/at_json_pointer_const.link deleted file mode 100644 index f04bf5a67..000000000 --- a/doc/examples/at_json_pointer_const.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/back.link b/doc/examples/back.link deleted file mode 100644 index 7fe2400a8..000000000 --- a/doc/examples/back.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/basic_json__CompatibleType.link b/doc/examples/basic_json__CompatibleType.link deleted file mode 100644 index a6336474c..000000000 --- a/doc/examples/basic_json__CompatibleType.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/basic_json__InputIt_InputIt.link b/doc/examples/basic_json__InputIt_InputIt.link deleted file mode 100644 index 844e914f5..000000000 --- a/doc/examples/basic_json__InputIt_InputIt.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/basic_json__basic_json.link b/doc/examples/basic_json__basic_json.link deleted file mode 100644 index 757e2c761..000000000 --- a/doc/examples/basic_json__basic_json.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/basic_json__copyassignment.link b/doc/examples/basic_json__copyassignment.link deleted file mode 100644 index 86beb677a..000000000 --- a/doc/examples/basic_json__copyassignment.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/basic_json__list_init_t.link b/doc/examples/basic_json__list_init_t.link deleted file mode 100644 index 126f69280..000000000 --- a/doc/examples/basic_json__list_init_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/basic_json__moveconstructor.link b/doc/examples/basic_json__moveconstructor.link deleted file mode 100644 index 9318284e8..000000000 --- a/doc/examples/basic_json__moveconstructor.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/basic_json__nullptr_t.link b/doc/examples/basic_json__nullptr_t.link deleted file mode 100644 index bcc4e9601..000000000 --- a/doc/examples/basic_json__nullptr_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/basic_json__size_type_basic_json.link b/doc/examples/basic_json__size_type_basic_json.link deleted file mode 100644 index 6a6742b91..000000000 --- a/doc/examples/basic_json__size_type_basic_json.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/basic_json__value.link b/doc/examples/basic_json__value.link deleted file mode 100644 index f47a80d6b..000000000 --- a/doc/examples/basic_json__value.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/basic_json__value_ptr.link b/doc/examples/basic_json__value_ptr.link deleted file mode 100644 index 14d3851b4..000000000 --- a/doc/examples/basic_json__value_ptr.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/basic_json__value_t.link b/doc/examples/basic_json__value_t.link deleted file mode 100644 index d80f2482a..000000000 --- a/doc/examples/basic_json__value_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/begin.link b/doc/examples/begin.link deleted file mode 100644 index 1f59a9bd7..000000000 --- a/doc/examples/begin.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/cbegin.link b/doc/examples/cbegin.link deleted file mode 100644 index 26ff77342..000000000 --- a/doc/examples/cbegin.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/cend.link b/doc/examples/cend.link deleted file mode 100644 index a1adb3a82..000000000 --- a/doc/examples/cend.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/clear.link b/doc/examples/clear.link deleted file mode 100644 index 0146c1878..000000000 --- a/doc/examples/clear.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/contains.link b/doc/examples/contains.link deleted file mode 100644 index f57e70268..000000000 --- a/doc/examples/contains.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/contains_json_pointer.link b/doc/examples/contains_json_pointer.link deleted file mode 100644 index 1648e373d..000000000 --- a/doc/examples/contains_json_pointer.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/count.link b/doc/examples/count.link deleted file mode 100644 index 2c4c08131..000000000 --- a/doc/examples/count.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/crbegin.link b/doc/examples/crbegin.link deleted file mode 100644 index f7da8d6fd..000000000 --- a/doc/examples/crbegin.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/crend.link b/doc/examples/crend.link deleted file mode 100644 index fc3d145fd..000000000 --- a/doc/examples/crend.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/diagnostics_extended.link b/doc/examples/diagnostics_extended.link deleted file mode 100644 index 9f10da942..000000000 --- a/doc/examples/diagnostics_extended.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/diagnostics_standard.link b/doc/examples/diagnostics_standard.link deleted file mode 100644 index cd0453b5e..000000000 --- a/doc/examples/diagnostics_standard.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/diff.link b/doc/examples/diff.link deleted file mode 100644 index 7adb19bba..000000000 --- a/doc/examples/diff.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/dump.link b/doc/examples/dump.link deleted file mode 100644 index 84d944151..000000000 --- a/doc/examples/dump.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/emplace.link b/doc/examples/emplace.link deleted file mode 100644 index 02b41d8bb..000000000 --- a/doc/examples/emplace.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/emplace_back.link b/doc/examples/emplace_back.link deleted file mode 100644 index 7290ca695..000000000 --- a/doc/examples/emplace_back.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/empty.link b/doc/examples/empty.link deleted file mode 100644 index cfe5867c2..000000000 --- a/doc/examples/empty.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/end.link b/doc/examples/end.link deleted file mode 100644 index abe8fedd7..000000000 --- a/doc/examples/end.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/erase__IteratorType.link b/doc/examples/erase__IteratorType.link deleted file mode 100644 index f1d7ba51d..000000000 --- a/doc/examples/erase__IteratorType.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/erase__IteratorType_IteratorType.link b/doc/examples/erase__IteratorType_IteratorType.link deleted file mode 100644 index 2d6d24c20..000000000 --- a/doc/examples/erase__IteratorType_IteratorType.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/erase__key_type.link b/doc/examples/erase__key_type.link deleted file mode 100644 index df8239156..000000000 --- a/doc/examples/erase__key_type.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/erase__size_type.link b/doc/examples/erase__size_type.link deleted file mode 100644 index a46d5276c..000000000 --- a/doc/examples/erase__size_type.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/exception.link b/doc/examples/exception.link deleted file mode 100644 index 5f40ff4c7..000000000 --- a/doc/examples/exception.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/find__key_type.link b/doc/examples/find__key_type.link deleted file mode 100644 index 0bfcc8a70..000000000 --- a/doc/examples/find__key_type.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/flatten.link b/doc/examples/flatten.link deleted file mode 100644 index ac836a585..000000000 --- a/doc/examples/flatten.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/from_bson.link b/doc/examples/from_bson.link deleted file mode 100644 index 08af52bcc..000000000 --- a/doc/examples/from_bson.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/from_cbor.link b/doc/examples/from_cbor.link deleted file mode 100644 index bbb578c4a..000000000 --- a/doc/examples/from_cbor.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/from_msgpack.link b/doc/examples/from_msgpack.link deleted file mode 100644 index 77a55594c..000000000 --- a/doc/examples/from_msgpack.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/from_ubjson.link b/doc/examples/from_ubjson.link deleted file mode 100644 index c5f82cb48..000000000 --- a/doc/examples/from_ubjson.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/front.link b/doc/examples/front.link deleted file mode 100644 index ab3cc8d57..000000000 --- a/doc/examples/front.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/get__PointerType.link b/doc/examples/get__PointerType.link deleted file mode 100644 index f4a213e15..000000000 --- a/doc/examples/get__PointerType.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/get__ValueType_const.link b/doc/examples/get__ValueType_const.link deleted file mode 100644 index cf444a129..000000000 --- a/doc/examples/get__ValueType_const.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/get_ptr.link b/doc/examples/get_ptr.link deleted file mode 100644 index 139fd0435..000000000 --- a/doc/examples/get_ptr.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/get_ref.link b/doc/examples/get_ref.link deleted file mode 100644 index 360d00229..000000000 --- a/doc/examples/get_ref.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/get_to.link b/doc/examples/get_to.link deleted file mode 100644 index 5adf0ec78..000000000 --- a/doc/examples/get_to.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/insert.link b/doc/examples/insert.link deleted file mode 100644 index 4d742039f..000000000 --- a/doc/examples/insert.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/insert__count.link b/doc/examples/insert__count.link deleted file mode 100644 index 49b892bb7..000000000 --- a/doc/examples/insert__count.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/insert__ilist.link b/doc/examples/insert__ilist.link deleted file mode 100644 index ea6760f9e..000000000 --- a/doc/examples/insert__ilist.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/insert__range.link b/doc/examples/insert__range.link deleted file mode 100644 index a2c24a087..000000000 --- a/doc/examples/insert__range.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/insert__range_object.link b/doc/examples/insert__range_object.link deleted file mode 100644 index 9c45c4739..000000000 --- a/doc/examples/insert__range_object.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/invalid_iterator.link b/doc/examples/invalid_iterator.link deleted file mode 100644 index 0ef322e81..000000000 --- a/doc/examples/invalid_iterator.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/is_array.link b/doc/examples/is_array.link deleted file mode 100644 index dd17ccbec..000000000 --- a/doc/examples/is_array.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/is_binary.link b/doc/examples/is_binary.link deleted file mode 100644 index 0443f9105..000000000 --- a/doc/examples/is_binary.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/is_boolean.link b/doc/examples/is_boolean.link deleted file mode 100644 index 3e740d6c6..000000000 --- a/doc/examples/is_boolean.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/is_discarded.link b/doc/examples/is_discarded.link deleted file mode 100644 index de93aa944..000000000 --- a/doc/examples/is_discarded.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/is_null.link b/doc/examples/is_null.link deleted file mode 100644 index fbeab6e57..000000000 --- a/doc/examples/is_null.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/is_number.link b/doc/examples/is_number.link deleted file mode 100644 index b10372a0a..000000000 --- a/doc/examples/is_number.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/is_number_float.link b/doc/examples/is_number_float.link deleted file mode 100644 index f58a47f6d..000000000 --- a/doc/examples/is_number_float.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/is_number_integer.link b/doc/examples/is_number_integer.link deleted file mode 100644 index 94a351dec..000000000 --- a/doc/examples/is_number_integer.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/is_number_unsigned.link b/doc/examples/is_number_unsigned.link deleted file mode 100644 index c8bed2123..000000000 --- a/doc/examples/is_number_unsigned.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/is_object.link b/doc/examples/is_object.link deleted file mode 100644 index f8240d977..000000000 --- a/doc/examples/is_object.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/is_primitive.link b/doc/examples/is_primitive.link deleted file mode 100644 index 7f1664989..000000000 --- a/doc/examples/is_primitive.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/is_string.link b/doc/examples/is_string.link deleted file mode 100644 index 999ccd948..000000000 --- a/doc/examples/is_string.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/is_structured.link b/doc/examples/is_structured.link deleted file mode 100644 index e54b5c1ee..000000000 --- a/doc/examples/is_structured.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/items.link b/doc/examples/items.link deleted file mode 100644 index 61f135604..000000000 --- a/doc/examples/items.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/iterator_wrapper.link b/doc/examples/iterator_wrapper.link deleted file mode 100644 index 43c08ab07..000000000 --- a/doc/examples/iterator_wrapper.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/json_pointer.link b/doc/examples/json_pointer.link deleted file mode 100644 index 1d3074ffe..000000000 --- a/doc/examples/json_pointer.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/json_pointer__back.link b/doc/examples/json_pointer__back.link deleted file mode 100644 index 0ab9687b6..000000000 --- a/doc/examples/json_pointer__back.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/json_pointer__empty.link b/doc/examples/json_pointer__empty.link deleted file mode 100644 index bac9163fb..000000000 --- a/doc/examples/json_pointer__empty.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/json_pointer__operator_add.link b/doc/examples/json_pointer__operator_add.link deleted file mode 100644 index 08cfe8c24..000000000 --- a/doc/examples/json_pointer__operator_add.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/json_pointer__operator_add_binary.link b/doc/examples/json_pointer__operator_add_binary.link deleted file mode 100644 index b973a409f..000000000 --- a/doc/examples/json_pointer__operator_add_binary.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/json_pointer__parent_pointer.link b/doc/examples/json_pointer__parent_pointer.link deleted file mode 100644 index 63edd5eef..000000000 --- a/doc/examples/json_pointer__parent_pointer.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/json_pointer__pop_back.link b/doc/examples/json_pointer__pop_back.link deleted file mode 100644 index 93872948d..000000000 --- a/doc/examples/json_pointer__pop_back.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/json_pointer__push_back.link b/doc/examples/json_pointer__push_back.link deleted file mode 100644 index df40229e2..000000000 --- a/doc/examples/json_pointer__push_back.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/json_pointer__to_string.link b/doc/examples/json_pointer__to_string.link deleted file mode 100644 index 51eb09342..000000000 --- a/doc/examples/json_pointer__to_string.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/max_size.link b/doc/examples/max_size.link deleted file mode 100644 index 52bd366c7..000000000 --- a/doc/examples/max_size.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/merge_patch.link b/doc/examples/merge_patch.link deleted file mode 100644 index 241098940..000000000 --- a/doc/examples/merge_patch.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/meta.link b/doc/examples/meta.link deleted file mode 100644 index 6955de3d7..000000000 --- a/doc/examples/meta.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/object.link b/doc/examples/object.link deleted file mode 100644 index 322128e7e..000000000 --- a/doc/examples/object.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operator__ValueType.link b/doc/examples/operator__ValueType.link deleted file mode 100644 index e4db023a2..000000000 --- a/doc/examples/operator__ValueType.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operator__equal.link b/doc/examples/operator__equal.link deleted file mode 100644 index 966c4f732..000000000 --- a/doc/examples/operator__equal.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operator__equal__nullptr_t.link b/doc/examples/operator__equal__nullptr_t.link deleted file mode 100644 index 5321622b1..000000000 --- a/doc/examples/operator__equal__nullptr_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operator__greater.link b/doc/examples/operator__greater.link deleted file mode 100644 index b52b4b832..000000000 --- a/doc/examples/operator__greater.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operator__greaterequal.link b/doc/examples/operator__greaterequal.link deleted file mode 100644 index 7b9b42cfb..000000000 --- a/doc/examples/operator__greaterequal.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operator__less.link b/doc/examples/operator__less.link deleted file mode 100644 index 96d69ee3a..000000000 --- a/doc/examples/operator__less.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operator__lessequal.link b/doc/examples/operator__lessequal.link deleted file mode 100644 index 750c6fcfc..000000000 --- a/doc/examples/operator__lessequal.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operator__notequal.link b/doc/examples/operator__notequal.link deleted file mode 100644 index bb094c4f7..000000000 --- a/doc/examples/operator__notequal.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operator__notequal__nullptr_t.link b/doc/examples/operator__notequal__nullptr_t.link deleted file mode 100644 index 3a013c2e9..000000000 --- a/doc/examples/operator__notequal__nullptr_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operator__value_t.link b/doc/examples/operator__value_t.link deleted file mode 100644 index 71cb2143e..000000000 --- a/doc/examples/operator__value_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operator_deserialize.link b/doc/examples/operator_deserialize.link deleted file mode 100644 index 2e4f7283a..000000000 --- a/doc/examples/operator_deserialize.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operator_serialize.link b/doc/examples/operator_serialize.link deleted file mode 100644 index f6d157ecf..000000000 --- a/doc/examples/operator_serialize.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operatorarray__key_type.link b/doc/examples/operatorarray__key_type.link deleted file mode 100644 index e03051d58..000000000 --- a/doc/examples/operatorarray__key_type.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operatorarray__key_type_const.link b/doc/examples/operatorarray__key_type_const.link deleted file mode 100644 index a9023380c..000000000 --- a/doc/examples/operatorarray__key_type_const.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operatorarray__size_type.link b/doc/examples/operatorarray__size_type.link deleted file mode 100644 index 73b8b1692..000000000 --- a/doc/examples/operatorarray__size_type.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operatorarray__size_type_const.link b/doc/examples/operatorarray__size_type_const.link deleted file mode 100644 index 3f2301897..000000000 --- a/doc/examples/operatorarray__size_type_const.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operatorjson_pointer.link b/doc/examples/operatorjson_pointer.link deleted file mode 100644 index fa7aecb53..000000000 --- a/doc/examples/operatorjson_pointer.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/operatorjson_pointer_const.link b/doc/examples/operatorjson_pointer_const.link deleted file mode 100644 index eb01e1f03..000000000 --- a/doc/examples/operatorjson_pointer_const.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/other_error.link b/doc/examples/other_error.link deleted file mode 100644 index f542efd12..000000000 --- a/doc/examples/other_error.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/out_of_range.link b/doc/examples/out_of_range.link deleted file mode 100644 index 25833f31c..000000000 --- a/doc/examples/out_of_range.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/parse__allow_exceptions.link b/doc/examples/parse__allow_exceptions.link deleted file mode 100644 index 386dfe8e4..000000000 --- a/doc/examples/parse__allow_exceptions.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/parse__array__parser_callback_t.link b/doc/examples/parse__array__parser_callback_t.link deleted file mode 100644 index cdecb14a2..000000000 --- a/doc/examples/parse__array__parser_callback_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/parse__contiguouscontainer__parser_callback_t.link b/doc/examples/parse__contiguouscontainer__parser_callback_t.link deleted file mode 100644 index c681b8c3f..000000000 --- a/doc/examples/parse__contiguouscontainer__parser_callback_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/parse__istream__parser_callback_t.link b/doc/examples/parse__istream__parser_callback_t.link deleted file mode 100644 index 21118db29..000000000 --- a/doc/examples/parse__istream__parser_callback_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/parse__iteratortype__parser_callback_t.link b/doc/examples/parse__iteratortype__parser_callback_t.link deleted file mode 100644 index d12ba20b7..000000000 --- a/doc/examples/parse__iteratortype__parser_callback_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/parse__string__parser_callback_t.link b/doc/examples/parse__string__parser_callback_t.link deleted file mode 100644 index 2d24e2ec7..000000000 --- a/doc/examples/parse__string__parser_callback_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/parse_error.link b/doc/examples/parse_error.link deleted file mode 100644 index f3c0da789..000000000 --- a/doc/examples/parse_error.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/patch.link b/doc/examples/patch.link deleted file mode 100644 index d9b370a8d..000000000 --- a/doc/examples/patch.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/push_back.link b/doc/examples/push_back.link deleted file mode 100644 index b89d5c635..000000000 --- a/doc/examples/push_back.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/push_back__initializer_list.link b/doc/examples/push_back__initializer_list.link deleted file mode 100644 index 4e57e93a3..000000000 --- a/doc/examples/push_back__initializer_list.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/push_back__object_t__value.link b/doc/examples/push_back__object_t__value.link deleted file mode 100644 index 6e0cf7b13..000000000 --- a/doc/examples/push_back__object_t__value.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/rbegin.link b/doc/examples/rbegin.link deleted file mode 100644 index 06beb46da..000000000 --- a/doc/examples/rbegin.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/rend.link b/doc/examples/rend.link deleted file mode 100644 index bf8e33d4b..000000000 --- a/doc/examples/rend.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/sax_parse.link b/doc/examples/sax_parse.link deleted file mode 100644 index 8bab12742..000000000 --- a/doc/examples/sax_parse.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/size.link b/doc/examples/size.link deleted file mode 100644 index 31f00cad4..000000000 --- a/doc/examples/size.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/swap__array_t.link b/doc/examples/swap__array_t.link deleted file mode 100644 index 75937905d..000000000 --- a/doc/examples/swap__array_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/swap__binary_t.link b/doc/examples/swap__binary_t.link deleted file mode 100644 index f035a7170..000000000 --- a/doc/examples/swap__binary_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/swap__object_t.link b/doc/examples/swap__object_t.link deleted file mode 100644 index 45b04995a..000000000 --- a/doc/examples/swap__object_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/swap__reference.link b/doc/examples/swap__reference.link deleted file mode 100644 index f056ec405..000000000 --- a/doc/examples/swap__reference.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/swap__string_t.link b/doc/examples/swap__string_t.link deleted file mode 100644 index 9b00374eb..000000000 --- a/doc/examples/swap__string_t.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/to_bson.link b/doc/examples/to_bson.link deleted file mode 100644 index 3bad4a1c4..000000000 --- a/doc/examples/to_bson.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/to_cbor.link b/doc/examples/to_cbor.link deleted file mode 100644 index efac9b06c..000000000 --- a/doc/examples/to_cbor.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/to_msgpack.link b/doc/examples/to_msgpack.link deleted file mode 100644 index 4c7a078ca..000000000 --- a/doc/examples/to_msgpack.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/to_ubjson.link b/doc/examples/to_ubjson.link deleted file mode 100644 index 996e19df1..000000000 --- a/doc/examples/to_ubjson.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/type.link b/doc/examples/type.link deleted file mode 100644 index 746aaa644..000000000 --- a/doc/examples/type.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/type_error.link b/doc/examples/type_error.link deleted file mode 100644 index d054b5c24..000000000 --- a/doc/examples/type_error.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/type_name.link b/doc/examples/type_name.link deleted file mode 100644 index c0c55597e..000000000 --- a/doc/examples/type_name.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/unflatten.link b/doc/examples/unflatten.link deleted file mode 100644 index 0d1be78d2..000000000 --- a/doc/examples/unflatten.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/update.link b/doc/examples/update.link deleted file mode 100644 index 2728616a2..000000000 --- a/doc/examples/update.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/examples/update__range.link b/doc/examples/update__range.link deleted file mode 100644 index 562ebf0ce..000000000 --- a/doc/examples/update__range.link +++ /dev/null @@ -1 +0,0 @@ -online \ No newline at end of file diff --git a/doc/mkdocs/Makefile b/doc/mkdocs/Makefile index 1f3ccf54e..854c46ace 100644 --- a/doc/mkdocs/Makefile +++ b/doc/mkdocs/Makefile @@ -7,8 +7,6 @@ build: prepare_files # create files that are not versioned inside the mkdocs folder prepare_files: clean - # build Doxygen - $(MAKE) -C .. # create subfolders mkdir docs/images docs/examples # copy images @@ -27,6 +25,7 @@ publish: prepare_files # install a Python virtual environment install_venv: requirements.txt python3 -mvenv venv + venv/bin/pip install wheel venv/bin/pip install -r requirements.txt # uninstall the virtual environment diff --git a/doc/mkdocs/docs/api/adl_serializer/from_json.md b/doc/mkdocs/docs/api/adl_serializer/from_json.md new file mode 100644 index 000000000..3c955079c --- /dev/null +++ b/doc/mkdocs/docs/api/adl_serializer/from_json.md @@ -0,0 +1,37 @@ +# adl_serializer::from_json + +```cpp +// (1) +template +static auto from_json(BasicJsonType && j, TargetType& val) noexcept( + noexcept(::nlohmann::from_json(std::forward(j), val))) +-> decltype(::nlohmann::from_json(std::forward(j), val), void()) + +// (2) +template +static auto from_json(BasicJsonType && j) noexcept( +noexcept(::nlohmann::from_json(std::forward(j), detail::identity_tag {}))) +-> decltype(::nlohmann::from_json(std::forward(j), detail::identity_tag {})) +``` + +This function is usually called by the [`get()`](../basic_json/get.md) function of the +[basic_json](../basic_json) class (either explicit or via conversion operators). + +1. This function is chosen for default-constructible value types. +2. This function is chosen for value types which are not default-constructible. + +## Parameters + +`j` (in) +: JSON value to read from + +`val` (out) +: value to write to + +## Return value + +Copy of the JSON value, converted to `ValueType` + +!!! note + + This documentation page is a stub. diff --git a/doc/mkdocs/docs/api/adl_serializer.md b/doc/mkdocs/docs/api/adl_serializer/index.md similarity index 83% rename from doc/mkdocs/docs/api/adl_serializer.md rename to doc/mkdocs/docs/api/adl_serializer/index.md index 7b79747f5..4ab8da4de 100644 --- a/doc/mkdocs/docs/api/adl_serializer.md +++ b/doc/mkdocs/docs/api/adl_serializer/index.md @@ -27,5 +27,5 @@ struct adl_serializer { ## Member functions -- **from_json** - convert a JSON value to any value type -- **to_json** - convert any value type to a JSON value +- [**from_json**](from_json.md) - convert a JSON value to any value type +- [**to_json**](to_json.md) - convert any value type to a JSON value diff --git a/doc/mkdocs/docs/api/adl_serializer/to_json.md b/doc/mkdocs/docs/api/adl_serializer/to_json.md new file mode 100644 index 000000000..9289914db --- /dev/null +++ b/doc/mkdocs/docs/api/adl_serializer/to_json.md @@ -0,0 +1,22 @@ +# adl_serializer::to_json + +```cpp +template +static auto to_json(BasicJsonType& j, TargetType && val) noexcept( + noexcept(::nlohmann::to_json(j, std::forward(val)))) +-> decltype(::nlohmann::to_json(j, std::forward(val)), void()) +``` + +This function is usually called by the constructors of the [basic_json](../basic_json) class. + +## Parameters + +`j` (out) +: JSON value to write to + +`val` (in) +: value to read from + +!!! note + + This documentation page is a stub. diff --git a/doc/mkdocs/docs/api/basic_json/array.md b/doc/mkdocs/docs/api/basic_json/array.md index 89113026d..680637b34 100644 --- a/doc/mkdocs/docs/api/basic_json/array.md +++ b/doc/mkdocs/docs/api/basic_json/array.md @@ -50,6 +50,11 @@ This function is only needed to express two edge cases that cannot be realized w --8<-- "examples/array.output" ``` +## See also + +- [`basic_json(initializer_list_t)`](basic_json.md) - create a JSON value from an initializer list +- [`object`](object.md) - create a JSON object value from an initializer list + ## Version history - Added in version 1.0.0. diff --git a/doc/mkdocs/docs/api/basic_json/basic_json.md b/doc/mkdocs/docs/api/basic_json/basic_json.md index 9ff6fbb8d..582b65a87 100644 --- a/doc/mkdocs/docs/api/basic_json/basic_json.md +++ b/doc/mkdocs/docs/api/basic_json/basic_json.md @@ -49,6 +49,8 @@ basic_json(basic_json&& other) noexcept; array | `#!json []` binary | empty array + The postcondition of this constructor can be restored by calling [`clear()`](clear.md). + 2. Create a `#!json null` JSON value. It either takes a null pointer as parameter (explicitly creating `#!json null`) or no parameter (implicitly creating `#!json null`). The passed null pointer itself is not read -- it is only used to choose the right constructor. @@ -104,6 +106,9 @@ basic_json(basic_json&& other) noexcept; - the empty array (`#!json []`): use `array(initializer_list_t)` with an empty initializer list in this case - arrays whose elements satisfy rule 2: use `array(initializer_list_t)` with the same initializer list in this case + + Function [`array()`](array.md) and [`object()`](object.md) force array and object creation from initializer lists, + respectively. 6. Constructs a JSON array value by creating `cnt` copies of a passed value. In case `cnt` is `0`, an empty array is created. @@ -142,6 +147,9 @@ basic_json(basic_json&& other) noexcept; - `BasicJsonType` is a `basic_json` type. - `BasicJsonType` has different template arguments than `basic_json_t`. +`U`: +: `uncvref_t` + ## Parameters `v` (in) @@ -269,7 +277,7 @@ basic_json(basic_json&& other) noexcept; ## Example -??? example +??? example "Example: (1) create an empty value with a given type" The following code shows the constructor for different `value_t` values. @@ -283,7 +291,7 @@ basic_json(basic_json&& other) noexcept; --8<-- "examples/basic_json__value_t.output" ``` -??? example +??? example "Example: (2) create a `#!json null` object" The following code shows the constructor with and without a null pointer parameter. @@ -297,7 +305,7 @@ basic_json(basic_json&& other) noexcept; --8<-- "examples/basic_json__nullptr_t.output" ``` -??? example +??? example "Example: (3) create a JSON value from compatible types" The following code shows the constructor with several compatible types. @@ -311,7 +319,7 @@ basic_json(basic_json&& other) noexcept; --8<-- "examples/basic_json__CompatibleType.output" ``` -??? example +??? example "Example: (5) create a container (array or object) from an initializer list" The example below shows how JSON values are created from initializer lists. @@ -325,7 +333,7 @@ basic_json(basic_json&& other) noexcept; --8<-- "examples/basic_json__list_init_t.output" ``` -??? example +??? example "Example: (6) construct an array with count copies of given value" The following code shows examples for creating arrays with several copies of a given value. @@ -339,7 +347,7 @@ basic_json(basic_json&& other) noexcept; --8<-- "examples/basic_json__size_type_basic_json.output" ``` -??? example +??? example "Example: (7) construct a JSON container given an iterator range" The example below shows several ways to create JSON values by specifying a subrange with iterators. @@ -353,7 +361,7 @@ basic_json(basic_json&& other) noexcept; --8<-- "examples/basic_json__InputIt_InputIt.output" ``` -??? example +??? example "Example: (8) copy constructor" The following code shows an example for the copy constructor. @@ -367,7 +375,7 @@ basic_json(basic_json&& other) noexcept; --8<-- "examples/basic_json__basic_json.output" ``` -??? example +??? example "Example: (9) move constructor" The code below shows the move constructor explicitly called via `std::move`. diff --git a/doc/mkdocs/docs/api/basic_json/dump.md b/doc/mkdocs/docs/api/basic_json/dump.md index cad06ca92..c9fb2b1c2 100644 --- a/doc/mkdocs/docs/api/basic_json/dump.md +++ b/doc/mkdocs/docs/api/basic_json/dump.md @@ -7,8 +7,9 @@ string_t dump(const int indent = -1, const error_handler_t error_handler = error_handler_t::strict) const; ``` -Serialization function for JSON values. The function tries to mimic Python's `json.dumps()` function, and currently -supports its `indent` and `ensure_ascii` parameters. +Serialization function for JSON values. The function tries to mimic Python's +[`json.dumps()` function](https://docs.python.org/2/library/json.html#json.dump), and currently supports its `indent` +and `ensure_ascii` parameters. ## Parameters @@ -33,6 +34,11 @@ supports its `indent` and `ensure_ascii` parameters. string containing the serialization of the JSON value +## Exceptions + +Throws [`type_error.316`](../../home/exceptions.md#jsonexceptiontype_error316) if a string stored inside the JSON value +is not UTF-8 encoded and `error_handler` is set to `strict` + ## Exception safety Strong guarantee: if an exception is thrown, there are no changes to any JSON value. @@ -64,3 +70,10 @@ Binary values are serialized as object containing two keys: ```json --8<-- "examples/dump.output" ``` + +## Version history + +- Added in version 1.0.0. +- Indentation character `indent_char`, option `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. diff --git a/doc/mkdocs/docs/api/basic_json/get_allocator.md b/doc/mkdocs/docs/api/basic_json/get_allocator.md index d4133af7a..431c64d65 100644 --- a/doc/mkdocs/docs/api/basic_json/get_allocator.md +++ b/doc/mkdocs/docs/api/basic_json/get_allocator.md @@ -13,3 +13,7 @@ associated allocator ## Version history - Unknown. + +!!! note + + This documentation page is a stub. diff --git a/doc/mkdocs/docs/api/basic_json/get_ptr.md b/doc/mkdocs/docs/api/basic_json/get_ptr.md index c5cee307a..7554844bb 100644 --- a/doc/mkdocs/docs/api/basic_json/get_ptr.md +++ b/doc/mkdocs/docs/api/basic_json/get_ptr.md @@ -2,7 +2,7 @@ ```cpp template -PointerType get_ptr(); +PointerType get_ptr() noexcept; template constexpr const PointerType get_ptr() const noexcept; @@ -25,7 +25,7 @@ otherwise ## Exception safety -Strong exception safety: if an exception occurs, the original value stays intact. +No-throw guarantee: this function never throws exceptions. ## Complexity diff --git a/doc/mkdocs/docs/api/basic_json/index.md b/doc/mkdocs/docs/api/basic_json/index.md index e8841e850..2d81a2261 100644 --- a/doc/mkdocs/docs/api/basic_json/index.md +++ b/doc/mkdocs/docs/api/basic_json/index.md @@ -44,7 +44,7 @@ Todo ## Member types -- [**adl_serializer**](../adl_serializer.md) - the default serializer +- [**adl_serializer**](../adl_serializer) - the default serializer - [**value_t**](value_t.md) - the JSON type enumeration - [**json_pointer**](../json_pointer.md) - JSON Pointer implementation - [**json_serializer**](json_serializer.md) - type of the serializer to for conversions from/to JSON diff --git a/doc/mkdocs/docs/api/basic_json/is_number.md b/doc/mkdocs/docs/api/basic_json/is_number.md index 9bcb13144..dbfda2a02 100644 --- a/doc/mkdocs/docs/api/basic_json/is_number.md +++ b/doc/mkdocs/docs/api/basic_json/is_number.md @@ -44,6 +44,12 @@ constexpr bool is_number() const noexcept --8<-- "examples/is_number.output" ``` +# See also + +- [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number +- [is_number_unsigned()](is_number_unsigned.md) check if value is an unsigned integer number +- [is_number_float()](is_number_float.md) check if value is a floating-point number + ## Version history - Added in version 1.0.0. diff --git a/doc/mkdocs/docs/api/basic_json/is_number_float.md b/doc/mkdocs/docs/api/basic_json/is_number_float.md index d709bf71b..1ecd35b2d 100644 --- a/doc/mkdocs/docs/api/basic_json/is_number_float.md +++ b/doc/mkdocs/docs/api/basic_json/is_number_float.md @@ -35,6 +35,12 @@ Constant. --8<-- "examples/is_number_float.output" ``` +# See also + +- [is_number()](is_number.md) check if value is a number +- [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number +- [is_number_unsigned()](is_number_unsigned.md) check if value is an unsigned integer number + ## Version history - Added in version 1.0.0. diff --git a/doc/mkdocs/docs/api/basic_json/is_number_integer.md b/doc/mkdocs/docs/api/basic_json/is_number_integer.md index c308c9296..bd539be2e 100644 --- a/doc/mkdocs/docs/api/basic_json/is_number_integer.md +++ b/doc/mkdocs/docs/api/basic_json/is_number_integer.md @@ -35,6 +35,12 @@ Constant. --8<-- "examples/is_number_integer.output" ``` +# See also + +- [is_number()](is_number.md) check if value is a number +- [is_number_unsigned()](is_number_unsigned.md) check if value is an unsigned integer number +- [is_number_float()](is_number_float.md) check if value is a floating-point number + ## Version history - Added in version 1.0.0. diff --git a/doc/mkdocs/docs/api/basic_json/is_number_unsigned.md b/doc/mkdocs/docs/api/basic_json/is_number_unsigned.md index 56493eae6..90c6a1a03 100644 --- a/doc/mkdocs/docs/api/basic_json/is_number_unsigned.md +++ b/doc/mkdocs/docs/api/basic_json/is_number_unsigned.md @@ -35,6 +35,12 @@ Constant. --8<-- "examples/is_number_unsigned.output" ``` +# See also + +- [is_number()](is_number.md) check if value is a number +- [is_number_integer()](is_number_integer.md) check if value is an integer or unsigned integer number +- [is_number_float()](is_number_float.md) check if value is a floating-point number + ## Version history - Added in version 2.0.0. diff --git a/doc/mkdocs/docs/api/basic_json/is_primitive.md b/doc/mkdocs/docs/api/basic_json/is_primitive.md index 37be35c7f..b38264250 100644 --- a/doc/mkdocs/docs/api/basic_json/is_primitive.md +++ b/doc/mkdocs/docs/api/basic_json/is_primitive.md @@ -54,6 +54,15 @@ This library extends primitive types to binary types, because binary types are --8<-- "examples/is_primitive.output" ``` +# See also + +- [is_structured()](is_structured.md) returns whether JSON value is structured +- [is_null()](is_null.md) returns whether JSON value is `null` +- [is_string()](is_string.md) returns whether JSON value is a string +- [is_boolean()](is_boolean.md) returns whether JSON value is a boolean +- [is_number()](is_number.md) returns whether JSON value is a number +- [is_binary()](is_binary.md) returns whether JSON value is a binary array + ## Version history - Added in version 1.0.0. diff --git a/doc/mkdocs/docs/api/basic_json/is_structured.md b/doc/mkdocs/docs/api/basic_json/is_structured.md index 397579884..4890a301e 100644 --- a/doc/mkdocs/docs/api/basic_json/is_structured.md +++ b/doc/mkdocs/docs/api/basic_json/is_structured.md @@ -18,6 +18,15 @@ No-throw guarantee: this member function never throws exceptions. Constant. +## Possible implementation + +```cpp +constexpr bool is_primitive() const noexcept +{ + return is_array() || is_object(); +} +``` + ## Notes The term *structured* stems from [RFC 8259](https://tools.ietf.org/html/rfc8259): @@ -43,6 +52,12 @@ Note that though strings are containers in C++, they are treated as primitive va --8<-- "examples/is_structured.output" ``` +# See also + +- [is_primitive()](is_primitive.md) returns whether JSON value is primitive +- [is_array()](is_array.md) returns whether value is an array +- [is_object()](is_object.md) returns whether value is an object + ## Version history - Added in version 1.0.0. diff --git a/doc/mkdocs/docs/api/basic_json/json_serializer.md b/doc/mkdocs/docs/api/basic_json/json_serializer.md index 89379acf4..7c50284b7 100644 --- a/doc/mkdocs/docs/api/basic_json/json_serializer.md +++ b/doc/mkdocs/docs/api/basic_json/json_serializer.md @@ -17,7 +17,7 @@ using json_serializer = JSONSerializer; #### Default type -The default values for `json_serializer` is [`adl_serializer`](../adl_serializer.md). +The default values for `json_serializer` is [`adl_serializer`](../adl_serializer). ## Version history diff --git a/doc/mkdocs/docs/api/basic_json/meta.md b/doc/mkdocs/docs/api/basic_json/meta.md index 807c2aa73..61218c3fa 100644 --- a/doc/mkdocs/docs/api/basic_json/meta.md +++ b/doc/mkdocs/docs/api/basic_json/meta.md @@ -30,18 +30,20 @@ Constant. ## Example -The following code shows an example output of the `meta()` -function. +??? example -```cpp ---8<-- "examples/meta.cpp" -``` - -Output: - -```json ---8<-- "examples/meta.output" -``` + The following code shows an example output of the `meta()` + function. + + ```cpp + --8<-- "examples/meta.cpp" + ``` + + Output: + + ```json + --8<-- "examples/meta.output" + ``` ## Version history diff --git a/doc/mkdocs/docs/api/basic_json/object.md b/doc/mkdocs/docs/api/basic_json/object.md index 4aae6fe2a..3060b70a0 100644 --- a/doc/mkdocs/docs/api/basic_json/object.md +++ b/doc/mkdocs/docs/api/basic_json/object.md @@ -53,6 +53,11 @@ the initializer list constructor `basic_json(initializer_list_t, bool, value_t)` --8<-- "examples/object.output" ``` +## See also + +- [`basic_json(initializer_list_t)`](basic_json.md) - create a JSON value from an initializer list +- [`array`](array.md) - create a JSON array value from an initializer list + ## Version history - Added in version 1.0.0. diff --git a/doc/mkdocs/docs/hooks.py b/doc/mkdocs/docs/hooks.py deleted file mode 100644 index 8fee83973..000000000 --- a/doc/mkdocs/docs/hooks.py +++ /dev/null @@ -1,10 +0,0 @@ -import shutil -import os.path - - -def copy_doxygen(*args, **kwargs): - doxygen_dir = os.path.join(kwargs['config']['site_dir'], 'doxygen') - if not os.path.isdir(doxygen_dir) or not os.listdir(doxygen_dir): - print('Copy Doxygen files...') - shutil.copytree('../html', doxygen_dir) - print('Copy Doxygen complete') diff --git a/doc/mkdocs/mkdocs.yml b/doc/mkdocs/mkdocs.yml index 7aa6e2c5d..8974f0a53 100644 --- a/doc/mkdocs/mkdocs.yml +++ b/doc/mkdocs/mkdocs.yml @@ -70,7 +70,6 @@ nav: - integration/cmake.md - integration/package_managers.md - integration/pkg-config.md - - Doxygen: doxygen/index.html - API: - basic_json: - api/basic_json/index.md @@ -179,7 +178,10 @@ nav: - api/basic_json/update.md - api/basic_json/value.md - api/basic_json/value_t.md - - api/adl_serializer.md + - adl_serializer: + - api/adl_serializer/index.md + - api/adl_serializer/from_json.md + - api/adl_serializer/to_json.md - api/json.md - api/json_pointer.md - api/ordered_map.md @@ -234,9 +236,6 @@ markdown_extensions: plugins: - search: separator: '[\s\-\.]+' - - mkdocs-simple-hooks: - hooks: - on_post_build: "docs.hooks:copy_doxygen" - minify: minify_html: true diff --git a/doc/scripts/git-update-ghpages b/doc/scripts/git-update-ghpages deleted file mode 100755 index 393650c1c..000000000 --- a/doc/scripts/git-update-ghpages +++ /dev/null @@ -1,193 +0,0 @@ -#!/usr/bin/env bash -set -o errexit - -copy_contents() { - local source="$1" - status "Copying contents from $source" - if [[ ! "$dryrun" == "1" ]]; then - (cd "$source" >/dev/null && tar c .) | tar xv - else - _ "(cd \"$source\" >/dev/null && tar c .) | tar xv" - fi -} - -# Sets git config -set_config() { - if [ -n "$GIT_NAME" ]; then _ git config user.name "$GIT_NAME"; fi - if [ -n "$GIT_EMAIL" ]; then _ git config user.email "$GIT_EMAIL"; fi -} - -# Runs the deployment -run() { - if [ ! -d "$source" ]; then - echo "Source is not a directory: $source" - exit 1 - fi - - local tmpdir="$(mktemp -d)" - - if [[ "$force" == "1" ]]; then - _ cd "$tmpdir" - _ git init - _ git checkout -b "$branch" - copy_contents "$source" - if [[ "$useenv" == "1" ]]; then set_config; fi - _ git add -A . - git_commit - git_push --force - else - _ cd "$tmpdir" - _ git clone "$repo" . -b "$branch" || ( \ - _ git init && \ - _ git checkout -b "$branch") - if [[ "$keep" == "0" ]]; then _ rm -rf ./*; fi - copy_contents "$source" - if [[ "$useenv" == "1" ]]; then set_config; fi - _ git add -A . - git_commit || true - git_push - fi - _ rm -rf "$tmpdir" - status_ "Done" -} - -git_commit() { - if [ -z "$author" ]; then - _ git commit -m "$message" - else - _ git commit -m "$message" --author "$author" - fi -} - -git_push() { - if [ -z "$GITHUB_TOKEN" ]; then - _ git push "${repo}" "$branch" "$@" - else - status "Pushing via \$GITHUB_TOKEN $@" - _ git push "https://${GITHUB_TOKEN}@github.com/${repospec}.git" "$branch" "$@" \ - --quiet >/dev/null 2>&1 || \ - ( status_ "Failed to push"; exit 1 ) - fi -} - -status() { - echo -e "\n\033[34m==>\033[0;1m" "$@\033[0m" -} -status_() { - echo -e "\033[33;1m==>\033[0m" "$@" -} - -_() { - echo "" - status_ "$@" - if [[ ! "$dryrun" == "1" ]]; then "$@"; fi -} - -help() { - local cmd="$(basename $0)" - echo 'Usage:' - echo " $cmd " - echo '' - echo 'Parameters:' - echo " REPO repository to push to in 'user/repo' form" - echo " SOURCE path to upload to repository's gh-pages branch" - echo '' - echo 'Options:' - echo ' -h, --help show help screen' - echo ' -f, --force force push' - echo ' -n, --dry-run run in simulation mode' - echo ' -e, --use-env pick up arguments from environment variables' - echo ' -b, --branch use this branch name (default: gh-pages)' - echo ' -a, --author set the author' - echo ' -k, --keep keep existing files in the repo' - echo '' - echo 'Env var options:' - echo ' GITHUB_TOKEN if set, use this to push to the repo' - echo '' - echo 'Optional env vars:' - echo " Run with '-e' to enable the use of these variables." - echo " GIT_NAME set this as the repos user.name" - echo ' GIT_EMAIL set this as the repos user.email' - echo ' GITHUB_REPO substitute as the REPO (1st argument)' - echo ' GIT_SOURCE substitute as the SOURCE (2nd argument)' - echo ' GIT_BRANCH use this branch name (--branch)' - echo '' - echo 'Example:' - echo " $cmd rstacruz/myproject doc" - echo " # pushes './doc' into the gh-pages branch of rstacruz/myproject" - echo '' - echo " export GITHUB_REPO='xyz/abc'" - echo " export GIT_SOURCE='docs'" - echo " $cmd -e" - echo " # pushes './doc' into the gh-pages branch of xyz/abc" -} - -# -# Defaults -# - -force=0 -dryrun=0 -repospec= -source= -branch= -message="Update" -useenv=0 -author="" -keep=0 - -# -# Parse args -# - -while [[ "$1" =~ ^- && ! "$1" == '--' ]]; do case $1 in - -h | --help ) - help - exit - ;; - -b | --branch ) - shift - branch="$1" - ;; - -n | --dry-run ) - dryrun=1 - ;; - -e | --use-env ) - useenv=1 - ;; - -k | --keep ) - keep=1 - ;; - -a | --author) - shift - author="$1" - ;; - -f | --force ) - force=1 - ;; -esac; shift; done -if [[ "$1" == '--' ]]; then shift; fi - -if [[ "$useenv" == "1" ]] && [[ -n "$GIT_BRANCH" ]] && [[ -z "$branch" ]]; then - branch="$GIT_BRANCH" -fi - -if [[ "$useenv" == "1" ]] && [[ -n "$GITHUB_REPO" ]] && [[ -n "$GIT_SOURCE" ]] && [[ -z "$2" ]]; then - repospec="$GITHUB_REPO" - source="$GIT_SOURCE" -else - repospec="$1" - source="$2" -fi - -: ${branch:="gh-pages"} - -if [ -z "$source" ]; then - help - exit 1 -fi - -source="`pwd -LP`/$source" -repo="https://github.com/${repospec}.git" - -run diff --git a/doc/scripts/send_to_wandbox.py b/doc/scripts/send_to_wandbox.py deleted file mode 100755 index 112656694..000000000 --- a/doc/scripts/send_to_wandbox.py +++ /dev/null @@ -1,120 +0,0 @@ -#! /usr/bin/env python - -# This script uploads a directory to Wandbox (http://melpon.org/wandbox), -# which is an online compiler environment, and prints a permalink to the -# uploaded code. We use this to provide a "Try it online" version of the -# library to make the barrier to entry as low as possible. -# -# This script was adapted from the script proposed in -# https://github.com/melpon/wandbox/issues/153. -# -# To know how to use this script: ./wandbox.py --help -# -# Copyright Louis Dionne 2015 -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) - -import argparse -import fnmatch -import json -import os -import re -import urllib2 - - -# Strips C and C++ comments from the given string. -# -# Copied from https://stackoverflow.com/a/241506/627587. -def strip_comments(text): - def replacer(match): - s = match.group(0) - if s.startswith('/'): - return " " # note: a space and not an empty string - else: - return s - pattern = re.compile( - r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', - re.DOTALL | re.MULTILINE - ) - return re.sub(pattern, replacer, text) - - -# Post the given JSON data to Wandbox's API, and return the result -# as a JSON object. -def upload(options): - request = urllib2.Request('https://melpon.org/wandbox/api/compile.json') - request.add_header('Content-Type', 'application/json') - response = urllib2.urlopen(request, json.dumps(options)) - return json.loads(response.read()) - - -# Returns a list of the '.hpp' headers in the given directory and in -# subdirectories. -# -# The path must be absolute, and the returned paths are all absolute too. -def headers(path): - return [ - os.path.join(dir, file) - for (dir, _, files) in os.walk(path) - for file in fnmatch.filter(files, "*.hpp") - ] - - -def main(): - parser = argparse.ArgumentParser(description= - """Upload a directory to Wandbox (http://melpon.org/wandbox). - - On success, the program prints a permalink to the uploaded - directory on Wandbox and returns 0. On error, it prints the - response from the Wandbox API and returns 1. - - Note that the comments are stripped from all the headers in the - uploaded directory. - """ - ) - parser.add_argument('directory', type=str, help= - """A directory to upload to Wandbox. - - The path may be either absolute or relative to the current directory. - However, the names of the files uploaded to Wandbox will all be - relative to this directory. This way, one can easily specify the - directory to be '/some/project/include', and the uploaded files - will be uploaded as-if they were rooted at '/some/project/include' - """) - parser.add_argument('main', type=str, help= - """The main source file. - - The path may be either absolute or relative to the current directory. - """ - ) - args = parser.parse_args() - directory = os.path.abspath(args.directory) - if not os.path.exists(directory): - raise Exception("'%s' is not a valid directory" % args.directory) - - cpp = os.path.abspath(args.main) - if not os.path.exists(cpp): - raise Exception("'%s' is not a valid file name" % args.main) - - response = upload({ - 'code': open(cpp).read(), - 'codes': [{ - 'file': os.path.relpath(header, directory), - #'code': strip_comments(open(header).read()) - 'code': open(header).read() - } for header in headers(directory)], - 'options': 'boost-nothing,c++11', - 'compiler': 'gcc-4.9.2', - 'save': True, - 'compiler-option-raw': '-I.' - }) - - if 'status' in response and response['status'] == '0': - print response['url'] - return 0 - else: - print response - return 1 - - -exit(main()) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index b140577f2..81227ccdf 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -318,6 +318,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /*! @brief returns the allocator associated with the container + @sa https://json.nlohmann.me/api/basic_json/get_allocator/ */ static allocator_type get_allocator() { @@ -326,29 +327,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /*! @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 + @sa https://json.nlohmann.me/api/basic_json/meta/ */ JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json meta() @@ -1364,72 +1343,12 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec // 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 see @ref parser_callback_t for more information and examples - */ + /// @brief parser event types + /// @sa https://json.nlohmann.me/api/basic_json/parse_event_t/ 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 see @ref parse for examples - - @since version 1.0.0 - */ + /// @brief per-element parser callback type + /// @sa https://json.nlohmann.me/api/basic_json/parser_callback_t/ using parser_callback_t = detail::parser_callback_t; ////////////////// @@ -1441,128 +1360,24 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /// 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 see @ref clear() -- restores the postcondition of this constructor - - @since version 1.0.0 - */ + /// @brief create an empty value with a given type + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ 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 - */ + /// @brief create a null object + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ 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::to_json` method - with `U = uncvref_t`, 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` 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 ...) - - `json_serializer` has a `to_json(basic_json_t&, CompatibleType&&)` method - - @tparam U = `uncvref_t` - - @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 - */ + /// @brief create a JSON value from compatible types + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ template < typename CompatibleType, typename U = detail::uncvref_t, detail::enable_if_t < @@ -1576,32 +1391,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 - */ + /// @brief create a JSON value from an existing one + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ template < typename BasicJsonType, detail::enable_if_t < detail::is_basic_json::value&& !std::is_same::value, int > = 0 > @@ -1655,80 +1446,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 see @ref array(initializer_list_t) -- create a JSON array - value from an initializer list - @sa see @ref object(initializer_list_t) -- create a JSON object - value from an initializer list - - @since version 1.0.0 - */ + /// @brief create a container (array or object) from an initializer list + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ basic_json(initializer_list_t init, bool type_deduction = true, value_t manual_type = value_t::array) @@ -1875,115 +1594,24 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 see @ref basic_json(initializer_list_t, bool, value_t) -- - create a JSON value from an initializer list - @sa see @ref object(initializer_list_t) -- create a JSON object - value from an initializer list - - @since version 1.0.0 - */ + /// @brief explicitly create an array from an initializer list + /// @sa https://json.nlohmann.me/api/basic_json/array/ 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 see @ref basic_json(initializer_list_t, bool, value_t) -- - create a JSON value from an initializer list - @sa see @ref array(initializer_list_t) -- create a JSON array - value from an initializer list - - @since version 1.0.0 - */ + /// @brief explicitly create an object from an initializer list + /// @sa https://json.nlohmann.me/api/basic_json/object/ 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 - */ + /// @brief construct an array with count copies of given value + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ basic_json(size_type cnt, const basic_json& val) : m_type(value_t::array) { @@ -1992,61 +1620,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 - */ + /// @brief construct a JSON container given an iterator range + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ template < class InputIT, typename std::enable_if < std::is_same::value || std::is_same::value, int >::type = 0 > @@ -2162,31 +1737,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec std::is_same>::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 - */ + /// @brief copy constructor + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ basic_json(const basic_json& other) : m_type(other.m_type) { @@ -2253,32 +1805,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 - */ + /// @brief move constructor + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ basic_json(basic_json&& other) noexcept : m_type(std::move(other.m_type)), m_value(std::move(other.m_value)) @@ -2294,29 +1822,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 - */ + /// @brief copy assignment + /// @sa https://json.nlohmann.me/api/basic_json/operator=/ basic_json& operator=(basic_json other) noexcept ( std::is_nothrow_move_constructible::value&& std::is_nothrow_move_assignable::value&& @@ -2336,21 +1843,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 - */ + /// @brief destructor + /// @sa https://json.nlohmann.me/api/basic_json/~basic_json/ ~basic_json() noexcept { assert_invariant(false); @@ -2368,53 +1862,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /// 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; all - bytes are copied to the output unchanged). - - @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. - */ + /// @brief serialization + /// @sa https://json.nlohmann.me/api/basic_json/dump/ string_t dump(const int indent = -1, const char indent_char = ' ', const bool ensure_ascii = false, @@ -2435,397 +1884,106 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 see @ref operator value_t() -- return the type of the JSON value (implicit) - @sa see @ref type_name() -- return the type as string - - @since version 1.0.0 - */ + /// @brief return the type of the JSON value (explicit) + /// @sa https://json.nlohmann.me/api/basic_json/type/ 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 see @ref is_structured() -- returns whether JSON value is structured - @sa see @ref is_null() -- returns whether JSON value is `null` - @sa see @ref is_string() -- returns whether JSON value is a string - @sa see @ref is_boolean() -- returns whether JSON value is a boolean - @sa see @ref is_number() -- returns whether JSON value is a number - @sa see @ref is_binary() -- returns whether JSON value is a binary array - - @since version 1.0.0 - */ + /// @brief return whether type is primitive + /// @sa https://json.nlohmann.me/api/basic_json/is_primitive/ constexpr bool is_primitive() const noexcept { return is_null() || is_string() || is_boolean() || is_number() || 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 see @ref is_primitive() -- returns whether value is primitive - @sa see @ref is_array() -- returns whether value is an array - @sa see @ref is_object() -- returns whether value is an object - - @since version 1.0.0 - */ + /// @brief return whether type is structured + /// @sa https://json.nlohmann.me/api/basic_json/is_structured/ constexpr bool is_structured() const noexcept { return is_array() || 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 - */ + /// @brief return whether value is null + /// @sa https://json.nlohmann.me/api/basic_json/is_null/ 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 - */ + /// @brief return whether value is a boolean + /// @sa https://json.nlohmann.me/api/basic_json/is_boolean/ 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 see @ref is_number_integer() -- check if value is an integer or unsigned - integer number - @sa see @ref is_number_unsigned() -- check if value is an unsigned integer - number - @sa see @ref is_number_float() -- check if value is a floating-point number - - @since version 1.0.0 - */ + /// @brief return whether value is a number + /// @sa https://json.nlohmann.me/api/basic_json/is_number/ constexpr bool is_number() const noexcept { return is_number_integer() || 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 see @ref is_number() -- check if value is a number - @sa see @ref is_number_unsigned() -- check if value is an unsigned integer - number - @sa see @ref is_number_float() -- check if value is a floating-point number - - @since version 1.0.0 - */ + /// @brief return whether value is an integer number + /// @sa https://json.nlohmann.me/api/basic_json/is_number_integer/ constexpr bool is_number_integer() const noexcept { return m_type == value_t::number_integer || 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 see @ref is_number() -- check if value is a number - @sa see @ref is_number_integer() -- check if value is an integer or unsigned - integer number - @sa see @ref is_number_float() -- check if value is a floating-point number - - @since version 2.0.0 - */ + /// @brief return whether value is an unsigned integer number + /// @sa https://json.nlohmann.me/api/basic_json/is_number_unsigned/ 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 see @ref is_number() -- check if value is number - @sa see @ref is_number_integer() -- check if value is an integer number - @sa see @ref is_number_unsigned() -- check if value is an unsigned integer - number - - @since version 1.0.0 - */ + /// @brief return whether value is a floating-point number + /// @sa https://json.nlohmann.me/api/basic_json/is_number_float/ 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 - */ + /// @brief return whether value is an object + /// @sa https://json.nlohmann.me/api/basic_json/is_object/ 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 - */ + /// @brief return whether value is an array + /// @sa https://json.nlohmann.me/api/basic_json/is_array/ 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 - */ + /// @brief return whether value is a string + /// @sa https://json.nlohmann.me/api/basic_json/is_string/ 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 - */ + /// @brief return whether value is a binary array + /// @sa https://json.nlohmann.me/api/basic_json/is_binary/ 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 - */ + /// @brief return whether value is discarded + /// @sa https://json.nlohmann.me/api/basic_json/is_discarded/ 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 see @ref type() -- return the type of the JSON value (explicit) - @sa see @ref type_name() -- return the type as string - - @since version 1.0.0 - */ + /// @brief return the type of the JSON value (implicit) + /// @sa https://json.nlohmann.me/api/basic_json/operator_value_t/ constexpr operator value_t() const noexcept { return m_type; @@ -2975,32 +2133,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /// Direct access to the stored value of a JSON value. /// @{ - /*! - @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 - */ + /// @brief get a pointer value (implicit) + /// @sa https://json.nlohmann.me/api/basic_json/get_ptr/ template::value, int>::type = 0> auto get_ptr() noexcept -> decltype(std::declval().get_impl_ptr(std::declval())) @@ -3009,10 +2143,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec return get_impl_ptr(static_cast(nullptr)); } - /*! - @brief get a pointer value (implicit) - @copydoc get_ptr() - */ + /// @brief get a pointer value (implicit) + /// @sa https://json.nlohmann.me/api/basic_json/get_ptr/ template < typename PointerType, typename std::enable_if < std::is_pointer::value&& std::is_const::type>::value, int >::type = 0 > @@ -3251,39 +2383,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec return get_ptr(); } - /*! - @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 - `from_json()` method. - - The function is equivalent to executing - @code {.cpp} - ValueType v; - JSONSerializer::from_json(*this, v); - @endcode - - This overloads is chosen if: - - @a ValueType is not @ref basic_json, - - @ref json_serializer 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 `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`\, (3) A JSON object can be converted to C++ - associative containers such as `std::unordered_map`.,get_to} - - @since version 3.3.0 - */ + /// @brief get a value (explicit) + /// @sa https://json.nlohmann.me/api/basic_json/get_to/ template < typename ValueType, detail::enable_if_t < !detail::is_basic_json::value&& diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 25c6983b0..91765c7c8 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -17805,6 +17805,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /*! @brief returns the allocator associated with the container + @sa https://json.nlohmann.me/api/basic_json/get_allocator/ */ static allocator_type get_allocator() { @@ -17813,29 +17814,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /*! @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 + @sa https://json.nlohmann.me/api/basic_json/meta/ */ JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json meta() @@ -18851,72 +18830,12 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec // 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 see @ref parser_callback_t for more information and examples - */ + /// @brief parser event types + /// @sa https://json.nlohmann.me/api/basic_json/parse_event_t/ 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 see @ref parse for examples - - @since version 1.0.0 - */ + /// @brief per-element parser callback type + /// @sa https://json.nlohmann.me/api/basic_json/parser_callback_t/ using parser_callback_t = detail::parser_callback_t; ////////////////// @@ -18928,128 +18847,24 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /// 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 see @ref clear() -- restores the postcondition of this constructor - - @since version 1.0.0 - */ + /// @brief create an empty value with a given type + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ 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 - */ + /// @brief create a null object + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ 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::to_json` method - with `U = uncvref_t`, 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` 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 ...) - - `json_serializer` has a `to_json(basic_json_t&, CompatibleType&&)` method - - @tparam U = `uncvref_t` - - @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 - */ + /// @brief create a JSON value from compatible types + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ template < typename CompatibleType, typename U = detail::uncvref_t, detail::enable_if_t < @@ -19063,32 +18878,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 - */ + /// @brief create a JSON value from an existing one + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ template < typename BasicJsonType, detail::enable_if_t < detail::is_basic_json::value&& !std::is_same::value, int > = 0 > @@ -19142,80 +18933,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 see @ref array(initializer_list_t) -- create a JSON array - value from an initializer list - @sa see @ref object(initializer_list_t) -- create a JSON object - value from an initializer list - - @since version 1.0.0 - */ + /// @brief create a container (array or object) from an initializer list + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ basic_json(initializer_list_t init, bool type_deduction = true, value_t manual_type = value_t::array) @@ -19362,115 +19081,24 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 see @ref basic_json(initializer_list_t, bool, value_t) -- - create a JSON value from an initializer list - @sa see @ref object(initializer_list_t) -- create a JSON object - value from an initializer list - - @since version 1.0.0 - */ + /// @brief explicitly create an array from an initializer list + /// @sa https://json.nlohmann.me/api/basic_json/array/ 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 see @ref basic_json(initializer_list_t, bool, value_t) -- - create a JSON value from an initializer list - @sa see @ref array(initializer_list_t) -- create a JSON array - value from an initializer list - - @since version 1.0.0 - */ + /// @brief explicitly create an object from an initializer list + /// @sa https://json.nlohmann.me/api/basic_json/object/ 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 - */ + /// @brief construct an array with count copies of given value + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ basic_json(size_type cnt, const basic_json& val) : m_type(value_t::array) { @@ -19479,61 +19107,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 - */ + /// @brief construct a JSON container given an iterator range + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ template < class InputIT, typename std::enable_if < std::is_same::value || std::is_same::value, int >::type = 0 > @@ -19649,31 +19224,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec std::is_same>::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 - */ + /// @brief copy constructor + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ basic_json(const basic_json& other) : m_type(other.m_type) { @@ -19740,32 +19292,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 - */ + /// @brief move constructor + /// @sa https://json.nlohmann.me/api/basic_json/basic_json/ basic_json(basic_json&& other) noexcept : m_type(std::move(other.m_type)), m_value(std::move(other.m_value)) @@ -19781,29 +19309,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 - */ + /// @brief copy assignment + /// @sa https://json.nlohmann.me/api/basic_json/operator=/ basic_json& operator=(basic_json other) noexcept ( std::is_nothrow_move_constructible::value&& std::is_nothrow_move_assignable::value&& @@ -19823,21 +19330,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 - */ + /// @brief destructor + /// @sa https://json.nlohmann.me/api/basic_json/~basic_json/ ~basic_json() noexcept { assert_invariant(false); @@ -19855,53 +19349,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /// 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; all - bytes are copied to the output unchanged). - - @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. - */ + /// @brief serialization + /// @sa https://json.nlohmann.me/api/basic_json/dump/ string_t dump(const int indent = -1, const char indent_char = ' ', const bool ensure_ascii = false, @@ -19922,397 +19371,106 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec 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 see @ref operator value_t() -- return the type of the JSON value (implicit) - @sa see @ref type_name() -- return the type as string - - @since version 1.0.0 - */ + /// @brief return the type of the JSON value (explicit) + /// @sa https://json.nlohmann.me/api/basic_json/type/ 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 see @ref is_structured() -- returns whether JSON value is structured - @sa see @ref is_null() -- returns whether JSON value is `null` - @sa see @ref is_string() -- returns whether JSON value is a string - @sa see @ref is_boolean() -- returns whether JSON value is a boolean - @sa see @ref is_number() -- returns whether JSON value is a number - @sa see @ref is_binary() -- returns whether JSON value is a binary array - - @since version 1.0.0 - */ + /// @brief return whether type is primitive + /// @sa https://json.nlohmann.me/api/basic_json/is_primitive/ constexpr bool is_primitive() const noexcept { return is_null() || is_string() || is_boolean() || is_number() || 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 see @ref is_primitive() -- returns whether value is primitive - @sa see @ref is_array() -- returns whether value is an array - @sa see @ref is_object() -- returns whether value is an object - - @since version 1.0.0 - */ + /// @brief return whether type is structured + /// @sa https://json.nlohmann.me/api/basic_json/is_structured/ constexpr bool is_structured() const noexcept { return is_array() || 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 - */ + /// @brief return whether value is null + /// @sa https://json.nlohmann.me/api/basic_json/is_null/ 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 - */ + /// @brief return whether value is a boolean + /// @sa https://json.nlohmann.me/api/basic_json/is_boolean/ 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 see @ref is_number_integer() -- check if value is an integer or unsigned - integer number - @sa see @ref is_number_unsigned() -- check if value is an unsigned integer - number - @sa see @ref is_number_float() -- check if value is a floating-point number - - @since version 1.0.0 - */ + /// @brief return whether value is a number + /// @sa https://json.nlohmann.me/api/basic_json/is_number/ constexpr bool is_number() const noexcept { return is_number_integer() || 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 see @ref is_number() -- check if value is a number - @sa see @ref is_number_unsigned() -- check if value is an unsigned integer - number - @sa see @ref is_number_float() -- check if value is a floating-point number - - @since version 1.0.0 - */ + /// @brief return whether value is an integer number + /// @sa https://json.nlohmann.me/api/basic_json/is_number_integer/ constexpr bool is_number_integer() const noexcept { return m_type == value_t::number_integer || 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 see @ref is_number() -- check if value is a number - @sa see @ref is_number_integer() -- check if value is an integer or unsigned - integer number - @sa see @ref is_number_float() -- check if value is a floating-point number - - @since version 2.0.0 - */ + /// @brief return whether value is an unsigned integer number + /// @sa https://json.nlohmann.me/api/basic_json/is_number_unsigned/ 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 see @ref is_number() -- check if value is number - @sa see @ref is_number_integer() -- check if value is an integer number - @sa see @ref is_number_unsigned() -- check if value is an unsigned integer - number - - @since version 1.0.0 - */ + /// @brief return whether value is a floating-point number + /// @sa https://json.nlohmann.me/api/basic_json/is_number_float/ 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 - */ + /// @brief return whether value is an object + /// @sa https://json.nlohmann.me/api/basic_json/is_object/ 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 - */ + /// @brief return whether value is an array + /// @sa https://json.nlohmann.me/api/basic_json/is_array/ 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 - */ + /// @brief return whether value is a string + /// @sa https://json.nlohmann.me/api/basic_json/is_string/ 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 - */ + /// @brief return whether value is a binary array + /// @sa https://json.nlohmann.me/api/basic_json/is_binary/ 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 - */ + /// @brief return whether value is discarded + /// @sa https://json.nlohmann.me/api/basic_json/is_discarded/ 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 see @ref type() -- return the type of the JSON value (explicit) - @sa see @ref type_name() -- return the type as string - - @since version 1.0.0 - */ + /// @brief return the type of the JSON value (implicit) + /// @sa https://json.nlohmann.me/api/basic_json/operator_value_t/ constexpr operator value_t() const noexcept { return m_type; @@ -20462,32 +19620,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec /// Direct access to the stored value of a JSON value. /// @{ - /*! - @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 - */ + /// @brief get a pointer value (implicit) + /// @sa https://json.nlohmann.me/api/basic_json/get_ptr/ template::value, int>::type = 0> auto get_ptr() noexcept -> decltype(std::declval().get_impl_ptr(std::declval())) @@ -20496,10 +19630,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec return get_impl_ptr(static_cast(nullptr)); } - /*! - @brief get a pointer value (implicit) - @copydoc get_ptr() - */ + /// @brief get a pointer value (implicit) + /// @sa https://json.nlohmann.me/api/basic_json/get_ptr/ template < typename PointerType, typename std::enable_if < std::is_pointer::value&& std::is_const::type>::value, int >::type = 0 > @@ -20738,39 +19870,8 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec return get_ptr(); } - /*! - @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 - `from_json()` method. - - The function is equivalent to executing - @code {.cpp} - ValueType v; - JSONSerializer::from_json(*this, v); - @endcode - - This overloads is chosen if: - - @a ValueType is not @ref basic_json, - - @ref json_serializer 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 `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`\, (3) A JSON object can be converted to C++ - associative containers such as `std::unordered_map`.,get_to} - - @since version 3.3.0 - */ + /// @brief get a value (explicit) + /// @sa https://json.nlohmann.me/api/basic_json/get_to/ template < typename ValueType, detail::enable_if_t < !detail::is_basic_json::value&&