Library: Foundation
Package: Core
Header: Poco/Nullable.h
Nullable is a simple wrapper class for value types that allows to introduce a "null" value or state to value objects.
The class is useful for passing parameters to functions when parameters are optional and no default values should be used.
A Nullable can be default constructed. In this case, the Nullable will have a Null value and isNull() will return true. Calling value() (without default value) on a Null object will throw a NullValueException.
A Nullable can also be constructed from a value. It is possible to assign a value to a Nullable, and to reset a Nullable to contain a Null value by calling clear().
For use with Nullable, the value type should support default construction.
Member Functions: assign, clear, isNull, operator =, swap, value
Nullable();
Creates an empty Nullable.
Nullable(
const C & value
);
Creates a Nullable with the given value.
Nullable(
const Nullable & other
);
Creates a Nullable by copying another one.
~Nullable();
Destroys the Nullable.
Nullable & assign(
const C & value
);
Assigns a value to the Nullable.
Nullable & assign(
const Nullable & other
);
Assigns another Nullable.
void clear();
Clears the Nullable.
bool isNull() const;
Returns true if and only if the Nullable is empty.
Nullable & operator = (
const C & value
);
Nullable & operator = (
const Nullable & other
);
void swap(
Nullable & other
);
const C & value() const;
Returns the Nullable's value.
Throws a NullValueException if the Nullable is empty.
const C & value(
const C & deflt
) const;