BGC Tools
|
Represents an ordered collection of JsonValues. More...
Data Structures | |
class | JsonArrayDebugView |
Public Member Functions | |
JsonArray () | |
Initializes a new instance of JsonArray. More... | |
JsonArray (params JsonValue[] values) | |
Initializes a new instance and adds the given values to the collection. More... | |
JsonArray | Add (JsonValue value) |
Adds the given value to this collection. More... | |
JsonArray | AddIfNotNull (JsonValue value) |
Adds the given value to this collection only if the value is not null. More... | |
JsonArray | Insert (int index, JsonValue value) |
Inserts the given value at the given index in this collection. More... | |
JsonArray | InsertIfNotNull (int index, JsonValue value) |
Inserts the given value at the given index in this collection if it is not null. More... | |
JsonArray | Remove (int index) |
Removes the value at the given index. More... | |
JsonArray | Clear () |
Clears the contents of this collection. More... | |
bool | Contains (JsonValue item) |
Determines whether the given item is in the JsonArray. More... | |
int | IndexOf (JsonValue item) |
Determines the index of the given item in this JsonArray. More... | |
IEnumerator< JsonValue > | GetEnumerator () |
Returns an enumerator that iterates through the collection. More... | |
override string | ToString () |
Returns a JSON string representing the state of the array. More... | |
string | ToString (bool pretty) |
Returns a JSON string representing the state of the array. More... | |
Data Fields | |
int | Count => items.Count |
The number of values in this collection. More... | |
Properties | |
JsonValue | this[int index] [get, set] |
The value at the given index. More... | |
Private Member Functions | |
System.Collections.IEnumerator System.Collections.IEnumerable. | GetEnumerator () |
Returns an enumerator that iterates through the collection. More... | |
Private Attributes | |
List< JsonValue > | items = new List<JsonValue>() |
Represents an ordered collection of JsonValues.
Definition at line 11 of file JsonArray.cs.
|
inline |
|
inline |
Initializes a new instance and adds the given values to the collection.
values | The values to be added to this collection. |
Definition at line 47 of file JsonArray.cs.
Adds the given value to this collection.
value | The value to be added. |
Definition at line 65 of file JsonArray.cs.
References LightJson.JsonArray.Add().
Referenced by LightJson.JsonArray.Add(), LightJson.JsonArray.AddIfNotNull(), BGC.Extensions.JsonExtensions.AnyListToStringJsonArray< T >(), BGC.Extensions.JsonExtensions.ConvertToJsonArray< T >(), BGC.DataStructures.EnumListContainer< TEnum >.Deserialize(), BGC.DataStructures.IntListContainer.Deserialize(), BGC.Extensions.JsonExtensions.FloatListToJsonArray(), BGC.Extensions.JsonExtensions.IntListToJsonArray(), BGC.Extensions.JsonExtensions.JsonArrayToList< T >(), LightJson.Serialization.JsonReader.ReadArray(), BGC.Audio.Calibration.SerializeCalibration(), BGC.Utility.JsonUtility.ToJsonArray(), and BGC.Utility.JsonUtility.ToJsonArray< T >().
Adds the given value to this collection only if the value is not null.
value | The value to be added. |
Definition at line 76 of file JsonArray.cs.
References LightJson.JsonArray.Add(), and LightJson.JsonValue.IsNull.
|
inline |
Clears the contents of this collection.
Definition at line 129 of file JsonArray.cs.
References LightJson.JsonArray.Clear(), LightJson.JsonArray.Contains(), LightJson.JsonArray.GetEnumerator(), LightJson.JsonArray.IndexOf(), LightJson.Serialization.JsonWriter.Serialize(), and LightJson.JsonArray.ToString().
Referenced by LightJson.JsonArray.Clear().
bool LightJson.JsonArray.Contains | ( | JsonValue | item | ) |
Determines whether the given item is in the JsonArray.
item | The item to locate in the JsonArray. |
Referenced by LightJson.JsonArray.Clear().
IEnumerator<JsonValue> LightJson.JsonArray.GetEnumerator | ( | ) |
Returns an enumerator that iterates through the collection.
Referenced by LightJson.JsonArray.Clear(), and LightJson.Serialization.JsonWriter.Render().
|
private |
Returns an enumerator that iterates through the collection.
int LightJson.JsonArray.IndexOf | ( | JsonValue | item | ) |
Determines the index of the given item in this JsonArray.
item | The item to locate in this JsonArray. |
Referenced by LightJson.JsonArray.Clear().
Inserts the given value at the given index in this collection.
index | The index where the given value will be inserted. |
value | The value to be inserted into this collection. |
Definition at line 92 of file JsonArray.cs.
References LightJson.JsonArray.Insert().
Referenced by LightJson.JsonArray.Insert(), and LightJson.JsonArray.InsertIfNotNull().
Inserts the given value at the given index in this collection if it is not null.
index | The index where the given value will be inserted. |
value | The value to be inserted into this collection. |
Definition at line 104 of file JsonArray.cs.
References LightJson.JsonArray.Insert(), and LightJson.JsonValue.IsNull.
|
inline |
Removes the value at the given index.
index | The index of the value to be removed. |
Definition at line 119 of file JsonArray.cs.
override string LightJson.JsonArray.ToString | ( | ) |
Returns a JSON string representing the state of the array.
The resulting string is safe to be inserted as is into dynamically generated JavaScript or JSON code.
Referenced by LightJson.JsonArray.Clear().
string LightJson.JsonArray.ToString | ( | bool | pretty | ) |
Returns a JSON string representing the state of the array.
The resulting string is safe to be inserted as is into dynamically generated JavaScript or JSON code.
pretty | Indicates whether the resulting string should be formatted for human-readability. |
int LightJson.JsonArray.Count => items.Count |
The number of values in this collection.
Definition at line 16 of file JsonArray.cs.
Referenced by BGC.Extensions.JsonExtensions.AnyListToStringJsonArray< T >(), BGC.DataStructures.IntListContainer.Deserialize(), BGC.Audio.Calibration.DeserializeCalibration(), BGC.Extensions.JsonExtensions.FloatListToJsonArray(), BGC.IO.ResourceInfo.InitializeResourceInfo(), BGC.Extensions.JsonExtensions.IntListToJsonArray(), BGC.Extensions.JsonExtensions.JsonaArrayToStringList(), BGC.Extensions.JsonExtensions.JsonArrayToFloatList(), BGC.Extensions.IntListContainerExtensions.JsonArrayToIntListContainerList(), BGC.Tests.IntListContainerTests.TestJsonArray(), BGC.Tests.IntListContainerTests.TestJsonArrayConstructor(), and BGC.Utility.JsonUtility.ToIntArray().
Definition at line 13 of file JsonArray.cs.
|
getset |
The value at the given index.
index | The zero-based index of the value. |
Will return JsonValue.Null if the given index is out of range.
Definition at line 22 of file JsonArray.cs.