Merge "Fix RemoveText code in text-controller.cpp" into 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) 2016 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/integration-api/debug.h>
21 #include <dali-toolkit/devel-api/builder/json-parser.h>
22
23 #if defined( DEBUG_ENABLED )
24
25 namespace Dali
26 {
27 namespace Toolkit
28 {
29 namespace Internal
30 {
31
32 #define DUMP_PARSE_TREE(parser)  LogTree(parser)
33 #define DUMP_TEST_MAPPINGS(parser)                                      \
34   OptionalChild mappings = IsChild( parser.GetRoot(), KEYNAME_MAPPINGS ); \
35   if( mappings )                                                        \
36   {                                                                     \
37     std::ostringstream oss;                                             \
38     oss << "Mappings: {" << std::endl;                                  \
39     for( TreeNode::ConstIterator iter = (*mappings).CBegin(); iter != (*mappings).CEnd(); ++iter ) \
40     {                                                                   \
41       Property::Value value;                                            \
42       bool converted = GetPropertyMap(*mappings, (*iter).first, Property::NONE, value ); \
43       if( converted )                                                   \
44       {                                                                 \
45         oss << "  " << (*iter).first << ":" << value << std::endl;      \
46       }                                                                 \
47     }                                                                   \
48     oss << "}" << std::endl;                                            \
49     DALI_LOG_INFO( gFilterScript, Debug::Verbose, oss.str().c_str() );  \
50   }
51
52
53 void LogTree( const Toolkit::JsonParser& mParser );
54
55 std::string PropertyValueToString( const Property::Value& value );
56
57
58 } // Internal
59 } // Toolkit
60 } // Dali
61
62 #else
63
64 #define DUMP_PARSE_TREE(parser)
65 #define DUMP_TEST_MAPPINGS(parser)
66
67 #endif // DEBUG_ENABLED
68 #endif // DALI_TOOLKIT_INTERNAL_BUILDER_IMPL_DEBUG_H