Couchbase Lite C
Couchbase Lite C API
Functions
Value Slots

An FLSlot is a temporary reference to an element of a mutable Array/Dict; its only purpose is to let you store a value into it, using the FLSlot_... functions. More...

Functions

MUST_USE_RESULT FLEECE_PUBLIC FLSlot FLMutableArray_Set (FLMutableArray, uint32_t index)
 Returns an FLSlot that refers to the given index of the given array. More...
 
MUST_USE_RESULT FLEECE_PUBLIC FLSlot FLMutableArray_Append (FLMutableArray)
 Appends a null value to the array and returns an FLSlot that refers to that position. More...
 
MUST_USE_RESULT FLEECE_PUBLIC FLSlot FLMutableDict_Set (FLMutableDict, FLString key)
 Returns an FLSlot that refers to the given key/value pair of the given dictionary. More...
 
FLEECE_PUBLIC void FLSlot_SetNull (FLSlot)
 Stores a JSON null into a slot. More...
 
FLEECE_PUBLIC void FLSlot_SetBool (FLSlot, bool)
 Stores a boolean into a slot. More...
 
FLEECE_PUBLIC void FLSlot_SetInt (FLSlot, int64_t)
 Stores an integer into a slot. More...
 
FLEECE_PUBLIC void FLSlot_SetUInt (FLSlot, uint64_t)
 Stores an unsigned int into a slot. More...
 
FLEECE_PUBLIC void FLSlot_SetFloat (FLSlot, float)
 Stores a float into a slot. More...
 
FLEECE_PUBLIC void FLSlot_SetDouble (FLSlot, double)
 Stores a double into a slot. More...
 
FLEECE_PUBLIC void FLSlot_SetString (FLSlot, FLString)
 Stores a UTF-8 string into a slot. More...
 
FLEECE_PUBLIC void FLSlot_SetData (FLSlot, FLSlice)
 Stores a data blob into a slot. More...
 
FLEECE_PUBLIC void FLSlot_SetValue (FLSlot, FLValue)
 Stores an FLValue into a slot. More...
 
static void FLSlot_SetArray (FLSlot slot, FLArray array)
 
static void FLSlot_SetDict (FLSlot slot, FLDict dict)
 

Detailed Description

An FLSlot is a temporary reference to an element of a mutable Array/Dict; its only purpose is to let you store a value into it, using the FLSlot_... functions.

Since there are three ways to store a value into a collection (array set, array append, dict set) and nine types of values that can be stored, that makes 27 setter functions. For efficiency, these are declared as inlines that call one of three functions to acquire a slot, and one of nine functions to store a value into it.

It's usually more convenient to use the typed functions like FLMutableArray_SetInt, but you might drop down to the lower level ones if you're creating an adapter between Fleece and a different data model, such as Apple's Foundation classes.

Function Documentation

◆ FLMutableArray_Append()

MUST_USE_RESULT FLEECE_PUBLIC FLSlot FLMutableArray_Append ( FLMutableArray  )

Appends a null value to the array and returns an FLSlot that refers to that position.

You store a value to it by calling one of the nine FLSlot_Set... functions.

Warning
You should immediately store a value into the FLSlot. Do not keep it around; any changes to the array invalidate it.

◆ FLMutableArray_Set()

MUST_USE_RESULT FLEECE_PUBLIC FLSlot FLMutableArray_Set ( FLMutableArray  ,
uint32_t  index 
)

Returns an FLSlot that refers to the given index of the given array.

You store a value to it by calling one of the nine FLSlot_Set... functions.

Warning
You should immediately store a value into the FLSlot. Do not keep it around; any changes to the array invalidate it.

◆ FLMutableDict_Set()

MUST_USE_RESULT FLEECE_PUBLIC FLSlot FLMutableDict_Set ( FLMutableDict  ,
FLString  key 
)

Returns an FLSlot that refers to the given key/value pair of the given dictionary.

You store a value to it by calling one of the nine FLSlot_Set... functions.

Warning
You should immediately store a value into the FLSlot. Do not keep it around; any changes to the dictionary invalidate it.

◆ FLSlot_SetArray()

static void FLSlot_SetArray ( FLSlot  slot,
FLArray  array 
)
inlinestatic

◆ FLSlot_SetBool()

FLEECE_PUBLIC void FLSlot_SetBool ( FLSlot  ,
bool   
)

Stores a boolean into a slot.

◆ FLSlot_SetData()

FLEECE_PUBLIC void FLSlot_SetData ( FLSlot  ,
FLSlice   
)

Stores a data blob into a slot.

◆ FLSlot_SetDict()

static void FLSlot_SetDict ( FLSlot  slot,
FLDict  dict 
)
inlinestatic

◆ FLSlot_SetDouble()

FLEECE_PUBLIC void FLSlot_SetDouble ( FLSlot  ,
double   
)

Stores a double into a slot.

◆ FLSlot_SetFloat()

FLEECE_PUBLIC void FLSlot_SetFloat ( FLSlot  ,
float   
)

Stores a float into a slot.

◆ FLSlot_SetInt()

FLEECE_PUBLIC void FLSlot_SetInt ( FLSlot  ,
int64_t   
)

Stores an integer into a slot.

◆ FLSlot_SetNull()

FLEECE_PUBLIC void FLSlot_SetNull ( FLSlot  )

Stores a JSON null into a slot.

◆ FLSlot_SetString()

FLEECE_PUBLIC void FLSlot_SetString ( FLSlot  ,
FLString   
)

Stores a UTF-8 string into a slot.

◆ FLSlot_SetUInt()

FLEECE_PUBLIC void FLSlot_SetUInt ( FLSlot  ,
uint64_t   
)

Stores an unsigned int into a slot.

◆ FLSlot_SetValue()

FLEECE_PUBLIC void FLSlot_SetValue ( FLSlot  ,
FLValue   
)

Stores an FLValue into a slot.