Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

NameDescription
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.


Anchor
a8b84736b452f4b819d888f8df12f9f0b
a8b84736b452f4b819d888f8df12f9f0b

const Type& Geo::Optional< Type >::Default

...

public: const Type & Default() const

...

Returns the default value.


Anchor
ac3038da2d553579498de8418cb1bd899
ac3038da2d553579498de8418cb1bd899

bool Geo::Optional< Type >::IsDefaultDefined

...

public: bool IsDefaultDefined() const

...

Returns true if the default value has been set.


Anchor
a2e2e9915ef904023a95ef68373172ce0
a2e2e9915ef904023a95ef68373172ce0

bool Geo::Optional< Type >::IsDefined

...

public: bool IsDefined() const

...

Returns true if the value has been set.


Anchor
a92cc9370095b6233d99c2bb05603da09
a92cc9370095b6233d99c2bb05603da09

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.


Anchor
ab39621933788dea3c7ad396bddf5c2d1
ab39621933788dea3c7ad396bddf5c2d1

bool Geo::Optional< Type >::operator!=

...

public: bool operator!=
(
    const Optional & v
) const

...

Inequality operator.


Anchor
a032ecc77bb0fb82503100953e5e4c74b
a032ecc77bb0fb82503100953e5e4c74b

Optional& Geo::Optional< Type >::operator=

...

public: Optional & operator=
(
    const Type & v
)

...

Assignment operator.


Anchor
ab73285b47d931dcf9f23a10966c416c1
ab73285b47d931dcf9f23a10966c416c1

bool Geo::Optional< Type >::operator==

...

public: bool operator==
(
    const Optional & v
) const

...

Equality operator.


Anchor
a2afac7883ea0b2b8b1f02ecc8558616f
a2afac7883ea0b2b8b1f02ecc8558616f

Geo::Optional< Type >::Optional

...

public: Optional()

...

Constructor. Defaults to undefined.


Anchor
a38b544ce955408516007b4f1fe19c66b
a38b544ce955408516007b4f1fe19c66b

Geo::Optional< Type >::Optional

...

public: Optional
(
    const Type & v
)

...

Explicit construction from a value.


Anchor
a645900996c2ffb97af5acaebaa04adcc
a645900996c2ffb97af5acaebaa04adcc

Geo::Optional< Type >::Optional

...

public: Optional
(
    const Optional & v
)

...

Copy constructor.


Anchor
ae0ef7850f1cf16d6759b03f8f2d5f102
ae0ef7850f1cf16d6759b03f8f2d5f102

Geo::Optional< Type >::Optional

...

public: Optional
(
    void * ,
    const Type & def
)

...

Constructor that allows you to set a default, but leave value undefined.


Anchor
a83940fa64e995cfd5fde59ec8bbb4dbd
a83940fa64e995cfd5fde59ec8bbb4dbd

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.


Anchor
a790b319b571bd82ec9f6b3081ee514aa
a790b319b571bd82ec9f6b3081ee514aa

void Geo::Optional< Type >::SetDefault

...

public: void SetDefault
(
    const Type & val
)

...

Set the default value.


Anchor
a4dde3eb05e002550942fe3014c9282f3
a4dde3eb05e002550942fe3014c9282f3

void Geo::Optional< Type >::Undefine

...

public: void Undefine()

...

Unsets the value, returning it to the default.


Anchor
a2a76e23f350bcdf048bd7f8a377be30e
a2a76e23f350bcdf048bd7f8a377be30e

void Geo::Optional< Type >::UndefineDefault

...

public: void UndefineDefault()

...

Unsets the default value.


Anchor
a13dd38df2695cca5f6527ae88d3e4b7f
a13dd38df2695cca5f6527ae88d3e4b7f

const Type& Geo::Optional< Type >::Value

...

public: const Type & Value() const

...

Return the value, if set, otherwise the default.