IJsonWrapper.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #region Header
  2. /**
  3. * IJsonWrapper.cs
  4. * Interface that represents a type capable of handling all kinds of JSON
  5. * data. This is mainly used when mapping objects through JsonMapper, and
  6. * it's implemented by JsonData.
  7. *
  8. * The authors disclaim copyright to this source code. For more details, see
  9. * the COPYING file included with this distribution.
  10. **/
  11. #endregion
  12. using System.Collections;
  13. using System.Collections.Specialized;
  14. namespace BestHTTP.JSON.LitJson
  15. {
  16. public enum JsonType
  17. {
  18. None,
  19. Object,
  20. Array,
  21. String,
  22. Int,
  23. Long,
  24. Double,
  25. Boolean
  26. }
  27. public interface IOrderedDictionary : IDictionary
  28. {
  29. new IDictionaryEnumerator GetEnumerator();
  30. void Insert(int index, object key, object value);
  31. void RemoveAt(int index);
  32. object this[int index]
  33. {
  34. get;
  35. set;
  36. }
  37. }
  38. public interface IJsonWrapper : IList, IOrderedDictionary
  39. {
  40. bool IsArray { get; }
  41. bool IsBoolean { get; }
  42. bool IsDouble { get; }
  43. bool IsInt { get; }
  44. bool IsLong { get; }
  45. bool IsObject { get; }
  46. bool IsString { get; }
  47. bool GetBoolean ();
  48. double GetDouble ();
  49. int GetInt ();
  50. JsonType GetJsonType ();
  51. long GetLong ();
  52. string GetString ();
  53. void SetBoolean (bool val);
  54. void SetDouble (double val);
  55. void SetInt (int val);
  56. void SetJsonType (JsonType type);
  57. void SetLong (long val);
  58. void SetString (string val);
  59. string ToJson ();
  60. void ToJson (JsonWriter writer);
  61. }
  62. }