Merge remote-tracking branch 'origin/tizen' into new_text
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / builder / json-parser.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali-toolkit/public-api/builder/json-parser.h>
20
21 // EXTERNAL INCLUDES
22 #include <memory.h>
23 #include <functional>
24 #include <iostream>
25 #include <vector>
26 #include <cstring>
27 #include <algorithm>
28
29 // INTERNAL INCLUDES
30 #include <dali-toolkit/internal/builder/json-parser-impl.h>
31
32 namespace Dali
33 {
34
35 namespace Toolkit
36 {
37
38 JsonParser JsonParser::New()
39 {
40   Internal::JsonParser* internal = new Internal::JsonParser();
41   return JsonParser(internal);
42 }
43
44 JsonParser JsonParser::New(const TreeNode& tree)
45 {
46   Internal::JsonParser* internal = new Internal::JsonParser(tree);
47   return JsonParser(internal);
48 }
49
50 JsonParser::JsonParser()
51 {
52 }
53
54 JsonParser::~JsonParser()
55 {
56 }
57
58 JsonParser DownCast( BaseHandle handle )
59 {
60   return JsonParser( dynamic_cast<Internal::JsonParser*>(handle.GetObjectPtr()) );
61 }
62
63 int JsonParser::Parse(const std::string& source)
64 {
65   return GetImplementation(*this).Parse(source);
66 }
67
68 void JsonParser::Pack(void)
69 {
70   return GetImplementation(*this).Pack();
71 }
72
73 const TreeNode* JsonParser::GetRoot() const
74 {
75   return GetImplementation(*this).GetRoot();
76 }
77
78 bool JsonParser::ParseError() const
79 {
80   return GetImplementation(*this).ParseError();
81 }
82
83 int JsonParser::GetErrorPosition() const
84 {
85   return GetImplementation(*this).GetErrorPosition();
86 }
87
88 std::string JsonParser::GetErrorDescription() const
89 {
90   return GetImplementation(*this).GetErrorDescription();
91 }
92
93 int JsonParser::GetErrorLineNumber() const
94 {
95   return GetImplementation(*this).GetErrorLineNumber();
96 }
97
98 int JsonParser::GetErrorColumn() const
99 {
100   return GetImplementation(*this).GetErrorColumn();
101 }
102
103 void JsonParser::Write(std::ostream& output, int indent) const
104 {
105   return GetImplementation(*this).Write(output, indent);
106 }
107
108 JsonParser::JsonParser(Internal::JsonParser* internal)
109   : BaseHandle(internal)
110 {
111 }
112
113 } // namespace toolkit
114
115 } // namespace Dali
116