Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

template version with re2c scanner #36

Merged
merged 105 commits into from
Feb 18, 2015
Merged

template version with re2c scanner #36

merged 105 commits into from
Feb 18, 2015

Conversation

nlohmann
Copy link
Owner

  • Changed: In the generic class basic_json, all JSON value types (array, object, string, bool, integer number, and floating-point) are now templated. That is, you can choose whether you like a std::list for your arrays or an std::unordered_map for your objects. The specialization json sets some reasonable defaults.
  • Changed: The library now consists of a single header, called json.hpp. Consequently, build systems such as Automake or CMake are not any longer required.
  • Changed: The deserialization is now supported by a lexer generated with re2c from file src/json.hpp.re2c. As a result, we follow the JSON specification more strictly. Note neither the tool re2c nor its input are required to use the class.
  • Added: The library now satisfies the ReversibleContainer requirement. It hence provides four different iterators (iterator, const_iterator, reverse_iterator, and const_reverse_iterator), comparison functions, swap(), size(), max_size(), and empty() member functions.
  • Added: The class uses user-defined allocators which default to std::allocator, but can be templated via parameter Allocator.
  • Added: To simplify pretty-printing, the std::setw stream manipulator has been overloaded to set the desired indentation. Pretty-printing a JSON object j is as simple as `std::cout << std::setw(4) << j << '\n'.
  • Changed: The type json::value_t::number is now called json::value_t::number_integer to be more symmetric compared to json::value_t::number_float.
  • Removed: The key() and value() member functions for object iterators were nonstandard and yielded more problems than benefits. They were removed from the library.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling c8c49da on template into c4d7485 on master.

@nlohmann nlohmann closed this Feb 18, 2015
@nlohmann nlohmann reopened this Feb 18, 2015
nlohmann added a commit that referenced this pull request Feb 18, 2015
template version with re2c scanner
@nlohmann nlohmann merged commit 118ec99 into master Feb 18, 2015
@nlohmann nlohmann deleted the template branch February 18, 2015 23:04
GerHobbelt pushed a commit to GerHobbelt/nlohmann-json that referenced this pull request May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants