forked from ln-dotnet/ln.json
39 lines
801 B
C#
39 lines
801 B
C#
|
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();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|