X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fmarkup-processor-helper-functions.cpp;h=9f4c34d35586c56553d4f4cb2c70dd9b3ac6ea0b;hp=ffa4ccead8421e07727558289db79b902accd03e;hb=3e844ed708b1cbe03cd5bfe9ad202aad27bbe360;hpb=b8da2e53925b9abb9fa362560069e8ca4aa62f81 diff --git a/dali-toolkit/internal/text/markup-processor-helper-functions.cpp b/dali-toolkit/internal/text/markup-processor-helper-functions.cpp index ffa4cce..9f4c34d 100644 --- a/dali-toolkit/internal/text/markup-processor-helper-functions.cpp +++ b/dali-toolkit/internal/text/markup-processor-helper-functions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,8 @@ const char FIRST_UPPER_CASE = 0x41; // ASCII value of the one after the first up const char LAST_UPPER_CASE = 0x5b; // ASCII value of the one after the last upper case character (Z). const char TO_LOWER_CASE = 32; // Value to add to a upper case character to transform it into a lower case. +const unsigned int MAX_FLOAT_ATTRIBUTE_SIZE = 17u; ///< The maximum length of any of the possible float values. +99999.999999999f (sign, five digits, dot, nine digits, f) + const char WEB_COLOR_TOKEN('#'); const char* const HEX_COLOR_TOKEN("0x"); const char* const ALPHA_ONE("FF"); @@ -51,6 +53,15 @@ 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"); + } // namespace bool TokenComparison(const std::string& string1, const char* const stringBuffer2, Length length) @@ -295,6 +306,45 @@ void Vector2ToString(const Vector2& value, std::string& vector2Str) vector2Str += yStr; } +void UnderlineTypeStringToTypeValue(const char* const typeStr, Length length, Text::Underline::Type& retType) +{ + if(TokenComparison(SOLID_UNDERLINE, typeStr, length)) + { + retType = Text::Underline::SOLID; + } + else if(TokenComparison(DASHED_UNDERLINE, typeStr, length)) + { + retType = Text::Underline::DASHED; + } + else if(TokenComparison(DOUBLE_UNDERLINE, typeStr, length)) + { + retType = Text::Underline::DOUBLE; + } +} + +bool HorizontalAlignmentTypeStringToTypeValue(const char* const typeStr, Length length, Text::HorizontalAlignment::Type& retType) +{ + // The string is valid value for HorizontalAlignment + bool valid = false; + if(TokenComparison(BEGIN_HORIZONTAL_ALIGNMENT, typeStr, length)) + { + retType = Text::HorizontalAlignment::BEGIN; + valid = true; + } + else if(TokenComparison(CENTER_HORIZONTAL_ALIGNMENT, typeStr, length)) + { + retType = Text::HorizontalAlignment::CENTER; + valid = true; + } + else if(TokenComparison(END_HORIZONTAL_ALIGNMENT, typeStr, length)) + { + retType = Text::HorizontalAlignment::END; + valid = true; + } + + return valid; +} + } // namespace Text } // namespace Toolkit