From cf9dbe583d3181dc01737f0d0bde6d8b86a334aa Mon Sep 17 00:00:00 2001 From: Juho Lauri <9369863+jplauri@users.noreply.github.com> Date: Wed, 2 Oct 2019 21:25:28 +0300 Subject: [PATCH] improved const correctness (#321) --- include/simdjson/parsedjson.h | 6 +++--- src/parsedjson.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/simdjson/parsedjson.h b/include/simdjson/parsedjson.h index 4293fbb5e..ef0122928 100644 --- a/include/simdjson/parsedjson.h +++ b/include/simdjson/parsedjson.h @@ -51,9 +51,9 @@ public: // return false if the tape is likely wrong (e.g., you did not parse a valid // JSON). WARN_UNUSED - bool print_json(std::ostream &os); + bool print_json(std::ostream &os) const; WARN_UNUSED - bool dump_raw_tape(std::ostream &os); + bool dump_raw_tape(std::ostream &os) const; // all nodes are stored on the tape using a 64-bit word. // @@ -91,7 +91,7 @@ public: // tape[current_loc++] = *((uint64_t *)&d); } - really_inline uint32_t get_current_loc() { return current_loc; } + really_inline uint32_t get_current_loc() const { return current_loc; } really_inline void annotate_previous_loc(uint32_t saved_loc, uint64_t val) { tape[saved_loc] |= val; diff --git a/src/parsedjson.cpp b/src/parsedjson.cpp index 4e4cfe320..a9d6bea07 100644 --- a/src/parsedjson.cpp +++ b/src/parsedjson.cpp @@ -113,7 +113,7 @@ void ParsedJson::init() { } WARN_UNUSED -bool ParsedJson::print_json(std::ostream &os) { +bool ParsedJson::print_json(std::ostream &os) const { if (!valid) { return false; } @@ -241,7 +241,7 @@ bool ParsedJson::print_json(std::ostream &os) { } WARN_UNUSED -bool ParsedJson::dump_raw_tape(std::ostream &os) { +bool ParsedJson::dump_raw_tape(std::ostream &os) const { if (!valid) { return false; }