Skip to content

Commit

Permalink
Merge pull request #97 from miloyip/issue72customdtoa
Browse files Browse the repository at this point in the history
Fix #72
  • Loading branch information
miloyip committed Aug 11, 2014
2 parents 34dd0fd + c549152 commit adb3974
Show file tree
Hide file tree
Showing 7 changed files with 453 additions and 164 deletions.
16 changes: 1 addition & 15 deletions doc/sax.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ You may doubt that, why not just using `sprintf()` or `std::stringstream` to bui
There are various reasons:
1. `Writer` must output a well-formed JSON. If there is incorrect event sequence (e.g. `Int()` just after `StartObject()`), it generates assertion fail in debug mode.
2. `Writer::String()` can handle string escaping (e.g. converting code point `U+000A` to `\n`) and Unicode transcoding.
3. `Writer` handles number output consistently. For example, user can set precision for `Double()`.
3. `Writer` handles number output consistently.
4. `Writer` implements the event handler concept. It can be used to handle events from `Reader`, `Document` or other event publisher.
5. `Writer` can be optimized for different platforms.

Expand Down Expand Up @@ -258,20 +258,6 @@ The last one, `Allocator` is the type of allocator, which is used for allocating
Besides, the constructor of `Writer` has a `levelDepth` parameter. This parameter affects the initial memory allocated for storing information per hierarchy level.
## Precision (#WriterPrecision)
When using `Double()`, the precision of output can be specified, for example:
~~~~~~~~~~cpp
writer.SetDoublePrecision(4);
writer.StartArary();
writer.Double(3.14159265359);
writer.EndArray();
~~~~~~~~~~
~~~~~~~~~~
[3.1416]
~~~~~~~~~~

## PrettyWriter {#PrettyWriter}
While the output of `Writer` is the most condensed JSON without white-spaces, suitable for network transfer or storage, it is not easily readable by human.
Expand Down
Loading

0 comments on commit adb3974

Please sign in to comment.