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 |
---|---|
Default() | Returns the default value. |
IsDefaultDefined() | Returns true if the default value has been set. |
IsDefined() | Returns true if the value has been set. |
Load(Geo::IGeoStream &) | Load this Geo::Optional<Type> from a Geo::IGeoStream. |
operator!=(const Optional &) | Inequality operator. |
operator=(const Type &) | Assignment operator. |
operator==(const Optional &) | Equality operator. |
Optional() | Constructor. Defaults to undefined. |
Optional(const Type &) | Explicit construction from a value. |
Optional(const Optional &) | Copy constructor. |
Optional(void *, const Type &) | Constructor that allows you to set a default, but leave value undefined. |
Save(Geo::IGeoStream &) | Save this Geo::Optional<Type> to a Geo::IGeoStream. |
SetDefault(const Type &) | Set the default value. |
Undefine() | Unsets the value, returning it to the default. |
UndefineDefault() | Unsets the default value. |
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.