[#BloombergLP-ball-UserFieldValue] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/ball.adoc[ball]::UserFieldValue :relfileprefix: ../../ :mrdocs: 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`). == Synopsis Declared in `<ball_userfieldvalue.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class UserFieldValue; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/ball/UserFieldValue/2constructor-071.adoc[`UserFieldValue`] [.small]#[constructor]# | Constructors | xref:BloombergLP/ball/UserFieldValue/operator_assign.adoc[`operator=`] | Assign to this object the value of the specified `rhs` object, and return a reference providing modifiable access to this object. | xref:BloombergLP/ball/UserFieldValue/allocator.adoc[`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. | xref:BloombergLP/ball/UserFieldValue/isUnset.adoc[`isUnset`] | Return `true` if this object has the unset value, and `false` otherwise. Note that if `isUnset()` returns `true`, then `type()` returns `ball::UserFieldType::e_VOID`. | xref:BloombergLP/ball/UserFieldValue/print.adoc[`print`] | 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. | xref:BloombergLP/ball/UserFieldValue/reset.adoc[`reset`] | Set this object to have the unset value. After this operation, `type() == ball::UserFieldType::e_VOID`. | xref:BloombergLP/ball/UserFieldValue/setCharArray.adoc[`setCharArray`] | Set this object to have the specified `value`. After this operation, `type() == ball::UserFieldType::e_CHAR_ARRAY`. | xref:BloombergLP/ball/UserFieldValue/setDatetimeTz.adoc[`setDatetimeTz`] | Set this object to have the specified `value`. After this operation, `type() == ball::UserFieldType::e_DATETIMETZ`. | xref:BloombergLP/ball/UserFieldValue/setDouble.adoc[`setDouble`] | Set this object to have the specified `value`. After this operation, `type() == ball::UserFieldType::e_DOUBLE`. | xref:BloombergLP/ball/UserFieldValue/setInt64.adoc[`setInt64`] | Set this object to have the specified `value`. After this operation, `type() == ball::UserFieldType::e_INT64`. | xref:BloombergLP/ball/UserFieldValue/setString.adoc[`setString`] | Set this object to have the specified `value`. After this operation, `type() == ball::UserFieldType::e_STRING`. | xref:BloombergLP/ball/UserFieldValue/swap.adoc[`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`. | xref:BloombergLP/ball/UserFieldValue/theCharArray.adoc[`theCharArray`] | Return a reference providing non‐modifiable access to the `bsl::vector<char>` value of this object. The behavior is undefined unless `type() == ball::UserFieldType::e_CHAR_ARRAY`. | xref:BloombergLP/ball/UserFieldValue/theDatetimeTz.adoc[`theDatetimeTz`] | Return a reference providing non‐modifiable access to the `DatetimeTz` value of this object. The behavior is undefined unless `type() == ball::UserFieldType::e_DATETIMETZ`. | xref:BloombergLP/ball/UserFieldValue/theDouble.adoc[`theDouble`] | Return a reference providing non‐modifiable access to the double value of this object. The behavior is undefined unless `type() == ball::UserFieldType::e_DOUBLE`. | xref:BloombergLP/ball/UserFieldValue/theInt64.adoc[`theInt64`] | Return a reference providing non‐modifiable access to the 64‐bit integer value of this object. The behavior is undefined unless `type() == ball::UserFieldType::e_INT64`. | xref:BloombergLP/ball/UserFieldValue/theString.adoc[`theString`] | Return a reference providing non‐modifiable access to the string value of this object. The behavior is undefined unless `type() == ball::UserFieldType::e_STRING`. | xref:BloombergLP/ball/UserFieldValue/type.adoc[`type`] | Return the type of this user field value. The type `ball::UserFieldValue::e_VOID` represents the unset value. | xref:BloombergLP/ball/UserFieldValue/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<UserFieldValue, UsesBslmaAllocator>`] | Declare that this type uses a `bslma` allocator. |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/ball/swap-0a.adoc[BloombergLP::ball::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. | `xref:BloombergLP/ball/operator_eq-048.adoc[BloombergLP::ball::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. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/ball/operator_not_eq-066.adoc[`operator!=`] | Return `true` if the specified `lhs` and `rhs` objects do not have the same value, and `false` otherwise. Two `UserFieldValue` objects do not have the same value if their type is not the same, or (if their type is not `e_VOID`) the value of that type (as accessed through `the*` methods) is not the same. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#