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=ce8bcee3312a2d7b36020b61604229d4a4ddbad9;hb=3e844ed708b1cbe03cd5bfe9ad202aad27bbe360;hpb=b7108fc5f28fd650a1ea08a8692c822a63baf5bd diff --git a/dali-toolkit/internal/text/markup-processor-helper-functions.cpp b/dali-toolkit/internal/text/markup-processor-helper-functions.cpp index ce8bcee..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"); @@ -55,6 +57,11 @@ 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) @@ -315,6 +322,29 @@ void UnderlineTypeStringToTypeValue(const char* const typeStr, Length length, Te } } +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