BGC Tools
|
Represents a key-value pair collection of JsonValue objects. More...
Data Structures | |
class | JsonObjectDebugView |
Public Member Functions | |
JsonObject () | |
Initializes a new instance of JsonObject. More... | |
JsonObject | Add (string key) |
Adds a key with a null value to this collection. More... | |
JsonObject | Add (string key, JsonValue value) |
Adds a value associated with a key to this collection. More... | |
JsonObject | AddIfNotNull (string key, JsonValue value) |
Adds a value associated with a key to this collection only if the value is not null. More... | |
bool | Remove (string key) |
Removes a property with the given key. More... | |
JsonObject | Clear () |
Clears the contents of this collection. More... | |
JsonObject | Rename (string oldKey, string newKey) |
Changes the key of one of the items in the collection. More... | |
bool | ContainsKey (string key) |
Determines whether this collection contains an item assosiated with the given key. More... | |
bool | ContainsKey (string key, out JsonValue value) |
Determines whether this collection contains an item assosiated with the given key. More... | |
bool | Contains (JsonValue value) |
Determines whether this collection contains the given JsonValue. More... | |
IEnumerator< KeyValuePair< string, JsonValue > > | GetEnumerator () |
Returns an enumerator that iterates through this collection. More... | |
override string | ToString () |
Returns a JSON string representing the state of the object. More... | |
string | ToString (bool pretty) |
Returns a JSON string representing the state of the object. More... | |
Data Fields | |
int | Count => properties.Count |
The number of properties in this JsonObject. More... | |
Properties | |
JsonValue | this[string key] [get, set] |
The property with the given key. More... | |
Private Member Functions | |
IEnumerator< JsonValue > IEnumerable< JsonValue >. | GetEnumerator () |
Returns an enumerator that iterates through this collection. More... | |
System.Collections.IEnumerator System.Collections.IEnumerable. | GetEnumerator () |
Returns an enumerator that iterates through this collection. More... | |
Private Attributes | |
Dictionary< string, JsonValue > | properties = new Dictionary<string, JsonValue>() |
Represents a key-value pair collection of JsonValue objects.
Definition at line 13 of file JsonObject.cs.
|
inline |
Initializes a new instance of JsonObject.
Definition at line 45 of file JsonObject.cs.
References LightJson.JsonObject.Add(), and LightJson.JsonValue.Null.
JsonObject LightJson.JsonObject.Add | ( | string | key | ) |
Adds a key with a null value to this collection.
key | The key of the property to be added. |
Returns this JsonObject.
Referenced by LightJson.JsonObject.Add(), LightJson.JsonObject.AddIfNotNull(), BGC.Audio.Calibration.DeserializeCalibration(), LightJson.JsonObject.JsonObject(), LightJson.Serialization.JsonReader.ReadObject(), BGC.Study.SessionElement.SerializeElement(), BGC.Study.ProtocolManager.SerializeProtocols(), BGC.Study.Session.SerializeSession(), BGC.Study.Session.Session(), BGC.Users.ProfileData.SetBool(), BGC.Users.ProfileData.SetDouble(), BGC.Users.ProfileData.SetFloat(), BGC.Users.ProfileData.SetInt(), BGC.Users.ProfileData.SetJsonArray(), BGC.Users.ProfileData.SetJsonValue(), BGC.Users.ProfileData.SetString(), BGC.Utility.EnumUtility.ToJsonObject< T >(), and BGC.Extensions.JsonExtensions.TryGetValue().
|
inline |
Adds a value associated with a key to this collection.
key | The key of the property to be added. |
value | The value of the property to be added. |
Definition at line 60 of file JsonObject.cs.
References LightJson.JsonObject.Add().
|
inline |
Adds a value associated with a key to this collection only if the value is not null.
key | The key of the property to be added. |
value | The value of the property to be added. |
Definition at line 72 of file JsonObject.cs.
References LightJson.JsonObject.Add(), LightJson.JsonValue.IsNull, and LightJson.JsonObject.Remove().
|
inline |
Clears the contents of this collection.
Definition at line 95 of file JsonObject.cs.
References LightJson.JsonObject.Clear().
Referenced by BGC.Users.ProfileData.Clear(), and LightJson.JsonObject.Clear().
bool LightJson.JsonObject.Contains | ( | JsonValue | value | ) |
Determines whether this collection contains the given JsonValue.
value | The value to locate in this collection. |
Referenced by LightJson.JsonObject.Rename().
bool LightJson.JsonObject.ContainsKey | ( | string | key | ) |
Determines whether this collection contains an item assosiated with the given key.
key | The key to locate in this collection. |
Referenced by BGC.Users.ProfileData.Deserialize(), BGC.Users.ProfileData.GetBool(), BGC.Users.ProfileData.GetDouble(), BGC.Study.ProtocolManager.GetEnvValue(), BGC.Users.ProfileData.GetFloat(), BGC.Users.ProfileData.GetInt(), BGC.Users.ProfileData.GetJsonArray(), BGC.Users.ProfileData.GetJsonValue(), BGC.Users.ProfileData.GetString(), LightJson.Serialization.JsonReader.ReadObject(), LightJson.JsonObject.Rename(), BGC.Study.SessionElement.SessionElement(), BGC.Users.ProfileData.SetBool(), BGC.Users.ProfileData.SetDouble(), BGC.Users.ProfileData.SetFloat(), BGC.Users.ProfileData.SetInt(), BGC.Users.ProfileData.SetJsonArray(), BGC.Users.ProfileData.SetJsonValue(), BGC.Users.ProfileData.SetString(), and BGC.Extensions.JsonExtensions.TryGetValue().
bool LightJson.JsonObject.ContainsKey | ( | string | key, |
out JsonValue | value | ||
) |
Determines whether this collection contains an item assosiated with the given key.
key | The key to locate in this collection. |
value | When this method returns, this value gets assigned the JsonValue assosiated with the key, if the key is found; otherwise, JsonValue.Null is assigned. |
IEnumerator<KeyValuePair<string, JsonValue> > LightJson.JsonObject.GetEnumerator | ( | ) |
Returns an enumerator that iterates through this collection.
Referenced by LightJson.Serialization.JsonWriter.GetJsonObjectEnumerator(), and LightJson.JsonObject.Rename().
|
private |
Returns an enumerator that iterates through this collection.
|
private |
Returns an enumerator that iterates through this collection.
bool LightJson.JsonObject.Remove | ( | string | key | ) |
Removes a property with the given key.
key | The key of the property to be removed. |
Referenced by LightJson.JsonObject.AddIfNotNull(), BGC.Users.ProfileData.GetJsonArray(), BGC.Study.ProtocolManager.RemoveRedundancies(), and LightJson.JsonObject.Rename().
|
inline |
Changes the key of one of the items in the collection.
This method has no effects if the oldKey does not exists. If the newKey already exists, the value will be overwritten.
oldKey | The name of the key to be changed. |
newKey | The new name of the key. |
Definition at line 111 of file JsonObject.cs.
References LightJson.JsonObject.Contains(), LightJson.JsonObject.ContainsKey(), LightJson.JsonObject.GetEnumerator(), LightJson.JsonObject.Remove(), LightJson.Serialization.JsonWriter.Serialize(), and LightJson.JsonObject.ToString().
override string LightJson.JsonObject.ToString | ( | ) |
Returns a JSON string representing the state of the object.
The resulting string is safe to be inserted as is into dynamically generated JavaScript or JSON code.
Referenced by BGC.Study.ProtocolManager.RemoveRedundancies(), and LightJson.JsonObject.Rename().
string LightJson.JsonObject.ToString | ( | bool | pretty | ) |
Returns a JSON string representing the state of the object.
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.JsonObject.Count => properties.Count |
The number of properties in this JsonObject.
Definition at line 18 of file JsonObject.cs.
Referenced by BGC.Study.SessionElement.SerializeElement(), BGC.Study.ProtocolManager.SerializeProtocols(), and BGC.Study.Session.SerializeSession().
|
private |
Definition at line 15 of file JsonObject.cs.
|
getset |
The property with the given key.
key | The key of the property to get or set. |
Returns JsonValue.Null if the given key is not assosiated with any value.
Definition at line 24 of file JsonObject.cs.