BGC Tools
|
Represents a writer that can write string representations of JsonValues. More...
Public Member Functions | |
JsonWriter (TextWriter innerWriter) | |
Initializes a new instance of JsonWriter. More... | |
JsonWriter (TextWriter innerWriter, bool pretty) | |
Initializes a new instance of JsonWriter. More... | |
void | Write (JsonValue jsonValue) |
Writes the given value to the InnerWriter. More... | |
Static Public Member Functions | |
static string | Serialize (JsonValue value) |
Returns a string representation of the given JsonValue. More... | |
static string | Serialize (JsonValue value, bool pretty) |
Generates a string representation of the given value. More... | |
Properties | |
string | IndentString [get, set] |
The string representing indentation in the output. More... | |
string | SpacingString [get, set] |
The string representing spacing in the output. More... | |
string | NewLineString [get, set] |
The string representing a new line on the output. More... | |
bool | SortObjects [get, set] |
Whether JsonObject properties should be written in a deterministic order. More... | |
TextWriter | InnerWriter [get, set] |
The TextWriter to which this JsonWriter writes. More... | |
Private Member Functions | |
void | Write (string text) |
void | WriteEncodedJsonValue (JsonValue value) |
void | WriteEncodedString (string text) |
void | WriteIndentation () |
void | WriteSpacing () |
void | WriteLine () |
void | WriteLine (string line) |
void | AddRenderingCollection (IEnumerable< JsonValue > value) |
void | RemoveRenderingCollection (IEnumerable< JsonValue > value) |
void | Render (JsonValue value) |
void | Render (JsonArray value) |
void | Render (JsonObject value) |
IEnumerator< KeyValuePair< string, JsonValue > > | GetJsonObjectEnumerator (JsonObject jsonObject) |
Gets a JsonObject enumarator based on the configuration of this JsonWriter. If JsonWriter.SortObjects is set to true, then a ordered enumerator is returned. Otherwise, a faster non-deterministic enumerator is returned. More... | |
Static Private Member Functions | |
static bool | IsValidNumber (double number) |
Private Attributes | |
int | indent |
bool | isNewLine |
HashSet< IEnumerable< JsonValue > > | renderingCollections = new HashSet<IEnumerable<JsonValue>>() |
A set of containing all the collection objects (JsonObject/JsonArray) being rendered. It is used to prevent circular references; since collections that contain themselves will never finish rendering. More... | |
Represents a writer that can write string representations of JsonValues.
Definition at line 14 of file JsonWriter.cs.
|
inline |
Initializes a new instance of JsonWriter.
innerWriter | The TextWriter used to write JsonValues. |
Definition at line 45 of file JsonWriter.cs.
|
inline |
Initializes a new instance of JsonWriter.
innerWriter | The TextWriter used to write JsonValues. |
pretty | Whether the output of the writer should be human-readable. |
Definition at line 52 of file JsonWriter.cs.
|
inlineprivate |
Definition at line 190 of file JsonWriter.cs.
|
inlineprivate |
Gets a JsonObject enumarator based on the configuration of this JsonWriter. If JsonWriter.SortObjects is set to true, then a ordered enumerator is returned. Otherwise, a faster non-deterministic enumerator is returned.
jsonObject | The JsonObject for which to get an enumerator. |
Definition at line 308 of file JsonWriter.cs.
References LightJson.JsonObject.GetEnumerator().
|
staticprivate |
|
inlineprivate |
Definition at line 198 of file JsonWriter.cs.
|
inlineprivate |
Definition at line 203 of file JsonWriter.cs.
References LightJson.JsonValue.Type.
|
inlineprivate |
Definition at line 227 of file JsonWriter.cs.
References LightJson.JsonArray.GetEnumerator().
|
inlineprivate |
Definition at line 263 of file JsonWriter.cs.
|
static |
Returns a string representation of the given JsonValue.
value | The JsonValue to serialize. |
Referenced by LightJson.JsonArray.Clear(), LightJson.JsonValue.GetHashCode(), and LightJson.JsonObject.Rename().
|
inlinestatic |
Generates a string representation of the given value.
value | The value to serialize. |
pretty | Indicates whether the resulting string should be formatted for human-readability. |
Definition at line 357 of file JsonWriter.cs.
References LightJson.Serialization.JsonWriter.Write().
|
inlineprivate |
Definition at line 64 of file JsonWriter.cs.
Referenced by LightJson.Serialization.JsonWriter.Serialize().
|
inline |
Writes the given value to the InnerWriter.
jsonValue | The JsonValue to write. |
Definition at line 333 of file JsonWriter.cs.
|
inlineprivate |
Definition at line 75 of file JsonWriter.cs.
References LightJson.JsonValue.AsString, and LightJson.JsonValue.Type.
|
inlineprivate |
Definition at line 113 of file JsonWriter.cs.
|
inlineprivate |
Definition at line 165 of file JsonWriter.cs.
|
inlineprivate |
Definition at line 178 of file JsonWriter.cs.
|
inlineprivate |
Definition at line 184 of file JsonWriter.cs.
|
inlineprivate |
Definition at line 173 of file JsonWriter.cs.
|
private |
Definition at line 16 of file JsonWriter.cs.
|
private |
Definition at line 17 of file JsonWriter.cs.
|
private |
A set of containing all the collection objects (JsonObject/JsonArray) being rendered. It is used to prevent circular references; since collections that contain themselves will never finish rendering.
Definition at line 24 of file JsonWriter.cs.
|
getset |
The string representing indentation in the output.
Definition at line 27 of file JsonWriter.cs.
|
getset |
The TextWriter to which this JsonWriter writes.
Definition at line 39 of file JsonWriter.cs.
|
getset |
The string representing a new line on the output.
Definition at line 33 of file JsonWriter.cs.
|
getset |
Whether JsonObject properties should be written in a deterministic order.
Definition at line 36 of file JsonWriter.cs.
|
getset |
The string representing spacing in the output.
Definition at line 30 of file JsonWriter.cs.