C++ Server-Side SDK
LaunchDarkly SDK
|
#include <context_builder.hpp>
Public Member Functions | |
ContextBuilder (Context const &context) | |
AttributesBuilder< ContextBuilder, Context > & | Kind (std::string const &kind, std::string key) |
AttributesBuilder< ContextBuilder, Context > * | Kind (std::string const &kind) |
Context | Build () const |
Class for building LaunchDarkly contexts.
You cannot build a context until you have added at least one kind.
Building a context with a single kind.
Building a context with multiple Kinds.
Using the builder with loops.
launchdarkly::ContextBuilder::ContextBuilder | ( | Context const & | context | ) |
Create a new context builder from the given context. The created builder will have all the kinds and attributes of the original context.
If the original context is not valid, then this builder will be created in a default state.
context | The context to base the builder on. |
Context launchdarkly::ContextBuilder::Build | ( | ) | const |
Build a context. The same builder instance may be used to build multiple contexts.
You MUST add at least one kind before building a context. Not doing so will result in an invalid context.
AttributesBuilder< ContextBuilder, Context > * launchdarkly::ContextBuilder::Kind | ( | std::string const & | kind | ) |
Start updating an existing kind.
kind | The kind to start updating. |
AttributesBuilder< ContextBuilder, Context > & launchdarkly::ContextBuilder::Kind | ( | std::string const & | kind, |
std::string | key | ||
) |
Start adding a kind to the context.
If you call this function multiple times with the same kind, then the same builder will be returned each time. If you previously called the function with the same kind, but different key, then the key will be updated.
kind | The kind being added. |
key | The key for the kind. |