position_t.hpp 605 B

123456789101112131415161718192021222324252627
  1. #pragma once
  2. #include <cstddef> // size_t
  3. namespace nlohmann
  4. {
  5. namespace detail
  6. {
  7. /// struct to capture the start position of the current token
  8. struct position_t
  9. {
  10. /// the total number of characters read
  11. std::size_t chars_read_total = 0;
  12. /// the number of characters read in the current line
  13. std::size_t chars_read_current_line = 0;
  14. /// the number of lines read
  15. std::size_t lines_read = 0;
  16. /// conversion to size_t to preserve SAX interface
  17. constexpr operator size_t() const
  18. {
  19. return chars_read_total;
  20. }
  21. };
  22. } // namespace detail
  23. } // namespace nlohmann