diff options
Diffstat (limited to 'src/core/basetypes/MCJSON.h')
-rw-r--r-- | src/core/basetypes/MCJSON.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/core/basetypes/MCJSON.h b/src/core/basetypes/MCJSON.h new file mode 100644 index 00000000..4f4ba761 --- /dev/null +++ b/src/core/basetypes/MCJSON.h @@ -0,0 +1,50 @@ +// +// MCJSON.h +// hermes +// +// Created by DINH Viêt Hoà on 4/8/13. +// Copyright (c) 2013 MailCore. All rights reserved. +// + +#ifndef __MAILCORE_MCJSON_H_ +#define __MAILCORE_MCJSON_H_ + +#include <MailCore/MCObject.h> +#include <MailCore/MCHashMap.h> +#include <MailCore/MCArray.h> +#include <MailCore/MCValue.h> +#include <MailCore/MCString.h> +#include <MailCore/MCData.h> + +namespace mailcore { + + class Null; + + class JSON { + public: + static String * objectToJSONString(Object * object, bool pretty = false); + static Data * objectToJSONData(Object * object, bool pretty = false); + static Object * objectFromJSONString(String * json); + static Object * objectFromJSONData(Data * json); + + private: + static void * hashMapToJSON(HashMap * hashmap); + static void * arrayToJSON(Array * array); + static void * stringToJSON(String * string); + static void * doubleToJSON(Value * value); + static void * boolToJSON(Value * value); + static void * nullToJSON(Null * value); + static void * objectToJSON(Object * object); + + static HashMap * hashMapFromJSON(void * json); + static Array * arrayFromJSON(void * json); + static String * stringFromJSON(void * json); + static Value * doubleFromJSON(void * json); + static Value * boolFromJSON(void * json); + static Null * nullFromJSON(void * json); + static Object * objectFromJSON(void * json); + }; + +} + +#endif /* defined(__hermes__MCJSON__) */ |