Interhaptics SDK for Unity 1.6
Loading...
Searching...
No Matches
SimpleJSON.JSONObject Class Reference
Inheritance diagram for SimpleJSON.JSONObject:
SimpleJSON.JSONNode

Public Member Functions

override Enumerator GetEnumerator ()
 
override void Add (string aKey, JSONNode aItem)
 
override JSONNode Remove (string aKey)
 
override JSONNode Remove (int aIndex)
 
override JSONNode Remove (JSONNode aNode)
 
override JSONNode Clone ()
 
override bool HasKey (string aKey)
 
override JSONNode GetValueOrDefault (string aKey, JSONNode aDefault)
 
- Public Member Functions inherited from SimpleJSON.JSONNode
virtual void Add (JSONNode aItem)
 
override string ToString ()
 
virtual string ToString (int aIndent)
 
Enumerator GetEnumerator ()
 
override bool Equals (object obj)
 
override int GetHashCode ()
 

Properties

override bool Inline [get, set]
 
override JSONNodeType Tag [get]
 
override bool IsObject [get]
 
override JSONNode this[string aKey] [get, set]
 
override JSONNode this[int aIndex] [get, set]
 
override int Count [get]
 
override IEnumerable< JSONNodeChildren [get]
 
- Properties inherited from SimpleJSON.JSONNode
JSONNodeType Tag [get]
 
virtual JSONNode this[int aIndex] [get, set]
 
virtual JSONNode this[string aKey] [get, set]
 
virtual string Value [get, set]
 
virtual int Count [get]
 
virtual bool IsNumber [get]
 
virtual bool IsString [get]
 
virtual bool IsBoolean [get]
 
virtual bool IsNull [get]
 
virtual bool IsArray [get]
 
virtual bool IsObject [get]
 
virtual bool Inline [get, set]
 
virtual IEnumerable< JSONNodeChildren [get]
 
IEnumerable< JSONNodeDeepChildren [get]
 
IEnumerable< KeyValuePair< string, JSONNode > > Linq [get]
 
KeyEnumerator Keys [get]
 
ValueEnumerator Values [get]
 
virtual double AsDouble [get, set]
 
virtual int AsInt [get, set]
 
virtual float AsFloat [get, set]
 
virtual bool AsBool [get, set]
 
virtual long AsLong [get, set]
 
virtual JSONArray AsArray [get]
 
virtual JSONObject AsObject [get]
 

Additional Inherited Members

- Static Public Member Functions inherited from SimpleJSON.JSONNode
static implicit operator JSONNode (string s)
 
static implicit operator string (JSONNode d)
 
static implicit operator JSONNode (double n)
 
static implicit operator double (JSONNode d)
 
static implicit operator JSONNode (float n)
 
static implicit operator float (JSONNode d)
 
static implicit operator JSONNode (int n)
 
static implicit operator int (JSONNode d)
 
static implicit operator JSONNode (long n)
 
static implicit operator long (JSONNode d)
 
static implicit operator JSONNode (bool b)
 
static implicit operator bool (JSONNode d)
 
static implicit operator JSONNode (KeyValuePair< string, JSONNode > aKeyValue)
 
static bool operator== (JSONNode a, object b)
 
static bool operator!= (JSONNode a, object b)
 
static JSONNode Parse (string aJSON)
 
- Static Public Attributes inherited from SimpleJSON.JSONNode
static bool forceASCII = false
 
static bool longAsString = false
 
static bool allowLineComments = true
 

Detailed Description

Definition at line 804 of file SimpleJSON.cs.

Member Function Documentation

◆ Add()

override void SimpleJSON.JSONObject.Add ( string aKey,
JSONNode aItem )
virtual

Reimplemented from SimpleJSON.JSONNode.

Definition at line 865 of file SimpleJSON.cs.

866 {
867 if (aItem == null)
868 aItem = JSONNull.CreateOrGet();
869
870 if (aKey != null)
871 {
872 if (m_Dict.ContainsKey(aKey))
873 m_Dict[aKey] = aItem;
874 else
875 m_Dict.Add(aKey, aItem);
876 }
877 else
878 m_Dict.Add(Guid.NewGuid().ToString(), aItem);
879 }

References SimpleJSON.JSONNode.Add(), and SimpleJSON.JSONNull.CreateOrGet().

◆ Clone()

override JSONNode SimpleJSON.JSONObject.Clone ( )
virtual

Reimplemented from SimpleJSON.JSONNode.

Definition at line 913 of file SimpleJSON.cs.

914 {
915 var node = new JSONObject();
916 foreach (var n in m_Dict)
917 {
918 node.Add(n.Key, n.Value.Clone());
919 }
920 return node;
921 }

◆ GetEnumerator()

override Enumerator SimpleJSON.JSONObject.GetEnumerator ( )

Definition at line 818 of file SimpleJSON.cs.

818{ return new Enumerator(m_Dict.GetEnumerator()); }

◆ GetValueOrDefault()

override JSONNode SimpleJSON.JSONObject.GetValueOrDefault ( string aKey,
JSONNode aDefault )
virtual

Reimplemented from SimpleJSON.JSONNode.

Definition at line 928 of file SimpleJSON.cs.

929 {
930 JSONNode res;
931 if (m_Dict.TryGetValue(aKey, out res))
932 return res;
933 return aDefault;
934 }

◆ HasKey()

override bool SimpleJSON.JSONObject.HasKey ( string aKey)
virtual

Reimplemented from SimpleJSON.JSONNode.

Definition at line 923 of file SimpleJSON.cs.

924 {
925 return m_Dict.ContainsKey(aKey);
926 }

◆ Remove() [1/3]

override JSONNode SimpleJSON.JSONObject.Remove ( int aIndex)
virtual

Reimplemented from SimpleJSON.JSONNode.

Definition at line 890 of file SimpleJSON.cs.

891 {
892 if (aIndex < 0 || aIndex >= m_Dict.Count)
893 return null;
894 var item = m_Dict.ElementAt(aIndex);
895 m_Dict.Remove(item.Key);
896 return item.Value;
897 }

References SimpleJSON.JSONNode.Remove(), and SimpleJSON.JSONNode.Value.

◆ Remove() [2/3]

override JSONNode SimpleJSON.JSONObject.Remove ( JSONNode aNode)
virtual

Reimplemented from SimpleJSON.JSONNode.

Definition at line 899 of file SimpleJSON.cs.

900 {
901 try
902 {
903 var item = m_Dict.Where(k => k.Value == aNode).First();
904 m_Dict.Remove(item.Key);
905 return aNode;
906 }
907 catch
908 {
909 return null;
910 }
911 }

References SimpleJSON.JSONNode.Remove().

◆ Remove() [3/3]

override JSONNode SimpleJSON.JSONObject.Remove ( string aKey)
virtual

Reimplemented from SimpleJSON.JSONNode.

Definition at line 881 of file SimpleJSON.cs.

882 {
883 if (!m_Dict.ContainsKey(aKey))
884 return null;
885 JSONNode tmp = m_Dict[aKey];
886 m_Dict.Remove(aKey);
887 return tmp;
888 }

References SimpleJSON.JSONNode.Remove().

Property Documentation

◆ Children

override IEnumerable<JSONNode> SimpleJSON.JSONObject.Children
get

Definition at line 936 of file SimpleJSON.cs.

937 {
938 get
939 {
940 foreach (KeyValuePair<string, JSONNode> N in m_Dict)
941 yield return N.Value;
942 }
943 }

◆ Count

override int SimpleJSON.JSONObject.Count
get

Definition at line 860 of file SimpleJSON.cs.

861 {
862 get { return m_Dict.Count; }
863 }

◆ Inline

override bool SimpleJSON.JSONObject.Inline
getset

Definition at line 809 of file SimpleJSON.cs.

810 {
811 get { return inline; }
812 set { inline = value; }
813 }

◆ IsObject

override bool SimpleJSON.JSONObject.IsObject
get

Definition at line 816 of file SimpleJSON.cs.

816{ get { return true; } }

◆ Tag

override JSONNodeType SimpleJSON.JSONObject.Tag
get

Definition at line 815 of file SimpleJSON.cs.

815{ get { return JSONNodeType.Object; } }

◆ this[int aIndex]

override JSONNode SimpleJSON.JSONObject.this[int aIndex]
getset

Definition at line 841 of file SimpleJSON.cs.

842 {
843 get
844 {
845 if (aIndex < 0 || aIndex >= m_Dict.Count)
846 return null;
847 return m_Dict.ElementAt(aIndex).Value;
848 }
849 set
850 {
851 if (value == null)
852 value = JSONNull.CreateOrGet();
853 if (aIndex < 0 || aIndex >= m_Dict.Count)
854 return;
855 string key = m_Dict.ElementAt(aIndex).Key;
856 m_Dict[key] = value;
857 }
858 }

◆ this[string aKey]

override JSONNode SimpleJSON.JSONObject.this[string aKey]
getset

Definition at line 821 of file SimpleJSON.cs.

822 {
823 get
824 {
825 if (m_Dict.ContainsKey(aKey))
826 return m_Dict[aKey];
827 else
828 return new JSONLazyCreator(this, aKey);
829 }
830 set
831 {
832 if (value == null)
833 value = JSONNull.CreateOrGet();
834 if (m_Dict.ContainsKey(aKey))
835 m_Dict[aKey] = value;
836 else
837 m_Dict.Add(aKey, value);
838 }
839 }

The documentation for this class was generated from the following file: