[#BloombergLP-baljsn-JsonTokenizer]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/baljsn.adoc[baljsn]::JsonTokenizer
:relfileprefix: ../../
:mrdocs:

This class implements a mechanism that makes the organization and values of a non&hyphen;scalar `bdljsn&colon;&colon;Json` object available as a series of tokens&period; Some tokens have associated values&period; See &period;

== Synopsis

Declared in `&lt;baljsn&lowbar;jsontokenizer&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class JsonTokenizer;
----

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/baljsn/JsonTokenizer/allocator_type.adoc[`allocator&lowbar;type`] 
| Type of the allocator used to supply memory&period;
|===


== Enums

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/baljsn/JsonTokenizer/TokenType-06.adoc[`TokenType`] 
| Enumeration of tokenizer token types&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/baljsn/JsonTokenizer/2constructor-0d.adoc[`JsonTokenizer`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/baljsn/JsonTokenizer/2destructor.adoc[`&#126;JsonTokenizer`] [.small]#[destructor]#
| Destroy this object&period;
| xref:BloombergLP/baljsn/JsonTokenizer/advanceToNextToken.adoc[`advanceToNextToken`] 
| Move to the next token in the source object&period; Return 0 on success and a non&hyphen;zero value otherwise&period; The return value is non&hyphen;zero when there are no more tokens in the source object&period; The behavior is undefined unless a source object was specified on construction and&sol;or a call to `reset`&period;
| xref:BloombergLP/baljsn/JsonTokenizer/get_allocator.adoc[`get&lowbar;allocator`] 
| Return the allocator used by this object to supply memory&period; Note that if no allocator was supplied at construction the default allocator in effect at construction is used&period;
| xref:BloombergLP/baljsn/JsonTokenizer/reset.adoc[`reset`] 
| Reset this tokenizer to use the specified `json` as a source object for tokens&period; All state associated with a previously specified source object (if any) is discarded&period; The behavior is undefined unless `json&hyphen;&gt;isArray()` or `json&hyphen;&gt;isObject()`&period;
| xref:BloombergLP/baljsn/JsonTokenizer/tokenType-09.adoc[`tokenType`] 
| Return the type of the current token&period;
| xref:BloombergLP/baljsn/JsonTokenizer/value-05.adoc[`value`] 
| `value` overloads
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/baljsn/JsonTokenizer/print.adoc[`print`] 
| Write the string representation of the specified enumeration `value` to the specified output `stream`, and return a reference to `stream`&period; Optionally specify an initial indentation `level`, whose absolute value is incremented recursively for nested objects&period; If `level` is specified, optionally specify `spacesPerLevel`, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects&period; If `level` is negative, suppress indentation of the first line&period; If `spacesPerLevel` is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by `level`)&period; See `toAscii` for what constitutes the string representation of a `JsonTokenizer&colon;&colon;TokenType` value&period;
| xref:BloombergLP/baljsn/JsonTokenizer/toAscii.adoc[`toAscii`] 
| Return the non&hyphen;modifiable string representation corresponding to the specified enumeration `value`, if it exists, and a unique (error) string otherwise&period; The string representation of `value` matches its corresponding enumerator name with the &quot;e&lowbar;&quot; prefix elided&period; For example&colon; &grave; bsl&colon;&colon;cout &lt;&lt; DstPolicy&colon;&colon;toAscii(JsonTokenizer&colon;&colon;e&lowbar;ELEMENT&lowbar;VALUE)&semi; &grave; will print the following on standard output&colon; &grave; ELEMENT&lowbar;VALUE &grave; Note that specifying a `value` that does not match any of the enumerators will result in a string representation that is distinct from any of those corresponding to the enumerators, but is otherwise unspecified&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/baljsn/JsonTokenizer_Visitor.adoc[BloombergLP::baljsn::JsonTokenizer&lowbar;Visitor]`
| This class provides a mechanism for extracting token information from a `bdljsn&colon;&colon;Json` object, transferring that information to a parent `baljsn&colon;&colon;JsonTokenizer` object (which considers this visitor a `friend`), and, if appropriate, arranging for the visiting of a subordinate `bdljsn&colon;&colon;Json` object&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
