![]() |
NDEVR
API Documentation
|
A core part of the engine, stores variables that can be listened to with ResourceListener which will recieve updates when changed. More...
Inherits ResourceBase.
Public Member Functions | |
| Resource (const Resource< T > &value)=delete | |
| Copy constructor is deleted to enforce unique ownership. | |
| Resource (const T &value) | |
| Constructs a Resource with an initial value. | |
| const T & | get () const |
| Returns a const reference to the stored value. | |
| void | getCopy (T ©) const |
| Copies the stored value into the provided output parameter. | |
| T & | getModifiable () |
| Returns a mutable reference to the stored value without notifying listeners. | |
| bool | isEqualTo (const T &value) const |
| Checks whether the given value is equal to the stored value. | |
| Resource< T > & | operator= (const Resource< T > &)=delete |
| Copy assignment is deleted to enforce unique ownership. | |
| void | set (const T &info, bool check_equal=true) |
| Destructor. | |
| void | set (T &&info, bool check_equal=true) |
| Sets the stored value by move and notifies all listeners. | |
| Public Member Functions inherited from ResourceBase | |
| ResourceBase () | |
| Constructs a default ResourceBase with no listeners. | |
| ResourceBase (const ResourceBase &value) | |
| Copy constructs a ResourceBase. | |
| virtual | ~ResourceBase () |
| Virtual destructor. | |
| ResourceListener * | addListener (ResourceListener *listener) const |
| Adds a listener that will be notified when this resource changes. | |
| void | addListener (ResourceListener *listener, bool silent_add) const |
| Adds a listener with optional silent registration. | |
| void | refreshListeners () |
| Notifies all registered listeners that the resource value has changed. | |
| void | removeListener (ResourceListener *listener) const |
| Removes a listener so it no longer receives update notifications. | |
Additional Inherited Members | |
| Protected Attributes inherited from ResourceBase | |
| Buffer< ResourceListener * > | m_listeners |
| The collection of listeners subscribed to this resource. | |
A core part of the engine, stores variables that can be listened to with ResourceListener which will recieve updates when changed.
Definition at line 41 of file Resource.h.
|
inlineexplicit |
Constructs a Resource with an initial value.
| [in] | value | The initial value to store in the Resource. |
Definition at line 48 of file Resource.h.
References ResourceBase::ResourceBase().
Referenced by Resource(), and operator=().
|
inline |
Returns a const reference to the stored value.
Definition at line 89 of file Resource.h.
Referenced by QCustomLineEdit::setup(), and QCustomComboBox::setupResource().
|
inline |
Copies the stored value into the provided output parameter.
| [in] | copy | The variable to receive a copy of the stored value. |
Definition at line 98 of file Resource.h.
|
inline |
Returns a mutable reference to the stored value without notifying listeners.
Definition at line 107 of file Resource.h.
|
inline |
Checks whether the given value is equal to the stored value.
| [in] | value | The value to compare against the stored value. |
Definition at line 118 of file Resource.h.
|
inline |
Destructor.
Sets the stored value by copy and notifies all listeners.
| [in] | info | The new value to assign. |
| [in] | check_equal | If true, skips the update when the new value equals the current value. |
Definition at line 62 of file Resource.h.
References isEqualTo(), and ResourceBase::refreshListeners().
Referenced by QCustomLineEdit::setup(), and QCustomComboBox::setupResource().
|
inline |
Sets the stored value by move and notifies all listeners.
| [in] | info | The new value to move-assign. |
| [in] | check_equal | If true, skips the update when the new value equals the current value. |
Definition at line 76 of file Resource.h.
References isEqualTo(), and ResourceBase::refreshListeners().