C++ Server-Side SDK
LaunchDarkly SDK
Typedefs | Functions
context.h File Reference
#include <launchdarkly/bindings/c/export.h>
#include <launchdarkly/bindings/c/value.h>
#include <stdbool.h>
Include dependency graph for context.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct _LDContext * LDContext
 
typedef struct _LDContext_PrivateAttributesIter * LDContext_PrivateAttributesIter
 

Functions

 LDContext_CanonicalKey (LDContext context)
 
 LDContext_Valid (LDContext context)
 
 LDContext_Free (LDContext context)
 
 LDContext_Get (LDContext context, char const *kind, char const *ref)
 
 LDContext_Errors (LDContext context)
 
 LDContext_PrivateAttributesIter_New (LDContext context, char const *kind)
 
 LDContext_PrivateAttributesIter_Free (LDContext_PrivateAttributesIter iter)
 
 LDContext_PrivateAttributesIter_Next (LDContext_PrivateAttributesIter iter)
 
 LDContext_PrivateAttributesIter_End (LDContext_PrivateAttributesIter iter)
 
 LDContext_PrivateAttributesIter_Value (LDContext_PrivateAttributesIter iter)
 

Function Documentation

◆ LDContext_CanonicalKey()

LDContext_CanonicalKey ( LDContext  context)

Get the canonical key for the context.

Parameters
contextThe context. Must not be NULL.
Returns
Canonical key. Only valid for the lifetime of this context.

◆ LDContext_Errors()

LDContext_Errors ( LDContext  context)

If the context is not valid, then get a string containing the reason the context is not valid.

The lifetime of the returned string is tied to the LDContext.

Parameters
contextThe context to check for validity. Must not be NULL.
Returns
A string explaining why the context is not valid.

◆ LDContext_Free()

LDContext_Free ( LDContext  context)

Free the context.

Parameters
contextThe context to free.

◆ LDContext_Get()

LDContext_Get ( LDContext  context,
char const *  kind,
char const *  ref 
)

Get an attribute value by kind and attribute reference. If the kind is not present, or the attribute not present in the kind, then a null pointer will be returned.

The lifetime of the LDValue is tied to the LDContext it was accessed from. Do not access a returned LDValue from a context after the context has been freed.

Parameters
contextThe context to get an attribute from. Must not be NULL.
kindThe kind within the context to get the attribute from. Must not be NULL.
refAn attribute reference representing the attribute to get. Must not be NULL.
Returns
The attribute value or a NULL pointer.

◆ LDContext_PrivateAttributesIter_End()

LDContext_PrivateAttributesIter_End ( LDContext_PrivateAttributesIter  iter)

Check if the iterator is at the end.

Parameters
iterThe iterator to check. Must not be NULL.
Returns
True if the iterator is at the end.

◆ LDContext_PrivateAttributesIter_Free()

LDContext_PrivateAttributesIter_Free ( LDContext_PrivateAttributesIter  iter)

Destroy the iterator.

Parameters
iterThe iterator to destroy.

◆ LDContext_PrivateAttributesIter_New()

LDContext_PrivateAttributesIter_New ( LDContext  context,
char const *  kind 
)

Create an iterator which iterates over the private attributes for the context kind. If there is no such context kind, then a null pointer will be returned.

The iterator must be destroyed with LDContext_PrivateAttributesIter_Free.

An iterator must not be used after the associated Context has been freed.

Parameters
contextThe context containing the kind. Must not be NULL.
kindThe kind to iterate private attributes for. Must not be NULL.
Returns
A private attributes iterator.

◆ LDContext_PrivateAttributesIter_Next()

LDContext_PrivateAttributesIter_Next ( LDContext_PrivateAttributesIter  iter)

Move the iterator to the next item.

Parameters
iterThe iterator to increment. Must not be NULL.

◆ LDContext_PrivateAttributesIter_Value()

LDContext_PrivateAttributesIter_Value ( LDContext_PrivateAttributesIter  iter)

Get the value pointed to by the iterator.

The lifetime of the returned value is the same as the Context.

Parameters
iterThe iterator to get a value for. Must not be NULL.
Returns
The attribute reference as a string.

◆ LDContext_Valid()

LDContext_Valid ( LDContext  context)

Check if the context is valid.

Parameters
contextThe context to check. Must not be NULL.
Returns
True if the context is valid.