[dali_2.3.19] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / builder / json-parser.cpp
1 /*
2  * Copyright (c) 2020 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/devel-api/builder/json-parser.h>
20
21 // EXTERNAL INCLUDES
22 #include <memory.h>
23 #include <algorithm>
24 #include <cstring>
25 #include <functional>
26 #include <iostream>
27
28 // INTERNAL INCLUDES
29 #include <dali-toolkit/internal/builder/json-parser-impl.h>
30
31 namespace Dali
32 {
33 namespace Toolkit
34 {
35 JsonParser JsonParser::New()
36 {
37   Internal::JsonParser* internal = new Internal::JsonParser();
38   return JsonParser(internal);
39 }
40
41 JsonParser JsonParser::New(const TreeNode& tree)
42 {
43   Internal::JsonParser* internal = new Internal::JsonParser(tree);
44   return JsonParser(internal);
45 }
46
47 JsonParser::JsonParser()
48 {
49 }
50
51 JsonParser::~JsonParser()
52 {
53 }
54
55 JsonParser JsonParser::DownCast(BaseHandle handle)
56 {
57   return JsonParser(dynamic_cast<Internal::JsonParser*>(handle.GetObjectPtr()));
58 }
59
60 bool JsonParser::Parse(const std::string& source)
61 {
62   return GetImplementation(*this).Parse(source);
63 }
64
65 void JsonParser::Pack(void)
66 {
67   return GetImplementation(*this).Pack();
68 }
69
70 const TreeNode* JsonParser::GetRoot() const
71 {
72   return GetImplementation(*this).GetRoot();
73 }
74
75 bool JsonParser::ParseError() const
76 {
77   return GetImplementation(*this).ParseError();
78 }
79
80 int JsonParser::GetErrorPosition() const
81 {
82   return GetImplementation(*this).GetErrorPosition();
83 }
84
85 std::string JsonParser::GetErrorDescription() const
86 {
87   return GetImplementation(*this).GetErrorDescription();
88 }
89
90 int JsonParser::GetErrorLineNumber() const
91 {
92   return GetImplementation(*this).GetErrorLineNumber();
93 }
94
95 int JsonParser::GetErrorColumn() const
96 {
97   return GetImplementation(*this).GetErrorColumn();
98 }
99
100 void JsonParser::Write(std::ostream& output, int indent) const
101 {
102   return GetImplementation(*this).Write(output, indent);
103 }
104
105 JsonParser::JsonParser(Internal::JsonParser* internal)
106 : BaseHandle(internal)
107 {
108 }
109
110 } // namespace Toolkit
111
112 } // namespace Dali