[dali_2.3.20] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / builder / builder-impl-debug.h
1 #ifndef DALI_TOOLKIT_INTERNAL_BUILDER_IMPL_DEBUG_H
2 #define DALI_TOOLKIT_INTERNAL_BUILDER_IMPL_DEBUG_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #include <dali-toolkit/devel-api/builder/json-parser.h>
21 #include <dali/integration-api/debug.h>
22
23 #if defined(DEBUG_ENABLED)
24
25 namespace Dali
26 {
27 namespace Toolkit
28 {
29 namespace Internal
30 {
31 #define DUMP_PARSE_TREE(parser) LogTree(parser)
32 #define DUMP_TEST_MAPPINGS(parser)                                                                 \
33   OptionalChild mappings = IsChild(parser.GetRoot(), KEYNAME_MAPPINGS);                            \
34   if(mappings)                                                                                     \
35   {                                                                                                \
36     std::ostringstream oss;                                                                        \
37     oss << "Mappings: {" << std::endl;                                                             \
38     for(TreeNode::ConstIterator iter = (*mappings).CBegin(); iter != (*mappings).CEnd(); ++iter)   \
39     {                                                                                              \
40       Property::Value value;                                                                       \
41       bool            converted = GetPropertyMap(*mappings, (*iter).first, Property::NONE, value); \
42       if(converted)                                                                                \
43       {                                                                                            \
44         oss << "  " << (*iter).first << ":" << value << std::endl;                                 \
45       }                                                                                            \
46     }                                                                                              \
47     oss << "}" << std::endl;                                                                       \
48     DALI_LOG_INFO(gFilterScript, Debug::Verbose, oss.str().c_str());                               \
49   }
50
51 void LogTree(const Toolkit::JsonParser& mParser);
52
53 std::string PropertyValueToString(const Property::Value& value);
54
55 } // namespace Internal
56 } // namespace Toolkit
57 } // namespace Dali
58
59 #else
60
61 #define DUMP_PARSE_TREE(parser)
62 #define DUMP_TEST_MAPPINGS(parser)
63
64 #endif // DEBUG_ENABLED
65 #endif // DALI_TOOLKIT_INTERNAL_BUILDER_IMPL_DEBUG_H