TGUI  0.8-dev
tgui::ObjectConverter Class Reference

Implicit converter for settable properties. More...

#include <ObjectConverter.hpp>

Public Member Functions

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

Detailed Description

Implicit converter for settable properties.

Constructor & Destructor Documentation

◆ ObjectConverter() [1/13]

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

Stores a string for later retrieval.

Parameters
stringString to store

◆ ObjectConverter() [2/13]

tgui::ObjectConverter::ObjectConverter ( const std::string &  string)
inline

Stores a string for later retrieval.

Parameters
stringString to store

◆ ObjectConverter() [3/13]

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

Stores a string for later retrieval.

Parameters
stringString to store

◆ ObjectConverter() [4/13]

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

Stores a font object for later retrieval.

Parameters
fontFont to store

◆ ObjectConverter() [5/13]

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

Stores a color object for later retrieval.

Parameters
colorColor to store

◆ ObjectConverter() [6/13]

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

Stores a color object for later retrieval.

Parameters
colorColor to store

◆ ObjectConverter() [7/13]

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

Stores a boolean for later retrieval.

Parameters
valueBoolean to store

◆ ObjectConverter() [8/13]

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() [9/13]

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

Stores an outline object for later retrieval.

Parameters
outlineOutline to store

◆ ObjectConverter() [10/13]

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

Stores a texture object for later retrieval.

Parameters
textureTexture to store

◆ ObjectConverter() [11/13]

tgui::ObjectConverter::ObjectConverter ( sf::Text::Style  style)
inline

Stores a text style for later retrieval.

Parameters
styleText style to store

To combine multiple text styles, wrap the value inside the TextStyle object before passing it.

◆ ObjectConverter() [12/13]

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

Stores a text style for later retrieval.

Parameters
styleText style to store

◆ ObjectConverter() [13/13]

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 sf::String& tgui::ObjectConverter::getString ( )

Retrieves the saved string.

Returns
The saved string or a serialized string

◆ getTextStyle()

const TextStyle& 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()

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: