Merge branch 'poco-1.10.0' of https://github.com/pocoproject/poco into poco-1.10.0

This commit is contained in:
Joerg-Christian Boehme 2020-01-15 12:18:10 +01:00
commit 68cdbc6a05
3 changed files with 53 additions and 11 deletions

View File

@ -82,6 +82,14 @@ public:
{ {
} }
Nullable(C&& value):
/// Creates a Nullable by moving the given value.
_value(value),
_isNull(false),
_null()
{
}
Nullable(const Nullable& other): Nullable(const Nullable& other):
/// Creates a Nullable by copying another one. /// Creates a Nullable by copying another one.
_value(other._value), _value(other._value),
@ -112,6 +120,14 @@ public:
return *this; return *this;
} }
Nullable& assign(C&& value)
/// Assigns a value to the Nullable.
{
_value = value;
_isNull = false;
return *this;
}
Nullable& assign(const Nullable& other) Nullable& assign(const Nullable& other)
/// Assigns another Nullable. /// Assigns another Nullable.
{ {
@ -133,6 +149,12 @@ public:
return assign(value); return assign(value);
} }
Nullable& operator = (C&& value)
/// Move-assigns a value to the Nullable.
{
return assign(value);
}
Nullable& operator = (const Nullable& other) Nullable& operator = (const Nullable& other)
/// Assigns another Nullable. /// Assigns another Nullable.
{ {

View File

@ -32,7 +32,7 @@ class Optional
/// that allows to introduce a specified/unspecified state /// that allows to introduce a specified/unspecified state
/// to value objects. /// to value objects.
/// ///
/// An Optional can be default constructed. In this case, /// An Optional can be default constructed. In this case,
/// the Optional will have a Null value and isSpecified() will /// the Optional will have a Null value and isSpecified() will
/// return false. Calling value()(without default value) on /// return false. Calling value()(without default value) on
/// a Null object will throw a NullValueException. /// a Null object will throw a NullValueException.
@ -53,20 +53,27 @@ class Optional
/// nillable == true. /// nillable == true.
{ {
public: public:
Optional(): Optional():
/// Creates an empty Optional. /// Creates an empty Optional.
_value(), _value(),
_isSpecified(false) _isSpecified(false)
{ {
} }
Optional(const C& value): Optional(const C& value):
/// Creates a Optional with the given value. /// Creates a Optional with the given value.
_value(value), _value(value),
_isSpecified(true) _isSpecified(true)
{ {
} }
Optional(C&& value):
/// Creates a Optional by moving the given value.
_value(value),
_isSpecified(true)
{
}
Optional(const Optional& other): Optional(const Optional& other):
/// Creates a Optional by copying another one. /// Creates a Optional by copying another one.
_value(other._value), _value(other._value),
@ -90,11 +97,19 @@ public:
Optional& assign(const C& value) Optional& assign(const C& value)
/// Assigns a value to the Optional. /// Assigns a value to the Optional.
{ {
_value = value; _value = value;
_isSpecified = true; _isSpecified = true;
return *this; return *this;
} }
Optional& assign(C&& value)
/// Moves a value into the Optional.
{
_value = value;
_isSpecified = true;
return *this;
}
Optional& assign(const Optional& other) Optional& assign(const Optional& other)
/// Assigns another Optional. /// Assigns another Optional.
{ {
@ -102,12 +117,17 @@ public:
swap(tmp); swap(tmp);
return *this; return *this;
} }
Optional& operator = (const C& value) Optional& operator = (const C& value)
{ {
return assign(value); return assign(value);
} }
Optional& operator = (C&& value)
{
return assign(value);
}
Optional& operator = (const Optional& other) Optional& operator = (const Optional& other)
{ {
return assign(other); return assign(other);
@ -140,7 +160,7 @@ public:
const C& value(const C& deflt) const const C& value(const C& deflt) const
/// Returns the Optional's value, or the /// Returns the Optional's value, or the
/// given default value if the Optional's /// given default value if the Optional's
/// value has not been specified. /// value has not been specified.
{ {
return _isSpecified ? _value : deflt; return _isSpecified ? _value : deflt;
@ -151,7 +171,7 @@ public:
{ {
return _isSpecified; return _isSpecified;
} }
void clear() void clear()
/// Clears the Optional. /// Clears the Optional.
{ {

View File

@ -216,7 +216,7 @@ protected:
helpFormatter.setHeader( helpFormatter.setHeader(
"\n" "\n"
"The POCO C++ Server Page Compiler.\n" "The POCO C++ Server Page Compiler.\n"
"Copyright (c) 2008-2019 by Applied Informatics Software Engineering GmbH.\n" "Copyright (c) 2008-2020 by Applied Informatics Software Engineering GmbH.\n"
"All rights reserved.\n\n" "All rights reserved.\n\n"
"This program compiles web pages containing embedded C++ code " "This program compiles web pages containing embedded C++ code "
"into a C++ class that can be used with the HTTP server " "into a C++ class that can be used with the HTTP server "