Quick Links:

bal | bbl | bdl | bsl

Public Types | Public Member Functions | Static Public Member Functions | Friends

ball::ManagedAttribute Class Reference

#include <ball_managedattribute.h>

List of all members.

Public Types

typedef bsl::allocator< char > allocator_type

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (ManagedAttribute, bslma::UsesBslmaAllocator)
 ManagedAttribute (const Attribute &attribute, const allocator_type &allocator=allocator_type())
 ManagedAttribute (const bsl::string_view &name, const bsl::string_view &value, const allocator_type &allocator=allocator_type())
 ManagedAttribute (const bsl::string_view &name, const char *value, const allocator_type &allocator=allocator_type())
 ManagedAttribute (const bsl::string_view &name, int value, const allocator_type &allocator=allocator_type())
 ManagedAttribute (const bsl::string_view &name, long value, const allocator_type &allocator=allocator_type())
 ManagedAttribute (const bsl::string_view &name, long long value, const allocator_type &allocator=allocator_type())
 ManagedAttribute (const bsl::string_view &name, unsigned int value, const allocator_type &allocator=allocator_type())
 ManagedAttribute (const bsl::string_view &name, unsigned long value, const allocator_type &allocator=allocator_type())
 ManagedAttribute (const bsl::string_view &name, unsigned long long value, const allocator_type &allocator=allocator_type())
 ManagedAttribute (const bsl::string_view &name, const void *value, const allocator_type &allocator=allocator_type())
 ManagedAttribute (const bsl::string_view &name, const Attribute::Value &value, const allocator_type &allocator=allocator_type())
 ManagedAttribute (const ManagedAttribute &original, const allocator_type &allocator=allocator_type())
 ~ManagedAttribute ()
ManagedAttributeoperator= (const ManagedAttribute &rhs)
void setName (const bsl::string_view &name)
void setValue (int value)
void setValue (long value)
void setValue (long long value)
void setValue (unsigned int value)
void setValue (unsigned long value)
void setValue (unsigned long long value)
void setValue (const bsl::string_view &value)
void setValue (const Attribute::Value &value)
void setValue (const char *value)
void setValue (const void *value)
const Attributeattribute () const
allocator_type get_allocator () const
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
const bsl::stringkey () const
const char * name () const
const Attribute::Valuevalue () const

Static Public Member Functions

static int hash (const ManagedAttribute &attribute, int size)

Friends

bool operator== (const ManagedAttribute &, const ManagedAttribute &)
bool operator!= (const ManagedAttribute &, const ManagedAttribute &)
bsl::ostream & operator<< (bsl::ostream &, const ManagedAttribute &)

Detailed Description

A ball::ManagedAttribute object contains a ball::Attribute object and provides storage for the attribute's name.

See Component ball_managedattribute


Member Typedef Documentation


Constructor & Destructor Documentation

ball::ManagedAttribute::ManagedAttribute ( const Attribute attribute,
const allocator_type allocator = allocator_type() 
) [explicit]

Create a ManagedAttribute object having the value of the specified attribute. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.

ball::ManagedAttribute::ManagedAttribute ( const bsl::string_view &  name,
const bsl::string_view &  value,
const allocator_type allocator = allocator_type() 
)

Create a ManagedAttribute object having the specified name and string value. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.

ball::ManagedAttribute::ManagedAttribute ( const bsl::string_view &  name,
const char *  value,
const allocator_type allocator = allocator_type() 
)

Create a ManagedAttribute object having the specified name and the C-style value string. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.

ball::ManagedAttribute::ManagedAttribute ( const bsl::string_view &  name,
int  value,
const allocator_type allocator = allocator_type() 
)
ball::ManagedAttribute::ManagedAttribute ( const bsl::string_view &  name,
long  value,
const allocator_type allocator = allocator_type() 
)
ball::ManagedAttribute::ManagedAttribute ( const bsl::string_view &  name,
long long  value,
const allocator_type allocator = allocator_type() 
)
ball::ManagedAttribute::ManagedAttribute ( const bsl::string_view &  name,
unsigned int  value,
const allocator_type allocator = allocator_type() 
)
ball::ManagedAttribute::ManagedAttribute ( const bsl::string_view &  name,
unsigned long  value,
const allocator_type allocator = allocator_type() 
)
ball::ManagedAttribute::ManagedAttribute ( const bsl::string_view &  name,
unsigned long long  value,
const allocator_type allocator = allocator_type() 
)

Create a ManagedAttribute object having the specified name and value. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.

ball::ManagedAttribute::ManagedAttribute ( const bsl::string_view &  name,
const void *  value,
const allocator_type allocator = allocator_type() 
)

Create a ManagedAttribute object having the specified name and the pointer to the specified value of cv-qualified void type. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.

ball::ManagedAttribute::ManagedAttribute ( const bsl::string_view &  name,
const Attribute::Value value,
const allocator_type allocator = allocator_type() 
)

Create a ManagedAttribute object having the specified name and value. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.

ball::ManagedAttribute::ManagedAttribute ( const ManagedAttribute original,
const allocator_type allocator = allocator_type() 
)

Create a ManagedAttribute object having the same value as the specified original object. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.

ball::ManagedAttribute::~ManagedAttribute (  ) 

Destroy this object.


Member Function Documentation

ball::ManagedAttribute::BSLMF_NESTED_TRAIT_DECLARATION ( ManagedAttribute  ,
bslma::UsesBslmaAllocator   
)
static int ball::ManagedAttribute::hash ( const ManagedAttribute attribute,
int  size 
) [static]

Return a hash value calculated from the specified attribute using the specified size as the number of slots. The hash value is guaranteed to be in the range [0 .. size - 1]. The behavior is undefined unless 0 < size.

ManagedAttribute& ball::ManagedAttribute::operator= ( const ManagedAttribute rhs  ) 

Assign to this object the value of the specified rhs object, and return a non-'const' reference to this object.

void ball::ManagedAttribute::setName ( const bsl::string_view &  name  ) 

Set the attribute name of this object to the specified name.

void ball::ManagedAttribute::setValue ( int  value  ) 
void ball::ManagedAttribute::setValue ( long  value  ) 
void ball::ManagedAttribute::setValue ( long long  value  ) 
void ball::ManagedAttribute::setValue ( unsigned int  value  ) 
void ball::ManagedAttribute::setValue ( unsigned long  value  ) 
void ball::ManagedAttribute::setValue ( unsigned long long  value  ) 
void ball::ManagedAttribute::setValue ( const bsl::string_view &  value  ) 
void ball::ManagedAttribute::setValue ( const Attribute::Value value  ) 
void ball::ManagedAttribute::setValue ( const char *  value  ) 
void ball::ManagedAttribute::setValue ( const void *  value  ) 

Set the attribute value of this object to the specified value.

const Attribute& ball::ManagedAttribute::attribute (  )  const

Return a const reference to the attribute of this object.

allocator_type ball::ManagedAttribute::get_allocator (  )  const

Return the allocator used by this object to supply memory. Note that if no allocator was supplied at construction the default allocator in effect at construction is used.

bsl::ostream& ball::ManagedAttribute::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Format this object to the specified output stream at the (absolute value of) the optionally specified indentation level and return a reference to stream. If level is specified, optionally specify spacesPerLevel, 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.

const bsl::string& ball::ManagedAttribute::key (  )  const

Return a const reference to the attribute name of this object.

const char* ball::ManagedAttribute::name (  )  const

Return the attribute name of this object. Note that this accessor should not be used to get the attribute name if the name string contains embedded zeros.

DEPRECATED: Use key() instead.

const Attribute::Value& ball::ManagedAttribute::value (  )  const

Return a const reference to the attribute value of this object.


Friends And Related Function Documentation

bool operator== ( const ManagedAttribute ,
const ManagedAttribute  
) [friend]
bool operator!= ( const ManagedAttribute ,
const ManagedAttribute  
) [friend]
bsl::ostream& operator<< ( bsl::ostream &  ,
const ManagedAttribute  
) [friend]

Write the value of the specified attribute to the specified output stream. Return the specified output stream.


The documentation for this class was generated from the following file: