diff --git a/Object_8cpp_source.html b/Object_8cpp_source.html index b51a6bc7e6..1776e71a25 100644 --- a/Object_8cpp_source.html +++ b/Object_8cpp_source.html @@ -326,14 +326,14 @@ $(function() {
Json::arrayValue
@ arrayValue
array value (ordered list)
Definition: json_value.h:42
Json::booleanValue
@ booleanValue
bool value
Definition: json_value.h:41
Json::Array::appendArray
Array appendArray()
Append a new Array and return it.
Definition: Object.cpp:110
-
Json::Writer::finish
void finish()
Finish the collection most recently started.
Definition: Writer.cpp:351
+
Json::Writer::finish
void finish()
Finish the collection most recently started.
Definition: Writer.cpp:349
Json::Object::Root::Root
Root(Writer &)
Each Object::Root must be constructed with its own unique Writer.
Definition: Object.cpp:75
Json::Object::Object
Object(Collection *parent, Writer *w)
Definition: Object.h:230
Json::Collection::~Collection
~Collection()
Definition: Object.cpp:37
Json::realValue
@ realValue
double value
Definition: json_value.h:39
Json::check
void check(bool condition, std::string const &message)
Definition: json/Writer.h:252
-
Json::Writer::startAppend
void startAppend(CollectionType)
Start a new collection inside an array.
Definition: Writer.cpp:336
-
Json::Writer::startRoot
void startRoot(CollectionType)
Start a new collection at the root level.
Definition: Writer.cpp:330
+
Json::Writer::startAppend
void startAppend(CollectionType)
Start a new collection inside an array.
Definition: Writer.cpp:334
+
Json::Writer::startRoot
void startRoot(CollectionType)
Start a new collection at the root level.
Definition: Writer.cpp:328
Json::copyFrom
void copyFrom(Json::Value &to, Json::Value const &from)
Copy all the keys and values from one object into another.
Definition: Object.cpp:226
Json::stringWriterObject
WriterObject stringWriterObject(std::string &s)
Definition: Object.cpp:241
Json::Collection::enabled_
bool enabled_
Definition: Object.h:170
@@ -352,7 +352,7 @@ $(function() {
Json::stringValue
@ stringValue
UTF-8 string value.
Definition: json_value.h:40
Json::Collection::operator=
Collection & operator=(Collection &&c) noexcept
Definition: Object.cpp:46
Json::Array::appendObject
Object appendObject()
Append a new Object and return it.
Definition: Object.cpp:101
-
Json::Writer::startSet
void startSet(CollectionType, std::string const &key)
Start a new collection inside an object.
Definition: Writer.cpp:343
+
Json::Writer::startSet
void startSet(CollectionType, std::string const &key)
Start a new collection inside an object.
Definition: Writer.cpp:341
Json::Array::append
void append(Scalar const &)
Append a scalar to the Arrary.
Definition: Object.h:397
Json::Object
Represents a JSON object being written to a Writer.
Definition: Object.h:178
Json::Value::getMemberNames
Members getMemberNames() const
Return a list of the member names.
Definition: json_value.cpp:948
diff --git a/Writer_8cpp_source.html b/Writer_8cpp_source.html index f218034361..61d774861f 100644 --- a/Writer_8cpp_source.html +++ b/Writer_8cpp_source.html @@ -118,369 +118,366 @@ $(function() {
47 const char openBracket = '[';
48 const char quote = '"';
49 
-
50 const std::string none;
+
50 static auto const integralFloatsBecomeInts = false;
51 
-
52 static auto const integralFloatsBecomeInts = false;
-
53 
-
54 size_t
-
55 lengthWithoutTrailingZeros(std::string const& s)
-
56 {
-
57  auto dotPos = s.find('.');
-
58  if (dotPos == std::string::npos)
-
59  return s.size();
-
60 
-
61  auto lastNonZero = s.find_last_not_of('0');
-
62  auto hasDecimals = dotPos != lastNonZero;
-
63 
-
64  if (hasDecimals)
-
65  return lastNonZero + 1;
-
66 
-
67  if (integralFloatsBecomeInts || lastNonZero + 2 > s.size())
-
68  return lastNonZero;
-
69 
-
70  return lastNonZero + 2;
-
71 }
+
52 size_t
+
53 lengthWithoutTrailingZeros(std::string const& s)
+
54 {
+
55  auto dotPos = s.find('.');
+
56  if (dotPos == std::string::npos)
+
57  return s.size();
+
58 
+
59  auto lastNonZero = s.find_last_not_of('0');
+
60  auto hasDecimals = dotPos != lastNonZero;
+
61 
+
62  if (hasDecimals)
+
63  return lastNonZero + 1;
+
64 
+
65  if (integralFloatsBecomeInts || lastNonZero + 2 > s.size())
+
66  return lastNonZero;
+
67 
+
68  return lastNonZero + 2;
+
69 }
+
70 
+
71 } // namespace
72 
-
73 } // namespace
-
74 
-
75 class Writer::Impl
-
76 {
-
77 public:
-
78  explicit Impl(Output const& output) : output_(output)
-
79  {
-
80  }
-
81  ~Impl() = default;
-
82 
-
83  Impl(Impl&&) = delete;
-
84  Impl&
-
85  operator=(Impl&&) = delete;
-
86 
-
87  bool
-
88  empty() const
-
89  {
-
90  return stack_.empty();
-
91  }
-
92 
-
93  void
-
94  start(CollectionType ct)
-
95  {
-
96  char ch = (ct == array) ? openBracket : openBrace;
-
97  output({&ch, 1});
-
98  stack_.push(Collection());
-
99  stack_.top().type = ct;
-
100  }
-
101 
-
102  void
-
103  output(boost::beast::string_view const& bytes)
-
104  {
-
105  markStarted();
-
106  output_(bytes);
-
107  }
-
108 
-
109  void
-
110  stringOutput(boost::beast::string_view const& bytes)
-
111  {
-
112  markStarted();
-
113  std::size_t position = 0, writtenUntil = 0;
-
114 
-
115  output_({&quote, 1});
-
116  auto data = bytes.data();
-
117  for (; position < bytes.size(); ++position)
-
118  {
-
119  auto i = jsonSpecialCharacterEscape.find(data[position]);
-
120  if (i != jsonSpecialCharacterEscape.end())
-
121  {
-
122  if (writtenUntil < position)
-
123  {
-
124  output_({data + writtenUntil, position - writtenUntil});
-
125  }
-
126  output_({i->second, jsonEscapeLength});
-
127  writtenUntil = position + 1;
-
128  };
-
129  }
-
130  if (writtenUntil < position)
-
131  output_({data + writtenUntil, position - writtenUntil});
-
132  output_({&quote, 1});
-
133  }
-
134 
-
135  void
-
136  markStarted()
-
137  {
-
138  check(!isFinished(), "isFinished() in output.");
-
139  isStarted_ = true;
-
140  }
-
141 
-
142  void
-
143  nextCollectionEntry(CollectionType type, std::string const& message)
-
144  {
-
145  check(!empty(), "empty () in " + message);
-
146 
-
147  auto t = stack_.top().type;
-
148  if (t != type)
-
149  {
-
150  check(
-
151  false,
-
152  "Not an " +
-
153  ((type == array ? "array: " : "object: ") + message));
-
154  }
-
155  if (stack_.top().isFirst)
-
156  stack_.top().isFirst = false;
-
157  else
-
158  output_({&comma, 1});
-
159  }
-
160 
-
161  void
-
162  writeObjectTag(std::string const& tag)
-
163  {
-
164 #ifndef NDEBUG
-
165  // Make sure we haven't already seen this tag.
-
166  auto& tags = stack_.top().tags;
-
167  check(tags.find(tag) == tags.end(), "Already seen tag " + tag);
-
168  tags.insert(tag);
-
169 #endif
-
170 
-
171  stringOutput(tag);
-
172  output_({&colon, 1});
-
173  }
-
174 
-
175  bool
-
176  isFinished() const
-
177  {
-
178  return isStarted_ && empty();
-
179  }
-
180 
-
181  void
-
182  finish()
-
183  {
-
184  check(!empty(), "Empty stack in finish()");
-
185 
-
186  auto isArray = stack_.top().type == array;
-
187  auto ch = isArray ? closeBracket : closeBrace;
-
188  output_({&ch, 1});
-
189  stack_.pop();
-
190  }
-
191 
-
192  void
-
193  finishAll()
-
194  {
-
195  if (isStarted_)
-
196  {
-
197  while (!isFinished())
-
198  finish();
-
199  }
-
200  }
-
201 
-
202  Output const&
-
203  getOutput() const
-
204  {
-
205  return output_;
-
206  }
-
207 
-
208 private:
-
209  // JSON collections are either arrrays, or objects.
-
210  struct Collection
-
211  {
-
212  explicit Collection() = default;
-
213 
-
215  Writer::CollectionType type;
-
216 
-
219  bool isFirst = true;
+
73 class Writer::Impl
+
74 {
+
75 public:
+
76  explicit Impl(Output const& output) : output_(output)
+
77  {
+
78  }
+
79  ~Impl() = default;
+
80 
+
81  Impl(Impl&&) = delete;
+
82  Impl&
+
83  operator=(Impl&&) = delete;
+
84 
+
85  bool
+
86  empty() const
+
87  {
+
88  return stack_.empty();
+
89  }
+
90 
+
91  void
+
92  start(CollectionType ct)
+
93  {
+
94  char ch = (ct == array) ? openBracket : openBrace;
+
95  output({&ch, 1});
+
96  stack_.push(Collection());
+
97  stack_.top().type = ct;
+
98  }
+
99 
+
100  void
+
101  output(boost::beast::string_view const& bytes)
+
102  {
+
103  markStarted();
+
104  output_(bytes);
+
105  }
+
106 
+
107  void
+
108  stringOutput(boost::beast::string_view const& bytes)
+
109  {
+
110  markStarted();
+
111  std::size_t position = 0, writtenUntil = 0;
+
112 
+
113  output_({&quote, 1});
+
114  auto data = bytes.data();
+
115  for (; position < bytes.size(); ++position)
+
116  {
+
117  auto i = jsonSpecialCharacterEscape.find(data[position]);
+
118  if (i != jsonSpecialCharacterEscape.end())
+
119  {
+
120  if (writtenUntil < position)
+
121  {
+
122  output_({data + writtenUntil, position - writtenUntil});
+
123  }
+
124  output_({i->second, jsonEscapeLength});
+
125  writtenUntil = position + 1;
+
126  };
+
127  }
+
128  if (writtenUntil < position)
+
129  output_({data + writtenUntil, position - writtenUntil});
+
130  output_({&quote, 1});
+
131  }
+
132 
+
133  void
+
134  markStarted()
+
135  {
+
136  check(!isFinished(), "isFinished() in output.");
+
137  isStarted_ = true;
+
138  }
+
139 
+
140  void
+
141  nextCollectionEntry(CollectionType type, std::string const& message)
+
142  {
+
143  check(!empty(), "empty () in " + message);
+
144 
+
145  auto t = stack_.top().type;
+
146  if (t != type)
+
147  {
+
148  check(
+
149  false,
+
150  "Not an " +
+
151  ((type == array ? "array: " : "object: ") + message));
+
152  }
+
153  if (stack_.top().isFirst)
+
154  stack_.top().isFirst = false;
+
155  else
+
156  output_({&comma, 1});
+
157  }
+
158 
+
159  void
+
160  writeObjectTag(std::string const& tag)
+
161  {
+
162 #ifndef NDEBUG
+
163  // Make sure we haven't already seen this tag.
+
164  auto& tags = stack_.top().tags;
+
165  check(tags.find(tag) == tags.end(), "Already seen tag " + tag);
+
166  tags.insert(tag);
+
167 #endif
+
168 
+
169  stringOutput(tag);
+
170  output_({&colon, 1});
+
171  }
+
172 
+
173  bool
+
174  isFinished() const
+
175  {
+
176  return isStarted_ && empty();
+
177  }
+
178 
+
179  void
+
180  finish()
+
181  {
+
182  check(!empty(), "Empty stack in finish()");
+
183 
+
184  auto isArray = stack_.top().type == array;
+
185  auto ch = isArray ? closeBracket : closeBrace;
+
186  output_({&ch, 1});
+
187  stack_.pop();
+
188  }
+
189 
+
190  void
+
191  finishAll()
+
192  {
+
193  if (isStarted_)
+
194  {
+
195  while (!isFinished())
+
196  finish();
+
197  }
+
198  }
+
199 
+
200  Output const&
+
201  getOutput() const
+
202  {
+
203  return output_;
+
204  }
+
205 
+
206 private:
+
207  // JSON collections are either arrrays, or objects.
+
208  struct Collection
+
209  {
+
210  explicit Collection() = default;
+
211 
+
213  Writer::CollectionType type;
+
214 
+
217  bool isFirst = true;
+
218 
+
219 #ifndef NDEBUG
220 
-
221 #ifndef NDEBUG
-
222 
-
223  std::set<std::string> tags;
-
224 #endif
-
225  };
+
221  std::set<std::string> tags;
+
222 #endif
+
223  };
+
224 
+
225  using Stack = std::stack<Collection, std::vector<Collection>>;
226 
-
227  using Stack = std::stack<Collection, std::vector<Collection>>;
-
228 
-
229  Output output_;
-
230  Stack stack_;
-
231 
-
232  bool isStarted_ = false;
-
233 };
-
234 
-
235 Writer::Writer(Output const& output) : impl_(std::make_unique<Impl>(output))
-
236 {
-
237 }
-
238 
-
239 Writer::~Writer()
-
240 {
-
241  if (impl_)
-
242  impl_->finishAll();
-
243 }
-
244 
-
245 Writer::Writer(Writer&& w) noexcept
-
246 {
-
247  impl_ = std::move(w.impl_);
-
248 }
-
249 
-
250 Writer&
-
251 Writer::operator=(Writer&& w) noexcept
-
252 {
-
253  impl_ = std::move(w.impl_);
-
254  return *this;
-
255 }
-
256 
-
257 void
-
258 Writer::output(char const* s)
-
259 {
-
260  impl_->stringOutput(s);
-
261 }
-
262 
-
263 void
-
264 Writer::output(std::string const& s)
-
265 {
-
266  impl_->stringOutput(s);
-
267 }
-
268 
-
269 void
-
270 Writer::output(Json::Value const& value)
-
271 {
-
272  impl_->markStarted();
-
273  outputJson(value, impl_->getOutput());
-
274 }
-
275 
-
276 void
-
277 Writer::output(float f)
-
278 {
-
279  auto s = ripple::to_string(f);
-
280  impl_->output({s.data(), lengthWithoutTrailingZeros(s)});
-
281 }
-
282 
-
283 void
-
284 Writer::output(double f)
-
285 {
-
286  auto s = ripple::to_string(f);
-
287  impl_->output({s.data(), lengthWithoutTrailingZeros(s)});
-
288 }
-
289 
-
290 void Writer::output(std::nullptr_t)
-
291 {
-
292  impl_->output("null");
-
293 }
-
294 
-
295 void
-
296 Writer::output(bool b)
-
297 {
-
298  impl_->output(b ? "true" : "false");
-
299 }
-
300 
-
301 void
-
302 Writer::implOutput(std::string const& s)
-
303 {
-
304  impl_->output(s);
-
305 }
-
306 
-
307 void
-
308 Writer::finishAll()
-
309 {
-
310  if (impl_)
-
311  impl_->finishAll();
-
312 }
-
313 
-
314 void
-
315 Writer::rawAppend()
-
316 {
-
317  impl_->nextCollectionEntry(array, "append");
-
318 }
-
319 
-
320 void
-
321 Writer::rawSet(std::string const& tag)
-
322 {
-
323  check(!tag.empty(), "Tag can't be empty");
-
324 
-
325  impl_->nextCollectionEntry(object, "set");
-
326  impl_->writeObjectTag(tag);
-
327 }
-
328 
-
329 void
-
330 Writer::startRoot(CollectionType type)
-
331 {
-
332  impl_->start(type);
-
333 }
-
334 
-
335 void
-
336 Writer::startAppend(CollectionType type)
-
337 {
-
338  impl_->nextCollectionEntry(array, "startAppend");
-
339  impl_->start(type);
-
340 }
-
341 
-
342 void
-
343 Writer::startSet(CollectionType type, std::string const& key)
-
344 {
-
345  impl_->nextCollectionEntry(object, "startSet");
-
346  impl_->writeObjectTag(key);
-
347  impl_->start(type);
-
348 }
-
349 
-
350 void
-
351 Writer::finish()
-
352 {
-
353  if (impl_)
-
354  impl_->finish();
-
355 }
-
356 
-
357 } // namespace Json
+
227  Output output_;
+
228  Stack stack_;
+
229 
+
230  bool isStarted_ = false;
+
231 };
+
232 
+
233 Writer::Writer(Output const& output) : impl_(std::make_unique<Impl>(output))
+
234 {
+
235 }
+
236 
+
237 Writer::~Writer()
+
238 {
+
239  if (impl_)
+
240  impl_->finishAll();
+
241 }
+
242 
+
243 Writer::Writer(Writer&& w) noexcept
+
244 {
+
245  impl_ = std::move(w.impl_);
+
246 }
+
247 
+
248 Writer&
+
249 Writer::operator=(Writer&& w) noexcept
+
250 {
+
251  impl_ = std::move(w.impl_);
+
252  return *this;
+
253 }
+
254 
+
255 void
+
256 Writer::output(char const* s)
+
257 {
+
258  impl_->stringOutput(s);
+
259 }
+
260 
+
261 void
+
262 Writer::output(std::string const& s)
+
263 {
+
264  impl_->stringOutput(s);
+
265 }
+
266 
+
267 void
+
268 Writer::output(Json::Value const& value)
+
269 {
+
270  impl_->markStarted();
+
271  outputJson(value, impl_->getOutput());
+
272 }
+
273 
+
274 void
+
275 Writer::output(float f)
+
276 {
+
277  auto s = ripple::to_string(f);
+
278  impl_->output({s.data(), lengthWithoutTrailingZeros(s)});
+
279 }
+
280 
+
281 void
+
282 Writer::output(double f)
+
283 {
+
284  auto s = ripple::to_string(f);
+
285  impl_->output({s.data(), lengthWithoutTrailingZeros(s)});
+
286 }
+
287 
+
288 void Writer::output(std::nullptr_t)
+
289 {
+
290  impl_->output("null");
+
291 }
+
292 
+
293 void
+
294 Writer::output(bool b)
+
295 {
+
296  impl_->output(b ? "true" : "false");
+
297 }
+
298 
+
299 void
+
300 Writer::implOutput(std::string const& s)
+
301 {
+
302  impl_->output(s);
+
303 }
+
304 
+
305 void
+
306 Writer::finishAll()
+
307 {
+
308  if (impl_)
+
309  impl_->finishAll();
+
310 }
+
311 
+
312 void
+
313 Writer::rawAppend()
+
314 {
+
315  impl_->nextCollectionEntry(array, "append");
+
316 }
+
317 
+
318 void
+
319 Writer::rawSet(std::string const& tag)
+
320 {
+
321  check(!tag.empty(), "Tag can't be empty");
+
322 
+
323  impl_->nextCollectionEntry(object, "set");
+
324  impl_->writeObjectTag(tag);
+
325 }
+
326 
+
327 void
+
328 Writer::startRoot(CollectionType type)
+
329 {
+
330  impl_->start(type);
+
331 }
+
332 
+
333 void
+
334 Writer::startAppend(CollectionType type)
+
335 {
+
336  impl_->nextCollectionEntry(array, "startAppend");
+
337  impl_->start(type);
+
338 }
+
339 
+
340 void
+
341 Writer::startSet(CollectionType type, std::string const& key)
+
342 {
+
343  impl_->nextCollectionEntry(object, "startSet");
+
344  impl_->writeObjectTag(key);
+
345  impl_->start(type);
+
346 }
+
347 
+
348 void
+
349 Writer::finish()
+
350 {
+
351  if (impl_)
+
352  impl_->finish();
+
353 }
+
354 
+
355 } // namespace Json
-
Json::Writer::Impl::nextCollectionEntry
void nextCollectionEntry(CollectionType type, std::string const &message)
Definition: Writer.cpp:143
-
Json::Writer::rawAppend
void rawAppend()
Add a comma before this next item if not the first item in an array.
Definition: Writer.cpp:315
-
Json::Writer::implOutput
void implOutput(std::string const &)
Definition: Writer.cpp:302
-
Json::Writer::Impl::isStarted_
bool isStarted_
Definition: Writer.cpp:232
+
Json::Writer::Impl::nextCollectionEntry
void nextCollectionEntry(CollectionType type, std::string const &message)
Definition: Writer.cpp:141
+
Json::Writer::rawAppend
void rawAppend()
Add a comma before this next item if not the first item in an array.
Definition: Writer.cpp:313
+
Json::Writer::implOutput
void implOutput(std::string const &)
Definition: Writer.cpp:300
+
Json::Writer::Impl::isStarted_
bool isStarted_
Definition: Writer.cpp:230
std::string
STL class.
-
Json::Writer::Impl::getOutput
Output const & getOutput() const
Definition: Writer.cpp:203
-
Json::Writer::Impl::Collection::tags
std::set< std::string > tags
What tags have we already seen in this collection?
Definition: Writer.cpp:223
-
Json::Writer::Impl::finishAll
void finishAll()
Definition: Writer.cpp:193
-
Json::Writer::Impl::Collection::isFirst
bool isFirst
Is this the first entry in a collection? If false, we have to emit a , before we write the next entry...
Definition: Writer.cpp:219
+
Json::Writer::Impl::getOutput
Output const & getOutput() const
Definition: Writer.cpp:201
+
Json::Writer::Impl::Collection::tags
std::set< std::string > tags
What tags have we already seen in this collection?
Definition: Writer.cpp:221
+
Json::Writer::Impl::finishAll
void finishAll()
Definition: Writer.cpp:191
+
Json::Writer::Impl::Collection::isFirst
bool isFirst
Is this the first entry in a collection? If false, we have to emit a , before we write the next entry...
Definition: Writer.cpp:217
std::string::find_last_not_of
T find_last_not_of(T... args)
-
Json::Writer::Impl::Impl
Impl(Output const &output)
Definition: Writer.cpp:78
-
Json::Writer::finish
void finish()
Finish the collection most recently started.
Definition: Writer.cpp:351
+
Json::Writer::Impl::Impl
Impl(Output const &output)
Definition: Writer.cpp:76
+
Json::Writer::finish
void finish()
Finish the collection most recently started.
Definition: Writer.cpp:349
Json::Writer::Impl::operator=
Impl & operator=(Impl &&)=delete
std::string::find
T find(T... args)
std::string::size
T size(T... args)
stack
-
Json::Writer::Impl::writeObjectTag
void writeObjectTag(std::string const &tag)
Definition: Writer.cpp:162
+
Json::Writer::Impl::writeObjectTag
void writeObjectTag(std::string const &tag)
Definition: Writer.cpp:160
Json::check
void check(bool condition, std::string const &message)
Definition: json/Writer.h:252
-
Json::Writer::startAppend
void startAppend(CollectionType)
Start a new collection inside an array.
Definition: Writer.cpp:336
+
Json::Writer::startAppend
void startAppend(CollectionType)
Start a new collection inside an array.
Definition: Writer.cpp:334
std::function
-
Json::Writer::startRoot
void startRoot(CollectionType)
Start a new collection at the root level.
Definition: Writer.cpp:330
-
Json::Writer::Impl::isFinished
bool isFinished() const
Definition: Writer.cpp:176
+
Json::Writer::startRoot
void startRoot(CollectionType)
Start a new collection at the root level.
Definition: Writer.cpp:328
+
Json::Writer::Impl::isFinished
bool isFinished() const
Definition: Writer.cpp:174
std::nullptr_t
-
Json::Writer::Impl::Collection::type
Writer::CollectionType type
What type of collection are we in?
Definition: Writer.cpp:215
-
Json::Writer::finishAll
void finishAll()
Finish all objects and arrays.
Definition: Writer.cpp:308
+
Json::Writer::Impl::Collection::type
Writer::CollectionType type
What type of collection are we in?
Definition: Writer.cpp:213
+
Json::Writer::finishAll
void finishAll()
Finish all objects and arrays.
Definition: Writer.cpp:306
Json::outputJson
void outputJson(Json::Value const &value, Output const &out)
Writes a minimal representation of a Json value to an Output in O(n) time.
Definition: Output.cpp:90
Json
JSON (JavaScript Object Notation).
Definition: json_reader.cpp:29
-
Json::Writer::~Writer
~Writer()
Definition: Writer.cpp:239
-
Json::Writer::Impl::output_
Output output_
Definition: Writer.cpp:229
-
ripple::JsonOptions::none
@ none
+
Json::Writer::~Writer
~Writer()
Definition: Writer.cpp:237
+
Json::Writer::Impl::output_
Output output_
Definition: Writer.cpp:227
std::stack::pop
T pop(T... args)
std::stack::top
T top(T... args)
Json::Writer::impl_
std::unique_ptr< Impl > impl_
Definition: json/Writer.h:244
Json::Writer::array
@ array
Definition: json/Writer.h:129
std::map
STL class.
-
Json::Writer::Impl::start
void start(CollectionType ct)
Definition: Writer.cpp:94
+
Json::Writer::Impl::start
void start(CollectionType ct)
Definition: Writer.cpp:92
Json::Writer::Impl::Collection::Collection
Collection()=default
-
Json::Writer::Impl::markStarted
void markStarted()
Definition: Writer.cpp:136
+
Json::Writer::Impl::markStarted
void markStarted()
Definition: Writer.cpp:134
Json::Writer::Impl::~Impl
~Impl()=default
-
Json::Writer::startSet
void startSet(CollectionType, std::string const &key)
Start a new collection inside an object.
Definition: Writer.cpp:343
-
Json::Writer::operator=
Writer & operator=(Writer &&) noexcept
Definition: Writer.cpp:251
-
Json::Writer::Impl::stack_
Stack stack_
Definition: Writer.cpp:230
-
Json::Writer::Impl
Definition: Writer.cpp:75
+
Json::Writer::startSet
void startSet(CollectionType, std::string const &key)
Start a new collection inside an object.
Definition: Writer.cpp:341
+
Json::Writer::operator=
Writer & operator=(Writer &&) noexcept
Definition: Writer.cpp:249
+
Json::Writer::Impl::stack_
Stack stack_
Definition: Writer.cpp:228
+
Json::Writer::Impl
Definition: Writer.cpp:73
std
STL namespace.
-
Json::Writer::rawSet
void rawSet(std::string const &key)
Emit just "tag": as part of an object.
Definition: Writer.cpp:321
+
Json::Writer::rawSet
void rawSet(std::string const &key)
Emit just "tag": as part of an object.
Definition: Writer.cpp:319
std::stack::empty
T empty(T... args)
std::stack::push
T push(T... args)
-
Json::Writer::Impl::finish
void finish()
Definition: Writer.cpp:182
-
Json::Writer::Writer
Writer(Output const &output)
Definition: Writer.cpp:235
-
Json::Writer::Impl::empty
bool empty() const
Definition: Writer.cpp:88
-
Json::Writer::output
void output(std::string const &)
Definition: Writer.cpp:264
+
Json::Writer::Impl::finish
void finish()
Definition: Writer.cpp:180
+
Json::Writer::Writer
Writer(Output const &output)
Definition: Writer.cpp:233
+
Json::Writer::Impl::empty
bool empty() const
Definition: Writer.cpp:86
+
Json::Writer::output
void output(std::string const &)
Definition: Writer.cpp:262
std::size_t
ripple::to_string
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
Definition: app/misc/impl/Manifest.cpp:41
-
Json::Writer::Impl::output
void output(boost::beast::string_view const &bytes)
Definition: Writer.cpp:103
+
Json::Writer::Impl::output
void output(boost::beast::string_view const &bytes)
Definition: Writer.cpp:101
std::map::end
T end(T... args)
-
Json::Writer::Impl::Collection
Definition: Writer.cpp:210
-
Json::Writer::Impl::stringOutput
void stringOutput(boost::beast::string_view const &bytes)
Definition: Writer.cpp:110
+
Json::Writer::Impl::Collection
Definition: Writer.cpp:208
+
Json::Writer::Impl::stringOutput
void stringOutput(boost::beast::string_view const &bytes)
Definition: Writer.cpp:108
Json::Writer::CollectionType
CollectionType
Definition: json/Writer.h:129
Json::Writer
Writer implements an O(1)-space, O(1)-granular output JSON writer.
Definition: json/Writer.h:126
std::string::data
T data(T... args)
diff --git a/Writer__test_8cpp_source.html b/Writer__test_8cpp_source.html index 4579cbb917..9964279c7b 100644 --- a/Writer__test_8cpp_source.html +++ b/Writer__test_8cpp_source.html @@ -289,17 +289,17 @@ $(function() {
ripple::test::TestOutputSuite::setup
void setup(std::string const &testName)
Definition: TestOutputSuite.h:37
Json::Writer::append
void append(Scalar t)
Append a value to an array.
Definition: json/Writer.h:164
-
Json::Writer::finish
void finish()
Finish the collection most recently started.
Definition: Writer.cpp:351
+
Json::Writer::finish
void finish()
Finish the collection most recently started.
Definition: Writer.cpp:349
Json::BEAST_DEFINE_TESTSUITE
BEAST_DEFINE_TESTSUITE(JsonObject, ripple_basics, ripple)
Json::JsonWriter_test::testNearTrivial
void testNearTrivial()
Definition: Writer_test.cpp:39
Json::Writer::set
void set(std::string const &tag, Type t)
Add a key, value assignment to an object.
Definition: json/Writer.h:188
Json::JsonWriter_test::testComplexObject
void testComplexObject()
Definition: Writer_test.cpp:162
-
Json::Writer::startAppend
void startAppend(CollectionType)
Start a new collection inside an array.
Definition: Writer.cpp:336
-
Json::Writer::startRoot
void startRoot(CollectionType)
Start a new collection at the root level.
Definition: Writer.cpp:330
+
Json::Writer::startAppend
void startAppend(CollectionType)
Start a new collection inside an array.
Definition: Writer.cpp:334
+
Json::Writer::startRoot
void startRoot(CollectionType)
Start a new collection at the root level.
Definition: Writer.cpp:328
Json::JsonWriter_test::testJson
void testJson()
Definition: Writer_test.cpp:186
Json::JsonWriter_test::testArray
void testArray()
Definition: Writer_test.cpp:118
Json::JsonWriter_test
Definition: Writer_test.cpp:27
-
Json::Writer::finishAll
void finishAll()
Finish all objects and arrays.
Definition: Writer.cpp:308
+
Json::Writer::finishAll
void finishAll()
Finish all objects and arrays.
Definition: Writer.cpp:306
Json::JsonWriter_test::testObject
void testObject()
Definition: Writer_test.cpp:151
Json
JSON (JavaScript Object Notation).
Definition: json_reader.cpp:29
Json::objectValue
@ objectValue
object value (collection of name/value pairs).
Definition: json_value.h:43
@@ -310,7 +310,7 @@ $(function() {
Json::JsonWriter_test::testTrivial
void testTrivial()
Definition: Writer_test.cpp:31
Json::JsonWriter_test::testLongArray
void testLongArray()
Definition: Writer_test.cpp:128
ripple::test::TestOutputSuite::writer_
std::unique_ptr< Json::Writer > writer_
Definition: TestOutputSuite.h:34
-
Json::Writer::startSet
void startSet(CollectionType, std::string const &key)
Start a new collection inside an object.
Definition: Writer.cpp:343
+
Json::Writer::startSet
void startSet(CollectionType, std::string const &key)
Start a new collection inside an object.
Definition: Writer.cpp:341
Json::JsonWriter_test::testPrimitives
void testPrimitives()
Definition: Writer_test.cpp:48
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
Json::JsonWriter_test::run
void run() override
Definition: Writer_test.cpp:199
@@ -318,7 +318,7 @@ $(function() {
Json::Writer::object
@ object
Definition: json/Writer.h:129
Json::JsonWriter_test::testEmpty
void testEmpty()
Definition: Writer_test.cpp:80
std::string::empty
T empty(T... args)
-
Json::Writer::output
void output(std::string const &)
Definition: Writer.cpp:264
+
Json::Writer::output
void output(std::string const &)
Definition: Writer.cpp:262
Json::JsonWriter_test::testEscaping
void testEscaping()
Definition: Writer_test.cpp:94
Json::Value
Represents a JSON value.
Definition: json_value.h:145
diff --git a/classJson_1_1Writer.html b/classJson_1_1Writer.html index ccea3222d0..3c79dd9a36 100644 --- a/classJson_1_1Writer.html +++ b/classJson_1_1Writer.html @@ -285,7 +285,7 @@ Private Attributes
-

Definition at line 235 of file Writer.cpp.

+

Definition at line 233 of file Writer.cpp.

@@ -313,7 +313,7 @@ Private Attributes
-

Definition at line 245 of file Writer.cpp.

+

Definition at line 243 of file Writer.cpp.

@@ -332,7 +332,7 @@ Private Attributes
-

Definition at line 239 of file Writer.cpp.

+

Definition at line 237 of file Writer.cpp.

@@ -361,7 +361,7 @@ Private Attributes
-

Definition at line 251 of file Writer.cpp.

+

Definition at line 249 of file Writer.cpp.

@@ -383,7 +383,7 @@ Private Attributes

Start a new collection at the root level.

-

Definition at line 330 of file Writer.cpp.

+

Definition at line 328 of file Writer.cpp.

@@ -405,7 +405,7 @@ Private Attributes

Start a new collection inside an array.

-

Definition at line 336 of file Writer.cpp.

+

Definition at line 334 of file Writer.cpp.

@@ -437,7 +437,7 @@ Private Attributes

Start a new collection inside an object.

-

Definition at line 343 of file Writer.cpp.

+

Definition at line 341 of file Writer.cpp.

@@ -458,7 +458,7 @@ Private Attributes

Finish the collection most recently started.

-

Definition at line 351 of file Writer.cpp.

+

Definition at line 349 of file Writer.cpp.

@@ -480,7 +480,7 @@ Private Attributes

Finish all objects and arrays.

After finishArray() has been called, no more operations can be performed.

-

Definition at line 308 of file Writer.cpp.

+

Definition at line 306 of file Writer.cpp.

@@ -527,7 +527,7 @@ template<typename Scalar >

Add a comma before this next item if not the first item in an array.

Useful if you are writing the actual array yourself.

-

Definition at line 315 of file Writer.cpp.

+

Definition at line 313 of file Writer.cpp.

@@ -587,7 +587,7 @@ template<typename Type >

Emit just "tag": as part of an object.

Useful if you are writing the actual value data yourself.

-

Definition at line 321 of file Writer.cpp.

+

Definition at line 319 of file Writer.cpp.

@@ -607,7 +607,7 @@ template<typename Type >
-

Definition at line 264 of file Writer.cpp.

+

Definition at line 262 of file Writer.cpp.

@@ -627,7 +627,7 @@ template<typename Type >
-

Definition at line 258 of file Writer.cpp.

+

Definition at line 256 of file Writer.cpp.

@@ -647,7 +647,7 @@ template<typename Type >
-

Definition at line 270 of file Writer.cpp.

+

Definition at line 268 of file Writer.cpp.

@@ -669,7 +669,7 @@ template<typename Type >

Output a null.

-

Definition at line 290 of file Writer.cpp.

+

Definition at line 288 of file Writer.cpp.

@@ -691,7 +691,7 @@ template<typename Type >

Output a float.

-

Definition at line 277 of file Writer.cpp.

+

Definition at line 275 of file Writer.cpp.

@@ -713,7 +713,7 @@ template<typename Type >

Output a double.

-

Definition at line 284 of file Writer.cpp.

+

Definition at line 282 of file Writer.cpp.

@@ -735,7 +735,7 @@ template<typename Type >

Output a bool.

-

Definition at line 296 of file Writer.cpp.

+

Definition at line 294 of file Writer.cpp.

@@ -807,7 +807,7 @@ template<typename Type >
-

Definition at line 302 of file Writer.cpp.

+

Definition at line 300 of file Writer.cpp.

diff --git a/classJson_1_1Writer_1_1Impl.html b/classJson_1_1Writer_1_1Impl.html index 2775d16f01..99ccb585f2 100644 --- a/classJson_1_1Writer_1_1Impl.html +++ b/classJson_1_1Writer_1_1Impl.html @@ -143,7 +143,7 @@ Private Attributes

Detailed Description

-

Definition at line 75 of file Writer.cpp.

+

Definition at line 73 of file Writer.cpp.

Member Typedef Documentation

◆ Stack

@@ -165,7 +165,7 @@ Private Attributes
-

Definition at line 227 of file Writer.cpp.

+

Definition at line 225 of file Writer.cpp.

@@ -194,7 +194,7 @@ Private Attributes
-

Definition at line 78 of file Writer.cpp.

+

Definition at line 76 of file Writer.cpp.

@@ -291,7 +291,7 @@ Private Attributes
-

Definition at line 88 of file Writer.cpp.

+

Definition at line 86 of file Writer.cpp.

@@ -311,7 +311,7 @@ Private Attributes
-

Definition at line 94 of file Writer.cpp.

+

Definition at line 92 of file Writer.cpp.

@@ -331,7 +331,7 @@ Private Attributes
-

Definition at line 103 of file Writer.cpp.

+

Definition at line 101 of file Writer.cpp.

@@ -351,7 +351,7 @@ Private Attributes
-

Definition at line 110 of file Writer.cpp.

+

Definition at line 108 of file Writer.cpp.

@@ -370,7 +370,7 @@ Private Attributes
-

Definition at line 136 of file Writer.cpp.

+

Definition at line 134 of file Writer.cpp.

@@ -400,7 +400,7 @@ Private Attributes
-

Definition at line 143 of file Writer.cpp.

+

Definition at line 141 of file Writer.cpp.

@@ -420,7 +420,7 @@ Private Attributes
-

Definition at line 162 of file Writer.cpp.

+

Definition at line 160 of file Writer.cpp.

@@ -439,7 +439,7 @@ Private Attributes
-

Definition at line 176 of file Writer.cpp.

+

Definition at line 174 of file Writer.cpp.

@@ -458,7 +458,7 @@ Private Attributes
-

Definition at line 182 of file Writer.cpp.

+

Definition at line 180 of file Writer.cpp.

@@ -477,7 +477,7 @@ Private Attributes
-

Definition at line 193 of file Writer.cpp.

+

Definition at line 191 of file Writer.cpp.

@@ -496,7 +496,7 @@ Private Attributes
-

Definition at line 203 of file Writer.cpp.

+

Definition at line 201 of file Writer.cpp.

@@ -521,7 +521,7 @@ Private Attributes
-

Definition at line 229 of file Writer.cpp.

+

Definition at line 227 of file Writer.cpp.

@@ -545,7 +545,7 @@ Private Attributes
-

Definition at line 230 of file Writer.cpp.

+

Definition at line 228 of file Writer.cpp.

@@ -569,7 +569,7 @@ Private Attributes
-

Definition at line 232 of file Writer.cpp.

+

Definition at line 230 of file Writer.cpp.

diff --git a/json_2Writer_8h_source.html b/json_2Writer_8h_source.html index eddf9202ce..8b7f14ac87 100644 --- a/json_2Writer_8h_source.html +++ b/json_2Writer_8h_source.html @@ -204,33 +204,33 @@ $(function() {
259 
260 #endif
-
Json::Writer::rawAppend
void rawAppend()
Add a comma before this next item if not the first item in an array.
Definition: Writer.cpp:315
-
Json::Writer::implOutput
void implOutput(std::string const &)
Definition: Writer.cpp:302
+
Json::Writer::rawAppend
void rawAppend()
Add a comma before this next item if not the first item in an array.
Definition: Writer.cpp:313
+
Json::Writer::implOutput
void implOutput(std::string const &)
Definition: Writer.cpp:300
Json::Writer::append
void append(Scalar t)
Append a value to an array.
Definition: json/Writer.h:164
std::string
STL class.
-
Json::Writer::finish
void finish()
Finish the collection most recently started.
Definition: Writer.cpp:351
+
Json::Writer::finish
void finish()
Finish the collection most recently started.
Definition: Writer.cpp:349
Json::Writer::set
void set(std::string const &tag, Type t)
Add a key, value assignment to an object.
Definition: json/Writer.h:188
Json::check
void check(bool condition, std::string const &message)
Definition: json/Writer.h:252
-
Json::Writer::startAppend
void startAppend(CollectionType)
Start a new collection inside an array.
Definition: Writer.cpp:336
+
Json::Writer::startAppend
void startAppend(CollectionType)
Start a new collection inside an array.
Definition: Writer.cpp:334
std::function
Json::StaticString::c_str
constexpr const char * c_str() const
Definition: json_value.h:73
-
Json::Writer::startRoot
void startRoot(CollectionType)
Start a new collection at the root level.
Definition: Writer.cpp:330
+
Json::Writer::startRoot
void startRoot(CollectionType)
Start a new collection at the root level.
Definition: Writer.cpp:328
std::nullptr_t
-
Json::Writer::finishAll
void finishAll()
Finish all objects and arrays.
Definition: Writer.cpp:308
+
Json::Writer::finishAll
void finishAll()
Finish all objects and arrays.
Definition: Writer.cpp:306
Json
JSON (JavaScript Object Notation).
Definition: json_reader.cpp:29
Json::Writer::output
void output(Json::StaticString const &t)
Definition: json/Writer.h:238
std::to_string
T to_string(T... args)
Json::Writer::impl_
std::unique_ptr< Impl > impl_
Definition: json/Writer.h:244
Json::Writer::array
@ array
Definition: json/Writer.h:129
memory
-
Json::Writer::startSet
void startSet(CollectionType, std::string const &key)
Start a new collection inside an object.
Definition: Writer.cpp:343
-
Json::Writer::Impl
Definition: Writer.cpp:75
+
Json::Writer::startSet
void startSet(CollectionType, std::string const &key)
Start a new collection inside an object.
Definition: Writer.cpp:341
+
Json::Writer::Impl
Definition: Writer.cpp:73
Json::StaticString
Lightweight wrapper to tag static string.
Definition: json_value.h:60
std
STL namespace.
-
Json::Writer::rawSet
void rawSet(std::string const &key)
Emit just "tag": as part of an object.
Definition: Writer.cpp:321
+
Json::Writer::rawSet
void rawSet(std::string const &key)
Emit just "tag": as part of an object.
Definition: Writer.cpp:319
Json::Writer::output
void output(Type t)
Output numbers or booleans.
Definition: json/Writer.h:232
-
Json::Writer::Writer
Writer(Output const &output)
Definition: Writer.cpp:235
-
Json::Writer::output
void output(std::string const &)
Definition: Writer.cpp:264
+
Json::Writer::Writer
Writer(Output const &output)
Definition: Writer.cpp:233
+
Json::Writer::output
void output(std::string const &)
Definition: Writer.cpp:262
std::unique_ptr
STL class.
Json::Writer::CollectionType
CollectionType
Definition: json/Writer.h:129
Json::Writer
Writer implements an O(1)-space, O(1)-granular output JSON writer.
Definition: json/Writer.h:126
diff --git a/structJson_1_1Writer_1_1Impl_1_1Collection.html b/structJson_1_1Writer_1_1Impl_1_1Collection.html index cd22233b71..225ebcf808 100644 --- a/structJson_1_1Writer_1_1Impl_1_1Collection.html +++ b/structJson_1_1Writer_1_1Impl_1_1Collection.html @@ -103,7 +103,7 @@ Public Attributes

Detailed Description

-

Definition at line 210 of file Writer.cpp.

+

Definition at line 208 of file Writer.cpp.

Constructor & Destructor Documentation

◆ Collection()

@@ -145,7 +145,7 @@ Public Attributes

What type of collection are we in?

-

Definition at line 215 of file Writer.cpp.

+

Definition at line 213 of file Writer.cpp.

@@ -163,7 +163,7 @@ Public Attributes

Is this the first entry in a collection? If false, we have to emit a , before we write the next entry.

-

Definition at line 219 of file Writer.cpp.

+

Definition at line 217 of file Writer.cpp.

@@ -181,7 +181,7 @@ Public Attributes

What tags have we already seen in this collection?

-

Definition at line 223 of file Writer.cpp.

+

Definition at line 221 of file Writer.cpp.