C++ Client-Side SDK
LaunchDarkly SDK
Public Member Functions | Friends | List of all members
launchdarkly::Attributes Class Referencefinal

#include <attributes.hpp>

Public Member Functions

std::string const & Key () const
 
std::string const & Name () const
 
bool Anonymous () const
 
Value const & CustomAttributes () const
 
AttributeReference::SetType const & PrivateAttributes () const
 
launchdarkly::Value const & Get (launchdarkly::AttributeReference const &ref) const
 
 Attributes (std::string key, std::optional< std::string > name, bool anonymous, launchdarkly::Value attributes, AttributeReference::SetType private_attributes=AttributeReference::SetType())
 
 Attributes (Attributes const &context)=default
 
 Attributes (Attributes &&context)=default
 
Attributesoperator= (Attributes const &)=default
 
Attributesoperator= (Attributes &&)=default
 

Friends

std::ostream & operator<< (std::ostream &out, Attributes const &attrs)
 

Detailed Description

A collection of attributes that can be present within a context. A multi-context has multiple sets of attributes keyed by their "kind".

Constructor & Destructor Documentation

◆ Attributes()

launchdarkly::Attributes::Attributes ( std::string  key,
std::optional< std::string >  name,
bool  anonymous,
launchdarkly::Value  attributes,
AttributeReference::SetType  private_attributes = AttributeReference::SetType() 
)
inline

Construct a set of attributes. This is used internally by the SDK but is not intended to used by consumers of the SDK.

Parameters
keyThe key for the context.
nameThe name of the context.
anonymousIf the context is anonymous.
attributesAdditional attributes for the context.
private_attributesA list of attributes that should be private.

Member Function Documentation

◆ Anonymous()

bool launchdarkly::Attributes::Anonymous ( ) const

Is the context anonymous or not. Defaults to false.

Returns
True if the context is anonymous.

◆ CustomAttributes()

Value const & launchdarkly::Attributes::CustomAttributes ( ) const

Get the custom attributes as a Value. This value is an kObject type.

Returns
The custom attributes.

◆ Get()

launchdarkly::Value const& launchdarkly::Attributes::Get ( launchdarkly::AttributeReference const &  ref) const
inline

Gets the item by the specified attribute reference, or returns a null Value.

Parameters
refThe reference to get an attribute by.
Returns
A Value containing the requested field, or a Value representing null.

◆ Key()

std::string const & launchdarkly::Attributes::Key ( ) const

Get the key for the context.

Returns
A reference to the context key.

◆ Name()

std::string const & launchdarkly::Attributes::Name ( ) const

Get the name for the context.

Returns
A reference to the context name, or an empty string if no name is set.

◆ PrivateAttributes()

AttributeReference::SetType const & launchdarkly::Attributes::PrivateAttributes ( ) const

Get a set of the private attributes for the context.

Returns
The set of private attributes for the context.

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