| C++ Client-Side SDK
    LaunchDarkly SDK | 
#include <attribute_reference.hpp>
| Public Types | |
| using | SetType = std::set< AttributeReference > | 
| Public Member Functions | |
| std::string const & | Component (std::size_t depth) const | 
| std::size_t | Depth () const | 
| bool | IsKind () const | 
| bool | Valid () const | 
| std::string const & | RedactionName () const | 
| AttributeReference (std::string ref_str) | |
| AttributeReference (char const *ref_str) | |
| AttributeReference () | |
| bool | operator== (AttributeReference const &other) const | 
| bool | operator== (std::vector< std::string_view > const &path) const | 
| bool | operator!= (AttributeReference const &other) const | 
| bool | operator!= (std::vector< std::string_view > const &path) const | 
| bool | operator< (AttributeReference const &rhs) const | 
| Static Public Member Functions | |
| static AttributeReference | FromReferenceStr (std::string ref_str) | 
| static AttributeReference | FromLiteralStr (std::string lit_str) | 
| static std::string | PathToStringReference (std::vector< std::string_view > path) | 
| Friends | |
| std::ostream & | operator<< (std::ostream &os, AttributeReference const &ref) | 
Represents an attribute name or path expression identifying a value within a launchdarkly::Context. This can be used to retrieve a value with launchdarkly::Context::Get, or to identify an attribute or nested value that should be considered private with launchdarkly::AttributesBuilder<BuilderReturn, BuildType>::SetPrivate or launchdarkly::AttributesBuilder<BuilderReturn,BuildType>::AddPrivateAttribute (the SDK configuration can also have a list of private attribute references).
This is represented as a separate type, rather than just a string, so that validation and parsing can be done ahead of time if an attribute reference will be used repeatedly later (such as in flag evaluations).
If the string starts with '/', then this is treated as a slash-delimited path reference where the first component is the name of an attribute, and subsequent components are the names of nested JSON object properties. In this syntax, the escape sequences "~0" and "~1" represent '~' and '/' respectively within a path component.
If the string does not start with '/', then it is treated as the literal name of an attribute.
| launchdarkly::AttributeReference::AttributeReference | ( | std::string | ref_str | ) | 
Construct an attribute reference from a string.
| ref_str | The string to make an attribute reference from. | 
| launchdarkly::AttributeReference::AttributeReference | ( | char const * | ref_str | ) | 
Construct an attribute reference from a constant string.
| ref_str | The string to make an attribute reference from. | 
| launchdarkly::AttributeReference::AttributeReference | ( | ) | 
Default constructs an invalid attribute reference.
| std::string const & launchdarkly::AttributeReference::Component | ( | std::size_t | depth | ) | const | 
Get the component of the attribute reference at the specified depth.
For example, Component(1) on the reference /a/b/c would return b.
| depth | The depth to get a component for. | 
| std::size_t launchdarkly::AttributeReference::Depth | ( | ) | const | 
Get the total depth of the reference.
For example, Depth() on the reference /a/b/c would return 3. 
| 
 | static | 
Create a string from an attribute that is known to be a literal.
This allows escaping literals that contained special characters.
| lit_str | The literal attribute name. | 
| 
 | static | 
Create an attribute from a string that is known to be an attribute reference string.
| ref_str | The reference string. | 
| bool launchdarkly::AttributeReference::IsKind | ( | ) | const | 
Check if the reference is a "kind" reference. Either /kind or kind.
| 
 | static | 
For a path, a series of names to address an attribute, create a name suitable for including in event meta data.
| path | The path to get a name for. | 
| std::string const & launchdarkly::AttributeReference::RedactionName | ( | ) | const | 
The redaction name will always be an attribute reference compatible string. So, for instance, a literal that contained /attr would be converted to /~1attr. 
| bool launchdarkly::AttributeReference::Valid | ( | ) | const | 
Check if the reference is valid.