Quick Links:

bal | bbl | bdl | bsl

Namespaces

Component ball_managedattribute
[Package ball]

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

Namespaces

namespace  ball

Detailed Description

Outline
Purpose:
Provide a wrapper for ball::Attribute with managed name storage.
Classes:
ball::ManagedAttribute wrapper for ball::Attribute with managed storage
See also:
Component 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>());
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()));