ln.json/JSONSpecial.cs

39 lines
801 B
C#
Raw Normal View History

2017-10-26 16:41:14 +02:00
using System;
namespace sharp.json
{
public class JSONSpecial: JSON
{
public static readonly JSON True = new JSONSpecial(JSONTypes.True);
public static readonly JSON False = new JSONSpecial(JSONTypes.False);
public static readonly JSON Null = new JSONSpecial(JSONTypes.Null);
private JSONSpecial(JSONTypes type)
:base(type)
{
}
public override bool isTrue()
{
return (JSONType == JSONTypes.True);
}
public override string prettyPrint(int d = 0)
{
switch (JSONType){
case JSONTypes.Null:
return "null";
case JSONTypes.True:
return "true";
case JSONTypes.False:
return "false";
}
throw new NotImplementedException("JSON Special Type badly wrong....");
}
public override string ToString()
{
return prettyPrint();
}
}
}