position_t.hpp 958 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // __ _____ _____ _____
  2. // __| | __| | | | JSON for Modern C++
  3. // | | |__ | | | | | | version 3.11.3
  4. // |_____|_____|_____|_|___| https://github.com/nlohmann/json
  5. //
  6. // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me>
  7. // SPDX-License-Identifier: MIT
  8. #pragma once
  9. #include <cstddef> // size_t
  10. #include <nlohmann/detail/abi_macros.hpp>
  11. NLOHMANN_JSON_NAMESPACE_BEGIN
  12. namespace detail
  13. {
  14. /// struct to capture the start position of the current token
  15. struct position_t
  16. {
  17. /// the total number of characters read
  18. std::size_t chars_read_total = 0;
  19. /// the number of characters read in the current line
  20. std::size_t chars_read_current_line = 0;
  21. /// the number of lines read
  22. std::size_t lines_read = 0;
  23. /// conversion to size_t to preserve SAX interface
  24. constexpr operator size_t() const
  25. {
  26. return chars_read_total;
  27. }
  28. };
  29. } // namespace detail
  30. NLOHMANN_JSON_NAMESPACE_END