adding documentation.

This commit is contained in:
Daniel Lemire
2025-11-05 11:42:38 -05:00
parent 77d73b068a
commit a962652ec3
3 changed files with 20 additions and 3 deletions
+3
View File
@@ -183,6 +183,9 @@ auto json = padded_string::load("twitter.json"); // load JSON file 'twitter.json
ondemand::document doc = parser.iterate(json); // position a pointer at the beginning of the JSON data
```
(Windows users compiling with C++17 or better may use `wchar_t` strings to support non-ASCII
filenames: `padded_string::load(L"twitter.json")`.)
If you prefer not to create your own `ondemand::parser` instance, you can access
a thread-local version by calling `ondemand::parser.get_parser()`.
+16
View File
@@ -54,6 +54,22 @@ dom::parser parser;
dom::element doc = parser.parse("[1,2,3]"_padded); // parse a string, the _padded suffix creates a simdjson::padded_string instance
```
You can also load a `padded_string` from a file.
```cpp
auto json = padded_string::load("twitter.json"); // load JSON file 'twitter.json'.
dom::element doc = parser.parse(json);
```
(Windows users compiling with C++17 or better may use `wchar_t` strings to support non-ASCII
filenames: `padded_string::load(L"twitter.json")`.)
(Windows users compiling with C++17 or better may use `wchar_t` strings to support non-ASCII
filenames: `padded_string::load(L"twitter.json")`.)
You can copy your data directly on a `simdjson::padded_string` as follows:
```cpp
+1 -3
View File
@@ -8,10 +8,8 @@
#include "simdjson/padded_string_view-inl.h"
#include <climits>
#include <cwchar>
#if defined(_WIN32) && SIMDJSON_CPLUSPLUS17
#include <wchar.h>
#endif
namespace simdjson {
namespace internal {