|
Couchbase Lite C
Couchbase Lite C API
|
Data Structures | |
| struct | FLDictIterator |
| Opaque dictionary iterator. More... | |
| struct | FLDictKey |
| Opaque key for a dictionary. More... | |
Functions | |
| uint32_t | FLDict_Count (FLDict) FLPURE |
| Returns the number of items in a dictionary, or 0 if the pointer is NULL. More... | |
| bool | FLDict_IsEmpty (FLDict) FLPURE |
| Returns true if a dictionary is empty (or NULL). More... | |
| FLMutableDict | FLDict_AsMutable (FLDict) FLPURE |
| If the dictionary is mutable, returns it cast to FLMutableDict, else NULL. More... | |
| FLValue | FLDict_Get (FLDict, FLSlice keyString) FLPURE |
| Looks up a key in a dictionary, returning its value. More... | |
Variables | |
| FLEECE_PUBLIC const FLDict | kFLEmptyDict |
Dict iteration | |
Iterating a dictionary typically looks like this: FLDictIterator iter;
FLDictIterator_Begin(theDict, &iter);
FLValue value;
while (NULL != (value = FLDictIterator_GetValue(&iter))) {
FLString key = FLDictIterator_GetKeyString(&iter);
// ...
FLDictIterator_Next(&iter);
}
void FLDictIterator_Begin(FLDict, FLDictIterator *) Initializes a FLDictIterator struct to iterate over a dictionary. FLString FLDictIterator_GetKeyString(const FLDictIterator *) Returns the current key's string value. bool FLDictIterator_Next(FLDictIterator *) Advances the iterator to the next value, or returns false if at the end. FLValue FLDictIterator_GetValue(const FLDictIterator *) FLPURE Returns the current value being iterated over. | |
| void | FLDictIterator_Begin (FLDict, FLDictIterator *) |
| Initializes a FLDictIterator struct to iterate over a dictionary. More... | |
| FLValue | FLDictIterator_GetKey (const FLDictIterator *) FLPURE |
| Returns the current key being iterated over. More... | |
| FLString | FLDictIterator_GetKeyString (const FLDictIterator *) |
| Returns the current key's string value. More... | |
| FLValue | FLDictIterator_GetValue (const FLDictIterator *) FLPURE |
| Returns the current value being iterated over. More... | |
| uint32_t | FLDictIterator_GetCount (const FLDictIterator *) FLPURE |
| Returns the number of items remaining to be iterated, including the current one. More... | |
| bool | FLDictIterator_Next (FLDictIterator *) |
| Advances the iterator to the next value, or returns false if at the end. More... | |
| void | FLDictIterator_End (FLDictIterator *) |
| Cleans up after an iterator. More... | |
Optimized Keys | |
| FLDictKey | FLDictKey_Init (FLSlice string) |
| Initializes an FLDictKey struct with a key string. More... | |
| FLString | FLDictKey_GetString (const FLDictKey *) |
| Returns the string value of the key (which it was initialized with.) More... | |
| FLValue | FLDict_GetWithKey (FLDict, FLDictKey *) |
| Looks up a key in a dictionary using an FLDictKey. More... | |
Mutable dictionaries | |
| FLMutableDict | FLDict_MutableCopy (FLDict source, FLCopyFlags) |
| Creates a new mutable Dict that's a copy of the source Dict. More... | |
| FLMutableDict | FLMutableDict_New (void) |
| Creates a new empty mutable Dict. More... | |
| FLMutableDict | FLMutableDict_NewFromJSON (FLString json, FLError *outError) |
| Creates a new mutable Dict from json. More... | |
| static FLMutableDict | FLMutableDict_Retain (FLMutableDict d) |
| Increments the ref-count of a mutable Dict. More... | |
| static void | FLMutableDict_Release (FLMutableDict d) |
| Decrements the refcount of (and possibly frees) a mutable Dict. More... | |
| FLDict | FLMutableDict_GetSource (FLMutableDict) |
| If the Dict was created by FLDict_MutableCopy, returns the original source Dict. More... | |
| bool | FLMutableDict_IsChanged (FLMutableDict) |
| Returns true if the Dict has been changed from the source it was copied from. More... | |
| void | FLMutableDict_SetChanged (FLMutableDict, bool) |
| Sets or clears the mutable Dict's "changed" flag. More... | |
| void | FLMutableDict_Remove (FLMutableDict, FLString key) |
| Removes the value for a key. More... | |
| void | FLMutableDict_RemoveAll (FLMutableDict) |
| Removes all keys and values. More... | |
| FLMutableArray | FLMutableDict_GetMutableArray (FLMutableDict, FLString key) |
| Convenience function for getting an array-valued property in mutable form. More... | |
| FLMutableDict | FLMutableDict_GetMutableDict (FLMutableDict, FLString key) |
| Convenience function for getting a dict-valued property in mutable form. More... | |
| static void | FLMutableDict_SetNull (FLMutableDict, FLString key) |
| Stores a JSON null value into a mutable dictionary. More... | |
| static void | FLMutableDict_SetBool (FLMutableDict, FLString key, bool) |
| Stores a boolean value into a mutable dictionary. More... | |
| static void | FLMutableDict_SetInt (FLMutableDict, FLString key, int64_t) |
| Stores an integer into a mutable dictionary. More... | |
| static void | FLMutableDict_SetUInt (FLMutableDict, FLString key, uint64_t) |
| Stores an unsigned integer into a mutable dictionary. More... | |
| static void | FLMutableDict_SetFloat (FLMutableDict, FLString key, float) |
| Stores a 32-bit floating-point number into a mutable dictionary. More... | |
| static void | FLMutableDict_SetDouble (FLMutableDict, FLString key, double) |
| Stores a 64-bit floating point number into a mutable dictionary. More... | |
| static void | FLMutableDict_SetString (FLMutableDict, FLString key, FLString) |
| Stores a UTF-8-encoded string into a mutable dictionary. More... | |
| static void | FLMutableDict_SetData (FLMutableDict, FLString key, FLSlice) |
| Stores a binary data blob into a mutable dictionary. More... | |
| static void | FLMutableDict_SetValue (FLMutableDict, FLString key, FLValue) |
| Stores a Fleece value into a mutable dictionary. More... | |
| static void | FLMutableDict_SetArray (FLMutableDict, FLString key, FLArray) |
| Stores a Fleece array into a mutable dictionary. More... | |
| static void | FLMutableDict_SetDict (FLMutableDict, FLString key, FLDict) |
| Stores a Fleece dictionary into a mutable dictionary. More... | |
| FLMutableDict FLDict_AsMutable | ( | FLDict | ) |
If the dictionary is mutable, returns it cast to FLMutableDict, else NULL.
| uint32_t FLDict_Count | ( | FLDict | ) |
Returns the number of items in a dictionary, or 0 if the pointer is NULL.
Looks up a key in a dictionary, returning its value.
Returns NULL if the value is not found or if the dictionary is NULL.
| bool FLDict_IsEmpty | ( | FLDict | ) |
Returns true if a dictionary is empty (or NULL).
Depending on the dictionary's representation, this can be faster than FLDict_Count(a) == 0
| FLMutableDict FLDict_MutableCopy | ( | FLDict | source, |
| FLCopyFlags | |||
| ) |
Creates a new mutable Dict that's a copy of the source Dict.
Its initial ref-count is 1, so a call to FLMutableDict_Release will free it.
Copying an immutable Dict is very cheap (only one small allocation.) The deepCopy flag is ignored.
Copying a mutable Dict is cheap if it's a shallow copy, but if deepCopy is true, nested mutable Dicts and Arrays are also copied, recursively.
If the source dict is NULL, then NULL is returned.
| void FLDictIterator_Begin | ( | FLDict | , |
| FLDictIterator * | |||
| ) |
Initializes a FLDictIterator struct to iterate over a dictionary.
Call FLDictIterator_GetKey and FLDictIterator_GetValue to get the first item, then FLDictIterator_Next.
| void FLDictIterator_End | ( | FLDictIterator * | ) |
Cleans up after an iterator.
Only needed if (a) the dictionary is a delta, and (b) you stop iterating before the end (i.e. before FLDictIterator_Next returns false.)
| uint32_t FLDictIterator_GetCount | ( | const FLDictIterator * | ) |
Returns the number of items remaining to be iterated, including the current one.
| FLValue FLDictIterator_GetKey | ( | const FLDictIterator * | ) |
Returns the current key being iterated over.
This Value will be a string or an integer.
| FLString FLDictIterator_GetKeyString | ( | const FLDictIterator * | ) |
Returns the current key's string value.
| FLValue FLDictIterator_GetValue | ( | const FLDictIterator * | ) |
Returns the current value being iterated over.
| bool FLDictIterator_Next | ( | FLDictIterator * | ) |
Advances the iterator to the next value, or returns false if at the end.
Returns the string value of the key (which it was initialized with.)
| FLMutableArray FLMutableDict_GetMutableArray | ( | FLMutableDict | , |
| FLString | key | ||
| ) |
Convenience function for getting an array-valued property in mutable form.
| FLMutableDict FLMutableDict_GetMutableDict | ( | FLMutableDict | , |
| FLString | key | ||
| ) |
Convenience function for getting a dict-valued property in mutable form.
| FLDict FLMutableDict_GetSource | ( | FLMutableDict | ) |
If the Dict was created by FLDict_MutableCopy, returns the original source Dict.
| bool FLMutableDict_IsChanged | ( | FLMutableDict | ) |
Returns true if the Dict has been changed from the source it was copied from.
| FLMutableDict FLMutableDict_New | ( | void | ) |
Creates a new empty mutable Dict.
Its initial ref-count is 1, so a call to FLMutableDict_Release will free it.
| FLMutableDict FLMutableDict_NewFromJSON | ( | FLString | json, |
| FLError * | outError | ||
| ) |
Creates a new mutable Dict from json.
The input JSON must represent a JSON array, or NULL will be returned. Its initial ref-count is 1, so a call to FLMutableDict_Release will free it.
|
inlinestatic |
Decrements the refcount of (and possibly frees) a mutable Dict.
| void FLMutableDict_Remove | ( | FLMutableDict | , |
| FLString | key | ||
| ) |
Removes the value for a key.
| void FLMutableDict_RemoveAll | ( | FLMutableDict | ) |
Removes all keys and values.
|
inlinestatic |
Increments the ref-count of a mutable Dict.
|
inlinestatic |
Stores a Fleece array into a mutable dictionary.
|
inlinestatic |
Stores a boolean value into a mutable dictionary.
| void FLMutableDict_SetChanged | ( | FLMutableDict | , |
| bool | |||
| ) |
Sets or clears the mutable Dict's "changed" flag.
|
inlinestatic |
Stores a binary data blob into a mutable dictionary.
|
inlinestatic |
Stores a Fleece dictionary into a mutable dictionary.
|
inlinestatic |
Stores a 64-bit floating point number into a mutable dictionary.
|
inlinestatic |
Stores a 32-bit floating-point number into a mutable dictionary.
|
inlinestatic |
Stores an integer into a mutable dictionary.
|
inlinestatic |
Stores a JSON null value into a mutable dictionary.
|
inlinestatic |
Stores a UTF-8-encoded string into a mutable dictionary.
|
inlinestatic |
Stores an unsigned integer into a mutable dictionary.
int64_t.
|
inlinestatic |
Stores a Fleece value into a mutable dictionary.
|
extern |