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

Go to the source code of this file.

Typedefs

typedef struct _LDAllFlagsState * LDAllFlagsState
 

Enumerations

enum  LDAllFlagsState_Options { LD_ALLFLAGSSTATE_DEFAULT = 0 , LD_ALLFLAGSSTATE_INCLUDE_REASONS = (1 << 0) , LD_ALLFLAGSSTATE_DETAILS_ONLY_FOR_TRACKED_FLAGS = (1 << 1) , LD_ALLFLAGSSTATE_CLIENT_SIDE_ONLY = (1 << 2) }
 

Functions

 LDAllFlagsState_Free (LDAllFlagsState state)
 
 LDAllFlagsState_Valid (LDAllFlagsState state)
 
 LDAllFlagsState_SerializeJSON (LDAllFlagsState state)
 
 LDAllFlagsState_Value (LDAllFlagsState state, char const *flag_key)
 
 LDAllFlagsState_Map (LDAllFlagsState state)
 

Enumeration Type Documentation

◆ LDAllFlagsState_Options

Defines options that may be used with LDServerSDK_AllFlagsState. To obtain default behavior, pass LD_ALLFLAGSSTATE_DEFAULT.

It is possible to combine multiple options by ORing them together.

Example:

LDAllFlagsState state = LDServerSDK_AllFlagsState(sdk, context,
);
@ LD_ALLFLAGSSTATE_CLIENT_SIDE_ONLY
Definition all_flags_state.h:128
@ LD_ALLFLAGSSTATE_INCLUDE_REASONS
Definition all_flags_state.h:115
LDServerSDK_AllFlagsState(LDServerSDK sdk, LDContext context, enum LDAllFlagsState_Options options)
Definition sdk.cpp:328
Enumerator
LD_ALLFLAGSSTATE_DEFAULT 

Default behavior.

LD_ALLFLAGSSTATE_INCLUDE_REASONS 

Include evaluation reasons in the state object. By default, they are not.

LD_ALLFLAGSSTATE_DETAILS_ONLY_FOR_TRACKED_FLAGS 

Include detailed flag metadata only for flags with event tracking or debugging turned on.

This reduces the size of the JSON data if you are passing the flag state to the front end.

LD_ALLFLAGSSTATE_CLIENT_SIDE_ONLY 

Include only flags marked for use with the client-side SDK. By default, all flags are included.

Function Documentation

◆ LDAllFlagsState_Free()

LDAllFlagsState_Free ( LDAllFlagsState  state)

Frees an LDAllFlagsState.

Parameters
stateThe state to free.
Returns
void

◆ LDAllFlagsState_Map()

LDAllFlagsState_Map ( LDAllFlagsState  state)

Returns an object-type LDValue where the keys are flag keys and the values are the flag values for the LDContext used to generate this state.

The LDValue is owned by the caller and must be freed. This may cause a large heap allocation. If you're interested in bootstrapping a client-side SDK, this is not the right method: see LDAllFlagsState_SerializeJSON.

Parameters
stateAn LDAllFlagsState. Must not be NULL.
Returns
An object-type LDValue of flag-key/flag-value pairs. The caller MUST free this value using LDValue_Free.

◆ LDAllFlagsState_SerializeJSON()

LDAllFlagsState_SerializeJSON ( LDAllFlagsState  state)

Serializes the LDAllFlagsState to a JSON string.

This JSON is suitable for bootstrapping a client-side SDK.

Parameters
stateThe LDAllFlagState to serialize. Must not be NULL.
Returns
A JSON string representing the LDAllFlagsState. The caller must free the string using LDMemory_FreeString.

◆ LDAllFlagsState_Valid()

LDAllFlagsState_Valid ( LDAllFlagsState  state)

True if the LDAllFlagsState is valid. False if there was an error, such as the data source being unavailable.

An invalid LDAllFlagsState can still be serialized successfully to a JSON string.

Parameters
stateThe LDAllFlagState to check for validity. Must not be NULL.
Returns
True if the state is valid, false otherwise.

◆ LDAllFlagsState_Value()

LDAllFlagsState_Value ( LDAllFlagsState  state,
char const *  flag_key 
)

Returns the flag value for the context used to generate this LDAllFlagsState.

In order to avoid copying when a large value is accessed, the returned LDValue is a reference and NOT DIRECTLY OWNED by the caller. Its lifetime is managed by the parent LDAllFlagsState object.

WARNING! Do not free the returned LDValue. Do not in any way access the returned LDValue after the LDAllFlagsState has been freed.

If the flag has no value, returns an LDValue of type LDValueType_Null.

To obtain a caller-owned copy of the LDValue not subject to these restrictions, call LDValue_NewValue on the result.

Parameters
stateAn LDAllFlagsState. Must not be NULL.
flag_keyKey of the flag. Must not be NULL.
Returns
The evaluation result of the flag. The caller MUST NOT free this value and MUST NOT access this value after the LDAllFlagsState has been freed.