TGUI  1.3.0
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_t<std::is_arithmetic<T>::value, T>>
 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.
 
TGUI_NODISCARD const StringgetString ()
 Retrieves the saved string.
 
TGUI_NODISCARD const FontgetFont ()
 Retrieves the saved font.
 
TGUI_NODISCARD const ColorgetColor ()
 Retrieves the saved color.
 
TGUI_NODISCARD const OutlinegetOutline ()
 Retrieves the saved outline.
 
TGUI_NODISCARD bool getBool ()
 Retrieves the saved boolean.
 
TGUI_NODISCARD float getNumber ()
 Retrieves the saved number.
 
TGUI_NODISCARD const TexturegetTexture ()
 Retrieves the saved texture.
 
TGUI_NODISCARD const TextStylesgetTextStyle ()
 Retrieves the saved text style.
 
TGUI_NODISCARD const std::shared_ptr< RendererData > & getRenderer ()
 Retrieves the saved renderer data.
 
TGUI_NODISCARD Type getType () const
 Retrieves the type of the object that has been stored.
 
TGUI_NODISCARD bool operator== (const ObjectConverter &right) const
 Check if the object equals another one.
 
TGUI_NODISCARD 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_t<std::is_arithmetic<T>::value, T>>
tgui::ObjectConverter::ObjectConverter ( T 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()

TGUI_NODISCARD 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()

TGUI_NODISCARD 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()

TGUI_NODISCARD 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()

TGUI_NODISCARD 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()

TGUI_NODISCARD 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()

TGUI_NODISCARD 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()

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

Retrieves the saved string.

Returns
The saved string or a serialized string

◆ getTextStyle()

TGUI_NODISCARD 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()

TGUI_NODISCARD 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()

TGUI_NODISCARD Type tgui::ObjectConverter::getType ( ) const

Retrieves the type of the object that has been stored.

Returns
The stored object type

◆ operator!=()

TGUI_NODISCARD 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==()

TGUI_NODISCARD 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: