TextObject.h 1009 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. GWEN
  3. Copyright (c) 2010 Facepunch Studios
  4. See license in Gwen.h
  5. */
  6. #pragma once
  7. #ifndef GWEN_TEXTOBJECT_H
  8. #define GWEN_TEXTOBJECT_H
  9. #include "Gwen/Gwen.h"
  10. #include "Gwen/Utility.h"
  11. namespace Gwen
  12. {
  13. class TextObject
  14. {
  15. public:
  16. TextObject(){}
  17. TextObject( const Gwen::String& text )
  18. {
  19. *this = text;
  20. }
  21. TextObject( const char* text )
  22. {
  23. *this = Gwen::String( text );
  24. }
  25. TextObject( const wchar_t* text )
  26. {
  27. *this = Gwen::UnicodeString( text );
  28. }
  29. TextObject( const Gwen::UnicodeString& unicode )
  30. {
  31. *this = unicode;
  32. }
  33. void operator = ( const Gwen::String& str )
  34. {
  35. m_Data = Gwen::Utility::StringToUnicode( str );
  36. }
  37. void operator = ( const Gwen::UnicodeString& unicodeStr )
  38. {
  39. m_Data = unicodeStr;
  40. }
  41. Gwen::String Get() const
  42. {
  43. return Gwen::Utility::UnicodeToString( m_Data );
  44. }
  45. const Gwen::UnicodeString& GetUnicode() const
  46. {
  47. return m_Data;
  48. }
  49. Gwen::UnicodeString m_Data;
  50. };
  51. }
  52. #endif