X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fmarkup-processor-helper-functions.cpp;h=9f4c34d35586c56553d4f4cb2c70dd9b3ac6ea0b;hb=27b34b7f9c8ba9936ee38db06f22f18fcf04c826;hp=e4cb1c4ee6942944c479ed18636c07c2676e59c2;hpb=076f84a43592f26ff0aa2bced54583f712800fe3;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/markup-processor-helper-functions.cpp b/dali-toolkit/internal/text/markup-processor-helper-functions.cpp index e4cb1c4..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. @@ -57,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) @@ -317,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