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.h;h=a28c1cb1e92489a5989baf479aa58c6c6f6b0b24;hp=2b0cafb6bd373ac0e93ff70e1fb2365a5090af59;hb=076f84a43592f26ff0aa2bced54583f712800fe3;hpb=d82494a77e405d5924cf1af3fe55b2d9b9577e3f diff --git a/dali-toolkit/internal/text/markup-processor-helper-functions.h b/dali-toolkit/internal/text/markup-processor-helper-functions.h old mode 100755 new mode 100644 index 2b0cafb..a28c1cb --- a/dali-toolkit/internal/text/markup-processor-helper-functions.h +++ b/dali-toolkit/internal/text/markup-processor-helper-functions.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_TEXT_MARKUP_PROCESSOR_HELPER_FUNCTIONS_H__ -#define __DALI_TOOLKIT_TEXT_MARKUP_PROCESSOR_HELPER_FUNCTIONS_H__ +#ifndef DALI_TOOLKIT_TEXT_MARKUP_PROCESSOR_HELPER_FUNCTIONS_H +#define DALI_TOOLKIT_TEXT_MARKUP_PROCESSOR_HELPER_FUNCTIONS_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -24,19 +24,17 @@ // INTERNAL INCLUDES #include +#include namespace Dali { - struct Vector2; struct Vector4; namespace Toolkit { - namespace Text { - /** * @brief Stores an attribute pair: name, value. */ @@ -44,20 +42,20 @@ struct Attribute { const char* nameBuffer; const char* valueBuffer; - Length nameLength; - Length valueLength; + Length nameLength; + Length valueLength; }; /** * @brief Stores a tag and its attributes. */ - struct Tag - { - Vector attributes; - const char* buffer; - Length length; - bool isEndTag; - }; +struct Tag +{ + Vector attributes; + const char* buffer; + Length length; + bool isEndTag; +}; /** * @brief Compare if two tokens are equal. @@ -74,7 +72,7 @@ struct Attribute * * @return @e true if both strings are equal. */ -bool TokenComparison( const std::string& string1, const char* const stringBuffer2, Length length ); +bool TokenComparison(const std::string& string1, const char* const stringBuffer2, Length length); /** * @brief Skips any unnecessary white space. @@ -82,8 +80,8 @@ bool TokenComparison( const std::string& string1, const char* const stringBuffer * @param[in,out] stringBuffer The string buffer. It's a const iterator pointing the current character. * @param[in] stringEndBuffer Pointer to one character after the end of the string buffer. */ -void SkipWhiteSpace( const char*& stringBuffer, - const char* const stringEndBuffer ); +void SkipWhiteSpace(const char*& stringBuffer, + const char* const stringEndBuffer); /** * @Brief Jumps to the next white space. @@ -91,8 +89,8 @@ void SkipWhiteSpace( const char*& stringBuffer, * @param[in,out] stringBuffer The string buffer. It's a const iterator pointing the current character. * @param[in] stringEndBuffer Pointer to one character after the end of the string buffer. */ -void JumpToWhiteSpace( const char*& stringBuffer, - const char* const stringEndBuffer ); +void JumpToWhiteSpace(const char*& stringBuffer, + const char* const stringEndBuffer); /** * @brief Converts a string into an unsigned int. @@ -101,7 +99,7 @@ void JumpToWhiteSpace( const char*& stringBuffer, * * @return The unsigned int value. */ -unsigned int StringToUint( const char* const uintStr ); +unsigned int StringToUint(const char* const uintStr); /** * @brief Converts a string into an hexadecimal unsigned int. @@ -110,7 +108,7 @@ unsigned int StringToUint( const char* const uintStr ); * * @return The hexadecimal value. */ -unsigned int StringToHex( const char* const uintStr ); +unsigned int StringToHex(const char* const uintStr); /** * @brief Converts a string into a float value. @@ -119,7 +117,7 @@ unsigned int StringToHex( const char* const uintStr ); * * @return The float value. */ -float StringToFloat( const char* const floatStr ); +float StringToFloat(const char* const floatStr); /** * @brief Converts a float into a string. @@ -127,7 +125,7 @@ float StringToFloat( const char* const floatStr ); * @param[in] value The float value. * @param[out] floatStr The string. */ -void FloatToString( float value, std::string& floatStr ); +void FloatToString(float value, std::string& floatStr); /** * @brief Converts an unsigned int into a string. @@ -135,7 +133,7 @@ void FloatToString( float value, std::string& floatStr ); * @param[in] value The unsigned int value. * @param[out] uIntStr The string. */ -void UintToString( unsigned int value, std::string& uIntStr ); +void UintToString(unsigned int value, std::string& uIntStr); /** * @brief Converts an ARGB color packed in 4 byte unsigned int into a Vector4 color used in Dali. @@ -143,7 +141,7 @@ void UintToString( unsigned int value, std::string& uIntStr ); * @param[in] color An ARGB color packed in an unsigned int. * @param[out] retColor A Vector4 with the converted color. */ -void UintColorToVector4( unsigned int color, Vector4& retColor ); +void UintColorToVector4(unsigned int color, Vector4& retColor); /** * @brief Converts a color packed inside a string into an ARGB Vector4 color. @@ -155,7 +153,7 @@ void UintColorToVector4( unsigned int color, Vector4& retColor ); * @param[in] length The length of the color string. * @param[out] retColor A color packed inside a Vector4. */ -void ColorStringToVector4( const char* const colorStr, Length length, Vector4& retColor ); +void ColorStringToVector4(const char* const colorStr, Length length, Vector4& retColor); /** * @brief Converts a color packed in a Vector4 into a string. @@ -167,7 +165,7 @@ void ColorStringToVector4( const char* const colorStr, Length length, Vector4& r * @param[in] value The color value. * @param[out] colorStr The string. */ -void Vector4ToColorString( const Vector4& value, std::string& vector2Str ); +void Vector4ToColorString(const Vector4& value, std::string& vector2Str); /** * @brief Converts a two dimension vector packed inside a string into a Vector2. @@ -176,7 +174,7 @@ void Vector4ToColorString( const Vector4& value, std::string& vector2Str ); * @param[in] length The length of the string. * @param[out] vector2 The Vector2. */ -void StringToVector2( const char* const vectorStr, Length length, Vector2& vector2 ); +void StringToVector2(const char* const vectorStr, Length length, Vector2& vector2); /** * @brief Converts a Vector2 into a string. @@ -184,7 +182,25 @@ void StringToVector2( const char* const vectorStr, Length length, Vector2& vecto * @param[in] value The vector2 value. * @param[out] vector2Str The string. */ -void Vector2ToString( const Vector2& value, std::string& vector2Str ); +void Vector2ToString(const Vector2& value, std::string& vector2Str); + +/** + * @brief Converts a string into its value in the enum Text::Underline::Type. + * + * @param[in] typeStr The underline type value packed inside a string. + * @param[in] length The length of the string. + * @param[out] retType The Underline type. + */ +void UnderlineTypeStringToTypeValue(const char* const typeStr, Length length, Text::Underline::Type& retType); + +/** + * @brief Converts a string into a float value. + * + * @param[in] floatStr A float packed inside a string. + * + * @return The float value. + */ +float StringToFloat(const char* const floatStr); } // namespace Text @@ -192,4 +208,4 @@ void Vector2ToString( const Vector2& value, std::string& vector2Str ); } // namespace Dali -#endif // __DALI_TOOLKIT_TEXT_MARKUP_PROCESSOR_HELPER_FUNCTIONS_H__ +#endif // DALI_TOOLKIT_TEXT_MARKUP_PROCESSOR_HELPER_FUNCTIONS_H