Couchbase Lite C
Couchbase Lite C API
Data Structures | Macros | Functions | Variables
FLCollections.h File Reference
#include "FLBase.h"

Go to the source code of this file.

Data Structures

struct  FLArrayIterator
 Opaque array iterator. More...
 
struct  FLDictIterator
 Opaque dictionary iterator. More...
 
struct  FLDictKey
 Opaque key for a dictionary. More...
 

Macros

#define _FLCOLLECTIONS_H
 

Functions

FLEECE_PUBLIC uint32_t FLArray_Count (FLArray FL_NULLABLE) FLPURE
 Returns the number of items in an array, or 0 if the pointer is NULL. More...
 
FLEECE_PUBLIC bool FLArray_IsEmpty (FLArray FL_NULLABLE) FLPURE
 Returns true if an array is empty (or NULL). More...
 
FLEECE_PUBLIC FLMutableArray FL_NULLABLE FLArray_AsMutable (FLArray FL_NULLABLE) FLPURE
 If the array is mutable, returns it cast to FLMutableArray, else NULL. More...
 
FLEECE_PUBLIC FLValue FL_NULLABLE FLArray_Get (FLArray FL_NULLABLE, uint32_t index) FLPURE
 Returns an value at an array index, or NULL if the index is out of range. More...
 
FLEECE_PUBLIC uint32_t FLDict_Count (FLDict FL_NULLABLE) FLPURE
 Returns the number of items in a dictionary, or 0 if the pointer is NULL. More...
 
FLEECE_PUBLIC bool FLDict_IsEmpty (FLDict FL_NULLABLE) FLPURE
 Returns true if a dictionary is empty (or NULL). More...
 
FLEECE_PUBLIC FLMutableDict FL_NULLABLE FLDict_AsMutable (FLDict FL_NULLABLE) FLPURE
 If the dictionary is mutable, returns it cast to FLMutableDict, else NULL. More...
 
FLEECE_PUBLIC FLValue FL_NULLABLE FLDict_Get (FLDict FL_NULLABLE, FLSlice keyString) FLPURE
 Looks up a key in a dictionary, returning its value. More...
 
Array iteration

Iterating an array typically looks like this:

FLArrayIterator_Begin(theArray, &iter);
FLValue value;
while (NULL != (value = FLArrayIterator_GetValue(&iter))) {
// ...
}
FLEECE_PUBLIC void FLArrayIterator_Begin(FLArray FL_NULLABLE, FLArrayIterator *)
Initializes a FLArrayIterator struct to iterate over an array.
FLEECE_PUBLIC FLValue FL_NULLABLE FLArrayIterator_GetValue(const FLArrayIterator *) FLPURE
Returns the current value being iterated over.
FLEECE_PUBLIC bool FLArrayIterator_Next(FLArrayIterator *)
Advances the iterator to the next value, or returns false if at the end.
const struct _FLValue * FLValue
A reference to a value of any type.
Definition: FLBase.h:35
Opaque array iterator.
Definition: FLCollections.h:73
FLEECE_PUBLIC void FLArrayIterator_Begin (FLArray FL_NULLABLE, FLArrayIterator *)
 Initializes a FLArrayIterator struct to iterate over an array. More...
 
FLEECE_PUBLIC FLValue FL_NULLABLE FLArrayIterator_GetValue (const FLArrayIterator *) FLPURE
 Returns the current value being iterated over. More...
 
FLEECE_PUBLIC FLValue FL_NULLABLE FLArrayIterator_GetValueAt (const FLArrayIterator *, uint32_t offset) FLPURE
 Returns a value in the array at the given offset from the current value. More...
 
FLEECE_PUBLIC uint32_t FLArrayIterator_GetCount (const FLArrayIterator *) FLPURE
 Returns the number of items remaining to be iterated, including the current one. More...
 
FLEECE_PUBLIC bool FLArrayIterator_Next (FLArrayIterator *)
 Advances the iterator to the next value, or returns false if at the end. More...
 
Dict iteration

Iterating a dictionary typically looks like this:

FLDictIterator_Begin(theDict, &iter);
FLValue value;
while (NULL != (value = FLDictIterator_GetValue(&iter))) {
// ...
}
FLEECE_PUBLIC FLValue FL_NULLABLE FLDictIterator_GetValue(const FLDictIterator *) FLPURE
Returns the current value being iterated over.
FLEECE_PUBLIC void FLDictIterator_Begin(FLDict FL_NULLABLE, FLDictIterator *)
Initializes a FLDictIterator struct to iterate over a dictionary.
FLEECE_PUBLIC bool FLDictIterator_Next(FLDictIterator *)
Advances the iterator to the next value, or returns false if at the end.
FLEECE_PUBLIC FLString FLDictIterator_GetKeyString(const FLDictIterator *)
Returns the current key's string value.
Opaque dictionary iterator.
Definition: FLCollections.h:144
A simple reference to a block of memory.
Definition: FLSlice.h:45
FLEECE_PUBLIC void FLDictIterator_Begin (FLDict FL_NULLABLE, FLDictIterator *)
 Initializes a FLDictIterator struct to iterate over a dictionary. More...
 
FLEECE_PUBLIC FLValue FL_NULLABLE FLDictIterator_GetKey (const FLDictIterator *) FLPURE
 Returns the current key being iterated over. More...
 
FLEECE_PUBLIC FLString FLDictIterator_GetKeyString (const FLDictIterator *)
 Returns the current key's string value. More...
 
FLEECE_PUBLIC FLValue FL_NULLABLE FLDictIterator_GetValue (const FLDictIterator *) FLPURE
 Returns the current value being iterated over. More...
 
FLEECE_PUBLIC uint32_t FLDictIterator_GetCount (const FLDictIterator *) FLPURE
 Returns the number of items remaining to be iterated, including the current one. More...
 
FLEECE_PUBLIC bool FLDictIterator_Next (FLDictIterator *)
 Advances the iterator to the next value, or returns false if at the end. More...
 
FLEECE_PUBLIC void FLDictIterator_End (FLDictIterator *)
 Cleans up after an iterator. More...
 
Optimized Keys
FLEECE_PUBLIC FLDictKey FLDictKey_Init (FLSlice string)
 Initializes an FLDictKey struct with a key string. More...
 
FLEECE_PUBLIC FLString FLDictKey_GetString (const FLDictKey *)
 Returns the string value of the key (which it was initialized with.) More...
 
FLEECE_PUBLIC FLValue FL_NULLABLE FLDict_GetWithKey (FLDict FL_NULLABLE, FLDictKey *)
 Looks up a key in a dictionary using an FLDictKey. More...
 

Variables

FLEECE_PUBLIC const FLArray kFLEmptyArray
 A constant empty array value. More...
 
FLEECE_PUBLIC const FLDict kFLEmptyDict
 A constant empty array value. More...
 

Macro Definition Documentation

◆ _FLCOLLECTIONS_H

#define _FLCOLLECTIONS_H