#include <ball_userfieldvalue.h>
|
| BSLMF_NESTED_TRAIT_DECLARATION (UserFieldValue, bslma::UsesBslmaAllocator) |
|
| UserFieldValue (bslma::Allocator *basicAllocator=0) |
|
| UserFieldValue (bsls::Types::Int64 value, bslma::Allocator *basicAllocator=0) |
|
| UserFieldValue (double value, bslma::Allocator *basicAllocator=0) |
|
| UserFieldValue (const bsl::string_view &value, bslma::Allocator *basicAllocator=0) |
|
| UserFieldValue (const bdlt::DatetimeTz &value, bslma::Allocator *basicAllocator=0) |
|
| UserFieldValue (const bsl::vector< char > &value, bslma::Allocator *basicAllocator=0) |
|
template<class t_INTEGRAL_TYPE > |
| UserFieldValue (t_INTEGRAL_TYPE value, bslma::Allocator *basicAllocator=0, typename bsl::enable_if< bsl::is_integral< t_INTEGRAL_TYPE >::value >::type *=0) |
|
| UserFieldValue (const UserFieldValue &original, bslma::Allocator *basicAllocator=0) |
|
| ~UserFieldValue ()=default |
| Destroy this object.
|
|
UserFieldValue & | operator= (const UserFieldValue &rhs) |
|
void | reset () |
|
void | setInt64 (bsls::Types::Int64 value) |
|
void | setDouble (double value) |
|
void | setString (const bsl::string_view &value) |
|
void | setDatetimeTz (const bdlt::DatetimeTz &value) |
|
void | setCharArray (const bsl::vector< char > &value) |
|
void | swap (UserFieldValue &other) |
|
bool | isUnset () const |
|
ball::UserFieldType::Enum | type () const |
|
const bsls::Types::Int64 & | theInt64 () const |
|
const double & | theDouble () const |
|
const bsl::string & | theString () const |
|
const bdlt::DatetimeTz & | theDatetimeTz () const |
|
const bsl::vector< char > & | theCharArray () const |
|
bslma::Allocator * | allocator () const |
|
bsl::ostream & | print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const |
|
This class implements a value-semantic type for representing the value of a user field in a log record. A user field value acts as a discriminated union, and may represent a value of any of the types described in ball::UserFieldType
or an unset value (indicated by type ball::UserFieldType::e_VOID
).
See ball_userfieldvalue
◆ UserFieldValue() [1/8]
Create a user field value having the unset value. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
◆ UserFieldValue() [2/8]
◆ UserFieldValue() [3/8]
ball::UserFieldValue::UserFieldValue |
( |
double |
value, |
|
|
bslma::Allocator * |
basicAllocator = 0 |
|
) |
| |
|
inlineexplicit |
◆ UserFieldValue() [4/8]
◆ UserFieldValue() [5/8]
◆ UserFieldValue() [6/8]
Create a user field value having the specified value
. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
◆ UserFieldValue() [7/8]
template<class t_INTEGRAL_TYPE >
Create a user field value having the specified integral value
. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
Note that this constructor is provided to disambiguate between constructors taking double
and bsls::Types::Int64
when supplied an integer that is not of type bsls::Types::Int64
. Also note that the implementation is (temporarily) provided inline to avoid issues with MSVC 2008.
◆ UserFieldValue() [8/8]
Create a UserFieldValue
object having the same value as the specified original
object. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the currently installed default allocator is used.
◆ ~UserFieldValue()
ball::UserFieldValue::~UserFieldValue |
( |
| ) |
|
|
default |
◆ allocator()
Return the allocator used by this object to supply memory. Note that if no allocator was supplied at construction the currently installed default allocator is used.
◆ BSLMF_NESTED_TRAIT_DECLARATION()
◆ isUnset()
bool ball::UserFieldValue::isUnset |
( |
| ) |
const |
|
inline |
◆ operator=()
Assign to this object the value of the specified rhs
object, and return a reference providing modifiable access to this object.
◆ print()
bsl::ostream & ball::UserFieldValue::print |
( |
bsl::ostream & |
stream, |
|
|
int |
level = 0 , |
|
|
int |
spacesPerLevel = 4 |
|
) |
| const |
Write the value of this object to the specified output stream
in a human-readable format, and return a reference to stream
. Optionally specify an initial indentation level
, whose absolute value is incremented recursively for nested objects. If level
is specified, optionally specify spacesPerLevel
, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects. If level
is negative, suppress indentation of the first line. If spacesPerLevel
is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level
). If stream
is not valid on entry, this operation has no effect. Note that the format is not fully specified, and can change without notice.
◆ reset()
void ball::UserFieldValue::reset |
( |
| ) |
|
|
inline |
◆ setCharArray()
void ball::UserFieldValue::setCharArray |
( |
const bsl::vector< char > & |
value | ) |
|
|
inline |
◆ setDatetimeTz()
◆ setDouble()
void ball::UserFieldValue::setDouble |
( |
double |
value | ) |
|
|
inline |
◆ setInt64()
◆ setString()
◆ swap()
Efficiently exchange the value of this object with the value of the specified other
object. This method provides the no-throw exception-safety guarantee if either type()
is the same as other.type()
, or neither type()
nor other.type()
is a type that requires allocation; otherwise, it provides the basic guarantee. The behavior is undefined unless this object was created with the same allocator as other
.
◆ theCharArray()
const bsl::vector< char > & ball::UserFieldValue::theCharArray |
( |
| ) |
const |
|
inline |
◆ theDatetimeTz()
◆ theDouble()
const double & ball::UserFieldValue::theDouble |
( |
| ) |
const |
|
inline |
◆ theInt64()
◆ theString()
const bsl::string & ball::UserFieldValue::theString |
( |
| ) |
const |
|
inline |
◆ type()
Return the type of this user field value. The type ball::UserFieldValue::e_VOID
represents the unset value.
◆ operator==
Return true
if the specified lhs
and rhs
objects have the same value, and false
otherwise. Two UserFieldValue
objects have the same value if they have the same type, and (if the type is not e_VOID
) the value of that type (as accessed through the*
methods) is the same.
◆ swap
Swap the value of the specified a
object with the value of the specified b
object. This method provides the no-throw exception-safety guarantee if either a.type()
is the same as b.type()
and a
and b
were created with the same allocator, or neither a.type()
nor b.type()
is a type that requires allocation; otherwise, it provides the basic guarantee.
The documentation for this class was generated from the following file: