BDE 4.14.0 Production release
Loading...
Searching...
No Matches
ball_managedattribute

Detailed Description

Outline

Purpose

Provide a wrapper for ball::Attribute with managed name storage.

Classes

See also
ball_attribute

Description

This component implements a wrapper for ball::Attribute, ball::ManagedAttribute, that manages the lifetime of the attribute name. Note that ball::Attribute does not manage the lifetime of its name (see ball_attribute ).

Usage

In this section we show intended usage of this component.

Example 1: Basic Properties of ball::ManagedAttribute

This example creates ball::ManagedAttribute objects and shows basic properties of those objects:

ball::ManagedAttribute p1("uuid", 4044457);
ball::ManagedAttribute p2("name", "Bloomberg");
assert("uuid" == p1.key());
assert("name" == p2.key());
assert(true == p1.value().is<int>());
assert(4044457 == p1.value().the<int>());
assert(true == p2.value().is<bsl::string>());
assert("Bloomberg" == p2.value().the<bsl::string>());
Definition ball_managedattribute.h:117
Definition bslstl_string.h:1281

Finally, we show that ball::ManagedAttribute manages the storage for the attribute name after construction:

char buffer[] = "Hello";
ball::ManagedAttribute p3(buffer, 1);
bsl::strcpy(buffer, "World");
assert("Hello" == p3.key()));