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

#include <context.hpp>

Public Member Functions

std::vector< std::string > const & Kinds () const
 
launchdarkly::Attributes const & Attributes (std::string const &kind) const
 
Value const & Get (std::string const &kind, launchdarkly::AttributeReference const &ref) const
 
bool Valid () const
 
std::string const & CanonicalKey () const
 
std::map< std::string, std::string > const & KindsToKeys () const
 
std::string const & errors ()
 
 Context (Context const &context)=default
 
 Context (Context &&context)=default
 
Contextoperator= (Context const &)=default
 
Contextoperator= (Context &&)=default
 

Friends

class ContextBuilder
 
std::ostream & operator<< (std::ostream &out, Context const &context)
 

Detailed Description

A LaunchDarkly context.

Member Function Documentation

◆ Attributes()

Attributes const & launchdarkly::Context::Attributes ( std::string const &  kind) const

Get a set of attributes associated with a kind.

Only call this function if you have checked that the kind is present.

Parameters
kindThe kind to get attributes for.
Returns
The attributes if they exist.

◆ CanonicalKey()

std::string const & launchdarkly::Context::CanonicalKey ( ) const

Get the canonical key for this context.

◆ errors()

std::string const& launchdarkly::Context::errors ( )
inline

Get a string containing errors the context encountered during construction.

Returns
A string containing errors, or an empty string if there are no errors.

◆ Get()

Value const & launchdarkly::Context::Get ( std::string const &  kind,
launchdarkly::AttributeReference const &  ref 
) const

Get an attribute value by kind and attribute reference. If the kind is not present, or the attribute not present in the kind, then Value::null() will be returned.

Parameters
kindThe kind to get the value for.
refThe reference to the desired attribute.
Returns
The attribute Value or a Value representing null.

◆ Kinds()

std::vector< std::string > const & launchdarkly::Context::Kinds ( ) const

Get the kinds the context contains.

Returns
A vector of kinds.

◆ KindsToKeys()

std::map< std::string, std::string > const & launchdarkly::Context::KindsToKeys ( ) const

Get a collection containing the kinds and their associated keys.

Returns
Returns a map of kinds to keys.

◆ Valid()

bool launchdarkly::Context::Valid ( ) const
inline

Check if a context is valid.

Returns
Returns true if the context is valid.

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