This is the documentation for Enlighten.
class Geo Optional
template<typename Type>
class Geo::Optional
Class allowing a value object (integer, string, etc) to be optional, by storing a current value, default value and a boolean to state which is valid.
The template type 'Type' must be default-constructible.
Functions
Name | Description |
|---|---|
Returns the default value. | |
Returns true if the default value has been set. | |
Returns true if the value has been set. | |
Load this Geo::Optional<Type> from a Geo::IGeoStream. | |
Inequality operator. | |
Assignment operator. | |
Equality operator. | |
Constructor. Defaults to undefined. | |
Explicit construction from a value. | |
Copy constructor. | |
Constructor that allows you to set a default, but leave value undefined. | |
Save this Geo::Optional<Type> to a Geo::IGeoStream. | |
Set the default value. | |
Unsets the value, returning it to the default. | |
Unsets the default value. | |
Return the value, if set, otherwise the default. |
const Type& Geo::Optional< Type >::Default
public: const Type & Default() const
Returns the default value.
bool Geo::Optional< Type >::IsDefaultDefined
public: bool IsDefaultDefined() const
Returns true if the default value has been set.
bool Geo::Optional< Type >::IsDefined
public: bool IsDefined() const
Returns true if the value has been set.
bool Geo::Optional< Type >::Load
public: bool Load
(
Geo::IGeoStream & stream
)
Load this Geo::Optional<Type> from a Geo::IGeoStream.
Expected the file value to be in little-endian, and restores to native. Does not read/modify the default value.
bool Geo::Optional< Type >::operator!=
public: bool operator!=
(
const Optional & v
) const
Inequality operator.
Optional& Geo::Optional< Type >::operator=
public: Optional & operator=
(
const Type & v
)
Assignment operator.
bool Geo::Optional< Type >::operator==
public: bool operator==
(
const Optional & v
) const
Equality operator.
Geo::Optional< Type >::Optional
public: Optional()
Constructor. Defaults to undefined.
Geo::Optional< Type >::Optional
public: Optional
(
const Type & v
)
Explicit construction from a value.
Geo::Optional< Type >::Optional
public: Optional
(
const Optional & v
)
Copy constructor.
Geo::Optional< Type >::Optional
public: Optional
(
void * ,
const Type & def
)
Constructor that allows you to set a default, but leave value undefined.
bool Geo::Optional< Type >::Save
public: bool Save
(
Geo::IGeoStream & stream
) const
Save this Geo::Optional<Type> to a Geo::IGeoStream.
Writes the file value in little-endian. Does not store the default value.
void Geo::Optional< Type >::SetDefault
public: void SetDefault
(
const Type & val
)
Set the default value.
void Geo::Optional< Type >::Undefine
public: void Undefine()
Unsets the value, returning it to the default.
void Geo::Optional< Type >::UndefineDefault
public: void UndefineDefault()
Unsets the default value.
const Type& Geo::Optional< Type >::Value
public: const Type & Value() const
Return the value, if set, otherwise the default.