| Line | |
|---|
| 1 | using System;
|
|---|
| 2 | using System.Text;
|
|---|
| 3 |
|
|---|
| 4 | namespace AllocsFixes.JSON {
|
|---|
| 5 | public class JsonNull : JsonValue {
|
|---|
| 6 | public override void ToString (StringBuilder _stringBuilder, bool _prettyPrint = false, int _currentLevel = 0) {
|
|---|
| 7 | _stringBuilder.Append ("null");
|
|---|
| 8 | }
|
|---|
| 9 |
|
|---|
| 10 | public static JsonNull Parse (string _json, ref int _offset) {
|
|---|
| 11 | //Log.Out ("ParseNull enter (" + offset + ")");
|
|---|
| 12 |
|
|---|
| 13 | if (!_json.Substring (_offset, 4).Equals ("null")) {
|
|---|
| 14 | throw new MalformedJsonException ("No valid null value found");
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | //Log.Out ("JSON:Parsed Null");
|
|---|
| 18 | _offset += 4;
|
|---|
| 19 | return new JsonNull ();
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | public override string AsString => throw new NotSupportedException ();
|
|---|
| 23 | public override int AsInt => throw new NotSupportedException ();
|
|---|
| 24 | public override double AsDouble => throw new NotSupportedException ();
|
|---|
| 25 | }
|
|---|
| 26 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.