keyword stringclasses 7
values | repo_name stringlengths 8 98 | file_path stringlengths 4 244 | file_extension stringclasses 29
values | file_size int64 0 84.1M | line_count int64 0 1.6M | content stringlengths 1 84.1M ⌀ | language stringclasses 14
values |
|---|---|---|---|---|---|---|---|
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/rbegin.cpp | .cpp | 343 | 17 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
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::... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/cbegin.cpp | .cpp | 343 | 17 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create an array value
const json array = {1, 2, 3, 4, 5};
// get an iterator to the first element
json::const_iterator it = array.cbegin();
// serialize the element that the iterator points to
std::... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator_spaceship__const_reference.c++20.cpp | .cpp | 1,165 | 42 | #include <compare>
#include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
const char* to_string(const std::partial_ordering& po)
{
if (std::is_lt(po))
{
return "less";
}
else if (std::is_gt(po))
{
return "greater";
}
else if (std::is_eq(po))
{
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/is_discarded.cpp | .cpp | 991 | 31 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_unsigned_integer = 12345678987654321u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/number_integer_t.cpp | .cpp | 221 | 11 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
std::cout << std::boolalpha << std::is_same<std::int64_t, json::number_integer_t>::value << std::endl;
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/swap__reference.cpp | .cpp | 372 | 19 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create two JSON values
json j1 = {1, 2, 3, 4, 5};
json j2 = {{"pi", 3.141592653589793}, {"e", 2.718281828459045}};
// swap the values
j1.swap(j2);
// output the values
std::cout << "j1 = " << j1... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/from_bson.cpp | .cpp | 635 | 22 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create byte vector
std::vector<std::uint8_t> v = {0x1b, 0x00, 0x00, 0x00, 0x08, 0x63, 0x6f, 0x6d,
0x70, 0x61, 0x63, 0x74, 0x00, 0x01, 0x10, 0x73,
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/back.cpp | .cpp | 1,049 | 39 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON values
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_arra... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/byte_container_with_subtype__byte_container_with_subtype.cpp | .cpp | 648 | 24 | #include <iostream>
#include <nlohmann/json.hpp>
// define a byte container based on std::vector
using byte_container_with_subtype = nlohmann::byte_container_with_subtype<std::vector<std::uint8_t>>;
using json = nlohmann::json;
int main()
{
// (1) create empty container
auto c1 = byte_container_with_subtype(... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/patch_inplace.cpp | .cpp | 772 | 36 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace nlohmann::literals;
int main()
{
// the original document
json doc = R"(
{
"baz": "qux",
"foo": "bar"
}
)"_json;
// the patch
json patch = R"(
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/contains__object_t_key_type.cpp | .cpp | 563 | 19 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace nlohmann::literals;
int main()
{
// create some JSON values
json j_object = R"( {"key": "value"} )"_json;
json j_array = R"( [1, 2, 3] )"_json;
// call contains
std::cout << std::boolalpha <<
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/unflatten.cpp | .cpp | 553 | 27 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON value
json j_flattened =
{
{"/answer/everything", 42},
{"/happy", true},
{"/list/0", 1},
{"/list/1", 0},
{"/list/2", 2},
{"/name", "N... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/update.cpp | .cpp | 691 | 25 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace nlohmann::literals;
int main()
{
// create two JSON objects
json o1 = R"( {"color": "red", "price": 17.99, "names": {"de": "Flugzeug"}} )"_json;
json o2 = R"( {"color": "blue", "speed": 100, "n... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/is_number_unsigned.cpp | .cpp | 1,051 | 31 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_unsigned_integer = 12345678987654321u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/json_base_class_t.cpp | .cpp | 2,235 | 89 | #include <iostream>
#include <nlohmann/json.hpp>
class visitor_adaptor_with_metadata
{
public:
template <class Fnc>
void visit(const Fnc& fnc) const;
int metadata = 42;
private:
template <class Ptr, class Fnc>
void do_visit(const Ptr& ptr, const Fnc& fnc) const;
};
using json = nlohmann::basi... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator__equal__nullptr_t.cpp | .cpp | 698 | 23 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create several JSON values
json array = {1, 2, 3};
json object = {{"A", "a"}, {"B", "b"}};
json number = 17;
json string = "foo";
json null;
// output values and comparisons
std::cout << std:... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/max_size.cpp | .cpp | 707 | 26 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
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 ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/sax_parse.cpp | .cpp | 3,319 | 132 | #include <iostream>
#include <iomanip>
#include <sstream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
// a simple event consumer that collects string representations of the passed
// values; note inheriting from json::json_sax_t is not required, but can
// help not to forget a required function
class sa... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/type_error.cpp | .cpp | 427 | 21 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
try
{
// calling push_back() on a string value
json j = "string";
j.push_back("another string");
}
catch (json::type_error& e)
{
// output exception information
std::c... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/accept__string.cpp | .cpp | 466 | 27 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// a valid JSON text
auto valid_text = R"(
{
"numbers": [1, 2, 3]
}
)";
// an invalid JSON text
auto invalid_text = R"(
{
"strings": ["extra", "comma", ]
}... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/push_back__object_t__value.cpp | .cpp | 584 | 26 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON values
json object = {{"one", 1}, {"two", 2}};
json null;
// print values
std::cout << object << '\n';
std::cout << null << '\n';
// add values
object.push_back(json::object_t::v... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/basic_json__list_init_t.cpp | .cpp | 593 | 22 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON values
json j_empty_init_list = json({});
json j_object = { {"one", 1}, {"two", 2} };
json j_array = {1, 2, 3, 4};
json j_nested_object = { {"one", {1}}, {"two", {1, 2}} };
json j_nested_a... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/swap__string_t.cpp | .cpp | 438 | 21 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON value
json value = { "the good", "the bad", "the ugly" };
// create string_t
json::string_t string = "the fast";
// swap the object stored in the JSON value
value[1].swap(string);
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/clear.cpp | .cpp | 832 | 35 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
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 ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator_ltlt__json_pointer.cpp | .cpp | 246 | 14 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON poiner
json::json_pointer ptr("/foo/bar/baz");
// write string representation to stream
std::cout << ptr << std::endl;
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/is_object.cpp | .cpp | 961 | 31 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
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_number_unsigned_integer = 12345678987654321u;
json j_object = {{"one", 1}, {"... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/erase__size_type.cpp | .cpp | 259 | 17 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON array
json j_array = {0, 1, 2, 3, 4, 5};
// call erase()
j_array.erase(2);
// print values
std::cout << j_array << '\n';
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/is_number.cpp | .cpp | 961 | 31 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_unsigned_integer = 12345678987654321u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/contains__json_pointer.cpp | .cpp | 1,117 | 44 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace nlohmann::literals;
int main()
{
// create a JSON value
json j =
{
{"number", 1}, {"string", "foo"}, {"array", {1, 2}}
};
std::cout << std::boolalpha
<< j.contains("/number"_json_po... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/swap__array_t.cpp | .cpp | 444 | 21 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON value
json value = {{"array", {1, 2, 3, 4}}};
// create an array_t
json::array_t array = {"Snap", "Crackle", "Pop"};
// swap the array stored in the JSON value
value["array"].swap(arra... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/crend.cpp | .cpp | 413 | 20 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
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
--i... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/value__keytype.c++17.cpp | .cpp | 889 | 33 | #include <iostream>
#include <string_view>
#include <nlohmann/json.hpp>
using namespace std::string_view_literals;
using json = nlohmann::json;
int main()
{
// create a JSON object with different entry types
json j =
{
{"integer", 1},
{"floating", 42.23},
{"string", "hello world"},... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/insert__ilist.cpp | .cpp | 367 | 18 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON array
json v = {1, 2, 3, 4};
// insert range from v2 before the end of array v
auto new_pos = v.insert(v.end(), {7, 8, 9});
// output new array and result of insert call
std::cout << *... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/json_pointer__push_back.cpp | .cpp | 419 | 22 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create empty JSON Pointer
json::json_pointer ptr;
std::cout << "\"" << ptr << "\"\n";
// call push_back()
ptr.push_back("foo");
std::cout << "\"" << ptr << "\"\n";
ptr.push_back("0");
std::c... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/at__size_type_const.cpp | .cpp | 755 | 38 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON array
const json array = {"first", "2nd", "third", "fourth"};
// output element at index 2 (third element)
std::cout << array.at(2) << '\n';
// exception type_error.304
try
{
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/find__keytype.c++17.cpp | .cpp | 617 | 23 | #include <iostream>
#include <string_view>
#include <nlohmann/json.hpp>
using namespace std::string_view_literals;
using json = nlohmann::json;
int main()
{
// create a JSON object
json j_object = {{"one", 1}, {"two", 2}};
// call find
auto it_two = j_object.find("two"sv);
auto it_three = j_objec... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/binary_t.cpp | .cpp | 265 | 11 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
std::cout << std::boolalpha << std::is_same<nlohmann::byte_container_with_subtype<std::vector<std::uint8_t>>, json::binary_t>::value << std::endl;
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/nlohmann_define_type_intrusive_with_default_explicit.cpp | .cpp | 1,755 | 56 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace nlohmann::literals;
namespace ns
{
class person
{
private:
std::string name = "John Doe";
std::string address = "123 Fake St";
int age = -1;
public:
person() = default;
person(std::string name_, std:... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/json_pointer__operator__equal.cpp | .cpp | 645 | 20 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// different JSON pointers
json::json_pointer ptr0;
json::json_pointer ptr1("");
json::json_pointer ptr2("/foo");
// compare JSON pointers
std::cout << std::boolalpha
<< "\"" << ptr0 << "\... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/is_binary.cpp | .cpp | 961 | 31 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_unsigned_integer = 12345678987654321u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator_array__keytype_const.c++17.cpp | .cpp | 353 | 19 | #include <iostream>
#include <string_view>
#include <nlohmann/json.hpp>
using namespace std::string_view_literals;
using json = nlohmann::json;
int main()
{
// create a JSON object
const json object =
{
{"one", 1}, {"two", 2}, {"three", 2.9}
};
// output element with key "two"
std::co... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/array_t.cpp | .cpp | 217 | 11 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
std::cout << std::boolalpha << std::is_same<std::vector<json>, json::array_t>::value << std::endl;
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/get_ptr.cpp | .cpp | 641 | 22 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON number
json value = 17;
// explicitly getting pointers
auto p1 = value.get_ptr<const json::number_integer_t*>();
auto p2 = value.get_ptr<json::number_integer_t*>();
auto p3 = value.get_... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/nlohmann_define_type_non_intrusive_macro.cpp | .cpp | 975 | 42 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace nlohmann::literals;
namespace ns
{
struct person
{
std::string name;
std::string address;
int age;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(person, name, address, age)
} // namespace ns
int main()
{
ns::person... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/find__object_t_key_type.cpp | .cpp | 547 | 21 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON object
json j_object = {{"one", 1}, {"two", 2}};
// call find
auto it_two = j_object.find("two");
auto it_three = j_object.find("three");
// print values
std::cout << std::boolalph... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/basic_json__value_t.cpp | .cpp | 764 | 26 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
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(jso... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator__greaterequal.cpp | .cpp | 825 | 25 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create several JSON values
json array_1 = {1, 2, 3};
json array_2 = {1, 2, 4};
json object_1 = {{"A", "a"}, {"B", "b"}};
json object_2 = {{"B", "b"}, {"A", "a"}};
json number_1 = 17;
json number_2... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/sax_parse__binary.cpp | .cpp | 2,933 | 115 | #include <iostream>
#include <iomanip>
#include <sstream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
// a simple event consumer that collects string representations of the passed
// values; note inheriting from json::json_sax_t is not required, but can
// help not to forget a required function
class sa... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator_literal_json.cpp | .cpp | 254 | 14 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace nlohmann::literals;
int main()
{
json j = R"( {"hello": "world", "answer": 42} )"_json;
std::cout << std::setw(2) << j << '\n';
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/from_ubjson.cpp | .cpp | 574 | 21 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create byte vector
std::vector<std::uint8_t> v = {0x7B, 0x69, 0x07, 0x63, 0x6F, 0x6D, 0x70, 0x61,
0x63, 0x74, 0x54, 0x69, 0x06, 0x73, 0x63, 0x68,
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/parse__allow_exceptions.cpp | .cpp | 662 | 37 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// an invalid JSON text
std::string text = R"(
{
"key": "value without closing quotes
}
)";
// parse with exceptions
try
{
json j = json::parse(text);
}
catch (json::pars... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/json_pointer__empty.cpp | .cpp | 579 | 21 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// different JSON Pointers
json::json_pointer ptr0;
json::json_pointer ptr1("");
json::json_pointer ptr2("/foo");
json::json_pointer ptr3("/foo/0");
// call empty()
std::cout << std::boolalpha
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/parse__pointers.cpp | .cpp | 360 | 16 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// a JSON text given as string that is not null-terminated
const char* ptr = "[1,2,3]another value";
// parse and serialize JSON
json j_complete = json::parse(ptr, ptr + 7);
std::cout << ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator_ltlt__basic_json.cpp | .cpp | 549 | 22 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON values
json j_object = {{"one", 1}, {"two", 2}};
json j_array = {1, 2, 4, 8, 16};
// serialize without indentation
std::cout << j_object << "\n\n";
std::cout << j_array... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/byte_container_with_subtype__has_subtype.cpp | .cpp | 602 | 20 | #include <iostream>
#include <nlohmann/json.hpp>
// define a byte container based on std::vector
using byte_container_with_subtype = nlohmann::byte_container_with_subtype<std::vector<std::uint8_t>>;
int main()
{
std::vector<std::uint8_t> bytes = {{0xca, 0xfe, 0xba, 0xbe}};
// create container
auto c1 = b... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/string_t.cpp | .cpp | 212 | 11 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
std::cout << std::boolalpha << std::is_same<std::string, json::string_t>::value << std::endl;
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/byte_container_with_subtype__subtype.cpp | .cpp | 712 | 23 | #include <iostream>
#include <nlohmann/json.hpp>
// define a byte container based on std::vector
using byte_container_with_subtype = nlohmann::byte_container_with_subtype<std::vector<std::uint8_t>>;
int main()
{
std::vector<std::uint8_t> bytes = {{0xca, 0xfe, 0xba, 0xbe}};
// create container
auto c1 = b... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/at__keytype.c++17.cpp | .cpp | 1,127 | 51 | #include <iostream>
#include <string_view>
#include <nlohmann/json.hpp>
using namespace std::string_view_literals;
using json = nlohmann::json;
int main()
{
// create JSON object
json object =
{
{"the good", "il buono"},
{"the bad", "il cattivo"},
{"the ugly", "il brutto"}
};
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/get_binary.cpp | .cpp | 408 | 17 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a binary vector
std::vector<std::uint8_t> vec = {0xCA, 0xFE, 0xBA, 0xBE};
// create a binary JSON value with subtype 42
json j = json::binary(vec, 42);
// output type and subtype
std::cout <<... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/is_number_integer.cpp | .cpp | 1,041 | 31 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_unsigned_integer = 12345678987654321u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/value__object_t_key_type.cpp | .cpp | 815 | 31 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON object with different entry types
json j =
{
{"integer", 1},
{"floating", 42.23},
{"string", "hello world"},
{"boolean", true},
{"object", {{"key1", 1}, {"key... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/type_name.cpp | .cpp | 1,021 | 28 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = -17;
json j_number_unsigned = 42u;
json j_number_float = 23.42;
json j_object = {{"one", 1}, {"two", 2}};
json j_... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/insert__range_object.cpp | .cpp | 457 | 22 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create two JSON objects
json j1 = {{"one", "eins"}, {"two", "zwei"}};
json j2 = {{"eleven", "elf"}, {"seventeen", "siebzehn"}};
// output objects
std::cout << j1 << '\n';
std::cout << j2 << '\n';
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/boolean_t.cpp | .cpp | 206 | 11 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
std::cout << std::boolalpha << std::is_same<bool, json::boolean_t>::value << std::endl;
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/nlohmann_json_namespace.cpp | .cpp | 353 | 15 | #include <iostream>
#include <nlohmann/json.hpp>
// possible use case: use NLOHMANN_JSON_NAMESPACE instead of nlohmann
using json = NLOHMANN_JSON_NAMESPACE::json;
// macro needed to output the NLOHMANN_JSON_NAMESPACE as string literal
#define Q(x) #x
#define QUOTE(x) Q(x)
int main()
{
std::cout << QUOTE(NLOHMANN... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/at__object_t_key_type_const.cpp | .cpp | 862 | 43 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON object
const json object =
{
{"the good", "il buono"},
{"the bad", "il cattivo"},
{"the ugly", "il brutto"}
};
// output element with key "the ugly"
std::cout << o... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/to_string.cpp | .cpp | 472 | 21 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using std::to_string;
int main()
{
// create values
json j = {{"one", 1}, {"two", 2}};
int i = 42;
// use ADL to select best to_string function
auto j_str = to_string(j); // calling nlohmann::to_string
auto i_str =... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/patch.cpp | .cpp | 738 | 34 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
using namespace nlohmann::literals;
int main()
{
// the original document
json doc = R"(
{
"baz": "qux",
"foo": "bar"
}
)"_json;
// the patch
json patch = R"(
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/insert__range.cpp | .cpp | 473 | 21 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON array
json v = {1, 2, 3, 4};
// create a JSON array to copy values from
json v2 = {"one", "two", "three", "four"};
// insert range from v2 before the end of array v
auto new_pos = v.in... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/nlohmann_json_version.cpp | .cpp | 306 | 13 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
std::cout << "JSON for Modern C++ version "
<< NLOHMANN_JSON_VERSION_MAJOR << "."
<< NLOHMANN_JSON_VERSION_MINOR << "."
<< NLOHMANN_JSON_VERSION_PATCH << std::endl;
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/push_back__initializer_list.cpp | .cpp | 611 | 28 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create JSON values
json object = {{"one", 1}, {"two", 2}};
json null;
// print values
std::cout << object << '\n';
std::cout << null << '\n';
// add values:
object.push_back({"three", 3}); ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/get_to.cpp | .cpp | 1,363 | 61 | #include <iostream>
#include <unordered_map>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON value with different types
json json_types =
{
{"boolean", true},
{
"number", {
{"integer", 42},
{"floating-point... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/count__object_t_key_type.cpp | .cpp | 465 | 19 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON object
json j_object = {{"one", 1}, {"two", 2}};
// call count()
auto count_two = j_object.count("two");
auto count_three = j_object.count("three");
// print values
std::cout << "n... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/operator__notequal.cpp | .cpp | 827 | 25 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create several JSON values
json array_1 = {1, 2, 3};
json array_2 = {1, 2, 4};
json object_1 = {{"A", "a"}, {"B", "b"}};
json object_2 = {{"B", "b"}, {"A", "a"}};
json number_1 = 17;
json number_2... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/end.cpp | .cpp | 406 | 20 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create an array value
json array = {1, 2, 3, 4, 5};
// get an iterator to one past the last element
json::iterator it = array.end();
// decrement the iterator to point to the last element
--it;
... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/front.cpp | .cpp | 951 | 30 | #include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
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)... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/count__keytype.c++17.cpp | .cpp | 535 | 21 | #include <iostream>
#include <string_view>
#include <nlohmann/json.hpp>
using namespace std::string_view_literals;
using json = nlohmann::json;
int main()
{
// create a JSON object
json j_object = {{"one", 1}, {"two", 2}};
// call count()
auto count_two = j_object.count("two"sv);
auto count_three... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/docs/examples/number_unsigned_t.cpp | .cpp | 223 | 11 | #include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
std::cout << std::boolalpha << std::is_same<std::uint64_t, json::number_unsigned_t>::value << std::endl;
}
| C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/fuzzing.md | .md | 3,187 | 82 | # Fuzz testing
Each parser of the library (JSON, BJData, BSON, CBOR, MessagePack, and UBJSON) can be fuzz tested. Currently,
[libFuzzer](https://llvm.org/docs/LibFuzzer.html) and [afl++](https://github.com/AFLplusplus/AFLplusplus) are supported.
## Corpus creation
For most effective fuzzing, a [corpus](https://llvm.... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/cmake_fetch_content2/project/main.cpp | .cpp | 416 | 17 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#includ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/reports/2016-09-09-nativejson_benchmark/conformance_Nlohmann (C++11).md | .md | 43,054 | 671 |
<!DOCTYPE html>
<html lang="en" class="">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# object: http://ogp.me/ns/object# article: http://ogp.me/ns/article# profile: http://ogp.me/ns/profile#">
<meta charset='utf-8'>
<link crossorigin="anonymous" href="https://assets-cdn.github.com/ass... | Markdown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/cmake_import/project/main.cpp | .cpp | 416 | 17 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#includ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-unicode1.cpp | .cpp | 26,991 | 621 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#includ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-udt.cpp | .cpp | 22,617 | 865 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#includ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-algorithms.cpp | .cpp | 12,285 | 370 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#includ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-wstring.cpp | .cpp | 2,469 | 100 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#includ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-iterators1.cpp | .cpp | 50,621 | 1,631 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#includ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-regression2.cpp | .cpp | 29,577 | 942 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
// cmak... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-class_iterator.cpp | .cpp | 17,188 | 469 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#includ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-noexcept.cpp | .cpp | 3,554 | 75 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#includ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/test_utils.hpp | .hpp | 1,011 | 34 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#pragma... | Unknown |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-conversions.cpp | .cpp | 54,637 | 1,573 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// Copyright (c) 2013-2022 Niels Lohmann <http://nlohmann.me>.
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-cbor.cpp | .cpp | 130,050 | 2,706 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#includ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-element_access2.cpp | .cpp | 96,001 | 1,795 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// Copyright (c) 2013-2022 Niels Lohmann <http://nlohmann.me>.
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-element_access1.cpp | .cpp | 40,061 | 882 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// Copyright (c) 2013-2022 Niels Lohmann <http://nlohmann.me>.
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-json_pointer.cpp | .cpp | 30,734 | 789 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#includ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-class_const_iterator.cpp | .cpp | 14,545 | 394 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#includ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-unicode5.cpp | .cpp | 10,970 | 325 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#includ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/unit-binary_formats.cpp | .cpp | 10,751 | 212 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
#includ... | C++ |
3D | OpenMS/OpenMS | src/openms/extern/nlohmann_json/tests/src/fuzzer-parse_ubjson.cpp | .cpp | 2,778 | 86 | // __ _____ _____ _____
// __| | __| | | | JSON for Modern C++ (supporting code)
// | | |__ | | | | | | version 3.11.2
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
/*
This... | C++ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.