Commit e63c5081 authored by Niels's avatar Niels

overworked doxygen

parent 0abac592
json_unit
json_benchmarks
working
html
......@@ -27,7 +27,9 @@ MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
ALIASES = "complexity=@par Complexity\n"
ALIASES += liveexample{2}="@par Example\n \1 \n @includelineno \2.cpp \n Output:\n @verbinclude \2.output"
ALIASES += requirement="@par Requirements\n"
TCL_SUBST =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
......@@ -50,7 +52,7 @@ LOOKUP_CACHE_SIZE = 0
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_PRIVATE = NO
EXTRACT_PACKAGE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
......@@ -69,7 +71,7 @@ SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
SORT_BRIEF_DOCS = YES
SORT_MEMBERS_CTORS_1ST = YES
SORT_GROUP_NAMES = NO
SORT_BY_SCOPE_NAME = NO
......@@ -80,9 +82,9 @@ GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_USED_FILES = NO
SHOW_FILES = YES
SHOW_NAMESPACES = YES
SHOW_NAMESPACES = NO
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
......@@ -99,18 +101,18 @@ WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = src/json.hpp
INPUT = src/json.hpp docs/doxyindex.cpp
INPUT_ENCODING = UTF-8
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXCLUDE_SYMBOLS = nlohmann::internals
EXAMPLE_PATH = docs/examples
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
IMAGE_PATH = docs/images
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
......@@ -119,15 +121,15 @@ USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# Configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = YES
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
REFERENCES_LINK_SOURCE = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = NO
REFERENCES_LINK_SOURCE = NO
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
VERBATIM_HEADERS = NO
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
......@@ -153,15 +155,15 @@ HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_BUNDLE_ID = me.nlohmann.json
DOCSET_PUBLISHER_ID = me.nlohmann
DOCSET_PUBLISHER_NAME = Publisher
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
CHM_INDEX_ENCODING =
BINARY_TOC = NO
BINARY_TOC = YES
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
......@@ -277,7 +279,7 @@ PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
CLASS_DIAGRAMS = NO
MSCGEN_PATH =
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
......@@ -286,18 +288,18 @@ DOT_NUM_THREADS = 0
DOT_FONTNAME = Helvetica
DOT_FONTSIZE = 10
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
CLASS_GRAPH = NO
COLLABORATION_GRAPH = NO
GROUP_GRAPHS = YES
UML_LOOK = YES
UML_LIMIT_NUM_FIELDS = 10
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
CALL_GRAPH = YES
CALLER_GRAPH = YES
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
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 =
......
......@@ -30,7 +30,11 @@ pretty:
--indent-col1-comments --pad-oper --pad-header --align-pointer=type \
--align-reference=type --add-brackets --convert-tabs --close-templates \
--lineend=linux --preserve-date --suffix=none \
src/json.hpp src/json.hpp.re2c test/unit.cpp benchmarks/benchmarks.cpp
src/json.hpp src/json.hpp.re2c test/unit.cpp benchmarks/benchmarks.cpp docs/examples/*.cpp
# update docs
update_docs:
make create -C docs/examples
# benchmarks
json_benchmarks: benchmarks/benchmarks.cpp benchmarks/benchpress.hpp benchmarks/cxxopts.hpp src/json.hpp
......
......@@ -272,7 +272,7 @@ std::vector<int> c_vector {1, 2, 3, 4};
json j_vec(c_vector);
// [1, 2, 3, 4]
std::deque<float> c_deque {1.2, 2.3, 3.4, 5.6};
std::deque<double> c_deque {1.2, 2.3, 3.4, 5.6};
json j_deque(c_deque);
// [1.2, 2.3, 3.4, 5.6]
......@@ -312,7 +312,7 @@ std::map<std::string, int> c_map { {"one", 1}, {"two", 2}, {"three", 3} };
json j_map(c_map);
// {"one": 1, "two": 2, "three": 3}
std::unordered_map<const char*, float> c_umap { {"one", 1.2}, {"two", 2.3}, {"three", 3.4} };
std::unordered_map<const char*, double> c_umap { {"one", 1.2}, {"two", 2.3}, {"three", 3.4} };
json j_umap(c_umap);
// {"one": 1.2, "two": 2.3, "three": 3.4}
......
/*!
@mainpage
@copyright Niels Lohmann\n
@include "../../LICENSE.MIT"
*/
/*!
@defgroup container Container
@brief methods and types to satisfy the Container requirements
A Container is an object used to store other objects and taking care of the
management of the memory used by the objects it contains.
@see http://en.cppreference.com/w/cpp/concept/Container
*/
/*!
@defgroup reversiblecontainer Reversible Container
*/
\ No newline at end of file
SRCDIR = ../../src
EXAMPLES = $(wildcard *.cpp)
all:
@echo "check"
@echo "create"
clean:
rm -f $(EXAMPLES:.cpp=) $(EXAMPLES:.cpp=.output) $(EXAMPLES:.cpp=.test)
%.output: %.cpp
make $(<:.cpp=) CPPFLAGS="-I $(SRCDIR)" CXXFLAGS="-std=c++11"
./$(<:.cpp=) > $@
rm $(<:.cpp=)
%.test: %.cpp
make $(<:.cpp=) CPPFLAGS="-I $(SRCDIR)" CXXFLAGS="-std=c++11"
./$(<:.cpp=) > $@
diff $@ $(<:.cpp=.output)
rm $(<:.cpp=) $@
create: $(EXAMPLES:.cpp=.output)
check: $(EXAMPLES:.cpp=.test)
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create a JSON value with default null value
json j;
// serialize the JSON null value
std::cout << j << '\n';
}
#include <json.hpp>
#include <deque>
#include <list>
#include <forward_list>
#include <set>
#include <unordered_set>
using namespace nlohmann;
int main()
{
// create an array from std::vector
std::vector<int> c_vector {1, 2, 3, 4};
json j_vec(c_vector);
// create an array from std::deque
std::deque<double> c_deque {1.2, 2.3, 3.4, 5.6};
json j_deque(c_deque);
// create an array from std::list
std::list<bool> c_list {true, true, false, true};
json j_list(c_list);
// create an array from std::forward_list
std::forward_list<int64_t> c_flist {12345678909876, 23456789098765, 34567890987654, 45678909876543};
json j_flist(c_flist);
// create an array from std::array
std::array<unsigned long, 4> c_array {{1, 2, 3, 4}};
json j_array(c_array);
// create an array from std::set
std::set<std::string> c_set {"one", "two", "three", "four", "one"};
json j_set(c_set); // only one entry for "one" is used
// create an array from std::unordered_set
std::unordered_set<std::string> c_uset {"one", "two", "three", "four", "one"};
json j_uset(c_uset); // only one entry for "one" is used
// create an array from std::multiset
std::multiset<std::string> c_mset {"one", "two", "one", "four"};
json j_mset(c_mset); // only one entry for "one" is used
// create an array from std::unordered_multiset
std::unordered_multiset<std::string> c_umset {"one", "two", "one", "four"};
json j_umset(c_umset); // both entries for "one" are used
// serialize the JSON arrays
std::cout << j_vec << '\n';
std::cout << j_deque << '\n';
std::cout << j_list << '\n';
std::cout << j_flist << '\n';
std::cout << j_array << '\n';
std::cout << j_set << '\n';
std::cout << j_uset << '\n';
std::cout << j_mset << '\n';
std::cout << j_umset << '\n';
}
[1,2,3,4]
[1.2,2.3,3.4,5.6]
[true,true,false,true]
[12345678909876,23456789098765,34567890987654,45678909876543]
[1,2,3,4]
["four","one","three","two"]
["four","three","two","one"]
["four","one","one","two"]
["four","two","one","one"]
#include <json.hpp>
#include <unordered_map>
using namespace nlohmann;
int main()
{
// create an object from std::map
std::map<std::string, int> c_map
{
{"one", 1}, {"two", 2}, {"three", 3}
};
json j_map(c_map);
// create an object from std::unordered_map
std::unordered_map<const char*, double> c_umap
{
{"one", 1.2}, {"two", 2.3}, {"three", 3.4}
};
json j_umap(c_umap);
// create an object from std::multimap
std::multimap<std::string, bool> c_mmap
{
{"one", true}, {"two", true}, {"three", false}, {"three", true}
};
json j_mmap(c_mmap); // only one entry for key "three" is used
// create an object from std::unordered_multimap
std::unordered_multimap<std::string, bool> c_ummap
{
{"one", true}, {"two", true}, {"three", false}, {"three", true}
};
json j_ummap(c_ummap); // only one entry for key "three" is used
// serialize the JSON objects
std::cout << j_map << '\n';
std::cout << j_umap << '\n';
std::cout << j_mmap << '\n';
std::cout << j_ummap << '\n';
}
{"one":1,"three":3,"two":2}
{"one":1.2,"three":3.4,"two":2.3}
{"one":true,"three":false,"two":true}
{"one":true,"three":false,"two":true}
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create an array_t value
json::array_t value = {"one", "two", 3, 4.5, false};
// create a JSON array from the value
json j(value);
// serialize the JSON array
std::cout << j << '\n';
}
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create a JSON array
json j1 = {"one", "two", 3, 4.5, false};
// create a copy
json j2(j1);
// serialize the JSON array
std::cout << j1 << " = " << j2 << '\n';
std::cout << std::boolalpha << (j1 == j2) << '\n';
}
["one","two",3,4.5,false] = ["one","two",3,4.5,false]
true
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create a JSON null value
json j(nullptr);
// serialize the JSON null value
std::cout << j << '\n';
}
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create an object_t value
json::object_t value = { {"one", 1}, {"two", 2} };
// create a JSON object from the value
json j(value);
// serialize the JSON object
std::cout << j << '\n';
}
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create the different JSON values with default values
json j_null(json::value_t::null);
json j_boolean(json::value_t::boolean);
json j_number_integer(json::value_t::number_integer);
json j_number_float(json::value_t::number_float);
json j_object(json::value_t::object);
json j_array(json::value_t::array);
json j_string(json::value_t::string);
// serialize the JSON values
std::cout << j_null << '\n';
std::cout << j_boolean << '\n';
std::cout << j_number_integer << '\n';
std::cout << j_number_float << '\n';
std::cout << j_object << '\n';
std::cout << j_array << '\n';
std::cout << j_string << '\n';
}
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create an array value
json array = {1, 2, 3, 4, 5};
// get am iterator to the first element
json::iterator it = array.begin();
// serialize the element that the iterator points to
std::cout << *it << '\n';
}
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create an array value
const json array = {1, 2, 3, 4, 5};
// get am iterator to the first element
json::const_iterator it = array.cbegin();
// serialize the element that the iterator points to
std::cout << *it << '\n';
}
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create an array value
json array = {1, 2, 3, 4, 5};
// get am iterator to one past the last element
json::const_iterator it = array.cend();
// decrement the iterator to point to the last element
--it;
// serialize the element that the iterator points to
std::cout << *it << '\n';
}
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create an array value
json array = {1, 2, 3, 4, 5};
// get an iterator to the reverse-beginning
json::const_reverse_iterator it = array.crbegin();
// serialize the element that the iterator points to
std::cout << *it << '\n';
}
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create an array value
json array = {1, 2, 3, 4, 5};
// get an iterator to the reverse-end
json::const_reverse_iterator it = array.crend();
// increment the iterator to point to the first element
--it;
// serialize the element that the iterator points to
std::cout << *it << '\n';
}
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_object_empty(json::value_t::object);
json j_array = {1, 2, 4, 8, 16};
json j_array_empty(json::value_t::array);
json j_string = "Hello, world";
// call empty()
std::cout << std::boolalpha;
std::cout << j_null.empty() << '\n';
std::cout << j_boolean.empty() << '\n';
std::cout << j_number_integer.empty() << '\n';
std::cout << j_number_float.empty() << '\n';
std::cout << j_object.empty() << '\n';
std::cout << j_object_empty.empty() << '\n';
std::cout << j_array.empty() << '\n';
std::cout << j_array_empty.empty() << '\n';
std::cout << j_string.empty() << '\n';
}
true
false
false
false
false
true
false
true
false
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create an array value
json array = {1, 2, 3, 4, 5};
// get am iterator to one past the last element
json::iterator it = array.end();
// decrement the iterator to point to the last element
--it;
// serialize the element that the iterator points to
std::cout << *it << '\n';
}
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
// call is_array()
std::cout << std::boolalpha;
std::cout << j_null.is_array() << '\n';
std::cout << j_boolean.is_array() << '\n';
std::cout << j_number_integer.is_array() << '\n';
std::cout << j_number_float.is_array() << '\n';
std::cout << j_object.is_array() << '\n';
std::cout << j_array.is_array() << '\n';
std::cout << j_string.is_array() << '\n';
}
false
false
false
false
false
true
false
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
// call is_boolean()
std::cout << std::boolalpha;
std::cout << j_null.is_boolean() << '\n';
std::cout << j_boolean.is_boolean() << '\n';
std::cout << j_number_integer.is_boolean() << '\n';
std::cout << j_number_float.is_boolean() << '\n';
std::cout << j_object.is_boolean() << '\n';
std::cout << j_array.is_boolean() << '\n';
std::cout << j_string.is_boolean() << '\n';
}
false
true
false
false
false
false
false
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
// call is_null()
std::cout << std::boolalpha;
std::cout << j_null.is_null() << '\n';
std::cout << j_boolean.is_null() << '\n';
std::cout << j_number_integer.is_null() << '\n';
std::cout << j_number_float.is_null() << '\n';
std::cout << j_object.is_null() << '\n';
std::cout << j_array.is_null() << '\n';
std::cout << j_string.is_null() << '\n';
}
true
false
false
false
false
false
false
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
// call is_number()
std::cout << std::boolalpha;
std::cout << j_null.is_number() << '\n';
std::cout << j_boolean.is_number() << '\n';
std::cout << j_number_integer.is_number() << '\n';
std::cout << j_number_float.is_number() << '\n';
std::cout << j_object.is_number() << '\n';
std::cout << j_array.is_number() << '\n';
std::cout << j_string.is_number() << '\n';
}
false
false
true
true
false
false
false
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
// call is_number_float()
std::cout << std::boolalpha;
std::cout << j_null.is_number_float() << '\n';
std::cout << j_boolean.is_number_float() << '\n';
std::cout << j_number_integer.is_number_float() << '\n';
std::cout << j_number_float.is_number_float() << '\n';
std::cout << j_object.is_number_float() << '\n';
std::cout << j_array.is_number_float() << '\n';
std::cout << j_string.is_number_float() << '\n';
}
false
false
false
true
false
false
false
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
// call is_number_integer()
std::cout << std::boolalpha;
std::cout << j_null.is_number_integer() << '\n';
std::cout << j_boolean.is_number_integer() << '\n';
std::cout << j_number_integer.is_number_integer() << '\n';
std::cout << j_number_float.is_number_integer() << '\n';
std::cout << j_object.is_number_integer() << '\n';
std::cout << j_array.is_number_integer() << '\n';
std::cout << j_string.is_number_integer() << '\n';
}
false
false
true
false
false
false
false
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
// call is_object()
std::cout << std::boolalpha;
std::cout << j_null.is_object() << '\n';
std::cout << j_boolean.is_object() << '\n';
std::cout << j_number_integer.is_object() << '\n';
std::cout << j_number_float.is_object() << '\n';
std::cout << j_object.is_object() << '\n';
std::cout << j_array.is_object() << '\n';
std::cout << j_string.is_object() << '\n';
}
false
false
false
false
true
false
false
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
json j_string = "Hello, world";
// call is_string()
std::cout << std::boolalpha;
std::cout << j_null.is_string() << '\n';
std::cout << j_boolean.is_string() << '\n';
std::cout << j_number_integer.is_string() << '\n';
std::cout << j_number_float.is_string() << '\n';
std::cout << j_object.is_string() << '\n';
std::cout << j_array.is_string() << '\n';
std::cout << j_string.is_string() << '\n';
}
false
false
false
false
false
false
true
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create an array value
json array = {1, 2, 3, 4, 5};
// get an iterator to the reverse-beginning
json::reverse_iterator it = array.rbegin();
// serialize the element that the iterator points to
std::cout << *it << '\n';
}
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create an array value
json array = {1, 2, 3, 4, 5};
// get an iterator to the reverse-end
json::reverse_iterator it = array.rend();
// increment the iterator to point to the first element
--it;
// serialize the element that the iterator points to
std::cout << *it << '\n';
}
#include <json.hpp>
using namespace nlohmann;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_object_empty(json::value_t::object);
json j_array = {1, 2, 4, 8, 16};
json j_array_empty(json::value_t::array);
json j_string = "Hello, world";
// call size()
std::cout << j_null.size() << '\n';
std::cout << j_boolean.size() << '\n';
std::cout << j_number_integer.size() << '\n';
std::cout << j_number_float.size() << '\n';
std::cout << j_object.size() << '\n';
std::cout << j_object_empty.size() << '\n';
std::cout << j_array.size() << '\n';
std::cout << j_array_empty.size() << '\n';
std::cout << j_string.size() << '\n';
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment