Replace std::string global variables with C-style string. 36/288336/2
authorhuayong.xu <huayong.xu@samsung.com>
Wed, 15 Feb 2023 08:58:50 +0000 (16:58 +0800)
committerhuayong.xu <huayong.xu@samsung.com>
Fri, 17 Feb 2023 01:07:49 +0000 (09:07 +0800)
A std::string global variable would allocate a memory in heap,
then copy the string from .text section to the heap.
This patch may reduce loading time & memory a little.

Change-Id: I2ce22c98695cee6edea088d98b9569e11fc6c837

32 files changed:
dali-scene3d/public-api/loader/blend-shape-details.cpp
dali-scene3d/public-api/loader/blend-shape-details.h
dali-scene3d/public-api/loader/dli-loader.cpp
dali-scene3d/public-api/loader/environment-definition.cpp
dali-scene3d/public-api/loader/gltf2-loader.cpp
dali-scene3d/public-api/loader/mesh-definition.cpp
dali-scene3d/public-api/loader/node-definition.cpp
dali-scene3d/public-api/loader/node-definition.h
dali-scene3d/public-api/loader/scene-definition.cpp
dali-scene3d/public-api/loader/shader-definition.cpp
dali-scene3d/public-api/loader/skinning-details.cpp
dali-scene3d/public-api/loader/skinning-details.h
dali-toolkit/internal/builder/builder-impl.cpp
dali-toolkit/internal/controls/control/control-data-impl.cpp
dali-toolkit/internal/controls/scene3d-view/scene3d-view-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp
dali-toolkit/internal/text/controller/text-controller-event-handler.cpp
dali-toolkit/internal/text/controller/text-controller-impl.cpp
dali-toolkit/internal/text/controller/text-controller-input-font-handler.cpp
dali-toolkit/internal/text/controller/text-controller-input-font-handler.h
dali-toolkit/internal/text/controller/text-controller-input-properties.cpp
dali-toolkit/internal/text/controller/text-controller-input-properties.h
dali-toolkit/internal/text/controller/text-controller-placeholder-handler.cpp
dali-toolkit/internal/text/controller/text-controller-placeholder-handler.h
dali-toolkit/internal/text/controller/text-controller.cpp
dali-toolkit/internal/text/controller/text-controller.h
dali-toolkit/internal/text/markup-processor/markup-processor-embedded-item.cpp
dali-toolkit/internal/text/markup-processor/markup-processor-font.cpp
dali-toolkit/internal/text/markup-processor/markup-processor-helper-functions.cpp
dali-toolkit/internal/text/text-effects-style.cpp
dali-toolkit/internal/text/text-font-style.cpp

index 01601f9..8e0353c 100644 (file)
@@ -32,13 +32,13 @@ namespace Scene3D
 {
 namespace Loader
 {
-const std::string BlendShapes::NUMBER_OF_BLEND_SHAPES("uNumberOfBlendShapes");
-const std::string BlendShapes::UNNORMALIZE_FACTOR("uBlendShapeUnnormalizeFactor");
-const std::string BlendShapes::COMPONENT_SIZE("uBlendShapeComponentSize");
+const char* BlendShapes::NUMBER_OF_BLEND_SHAPES("uNumberOfBlendShapes");
+const char* BlendShapes::UNNORMALIZE_FACTOR("uBlendShapeUnnormalizeFactor");
+const char* BlendShapes::COMPONENT_SIZE("uBlendShapeComponentSize");
 
-const std::string BlendShapes::COMPONENTS("blendShapeComponents");
+const char* BlendShapes::COMPONENTS("blendShapeComponents");
 
-const std::string BlendShapes::WEIGHTS_UNIFORM("uBlendShapeWeight");
+const char* BlendShapes::WEIGHTS_UNIFORM("uBlendShapeWeight");
 
 void BlendShapes::ConfigureProperties(const std::pair<MeshDefinition, MeshGeometry>& mesh, Shader shader, Actor actor)
 {
@@ -46,8 +46,8 @@ void BlendShapes::ConfigureProperties(const std::pair<MeshDefinition, MeshGeomet
 
   char        weightNameBuffer[32];
   char        unnormalizeFactorNameBuffer[64];
-  char* const pWeightName = weightNameBuffer + snprintf(weightNameBuffer, sizeof(weightNameBuffer), "%s", WEIGHTS_UNIFORM.c_str());
-  char* const pFactorName = unnormalizeFactorNameBuffer + snprintf(unnormalizeFactorNameBuffer, sizeof(unnormalizeFactorNameBuffer), "%s", UNNORMALIZE_FACTOR.c_str());
+  char* const pWeightName = weightNameBuffer + snprintf(weightNameBuffer, sizeof(weightNameBuffer), "%s", WEIGHTS_UNIFORM);
+  char* const pFactorName = unnormalizeFactorNameBuffer + snprintf(unnormalizeFactorNameBuffer, sizeof(unnormalizeFactorNameBuffer), "%s", UNNORMALIZE_FACTOR);
   for(const auto& blendShape : mesh.first.mBlendShapes)
   {
     snprintf(pWeightName, sizeof(weightNameBuffer) - (pWeightName - weightNameBuffer), "[%d]", index);
index 168fb09..e2db2a0 100644 (file)
@@ -54,15 +54,15 @@ struct DALI_SCENE3D_API BlendShapes
   };
 
   // shader properties - animatable (uniforms)
-  static const std::string NUMBER_OF_BLEND_SHAPES; ///< Integer number of blend shapes loaded.
-  static const std::string UNNORMALIZE_FACTOR;     ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float.
-  static const std::string COMPONENT_SIZE;         ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next.
+  static const char* NUMBER_OF_BLEND_SHAPES; ///< Integer number of blend shapes loaded.
+  static const char* UNNORMALIZE_FACTOR;     ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float.
+  static const char* COMPONENT_SIZE;         ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next.
 
   // shader properties - read-only (not available as uniforms)
-  static const std::string COMPONENTS; ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum.
+  static const char* COMPONENTS; ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum.
 
   // actor property (instance) - animatable (uniforms)
-  static const std::string WEIGHTS_UNIFORM; ///< The weight of each blend shape in a float array
+  static const char* WEIGHTS_UNIFORM; ///< The weight of each blend shape in a float array
 
   /**
    * @brief Registers properties based on the mesh definition (and geometry) and identified by the above string constants,
index 7eafcb7..8953f1a 100644 (file)
@@ -57,19 +57,18 @@ namespace rs = RendererState;
 
 namespace
 {
-const std::string NODES         = "nodes";
-const std::string SCENES        = "scenes";
-const std::string NODE          = "node";
-const std::string URI           = "uri";
-const std::string URL           = "url";
-const std::string CUSTOMIZATION = "customization";
-const std::string HINTS         = "hints";
-const std::string NAME("name");
-const std::string BLEND_SHAPE_HEADER("blendShapeHeader");
-const std::string BLEND_SHAPES("blendShapes");
-const std::string BLEND_SHAPE_VERSION_1_0("1.0");
-const std::string BLEND_SHAPE_VERSION_2_0("2.0");
-const std::string VERSION("version");
+const char* NODES         = "nodes";
+const char* SCENES        = "scenes";
+const char* NODE          = "node";
+const char* URI           = "uri";
+const char* URL           = "url";
+const char* HINTS         = "hints";
+const char* NAME("name");
+const char* BLEND_SHAPE_HEADER("blendShapeHeader");
+const char* BLEND_SHAPES("blendShapes");
+const char* BLEND_SHAPE_VERSION_1_0("1.0");
+const char* BLEND_SHAPE_VERSION_2_0("2.0");
+const char* VERSION("version");
 
 const char* const SHADOW_MAP_SIZE   = "shadowMapSize";
 const char* const ORTHOGRAPHIC_SIZE = "orthographicSize";
index 9b19610..3dea7c9 100644 (file)
@@ -43,7 +43,7 @@ namespace Loader
 {
 namespace
 {
-const std::string PRE_COMPUTED_BRDF_TEXTURE_FILE_NAME = "brdfLUT.png";
+const char* PRE_COMPUTED_BRDF_TEXTURE_FILE_NAME = "brdfLUT.png";
 }
 
 EnvironmentDefinition::RawData
index 69bcd51..814d911 100644 (file)
@@ -47,12 +47,12 @@ namespace
 Dali::Mutex gInitializeMutex;
 Dali::Mutex gReadMutex;
 
-const std::string POSITION_PROPERTY("position");
-const std::string ORIENTATION_PROPERTY("orientation");
-const std::string SCALE_PROPERTY("scale");
-const std::string BLEND_SHAPE_WEIGHTS_UNIFORM("uBlendShapeWeight");
-const std::string MRENDERER_MODEL_IDENTIFICATION("M-Renderer");
-const std::string ROOT_NODE_NAME("RootNode");
+const char* POSITION_PROPERTY("position");
+const char* ORIENTATION_PROPERTY("orientation");
+const char* SCALE_PROPERTY("scale");
+const char* BLEND_SHAPE_WEIGHTS_UNIFORM("uBlendShapeWeight");
+const char* MRENDERER_MODEL_IDENTIFICATION("M-Renderer");
+const char* ROOT_NODE_NAME("RootNode");
 const Vector3     SCALE_TO_ADJUST(100.0f, 100.0f, 100.0f);
 
 const Geometry::Type GLTF2_TO_DALI_PRIMITIVES[]{
@@ -1023,7 +1023,7 @@ float LoadBlendShapeKeyFrames(ConversionContext& context, const gt::Animation::C
   const float duration = LoadDataFromAccessors<float>(context, input, output, inputDataBuffer, outputDataBuffer);
 
   char        weightNameBuffer[32];
-  auto        prefixSize    = snprintf(weightNameBuffer, sizeof(weightNameBuffer), "%s[", BLEND_SHAPE_WEIGHTS_UNIFORM.c_str());
+  auto        prefixSize    = snprintf(weightNameBuffer, sizeof(weightNameBuffer), "%s[", BLEND_SHAPE_WEIGHTS_UNIFORM);
   char* const pWeightName   = weightNameBuffer + prefixSize;
   const auto  remainingSize = sizeof(weightNameBuffer) - prefixSize;
   for(uint32_t weightIndex = 0u, endWeightIndex = channel.mSampler->mOutput->mCount / channel.mSampler->mInput->mCount; weightIndex < endWeightIndex; ++weightIndex)
index 3beaf83..45ab5ff 100644 (file)
@@ -65,7 +65,7 @@ private:
   uint16_t (*mFunc)(uintptr_t&);
 };
 
-const std::string QUAD("quad");
+const char* QUAD("quad");
 
 ///@brief Reads a blob from the given stream @a source into @a target, which must have
 /// at least @a descriptor.length bytes.
index b47c203..98405d7 100644 (file)
@@ -61,7 +61,7 @@ void NodeDefinition::Renderable::OnCreate(const NodeDefinition& node, CreatePara
   actor.AddRenderer(renderer);
 }
 
-const std::string NodeDefinition::ORIGINAL_MATRIX_PROPERTY_NAME = "originalMatrix";
+const char* NodeDefinition::ORIGINAL_MATRIX_PROPERTY_NAME = "originalMatrix";
 
 Actor NodeDefinition::CreateActor(CreateParams& params)
 {
index d713ed5..0e9a5d7 100644 (file)
@@ -250,7 +250,7 @@ public: // METHODS
   static std::string_view GetIblYDirectionUniformName();
 
 public: // DATA
-  static const std::string ORIGINAL_MATRIX_PROPERTY_NAME;
+  static const char* ORIGINAL_MATRIX_PROPERTY_NAME;
 
   std::string mName;
   uint32_t    mNodeId = INVALID_INDEX;
index 3241769..f41422e 100644 (file)
@@ -45,7 +45,7 @@ namespace Loader
 {
 namespace
 {
-const std::string JOINT_MATRIX{"jointMatrix"};
+const char* JOINT_MATRIX{"jointMatrix"};
 
 const std::map<Property::Type, Constraint (*)(Actor&, Property::Index)> sConstraintFactory = {
   {Property::Type::BOOLEAN,
@@ -305,7 +305,7 @@ void ConfigureBoneMatrix(const Matrix& ibm, Actor joint, Shader& shader, Index&
 {
   // Register bone transform on shader.
   char propertyNameBuffer[32];
-  snprintf(propertyNameBuffer, sizeof(propertyNameBuffer), "%s[%d]", Skinning::BONE_UNIFORM_NAME.c_str(), boneIdx);
+  snprintf(propertyNameBuffer, sizeof(propertyNameBuffer), "%s[%d]", Skinning::BONE_UNIFORM_NAME, boneIdx);
   DALI_ASSERT_DEBUG(shader.GetPropertyIndex(propertyNameBuffer) == Property::INVALID_INDEX);
   auto propBoneXform = shader.RegisterProperty(propertyNameBuffer, Matrix{false});
 
index 729fa1d..a753155 100644 (file)
@@ -28,9 +28,8 @@ namespace Loader
 {
 namespace
 {
-const std::string SHADER_HINT_OUTPUT_IS_TRANSPARENT("OUTPUT_IS_TRANSPARENT"); ///< Might generate transparent alpha from opaque inputs.
-const std::string SHADER_HINT_MODIFIES_GEOMETRY("MODIFIES_GEOMETRY");         ///< Might change position of vertices, this option disables any culling optimizations.
-
+const char* SHADER_HINT_OUTPUT_IS_TRANSPARENT("OUTPUT_IS_TRANSPARENT"); ///< Might generate transparent alpha from opaque inputs.
+const char* SHADER_HINT_MODIFIES_GEOMETRY("MODIFIES_GEOMETRY");         ///< Might change position of vertices, this option disables any culling optimizations.
 } // namespace
 
 ShaderDefinition::ShaderDefinition(const ShaderDefinition& other)
index 128a19b..e100151 100644 (file)
@@ -27,8 +27,7 @@ namespace Loader
 {
 const unsigned int Skinning::MAX_JOINTS = 64;
 
-const std::string Skinning::BONE_UNIFORM_NAME = "uBone";
-
+const char* Skinning::BONE_UNIFORM_NAME = "uBone";
 } // namespace Loader
 } // namespace Scene3D
 } // namespace Dali
index 78ba38c..d754f0c 100644 (file)
@@ -40,7 +40,7 @@ struct DALI_SCENE3D_API Skinning
   /*
    * @brief Name of bone matrix uniform (array).
    */
-  static const std::string BONE_UNIFORM_NAME;
+  static const char* BONE_UNIFORM_NAME;
 
   Skinning() = delete;
 };
index 517d78f..8b69071 100644 (file)
@@ -70,23 +70,22 @@ namespace
 {
 #define TOKEN_STRING(x) #x
 
-const std::string KEYNAME_ACTORS           = "actors";
-const std::string KEYNAME_ENTRY_TRANSITION = "entryTransition";
-const std::string KEYNAME_EXIT_TRANSITION  = "exitTransition";
-const std::string KEYNAME_INCLUDES         = "includes";
-const std::string KEYNAME_INHERIT          = "inherit";
-const std::string KEYNAME_MAPPINGS         = "mappings";
-const std::string KEYNAME_NAME             = "name";
-const std::string KEYNAME_SIGNALS          = "signals";
-const std::string KEYNAME_STATES           = "states";
-const std::string KEYNAME_STYLES           = "styles";
-const std::string KEYNAME_TEMPLATES        = "templates";
-const std::string KEYNAME_TRANSITIONS      = "transitions";
-const std::string KEYNAME_TYPE             = "type";
-const std::string KEYNAME_VISUALS          = "visuals";
-
-const std::string PROPERTIES            = "properties";
-const std::string ANIMATABLE_PROPERTIES = "animatableProperties";
+const char* KEYNAME_ACTORS           = "actors";
+const char* KEYNAME_ENTRY_TRANSITION = "entryTransition";
+const char* KEYNAME_EXIT_TRANSITION  = "exitTransition";
+const char* KEYNAME_INCLUDES         = "includes";
+const char* KEYNAME_INHERIT          = "inherit";
+const char* KEYNAME_MAPPINGS         = "mappings";
+const char* KEYNAME_SIGNALS          = "signals";
+const char* KEYNAME_STATES           = "states";
+const char* KEYNAME_STYLES           = "styles";
+const char* KEYNAME_TEMPLATES        = "templates";
+const char* KEYNAME_TRANSITIONS      = "transitions";
+const char* KEYNAME_TYPE             = "type";
+const char* KEYNAME_VISUALS          = "visuals";
+
+const char* PROPERTIES            = "properties";
+const char* ANIMATABLE_PROPERTIES = "animatableProperties";
 
 typedef std::vector<const TreeNode*> TreeNodeList;
 
index 23f9204..76de885 100644 (file)
 
 namespace
 {
-const std::string READING_INFO_TYPE_NAME           = "name";
-const std::string READING_INFO_TYPE_ROLE           = "role";
-const std::string READING_INFO_TYPE_DESCRIPTION    = "description";
-const std::string READING_INFO_TYPE_STATE          = "state";
-const std::string READING_INFO_TYPE_ATTRIBUTE_NAME = "reading_info_type";
-const std::string READING_INFO_TYPE_SEPARATOR      = "|";
+const char* READING_INFO_TYPE_NAME           = "name";
+const char* READING_INFO_TYPE_ROLE           = "role";
+const char* READING_INFO_TYPE_DESCRIPTION    = "description";
+const char* READING_INFO_TYPE_STATE          = "state";
+const char* READING_INFO_TYPE_ATTRIBUTE_NAME = "reading_info_type";
+const char* READING_INFO_TYPE_SEPARATOR      = "|";
 } // namespace
 
 namespace Dali
index 77eb533..e93057d 100644 (file)
@@ -36,7 +36,7 @@ namespace
 const char* const IMAGE_BRDF_FILE_NAME = "brdfLUT.png";
 
 // glTF file extension
-const std::string GLTF_EXT(".gltf");
+const char* GLTF_EXT(".gltf");
 
 /**
  * cube map face index
index 8d3c203..14d2de7 100644 (file)
@@ -70,25 +70,25 @@ const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::DevelText::DEFAULT
  * The alignment depends on the alignment value of the text label (Use Text::VerticalAlignment enumerations).
  */
 const float VERTICAL_ALIGNMENT_TABLE[Text::VerticalAlignment::BOTTOM + 1] =
-  {
+{
     0.0f, // VerticalAlignment::TOP
     0.5f, // VerticalAlignment::CENTER
     1.0f  // VerticalAlignment::BOTTOM
 };
 
-const std::string TEXT_FIT_ENABLE_KEY("enable");
-const std::string TEXT_FIT_MIN_SIZE_KEY("minSize");
-const std::string TEXT_FIT_MAX_SIZE_KEY("maxSize");
-const std::string TEXT_FIT_STEP_SIZE_KEY("stepSize");
-const std::string TEXT_FIT_FONT_SIZE_KEY("fontSize");
-const std::string TEXT_FIT_FONT_SIZE_TYPE_KEY("fontSizeType");
+const char* TEXT_FIT_ENABLE_KEY("enable");
+const char* TEXT_FIT_MIN_SIZE_KEY("minSize");
+const char* TEXT_FIT_MAX_SIZE_KEY("maxSize");
+const char* TEXT_FIT_STEP_SIZE_KEY("stepSize");
+const char* TEXT_FIT_FONT_SIZE_KEY("fontSize");
+const char* TEXT_FIT_FONT_SIZE_TYPE_KEY("fontSizeType");
 
 #if defined(DEBUG_ENABLED)
 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
 #endif
 
 const Scripting::StringEnum AUTO_SCROLL_STOP_MODE_TABLE[] =
-  {
+{
     {"IMMEDIATE", Toolkit::TextLabel::AutoScrollStopMode::IMMEDIATE},
     {"FINISH_LOOP", Toolkit::TextLabel::AutoScrollStopMode::FINISH_LOOP},
 };
index 862a69c..50d7d3d 100644 (file)
@@ -57,7 +57,7 @@ namespace
 #define GET_LOCALE_TEXT(string) dgettext("dali-toolkit", string)
 #endif
 
-const std::string   TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME("TextSelectionPopupButton");
+const char*   TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME("TextSelectionPopupButton");
 const Dali::Vector4 DEFAULT_OPTION_PRESSED_COLOR(Dali::Vector4(0.24f, 0.72f, 0.8f, 1.0f));
 const float         DEFAULT_OPTION_PRESSED_CORNER_RADIUS = 0.0f;
 const Dali::Vector4 DEFAULT_LABEL_PADDING(Dali::Vector4(24.0f, 24.0f, 14.0f, 14.0f));
@@ -93,8 +93,8 @@ const char* const OPTION_COPY("optionCopy");                 // "Copy" popup opt
 const char* const OPTION_PASTE("optionPaste");               // "Paste" popup option.
 const char* const OPTION_CLIPBOARD("optionClipboard");       // "Clipboard" popup option.
 
-const std::string IDS_LTR("IDS_LTR");
-const std::string RTL_DIRECTION("RTL");
+const char* IDS_LTR("IDS_LTR");
+const char* RTL_DIRECTION("RTL");
 
 BaseHandle Create()
 {
@@ -726,10 +726,10 @@ void TextSelectionPopup::AddPopupOptionsToToolbar(bool showIcons, bool showCapti
   // Whether to mirror the list of buttons (for right to left languages)
   bool mirror = false;
 #if defined(__GLIBC__)
-  char* idsLtr = GET_LOCALE_TEXT(IDS_LTR.c_str());
+  char* idsLtr = GET_LOCALE_TEXT(IDS_LTR);
   if(NULL != idsLtr)
   {
-    mirror = (0 == strcmp(idsLtr, RTL_DIRECTION.c_str()));
+    mirror = (0 == strcmp(idsLtr, RTL_DIRECTION));
 
     if(mirror)
     {
index 5323d35..f7bd90a 100644 (file)
@@ -39,11 +39,11 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT
 
 DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_TEXT_PERFORMANCE_MARKER, false);
 
-const std::string KEY_C_NAME      = "c";
-const std::string KEY_V_NAME      = "v";
-const std::string KEY_X_NAME      = "x";
-const std::string KEY_A_NAME      = "a";
-const std::string KEY_INSERT_NAME = "Insert";
+const char* KEY_C_NAME      = "c";
+const char* KEY_V_NAME      = "v";
+const char* KEY_X_NAME      = "x";
+const char* KEY_A_NAME      = "a";
+const char* KEY_INSERT_NAME = "Insert";
 
 } // namespace
 
index c483114..7752360 100644 (file)
@@ -51,7 +51,7 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT
 
 constexpr float MAX_FLOAT = std::numeric_limits<float>::max();
 
-const std::string EMPTY_STRING("");
+const char* EMPTY_STRING = "";
 
 } // namespace
 
index a1e6214..f2d49d2 100644 (file)
@@ -131,7 +131,7 @@ void Controller::InputFontHandler::SetInputFontFamily(Controller& controller, co
   }
 }
 
-const std::string& Controller::InputFontHandler::GetInputFontFamily(const Controller& controller)
+std::string Controller::InputFontHandler::GetInputFontFamily(const Controller& controller)
 {
   if(NULL != controller.mImpl->mEventData)
   {
index 2ac7464..bf38a00 100644 (file)
@@ -34,7 +34,7 @@ namespace Text
 struct Controller::InputFontHandler
 {
   static void               SetInputFontFamily(Controller& controller, const std::string& fontFamily);
-  static const std::string& GetInputFontFamily(const Controller& controller);
+  static std::string        GetInputFontFamily(const Controller& controller);
   static void               SetInputFontWeight(const Controller& controller, FontWeight weight);
   static bool               IsInputFontWeightDefined(const Controller& controller);
   static FontWeight         GetInputFontWeight(const Controller& controller);
index f410187..7842d05 100644 (file)
@@ -38,7 +38,7 @@
 
 namespace
 {
-const std::string EMPTY_STRING("");
+const char* EMPTY_STRING = "";
 }
 
 namespace Dali::Toolkit::Text
@@ -116,7 +116,7 @@ void Controller::InputProperties::SetInputShadowProperties(Controller& controlle
   }
 }
 
-const std::string& Controller::InputProperties::GetInputShadowProperties(const Controller& controller)
+std::string Controller::InputProperties::GetInputShadowProperties(const Controller& controller)
 {
   return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.shadowProperties : EMPTY_STRING;
 }
@@ -129,7 +129,7 @@ void Controller::InputProperties::SetInputUnderlineProperties(Controller& contro
   }
 }
 
-const std::string& Controller::InputProperties::GetInputUnderlineProperties(const Controller& controller)
+std::string Controller::InputProperties::GetInputUnderlineProperties(const Controller& controller)
 {
   return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.underlineProperties : EMPTY_STRING;
 }
@@ -142,7 +142,7 @@ void Controller::InputProperties::SetInputEmbossProperties(Controller& controlle
   }
 }
 
-const std::string& Controller::InputProperties::GetInputEmbossProperties(const Controller& controller)
+std::string Controller::InputProperties::GetInputEmbossProperties(const Controller& controller)
 {
   return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.embossProperties : controller.GetDefaultEmbossProperties();
 }
@@ -155,7 +155,7 @@ void Controller::InputProperties::SetInputOutlineProperties(Controller& controll
   }
 }
 
-const std::string& Controller::InputProperties::GetInputOutlineProperties(const Controller& controller)
+std::string Controller::InputProperties::GetInputOutlineProperties(const Controller& controller)
 {
   return controller.mImpl->mEventData ? controller.mImpl->mEventData->mInputStyle.outlineProperties : controller.GetDefaultOutlineProperties();
 }
index b0736f7..9b31d22 100644 (file)
@@ -39,19 +39,19 @@ struct Controller::InputProperties
 
   static void SetInputShadowProperties(Controller& controller, const std::string& shadowProperties);
 
-  static const std::string& GetInputShadowProperties(const Controller& controller);
+  static std::string GetInputShadowProperties(const Controller& controller);
 
   static void SetInputUnderlineProperties(Controller& controller, const std::string& underlineProperties);
 
-  static const std::string& GetInputUnderlineProperties(const Controller& controller);
+  static std::string GetInputUnderlineProperties(const Controller& controller);
 
   static void SetInputEmbossProperties(Controller& controller, const std::string& embossProperties);
 
-  static const std::string& GetInputEmbossProperties(const Controller& controller);
+  static std::string GetInputEmbossProperties(const Controller& controller);
 
   static void SetInputOutlineProperties(Controller& controller, const std::string& outlineProperties);
 
-  static const std::string& GetInputOutlineProperties(const Controller& controller);
+  static std::string GetInputOutlineProperties(const Controller& controller);
 
   static void SetInputModePassword(Controller& controller, bool passwordInput);
 
index da15a43..a0f03a6 100644 (file)
@@ -33,7 +33,7 @@ namespace
 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
 #endif
 
-const std::string EMPTY_STRING("");
+const char* EMPTY_STRING = "";
 
 const char* const PLACEHOLDER_TEXT         = "text";
 const char* const PLACEHOLDER_TEXT_FOCUSED = "textFocused";
@@ -122,7 +122,7 @@ void Controller::PlaceholderHandler::SetPlaceholderFontFamily(Controller& contro
   }
 }
 
-const std::string& Controller::PlaceholderHandler::GetPlaceholderFontFamily(const Controller& controller)
+std::string Controller::PlaceholderHandler::GetPlaceholderFontFamily(const Controller& controller)
 {
   if((NULL != controller.mImpl->mEventData) && (NULL != controller.mImpl->mEventData->mPlaceholderFont))
   {
index c7107c9..3bbf87b 100644 (file)
@@ -39,7 +39,7 @@ struct Controller::PlaceholderHandler
   static void               SetPlaceholderText(Controller& controller, PlaceholderType type, const std::string& text);
   static void               GetPlaceholderText(const Controller& controller, PlaceholderType type, std::string& text);
   static void               SetPlaceholderFontFamily(Controller& controller, const std::string& placeholderTextFontFamily);
-  static const std::string& GetPlaceholderFontFamily(const Controller& controller);
+  static std::string        GetPlaceholderFontFamily(const Controller& controller);
   static void               SetPlaceholderTextFontWeight(Controller& controller, FontWeight weight);
   static bool               IsPlaceholderTextFontWeightDefined(const Controller& controller);
   static FontWeight         GetPlaceholderTextFontWeight(const Controller& controller);
index b66cd3c..810cd1a 100644 (file)
@@ -45,7 +45,7 @@ namespace
 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
 #endif
 
-const std::string EMPTY_STRING("");
+const char* EMPTY_STRING = "";
 
 template<typename Type>
 void EnsureCreated(Type*& object)
@@ -538,7 +538,7 @@ void Controller::SetDefaultFontFamily(const std::string& defaultFontFamily)
   }
 }
 
-const std::string& Controller::GetDefaultFontFamily() const
+std::string Controller::GetDefaultFontFamily() const
 {
   return mImpl->mFontDefaults ? mImpl->mFontDefaults->mFontDescription.family : EMPTY_STRING;
 }
@@ -548,7 +548,7 @@ void Controller::SetPlaceholderFontFamily(const std::string& placeholderTextFont
   PlaceholderHandler::SetPlaceholderFontFamily(*this, placeholderTextFontFamily);
 }
 
-const std::string& Controller::GetPlaceholderFontFamily() const
+std::string Controller::GetPlaceholderFontFamily() const
 {
   return PlaceholderHandler::GetPlaceholderFontFamily(*this);
 }
@@ -945,7 +945,7 @@ void Controller::SetDefaultEmbossProperties(const std::string& embossProperties)
   mImpl->mEmbossDefaults->properties = embossProperties;
 }
 
-const std::string& Controller::GetDefaultEmbossProperties() const
+std::string Controller::GetDefaultEmbossProperties() const
 {
   return mImpl->mEmbossDefaults ? mImpl->mEmbossDefaults->properties : EMPTY_STRING;
 }
@@ -956,7 +956,7 @@ void Controller::SetDefaultOutlineProperties(const std::string& outlinePropertie
   mImpl->mOutlineDefaults->properties = outlineProperties;
 }
 
-const std::string& Controller::GetDefaultOutlineProperties() const
+std::string Controller::GetDefaultOutlineProperties() const
 {
   return mImpl->mOutlineDefaults ? mImpl->mOutlineDefaults->properties : EMPTY_STRING;
 }
@@ -1006,7 +1006,7 @@ void Controller::SetInputFontFamily(const std::string& fontFamily)
   InputFontHandler::SetInputFontFamily(*this, fontFamily);
 }
 
-const std::string& Controller::GetInputFontFamily() const
+std::string Controller::GetInputFontFamily() const
 {
   return InputFontHandler::GetInputFontFamily(*this);
 }
@@ -1081,7 +1081,7 @@ void Controller::SetInputShadowProperties(const std::string& shadowProperties)
   InputProperties::SetInputShadowProperties(*this, shadowProperties);
 }
 
-const std::string& Controller::GetInputShadowProperties() const
+std::string Controller::GetInputShadowProperties() const
 {
   return InputProperties::GetInputShadowProperties(*this);
 }
@@ -1091,7 +1091,7 @@ void Controller::SetInputUnderlineProperties(const std::string& underlinePropert
   InputProperties::SetInputUnderlineProperties(*this, underlineProperties);
 }
 
-const std::string& Controller::GetInputUnderlineProperties() const
+std::string Controller::GetInputUnderlineProperties() const
 {
   return InputProperties::GetInputUnderlineProperties(*this);
 }
@@ -1101,7 +1101,7 @@ void Controller::SetInputEmbossProperties(const std::string& embossProperties)
   InputProperties::SetInputEmbossProperties(*this, embossProperties);
 }
 
-const std::string& Controller::GetInputEmbossProperties() const
+std::string Controller::GetInputEmbossProperties() const
 {
   return InputProperties::GetInputEmbossProperties(*this);
 }
@@ -1111,7 +1111,7 @@ void Controller::SetInputOutlineProperties(const std::string& outlineProperties)
   InputProperties::SetInputOutlineProperties(*this, outlineProperties);
 }
 
-const std::string& Controller::GetInputOutlineProperties() const
+std::string Controller::GetInputOutlineProperties() const
 {
   return InputProperties::GetInputOutlineProperties(*this);
 }
@@ -1236,7 +1236,7 @@ void Controller::SetInputStrikethroughProperties(const std::string& strikethroug
   }
 }
 
-const std::string& Controller::GetInputStrikethroughProperties() const
+std::string Controller::GetInputStrikethroughProperties() const
 {
   return (NULL != mImpl->mEventData) ? mImpl->mEventData->mInputStyle.strikethroughProperties : EMPTY_STRING;
 }
index 0a1b057..55953f4 100644 (file)
@@ -829,7 +829,7 @@ public: // Default style & Input style
    *
    * @return The default font family.
    */
-  const std::string& GetDefaultFontFamily() const;
+  std::string GetDefaultFontFamily() const;
 
   /**
    * @brief Sets the placeholder text font family.
@@ -842,7 +842,7 @@ public: // Default style & Input style
    *
    * @return The placeholder text font family
    */
-  const std::string& GetPlaceholderFontFamily() const;
+  std::string GetPlaceholderFontFamily() const;
 
   /**
    * @brief Sets the default font weight.
@@ -1258,7 +1258,7 @@ public: // Default style & Input style
    *
    * @return The emboss's properties string.
    */
-  const std::string& GetDefaultEmbossProperties() const;
+  std::string GetDefaultEmbossProperties() const;
 
   /**
    * @brief Sets the outline's properties string.
@@ -1274,7 +1274,7 @@ public: // Default style & Input style
    *
    * @return The outline's properties string.
    */
-  const std::string& GetDefaultOutlineProperties() const;
+  std::string GetDefaultOutlineProperties() const;
 
   /**
    * @brief Sets the default line spacing.
@@ -1350,7 +1350,7 @@ public: // Default style & Input style
    *
    * @return The input text's font family name.
    */
-  const std::string& GetInputFontFamily() const;
+  std::string GetInputFontFamily() const;
 
   /**
    * @brief Sets the input font's weight.
@@ -1451,7 +1451,7 @@ public: // Default style & Input style
    *
    * @return The shadow's properties string.
    */
-  const std::string& GetInputShadowProperties() const;
+  std::string GetInputShadowProperties() const;
 
   /**
    * @brief Sets the input underline's properties string.
@@ -1467,7 +1467,7 @@ public: // Default style & Input style
    *
    * @return The underline's properties string.
    */
-  const std::string& GetInputUnderlineProperties() const;
+  std::string GetInputUnderlineProperties() const;
 
   /**
    * @brief Sets the input emboss's properties string.
@@ -1483,7 +1483,7 @@ public: // Default style & Input style
    *
    * @return The emboss's properties string.
    */
-  const std::string& GetInputEmbossProperties() const;
+  std::string GetInputEmbossProperties() const;
 
   /**
    * @brief Sets input the outline's properties string.
@@ -1499,7 +1499,7 @@ public: // Default style & Input style
    *
    * @return The outline's properties string.
    */
-  const std::string& GetInputOutlineProperties() const;
+  std::string GetInputOutlineProperties() const;
 
   /**
    * @brief Sets the input strikethrough's properties string.
@@ -1515,7 +1515,7 @@ public: // Default style & Input style
    *
    * @return The strikethrough's properties string.
    */
-  const std::string& GetInputStrikethroughProperties() const;
+  std::string GetInputStrikethroughProperties() const;
 
   /**
    * @brief Set the control's interface.
index 8e9ec06..f39afce 100644 (file)
@@ -35,8 +35,7 @@ namespace Text
 {
 namespace
 {
-const std::string NONE("none");
-const std::string MULTIPLY("multiply");
+const char* MULTIPLY = "multiply";
 } // namespace
 
 void ProcessEmbeddedItem(const Tag& tag, EmbeddedItem& embeddedItem)
index 133d7fa..13afaa0 100644 (file)
@@ -37,9 +37,6 @@ namespace Text
 {
 namespace
 {
-const std::string  FONT_PREFIX("font-");
-const unsigned int FONT_PREFIX_LENGTH      = 5u;
-const unsigned int MIN_FONT_ATTRIBUTE_SIZE = 4u;   ///< The minimum length of any of the possible 'weight', 'width' , 'slant' or 'size' values.
 const unsigned int MAX_FONT_ATTRIBUTE_SIZE = 15u;  ///< The maximum length of any of the possible 'weight', 'width' or 'slant' values.
 const float        PIXEL_FORMAT_64_FACTOR  = 64.f; ///< 64.f is used to convert from point size to 26.6 pixel format.
 } // namespace
index b0ac16b..f7ed507 100644 (file)
@@ -44,23 +44,23 @@ const char        WEB_COLOR_TOKEN('#');
 const char* const HEX_COLOR_TOKEN("0x");
 const char* const ALPHA_ONE("FF");
 
-const std::string BLACK_COLOR("black");
-const std::string WHITE_COLOR("white");
-const std::string RED_COLOR("red");
-const std::string GREEN_COLOR("green");
-const std::string BLUE_COLOR("blue");
-const std::string YELLOW_COLOR("yellow");
-const std::string MAGENTA_COLOR("magenta");
-const std::string CYAN_COLOR("cyan");
-const std::string TRANSPARENT_COLOR("transparent");
-
-const std::string SOLID_UNDERLINE("solid");
-const std::string DASHED_UNDERLINE("dashed");
-const std::string DOUBLE_UNDERLINE("double");
-
-const std::string BEGIN_HORIZONTAL_ALIGNMENT("begin");
-const std::string CENTER_HORIZONTAL_ALIGNMENT("center");
-const std::string END_HORIZONTAL_ALIGNMENT("end");
+const char* BLACK_COLOR("black");
+const char* WHITE_COLOR("white");
+const char* RED_COLOR("red");
+const char* GREEN_COLOR("green");
+const char* BLUE_COLOR("blue");
+const char* YELLOW_COLOR("yellow");
+const char* MAGENTA_COLOR("magenta");
+const char* CYAN_COLOR("cyan");
+const char* TRANSPARENT_COLOR("transparent");
+
+const char* SOLID_UNDERLINE("solid");
+const char* DASHED_UNDERLINE("dashed");
+const char* DOUBLE_UNDERLINE("double");
+
+const char* BEGIN_HORIZONTAL_ALIGNMENT("begin");
+const char* CENTER_HORIZONTAL_ALIGNMENT("center");
+const char* END_HORIZONTAL_ALIGNMENT("end");
 
 } // namespace
 
index 1428b95..2bf1398 100644 (file)
@@ -35,17 +35,16 @@ namespace Text
 {
 namespace
 {
-const std::string COLOR_KEY("color");
-const std::string OFFSET_KEY("offset");
-const std::string BLUR_RADIUS_KEY("blurRadius");
-const std::string WIDTH_KEY("width");
-const std::string HEIGHT_KEY("height");
-const std::string ENABLE_KEY("enable");
-const std::string TYPE_KEY("type");
-const std::string DASH_WIDTH_KEY("dashWidth");
-const std::string DASH_GAP_KEY("dashGap");
-const std::string TRUE_TOKEN("true");
-const std::string FALSE_TOKEN("false");
+const char* COLOR_KEY = "color";
+const char* OFFSET_KEY = "offset";
+const char* BLUR_RADIUS_KEY = "blurRadius";
+const char* WIDTH_KEY = "width";
+const char* HEIGHT_KEY = "height";
+const char* ENABLE_KEY = "enable";
+const char* TYPE_KEY = "type";
+const char* DASH_WIDTH_KEY = "dashWidth";
+const char* DASH_GAP_KEY = "dashGap";
+const char* TRUE_TOKEN = "true";
 } // namespace
 
 bool ParseShadowProperties(const Property::Map& shadowPropertiesMap,
index ce5e860..f087a1e 100644 (file)
@@ -33,14 +33,13 @@ namespace Text
 {
 namespace
 {
-const std::string STYLE_KEY("style");
-const std::string WEIGHT_KEY("weight");
-const std::string WIDTH_KEY("width");
-const std::string SLANT_KEY("slant");
-const std::string FAMILY_KEY("family");
-const std::string TYPE_KEY("type");
-
-const std::string SYSTEM_TOKEN("system");
+const char* WEIGHT_KEY = "weight";
+const char* WIDTH_KEY = "width";
+const char* SLANT_KEY = "slant";
+const char* FAMILY_KEY = "family";
+const char* TYPE_KEY = "type";
+
+const char* SYSTEM_TOKEN = "system";
 
 } // namespace