Skip to content

Commit cf9dbe5

Browse files
jplaurilemire
authored andcommitted
improved const correctness (simdjson#321)
1 parent de8df0a commit cf9dbe5

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎include/simdjson/parsedjson.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ class ParsedJson {
5151
// return false if the tape is likely wrong (e.g., you did not parse a valid
5252
// JSON).
5353
WARN_UNUSED
54-
bool print_json(std::ostream &os);
54+
bool print_json(std::ostream &os) const;
5555
WARN_UNUSED
56-
bool dump_raw_tape(std::ostream &os);
56+
bool dump_raw_tape(std::ostream &os) const;
5757

5858
// all nodes are stored on the tape using a 64-bit word.
5959
//
@@ -91,7 +91,7 @@ class ParsedJson {
9191
// tape[current_loc++] = *((uint64_t *)&d);
9292
}
9393

94-
really_inline uint32_t get_current_loc() { return current_loc; }
94+
really_inline uint32_t get_current_loc() const { return current_loc; }
9595

9696
really_inline void annotate_previous_loc(uint32_t saved_loc, uint64_t val) {
9797
tape[saved_loc] |= val;

‎src/parsedjson.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ void ParsedJson::init() {
113113
}
114114

115115
WARN_UNUSED
116-
bool ParsedJson::print_json(std::ostream &os) {
116+
bool ParsedJson::print_json(std::ostream &os) const {
117117
if (!valid) {
118118
return false;
119119
}
@@ -241,7 +241,7 @@ bool ParsedJson::print_json(std::ostream &os) {
241241
}
242242

243243
WARN_UNUSED
244-
bool ParsedJson::dump_raw_tape(std::ostream &os) {
244+
bool ParsedJson::dump_raw_tape(std::ostream &os) const {
245245
if (!valid) {
246246
return false;
247247
}

0 commit comments

Comments
 (0)