Om
1.0.0
A universal framework for multimedia simulation
|
A class that is used to store a value that may or may not be set. More...
#include <omOptional.h>
Public Member Functions | |
Optional () | |
Create an optional object whose value is not set. More... | |
Optional (const T &newValue) | |
Create an optional object with the specified value. More... | |
Optional (const Optional &other) | |
Create a copy of another Optional object. More... | |
~Optional () | |
Destroy an Optional object, destroying any value stored within. More... | |
Optional & | operator= (const Optional &other) |
Assign the value of another Optional object to this object. More... | |
operator T & () | |
Get a reference to the value contained by this Optional object. More... | |
operator const T & () const | |
Get a const reference to the value contained by this Optional object. More... | |
T & | get () |
Get a reference to the value contained by this Optional object. More... | |
const T & | get () const |
Get a const reference to the value contained by this Optional object. More... | |
void | set (const T &newValue) |
Set the value contained by this Optional object. More... | |
Bool | isSet () const |
Return whether or not the optional value is set. More... | |
A class that is used to store a value that may or may not be set.
The Optional class is implemented using a pointer to a value that can be optionally NULL. When setting the value of an Optional object, the provided value is copy-constructed and stored internally. Accessing the contents of an Optional object that does not have a value will result in an assertion being raised.
|
inline |
Create an optional object whose value is not set.
|
inline |
Create an optional object with the specified value.
newValue | - the value to use for this Optional object. |
|
inline |
Create a copy of another Optional object.
|
inline |
Destroy an Optional object, destroying any value stored within.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return whether or not the optional value is set.
If the value is set, TRUE is returned. Otherwise FALSE is returned.