+void Vector4ToColorString(const Vector4& value, std::string& vector2Str)
+{
+ if(Color::BLACK == value)
+ {
+ vector2Str = BLACK_COLOR;
+ return;
+ }
+
+ if(Color::WHITE == value)
+ {
+ vector2Str = WHITE_COLOR;
+ return;
+ }
+
+ if(Color::RED == value)
+ {
+ vector2Str = RED_COLOR;
+ return;
+ }
+
+ if(Color::GREEN == value)
+ {
+ vector2Str = GREEN_COLOR;
+ return;
+ }
+
+ if(Color::BLUE == value)
+ {
+ vector2Str = BLUE_COLOR;
+ return;
+ }
+
+ if(Color::YELLOW == value)
+ {
+ vector2Str = YELLOW_COLOR;
+ return;
+ }
+
+ if(Color::MAGENTA == value)
+ {
+ vector2Str = MAGENTA_COLOR;
+ return;
+ }
+
+ if(Color::CYAN == value)
+ {
+ vector2Str = CYAN_COLOR;
+ return;
+ }
+
+ if(Color::TRANSPARENT == value)
+ {
+ vector2Str = TRANSPARENT_COLOR;
+ return;
+ }
+
+ const unsigned int alpha = static_cast<unsigned int>(255.f * value.a);
+ const unsigned int red = static_cast<unsigned int>(255.f * value.r);
+ const unsigned int green = static_cast<unsigned int>(255.f * value.g);
+ const unsigned int blue = static_cast<unsigned int>(255.f * value.b);
+
+ std::stringstream ss;
+ const unsigned int size = 2u * sizeof(unsigned char);
+
+ ss << "0x"
+ << std::setfill('0') << std::setw(size)
+ << std::hex << alpha
+ << std::setfill('0') << std::setw(size)
+ << std::hex << red
+ << std::setfill('0') << std::setw(size)
+ << std::hex << green
+ << std::setfill('0') << std::setw(size)
+ << std::hex << blue;
+ vector2Str = ss.str();
+}
+
+void StringToVector2(const char* const vectorStr, Length length, Vector2& vector2)
+{
+ // Points to the first character of the string.
+ const char* strBuffer = vectorStr;
+
+ // Points to the first character of the 'x' value.
+ const char* const xBuffer = strBuffer;
+
+ // Jumps to the next white space.
+ JumpToWhiteSpace(strBuffer, strBuffer + length);
+
+ // Points to the first character of the 'y' value.
+ const char* const yBuffer = strBuffer;
+
+ // Converts the shadow's offset to float.
+ vector2.x = StringToFloat(xBuffer);
+ vector2.y = StringToFloat(yBuffer);
+}
+
+void Vector2ToString(const Vector2& value, std::string& vector2Str)
+{
+ FloatToString(value.x, vector2Str);
+ vector2Str += " ";
+
+ std::string yStr;
+ FloatToString(value.y, yStr);
+
+ 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;
+}
+