Window Framework for UI Toolkit v2.0.x
GWG.WindowFramework.Theming.Json.JsonObject Class Referencesealed

Ordered object with ordinal, case-sensitive unique keys. More...

Inheritance diagram for GWG.WindowFramework.Theming.Json.JsonObject:
Collaboration diagram for GWG.WindowFramework.Theming.Json.JsonObject:

Data Structures

class  Reader

Public Member Functions

 JsonObject ()
 Creates an empty independently owned ordered object.
 JsonObject (JsonProperty property)
 Creates an object containing the supplied property value reference.
override JsonNode DeepClone ()
 Copies this object and all descendant mutable nodes.
IEnumerable< JsonProperty > Properties ()
 Enumerates stored properties in insertion order.
Public Member Functions inherited from GWG.WindowFramework.Theming.Json.JsonNode
JsonNode DeepClone ()
 Creates an independently mutable data tree, retaining scalar types and order.
override string ToString ()
 Serializes compact JSON without changing this tree or writing files.
string ToString (JsonFormatting formatting)
 Serializes this data tree using the selected whitespace policy.

Static Public Member Functions

static JsonObject Parse (string json)
 Parses one strict object with unique keys, maximum depth eight and 256 KiB UTF-8 input.
Static Public Member Functions inherited from GWG.WindowFramework.Theming.Json.JsonNode
static operator double (JsonNode node)
 Reads either numeric kind using invariant double parsing.
static operator float (JsonNode node)
 Converts a numeric scalar through double to float.
static operator int (JsonNode node)
 Reads a lexical integer within Int32 range; float/exponent kinds are not accepted.
static implicit operator JsonNode (bool value)
 Creates a boolean scalar without parsing text.
static implicit operator JsonNode (double value)
 Creates a finite floating scalar using invariant round-trip spelling.
static implicit operator JsonNode (float value)
 Creates a finite floating scalar using invariant round-trip spelling.
static implicit operator JsonNode (int value)
 Creates an invariant lexical integer scalar.
static implicit operator JsonNode (string value)
 Creates a string scalar; null produces an explicit JSON-null node.
static operator string (JsonNode node)
 Reads a string scalar, or null for absent/JSON-null input.
static string Quote (string value)
 Encodes a JSON string, including control characters and surrogate code units.

Properties

int Count [get]
 Gets current number of named properties.
override JsonNode this[string key] [get, set]
 Gets a named node or null if missing; assigns/replaces without changing existing key order.
override JsonKind Type [get]
 Gets Object kind.
Properties inherited from GWG.WindowFramework.Theming.Json.JsonNode
virtual JsonNode this[string key] [get, set]
 Named object access; the base implementation throws when a subtype is not an object.
JsonKind Type [get]
 Gets this node's exact JSON kind; lexical integer and float kinds are distinct.

Private Attributes

readonly Dictionary< string, JsonProperty > _lookup = new Dictionary<string, JsonProperty>(StringComparer.Ordinal)
readonly List< JsonProperty > _properties = new List<JsonProperty>()

Detailed Description

Ordered object with ordinal, case-sensitive unique keys.

Constructor & Destructor Documentation

◆ JsonObject() [1/2]

GWG.WindowFramework.Theming.Json.JsonObject.JsonObject ( )
inline

Creates an empty independently owned ordered object.

Here is the caller graph for this function:

◆ JsonObject() [2/2]

GWG.WindowFramework.Theming.Json.JsonObject.JsonObject ( JsonProperty property)
inline

Creates an object containing the supplied property value reference.

Parameters
propertyNonnull property; its node is borrowed unless cloned beforehand.

Member Function Documentation

◆ DeepClone()

override JsonNode GWG.WindowFramework.Theming.Json.JsonObject.DeepClone ( )
inline

Copies this object and all descendant mutable nodes.

Returns
Independent ordered object tree retaining value kinds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Parse()

JsonObject GWG.WindowFramework.Theming.Json.JsonObject.Parse ( string json)
inlinestatic

Parses one strict object with unique keys, maximum depth eight and 256 KiB UTF-8 input.

Parameters
jsonNonnull strict JSON object text; comments/trailing data are refused.
Returns
New independently mutable data object; not a validated theme manifest.
Exceptions
JsonParseExceptionSyntax, duplicate key, trailing data, resource limit or nonfinite number.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Properties()

IEnumerable< JsonProperty > GWG.WindowFramework.Theming.Json.JsonObject.Properties ( )
inline

Enumerates stored properties in insertion order.

Returns
Read-only list view; referenced nodes remain mutable and are not cloned.

Do not mutate the object while enumerating it or assume thread safety.

Field Documentation

◆ _lookup

readonly Dictionary<string, JsonProperty> GWG.WindowFramework.Theming.Json.JsonObject._lookup = new Dictionary<string, JsonProperty>(StringComparer.Ordinal)
private

◆ _properties

readonly List<JsonProperty> GWG.WindowFramework.Theming.Json.JsonObject._properties = new List<JsonProperty>()
private

Property Documentation

◆ Count

int GWG.WindowFramework.Theming.Json.JsonObject.Count
get

Gets current number of named properties.

◆ this[string key]

override JsonNode GWG.WindowFramework.Theming.Json.JsonObject.this[string key]
getset

Gets a named node or null if missing; assigns/replaces without changing existing key order.

Parameters
keyNonnull ordinal case-sensitive name.

Null assigned values become explicit JSON null. Assignment retains node references; DeepClone to prevent shared mutable subtrees. The API replaces duplicate assigned keys, whereas the parser rejects duplicate keys in input.

◆ Type

override JsonKind GWG.WindowFramework.Theming.Json.JsonObject.Type
get

Gets Object kind.