![]() |
UnityMol
0.9.6-875
UnityMol viewer / In developement
|
Static Public Member Functions | |
static object | JsonDecode (string json) |
static string | JsonEncode (object json) |
static bool | LastDecodeSuccessful () |
static int | GetLastErrorIndex () |
static string | GetLastErrorSnippet () |
Public Attributes | |
const int | TOKEN_NONE = 0 |
const int | TOKEN_CURLY_OPEN = 1 |
const int | TOKEN_CURLY_CLOSE = 2 |
const int | TOKEN_SQUARED_OPEN = 3 |
const int | TOKEN_SQUARED_CLOSE = 4 |
const int | TOKEN_COLON = 5 |
const int | TOKEN_COMMA = 6 |
const int | TOKEN_STRING = 7 |
const int | TOKEN_NUMBER = 8 |
const int | TOKEN_TRUE = 9 |
const int | TOKEN_FALSE = 10 |
const int | TOKEN_NULL = 11 |
Protected Member Functions | |
Hashtable | ParseObject (char[] json, ref int index) |
ArrayList | ParseArray (char[] json, ref int index) |
object | ParseValue (char[] json, ref int index, ref bool success) |
string | ParseString (char[] json, ref int index) |
double | ParseNumber (char[] json, ref int index) |
int | GetLastIndexOfNumber (char[] json, int index) |
void | EatWhitespace (char[] json, ref int index) |
int | LookAhead (char[] json, int index) |
int | NextToken (char[] json, ref int index) |
bool | SerializeObjectOrArray (object objectOrArray, StringBuilder builder) |
bool | SerializeObject (Hashtable anObject, StringBuilder builder) |
bool | SerializeArray (ArrayList anArray, StringBuilder builder) |
bool | SerializeValue (object value, StringBuilder builder) |
void | SerializeString (string aString, StringBuilder builder) |
void | SerializeNumber (double number, StringBuilder builder) |
Protected Attributes | |
int | lastErrorIndex = -1 |
string | lastDecode = "" |
Static Protected Attributes | |
static MiniJSON | instance = new MiniJSON() |
Private Attributes | |
const int | BUILDER_CAPACITY = 2000 |
This class encodes and decodes JSON strings.
Spec. details, see http://www.json.org/
JSON uses Arrays and Objects. These correspond here to the datatypes ArrayList and Hashtable. All numbers are parsed to doubles.
Definition at line 84 of file MiniJSON.cs.
|
protected |
Definition at line 417 of file MiniJSON.cs.
Referenced by NextToken(), ParseNumber(), and ParseString().
|
static |
On decoding, this function returns the position at which the parse failed (-1 = no error).
Definition at line 175 of file MiniJSON.cs.
References instance, and lastErrorIndex.
|
static |
If a decoding error occurred, this function returns a piece of the JSON string at which the error took place.
To ease debugging.
Definition at line 185 of file MiniJSON.cs.
References instance, lastDecode, and lastErrorIndex.
|
protected |
Definition at line 406 of file MiniJSON.cs.
Referenced by ParseNumber().
|
static |
Parses the string json into a value
json | A JSON string. |
Definition at line 114 of file MiniJSON.cs.
References instance, lastDecode, lastErrorIndex, and ParseValue().
Referenced by ParseData.ParsePDB.ReadJson.ReadFile().
|
static |
Converts a Hashtable / ArrayList object into a JSON string
json | A Hashtable / ArrayList |
Definition at line 155 of file MiniJSON.cs.
References instance, and SerializeValue().
|
static |
On decoding, this function returns the position at which the parse failed (-1 = no error).
Definition at line 166 of file MiniJSON.cs.
References instance, and lastErrorIndex.
|
protected |
Definition at line 426 of file MiniJSON.cs.
References NextToken().
Referenced by ParseArray(), ParseObject(), and ParseValue().
|
protected |
Definition at line 432 of file MiniJSON.cs.
References EatWhitespace(), TOKEN_COLON, TOKEN_COMMA, TOKEN_CURLY_CLOSE, TOKEN_CURLY_OPEN, TOKEN_FALSE, TOKEN_NONE, TOKEN_NULL, TOKEN_NUMBER, TOKEN_SQUARED_CLOSE, TOKEN_SQUARED_OPEN, TOKEN_STRING, and TOKEN_TRUE.
Referenced by LookAhead(), ParseArray(), ParseObject(), and ParseValue().
|
protected |
Definition at line 249 of file MiniJSON.cs.
References LookAhead(), NextToken(), ParseValue(), TOKEN_COMMA, TOKEN_NONE, and TOKEN_SQUARED_CLOSE.
Referenced by ParseValue().
|
protected |
Definition at line 393 of file MiniJSON.cs.
References EatWhitespace(), and GetLastIndexOfNumber().
Referenced by ParseValue().
|
protected |
Definition at line 203 of file MiniJSON.cs.
References LookAhead(), NextToken(), ParseString(), ParseValue(), TOKEN_COLON, TOKEN_COMMA, TOKEN_CURLY_CLOSE, and TOKEN_NONE.
Referenced by ParseValue().
|
protected |
Definition at line 316 of file MiniJSON.cs.
References EatWhitespace().
Referenced by ParseObject(), and ParseValue().
|
protected |
Definition at line 280 of file MiniJSON.cs.
References LookAhead(), NextToken(), ParseArray(), ParseNumber(), ParseObject(), ParseString(), TOKEN_CURLY_OPEN, TOKEN_FALSE, TOKEN_NONE, TOKEN_NULL, TOKEN_NUMBER, TOKEN_SQUARED_OPEN, TOKEN_STRING, and TOKEN_TRUE.
Referenced by JsonDecode(), ParseArray(), and ParseObject().
|
protected |
Definition at line 541 of file MiniJSON.cs.
References SerializeValue().
Referenced by SerializeObjectOrArray(), and SerializeValue().
|
protected |
Definition at line 631 of file MiniJSON.cs.
Referenced by SerializeValue().
|
protected |
Definition at line 514 of file MiniJSON.cs.
References SerializeString(), and SerializeValue().
Referenced by SerializeObjectOrArray(), and SerializeValue().
|
protected |
Definition at line 503 of file MiniJSON.cs.
References SerializeArray(), and SerializeObject().
|
protected |
Definition at line 597 of file MiniJSON.cs.
Referenced by SerializeObject(), and SerializeValue().
|
protected |
Definition at line 564 of file MiniJSON.cs.
References SerializeArray(), SerializeNumber(), SerializeObject(), and SerializeString().
Referenced by JsonEncode(), SerializeArray(), and SerializeObject().
|
private |
Definition at line 99 of file MiniJSON.cs.
Definition at line 101 of file MiniJSON.cs.
Referenced by GetLastErrorIndex(), GetLastErrorSnippet(), JsonDecode(), JsonEncode(), and LastDecodeSuccessful().
|
protected |
Definition at line 107 of file MiniJSON.cs.
Referenced by GetLastErrorSnippet(), and JsonDecode().
|
protected |
On decoding, this value holds the position at which the parse failed (-1 = no error).
Definition at line 106 of file MiniJSON.cs.
Referenced by GetLastErrorIndex(), GetLastErrorSnippet(), JsonDecode(), and LastDecodeSuccessful().
const int MiniJSON.TOKEN_COLON = 5 |
Definition at line 91 of file MiniJSON.cs.
Referenced by NextToken(), and ParseObject().
const int MiniJSON.TOKEN_COMMA = 6 |
Definition at line 92 of file MiniJSON.cs.
Referenced by NextToken(), ParseArray(), and ParseObject().
const int MiniJSON.TOKEN_CURLY_CLOSE = 2 |
Definition at line 88 of file MiniJSON.cs.
Referenced by NextToken(), and ParseObject().
const int MiniJSON.TOKEN_CURLY_OPEN = 1 |
Definition at line 87 of file MiniJSON.cs.
Referenced by NextToken(), and ParseValue().
const int MiniJSON.TOKEN_FALSE = 10 |
Definition at line 96 of file MiniJSON.cs.
Referenced by NextToken(), and ParseValue().
const int MiniJSON.TOKEN_NONE = 0 |
Definition at line 86 of file MiniJSON.cs.
Referenced by NextToken(), ParseArray(), ParseObject(), and ParseValue().
const int MiniJSON.TOKEN_NULL = 11 |
Definition at line 97 of file MiniJSON.cs.
Referenced by NextToken(), and ParseValue().
const int MiniJSON.TOKEN_NUMBER = 8 |
Definition at line 94 of file MiniJSON.cs.
Referenced by NextToken(), and ParseValue().
const int MiniJSON.TOKEN_SQUARED_CLOSE = 4 |
Definition at line 90 of file MiniJSON.cs.
Referenced by NextToken(), and ParseArray().
const int MiniJSON.TOKEN_SQUARED_OPEN = 3 |
Definition at line 89 of file MiniJSON.cs.
Referenced by NextToken(), and ParseValue().
const int MiniJSON.TOKEN_STRING = 7 |
Definition at line 93 of file MiniJSON.cs.
Referenced by NextToken(), and ParseValue().
const int MiniJSON.TOKEN_TRUE = 9 |
Definition at line 95 of file MiniJSON.cs.
Referenced by NextToken(), and ParseValue().