Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion::gfx::ResourceHolder::Field< T > Class Template Reference

A generic field that represents some state in the resource. More...

#include "resourceholder.h"

Inheritance diagram for ion::gfx::ResourceHolder::Field< T >:
Collaboration diagram for ion::gfx::ResourceHolder::Field< T >:

Public Member Functions

 Field (const int change_bit, const T &initial_value, ResourceHolder *holder)
 
 Field (const Field &other)
 
 ~Field () override
 
virtual bool IsValid (const T &value)
 Checks if a proposed value is valid. More...
 
const TGet () const
 Gets a const version of the current value. More...
 
TGetMutable ()
 Gets an editable version of the current value. More...
 
bool Set (const T &value)
 Sets the value of the Field if it is valid and tells the resource what has changed. More...
 
int GetBit () const
 Get the change bit. More...
 

Protected Member Functions

void OnChanged ()
 
void OnChanged (const int bit)
 Trigger a change for a specific bit. More...
 

Detailed Description

template<typename T>
class ion::gfx::ResourceHolder::Field< T >

A generic field that represents some state in the resource.

When the Field value changes, it tells the resource that something has changed.

Definition at line 138 of file resourceholder.h.

Constructor & Destructor Documentation

template<typename T>
ion::gfx::ResourceHolder::Field< T >::Field ( const int  change_bit,
const T initial_value,
ResourceHolder holder 
)
inline

Definition at line 140 of file resourceholder.h.

template<typename T>
ion::gfx::ResourceHolder::Field< T >::Field ( const Field< T > &  other)
inline

Definition at line 144 of file resourceholder.h.

template<typename T>
ion::gfx::ResourceHolder::Field< T >::~Field ( )
inlineoverride

Definition at line 148 of file resourceholder.h.

Member Function Documentation

template<typename T>
const T& ion::gfx::ResourceHolder::Field< T >::Get ( ) const
inline

Gets a const version of the current value.

Definition at line 157 of file resourceholder.h.

int ion::gfx::ResourceHolder::FieldBase::GetBit ( ) const
inlineinherited

Get the change bit.

Definition at line 102 of file resourceholder.h.

template<typename T>
T* ion::gfx::ResourceHolder::Field< T >::GetMutable ( )
inline

Gets an editable version of the current value.

Since the caller could do anything with the reference, also notify the resource.

Definition at line 161 of file resourceholder.h.

template<typename T>
virtual bool ion::gfx::ResourceHolder::Field< T >::IsValid ( const T value)
inlinevirtual

Checks if a proposed value is valid.

Descendant classes can override this to provide validation (e.g. range checking).

Reimplemented in ion::gfx::ResourceHolder::RangedField< T >.

Definition at line 152 of file resourceholder.h.

void ion::gfx::ResourceHolder::FieldBase::OnChanged ( )
inlineprotectedinherited

Definition at line 113 of file resourceholder.h.

void ion::gfx::ResourceHolder::FieldBase::OnChanged ( const int  bit)
inlineprotectedinherited

Trigger a change for a specific bit.

Definition at line 121 of file resourceholder.h.

template<typename T>
bool ion::gfx::ResourceHolder::Field< T >::Set ( const T value)
inline

Sets the value of the Field if it is valid and tells the resource what has changed.

If the value is not valid, an error message is logged. Returns whether the set occurred.

Definition at line 169 of file resourceholder.h.


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