mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-31 02:26:29 +03:00
41 lines
855 B
C++
41 lines
855 B
C++
#ifndef EE_GRAPHICS_TEXTTRANSFORM_HPP
|
|
#define EE_GRAPHICS_TEXTTRANSFORM_HPP
|
|
|
|
#include <eepp/core/string.hpp>
|
|
|
|
namespace EE { namespace Graphics {
|
|
|
|
class TextTransform {
|
|
public:
|
|
enum Value { LowerCase, UpperCase, Capitalize, None };
|
|
|
|
static TextTransform::Value fromString( std::string str ) {
|
|
String::toLowerInPlace( str );
|
|
if ( str == "lowercase" )
|
|
return LowerCase;
|
|
else if ( str == "uppercase" )
|
|
return UpperCase;
|
|
else if ( str == "capitalize" )
|
|
return Capitalize;
|
|
return None;
|
|
}
|
|
|
|
static std::string toString( const TextTransform::Value& val ) {
|
|
switch ( val ) {
|
|
case LowerCase:
|
|
return "lowercase";
|
|
case UpperCase:
|
|
return "uppercase";
|
|
case Capitalize:
|
|
return "capitalize";
|
|
case None:
|
|
return "none";
|
|
}
|
|
return "none";
|
|
}
|
|
};
|
|
|
|
}} // namespace EE::Graphics
|
|
|
|
#endif // EE_GRAPHICS_TEXTTRANSFORM_HPP
|