+ std::string stringConfigValue;
+ if( property.Get( stringConfigValue ) )
+ {
+ std::size_t pos = 0;
+
+ while( pos < stringConfigValue.size() )
+ {
+ // If we can't find "{","}" pair in stringConfigValue, will out loop.
+ std::size_t leftPos = stringConfigValue.find( "{", pos );
+ if( leftPos != std::string::npos )
+ {
+ std::size_t rightPos = stringConfigValue.find( "}", pos+1 );
+
+ if( rightPos != std::string::npos )
+ {
+ // If we find "{","}" pair but can't find matched constant
+ // try to find other "{","}" pair after current left position.
+ pos = leftPos+1;
+
+ for( uint32_t i = 0; i < mReplacementMap.Count() ; i++ )
+ {
+ Property::Key constant = mReplacementMap.GetKeyAt(i);
+
+ // Compare string which is between "{" and "}" with constant string
+ // If they are same, change string in stringConfigValue to mapped constant value.
+ if ( 0 == stringConfigValue.compare( leftPos+1, rightPos-leftPos-1, constant.stringKey ) )
+ {
+ std::string replaceString;
+ mReplacementMap.GetValue(i).Get( replaceString );
+
+ stringConfigValue.replace( leftPos, rightPos-leftPos+1, replaceString );
+ pos = leftPos + replaceString.size();
+ break;
+ }
+ }
+ }
+ else
+ {
+ // If we cannot find constant in const value, will out loop.
+ pos = stringConfigValue.size();
+ }
+ }
+ else
+ {
+ // If we cannot find constant in const value, will out loop.
+ pos = stringConfigValue.size();
+ }
+ }
+ property = Property::Value( stringConfigValue );
+ }
+ }
+ intoMap[ (*iter).second.GetName() ] = property;
+ }
+ }
+ }
+}
+
+void Builder::LoadConstants( const TreeNode& root, Property::Map& intoMap )
+{
+ Replacement replacer(intoMap);
+
+ if( OptionalChild constants = IsChild(root, "constants") )
+ {
+ for(TreeNode::ConstIterator iter = (*constants).CBegin();
+ iter != (*constants).CEnd(); ++iter)
+ {
+ Dali::Property::Value property;
+ if( (*iter).second.GetName() )
+ {
+#if defined(DEBUG_ENABLED)
+ DALI_SCRIPT_VERBOSE("Constant set from json '%s'\n", (*iter).second.GetName());
+#endif
+ DeterminePropertyFromNode( (*iter).second, property, replacer );
+ intoMap[ (*iter).second.GetName() ] = property;
+ }
+ }
+ }
+
+#if defined(DEBUG_ENABLED)
+ Property::Value* iter = intoMap.Find( "CONFIG_SCRIPT_LOG_LEVEL" );
+ if( iter && iter->GetType() == Property::STRING )
+ {
+ std::string logLevel( iter->Get< std::string >() );
+ if( logLevel == "NoLogging" )
+ {
+ gFilterScript->SetLogLevel( Integration::Log::NoLogging );
+ }
+ else if( logLevel == "Concise" )
+ {
+ gFilterScript->SetLogLevel( Integration::Log::Concise );
+ }
+ else if( logLevel == "General" )
+ {
+ gFilterScript->SetLogLevel( Integration::Log::General );
+ }
+ else if( logLevel == "Verbose" )
+ {
+ gFilterScript->SetLogLevel( Integration::Log::Verbose );