[#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‐scalar `bdljsn::Json` object available as a series of tokens. Some tokens have associated values. See . == Synopsis Declared in `<baljsn_jsontokenizer.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class JsonTokenizer; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/baljsn/JsonTokenizer/allocator_type.adoc[`allocator_type`] | Type of the allocator used to supply memory. |=== == Enums [cols="1,4"] |=== | Name| Description | xref:BloombergLP/baljsn/JsonTokenizer/TokenType-06.adoc[`TokenType`] | Enumeration of tokenizer token types. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/baljsn/JsonTokenizer/2constructor-0d.adoc[`JsonTokenizer`] [.small]#[constructor]# | Constructors | xref:BloombergLP/baljsn/JsonTokenizer/2destructor.adoc[`~JsonTokenizer`] [.small]#[destructor]# | Destroy this object. | xref:BloombergLP/baljsn/JsonTokenizer/advanceToNextToken.adoc[`advanceToNextToken`] | Move to the next token in the source object. Return 0 on success and a non‐zero value otherwise. The return value is non‐zero when there are no more tokens in the source object. The behavior is undefined unless a source object was specified on construction and/or a call to `reset`. | xref:BloombergLP/baljsn/JsonTokenizer/get_allocator.adoc[`get_allocator`] | Return the allocator used by this object to supply memory. Note that if no allocator was supplied at construction the default allocator in effect at construction is used. | xref:BloombergLP/baljsn/JsonTokenizer/reset.adoc[`reset`] | Reset this tokenizer to use the specified `json` as a source object for tokens. All state associated with a previously specified source object (if any) is discarded. The behavior is undefined unless `json‐>isArray()` or `json‐>isObject()`. | xref:BloombergLP/baljsn/JsonTokenizer/tokenType-09.adoc[`tokenType`] | Return the type of the current token. | 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`. Optionally specify an initial indentation `level`, whose absolute value is incremented recursively for nested objects. 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. If `level` is negative, suppress indentation of the first line. If `spacesPerLevel` is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by `level`). See `toAscii` for what constitutes the string representation of a `JsonTokenizer::TokenType` value. | xref:BloombergLP/baljsn/JsonTokenizer/toAscii.adoc[`toAscii`] | Return the non‐modifiable string representation corresponding to the specified enumeration `value`, if it exists, and a unique (error) string otherwise. The string representation of `value` matches its corresponding enumerator name with the "e_" prefix elided. For example: ` bsl::cout << DstPolicy::toAscii(JsonTokenizer::e_ELEMENT_VALUE); ` will print the following on standard output: ` ELEMENT_VALUE ` 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. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/baljsn/JsonTokenizer_Visitor.adoc[BloombergLP::baljsn::JsonTokenizer_Visitor]` | This class provides a mechanism for extracting token information from a `bdljsn::Json` object, transferring that information to a parent `baljsn::JsonTokenizer` object (which considers this visitor a `friend`), and, if appropriate, arranging for the visiting of a subordinate `bdljsn::Json` object. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#