1 // This may look like C code, but it's really -*- C++ -*-
2 /*
3  * Copyright (C) 2013 Emweb bv, Herent, Belgium.
4  *
5  * See the LICENSE file for terms of use.
6  */
7 #ifndef WT_JSON_SERIALIZER_H
8 #define WT_JSON_SERIALIZER_H
9 
10 #include <Wt/WDllDefs.h>
11 #include <string>
12 
13 namespace Wt {
14 class EscapeOStream;
15   namespace Json {
16 
17 class Object;
18 class Array;
19 
20 /*! \brief Serialization function for an Object.
21  *
22  * Serializes a Object into a string. All unicode in the object is
23  * UTF-8 encoded in the output. The output is indented to make it
24  * readable. The indentation argument to this function is used in
25  * recursive calls and should not be set.
26  *
27  * \throws WException when the trying to serialize a number which is a Nan
28  *
29  * \ingroup json
30  */
31 std::string WT_API serialize(const Object& obj, int indentation = 1);
32 void serialize(const Object& obj, int indentation, EscapeOStream& result);
33 
34 /*! \brief Serialization function for an Array.
35  *
36  * Serializes a Array into a string. All unicode in the object is
37  * UTF-8 encoded in the output. The output is indented to make it
38  * readable. The indentation argument to this function is used in
39  * recursive calls and should not be set.
40  *
41  * \throws WException when the trying to serialize a number which is a Nan
42  *
43  * \ingroup json
44  */
45 std::string WT_API serialize(const Array& arr, int indentation = 1);
46 void serialize(const Array& arr, int indentation, EscapeOStream& result);
47 
48   }
49 }
50 
51 #endif
52