TGUI  0.9.5
Loading...
Searching...
No Matches
tgui::ObjectConverter Class Reference

Implicit converter for settable properties. More...

#include <TGUI/ObjectConverter.hpp>

Public Types

enum class  Type {
  None , Bool , Font , Color ,
  String , Number , Outline , Texture ,
  TextStyle , RendererData
}
 

Public Member Functions

 ObjectConverter ()
 Default constructor, to create an empty object.
 
 ObjectConverter (const char *string)
 Stores a string for later retrieval.
 
 ObjectConverter (const String &string)
 Stores a string for later retrieval.
 
 ObjectConverter (Font font)
 Stores a font object for later retrieval.
 
 ObjectConverter (Color color)
 Stores a color object for later retrieval.
 
 ObjectConverter (bool value)
 Stores a boolean for later retrieval.
 
template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
 ObjectConverter (T number)
 Stores a number for later retrieval.
 
 ObjectConverter (const Outline &outline)
 Stores an outline object for later retrieval.
 
 ObjectConverter (const Texture &texture)
 Stores a texture object for later retrieval.
 
 ObjectConverter (TextStyle style)
 Stores a single text style for later retrieval.
 
 ObjectConverter (TextStyles style)
 Stores a text style for later retrieval.
 
 ObjectConverter (std::shared_ptr< RendererData > data)
 Stores render data for later retrieval.
 
const StringgetString ()
 Retrieves the saved string.
 
const FontgetFont ()
 Retrieves the saved font.
 
const ColorgetColor ()
 Retrieves the saved color.
 
const OutlinegetOutline ()
 Retrieves the saved outline.
 
bool getBool ()
 Retrieves the saved boolean.
 
float getNumber ()
 Retrieves the saved number.
 
const TexturegetTexture ()
 Retrieves the saved texture.
 
const TextStylesgetTextStyle ()
 Retrieves the saved text style.
 
const std::shared_ptr< RendererData > & getRenderer ()
 Retrieves the saved renderer data.
 
Type getType () const
 Retrieves the type of the object that has been stored.
 
bool operator== (const ObjectConverter &right) const
 Check if the object equals another one.
 
bool operator!= (const ObjectConverter &right) const
 Check if the object differs from another one.
 

Detailed Description

Implicit converter for settable properties.

Constructor & Destructor Documentation

◆ ObjectConverter() [1/11]

tgui::ObjectConverter::ObjectConverter ( const char *  string)
inline

Stores a string for later retrieval.

Parameters
stringString to store

◆ ObjectConverter() [2/11]

tgui::ObjectConverter::ObjectConverter ( const String string)
inline

Stores a string for later retrieval.

Parameters
stringString to store

◆ ObjectConverter() [3/11]

tgui::ObjectConverter::ObjectConverter ( Font  font)
inline

Stores a font object for later retrieval.

Parameters
fontFont to store

◆ ObjectConverter() [4/11]

tgui::ObjectConverter::ObjectConverter ( Color  color)
inline

Stores a color object for later retrieval.

Parameters
colorColor to store

◆ ObjectConverter() [5/11]

tgui::ObjectConverter::ObjectConverter ( bool  value)
inline

Stores a boolean for later retrieval.

Parameters
valueBoolean to store

◆ ObjectConverter() [6/11]

template<typename T , typename = typename std::enable_if<std::is_arithmetic<T>::value, T>::type>
tgui::ObjectConverter::ObjectConverter ( number)
inline

Stores a number for later retrieval.

Parameters
numberNumber to store

◆ ObjectConverter() [7/11]

tgui::ObjectConverter::ObjectConverter ( const Outline outline)
inline

Stores an outline object for later retrieval.

Parameters
outlineOutline to store

◆ ObjectConverter() [8/11]

tgui::ObjectConverter::ObjectConverter ( const Texture texture)
inline

Stores a texture object for later retrieval.

Parameters
textureTexture to store

◆ ObjectConverter() [9/11]

tgui::ObjectConverter::ObjectConverter ( TextStyle  style)
inline

Stores a single text style for later retrieval.

Parameters
styleText style to store

◆ ObjectConverter() [10/11]

tgui::ObjectConverter::ObjectConverter ( TextStyles  style)
inline

Stores a text style for later retrieval.

Parameters
styleText style to store

◆ ObjectConverter() [11/11]

tgui::ObjectConverter::ObjectConverter ( std::shared_ptr< RendererData data)
inline

Stores render data for later retrieval.

Parameters
dataRenderer data to store

Member Function Documentation

◆ getBool()

bool tgui::ObjectConverter::getBool ( )

Retrieves the saved boolean.

Returns
The saved boolean

This function will assert when something other than a boolean was saved

◆ getColor()

const Color & tgui::ObjectConverter::getColor ( )

Retrieves the saved color.

Returns
The saved color

This function will assert when something other than a color was saved

◆ getFont()

const Font & tgui::ObjectConverter::getFont ( )

Retrieves the saved font.

Returns
The saved font

This function will assert when something other than a font was saved

◆ getNumber()

float tgui::ObjectConverter::getNumber ( )

Retrieves the saved number.

Returns
The saved number

This function will assert when something other than a number was saved

◆ getOutline()

const Outline & tgui::ObjectConverter::getOutline ( )

Retrieves the saved outline.

Returns
The saved outline

This function will assert when something other than a outline was saved

◆ getRenderer()

const std::shared_ptr< RendererData > & tgui::ObjectConverter::getRenderer ( )

Retrieves the saved renderer data.

Returns
Saved renderer data

This function will assert when something other than a renderer data was saved

◆ getString()

const String & tgui::ObjectConverter::getString ( )

Retrieves the saved string.

Returns
The saved string or a serialized string

◆ getTextStyle()

const TextStyles & tgui::ObjectConverter::getTextStyle ( )

Retrieves the saved text style.

Returns
Saved text style

This function will assert when something other than a text style was saved

◆ getTexture()

const Texture & tgui::ObjectConverter::getTexture ( )

Retrieves the saved texture.

Returns
The saved texture

This function will assert when something other than a texture was saved

◆ getType()

Type tgui::ObjectConverter::getType ( ) const

Retrieves the type of the object that has been stored.

Returns
The stored object type

◆ operator!=()

bool tgui::ObjectConverter::operator!= ( const ObjectConverter right) const

Check if the object differs from another one.

Objects with different types will always be considered as different, even if using them would have the same outcome

◆ operator==()

bool tgui::ObjectConverter::operator== ( const ObjectConverter right) const

Check if the object equals another one.

Objects with different types will always be considered as different, even if using them would have the same outcome


The documentation for this class was generated from the following file: