Couchbase Lite C
Couchbase Lite C API
FLCollections.h
Go to the documentation of this file.
1//
2// FLCollections.h
3//
4// Copyright 2016-Present Couchbase, Inc.
5//
6// Use of this software is governed by the Business Source License included
7// in the file licenses/BSL-Couchbase.txt. As of the Change Date specified
8// in that file, in accordance with the Business Source License, use of this
9// software will be governed by the Apache License, Version 2.0, included in
10// the file licenses/APL2.txt.
11//
12
13#pragma once
14#ifndef _FLCOLLECTIONS_H
15#define _FLCOLLECTIONS_H
16
17#include "FLBase.h"
18
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25 // This is the C API! For the C++ API, see Fleece.hh.
26
27 //====== ARRAY
28
29
42
45
49
52
55
73 typedef struct {
74#if !DOXYGEN_PARSING
75 void* _private1;
76 uint32_t _private2;
77 bool _private3;
78 void* _private4;
79#endif
81
85
88
91
94
97
102 //====== DICT
103
104
109 FLEECE_PUBLIC extern const FLDict kFLEmptyDict;
110
113
117
120
124
125
144 typedef struct {
145#if !DOXYGEN_PARSING
146 void* _private1;
147 uint32_t _private2;
148 bool _private3;
149 void *_private4, *_private5, *_private6, *_private7;
150 int _private8;
151#endif
153
158
161
164
167
170
173
177
178
187 typedef struct {
188#if !DOXYGEN_PARSING
189 FLSlice _private1;
190 void* _private2;
191 uint32_t _private3, private4;
192 bool private5;
193#endif
194 } FLDictKey;
195
202
205
209
210
214#ifdef __cplusplus
215}
216#endif
217
219
220#endif // _FLCOLLECTIONS_H
#define FL_NULLABLE
Definition: CompilerSupport.h:74
#define FLEECE_PUBLIC
Definition: CompilerSupport.h:241
#define FL_ASSUME_NONNULL_BEGIN
Definition: CompilerSupport.h:72
#define FLPURE
Definition: CompilerSupport.h:110
#define FL_ASSUME_NONNULL_END
Definition: CompilerSupport.h:73
#define FLAPI
Definition: CompilerSupport.h:247
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.
FLEECE_PUBLIC bool FLArray_IsEmpty(FLArray FL_NULLABLE) FLPURE
Returns true if an array is empty (or NULL).
FLEECE_PUBLIC void FLArrayIterator_Begin(FLArray FL_NULLABLE, FLArrayIterator *)
Initializes a FLArrayIterator struct to iterate over an array.
FLEECE_PUBLIC const FLArray kFLEmptyArray
A constant empty array value.
FLEECE_PUBLIC FLValue FL_NULLABLE FLArrayIterator_GetValue(const FLArrayIterator *) FLPURE
Returns the current value being iterated over.
FLEECE_PUBLIC FLMutableArray FL_NULLABLE FLArray_AsMutable(FLArray FL_NULLABLE) FLPURE
If the array is mutable, returns it cast to FLMutableArray, else NULL.
FLEECE_PUBLIC uint32_t FLArrayIterator_GetCount(const FLArrayIterator *) FLPURE
Returns the number of items remaining to be iterated, including the current one.
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.
FLEECE_PUBLIC bool FLArrayIterator_Next(FLArrayIterator *)
Advances the iterator to the next value, or returns false if at the end.
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.
FLEECE_PUBLIC FLValue FL_NULLABLE FLDictIterator_GetKey(const FLDictIterator *) FLPURE
Returns the current key being iterated over.
FLEECE_PUBLIC FLValue FL_NULLABLE FLDictIterator_GetValue(const FLDictIterator *) FLPURE
Returns the current value being iterated over.
FLEECE_PUBLIC FLMutableDict FL_NULLABLE FLDict_AsMutable(FLDict FL_NULLABLE) FLPURE
If the dictionary is mutable, returns it cast to FLMutableDict, else NULL.
FLEECE_PUBLIC uint32_t FLDictIterator_GetCount(const FLDictIterator *) FLPURE
Returns the number of items remaining to be iterated, including the current one.
FLEECE_PUBLIC FLValue FL_NULLABLE FLDict_Get(FLDict FL_NULLABLE, FLSlice keyString) FLPURE
Looks up a key in a dictionary, returning its value.
FLEECE_PUBLIC FLString FLDictKey_GetString(const FLDictKey *)
Returns the string value of the key (which it was initialized with.)
FLEECE_PUBLIC const FLDict kFLEmptyDict
A constant empty array value.
FLEECE_PUBLIC void FLDictIterator_Begin(FLDict FL_NULLABLE, FLDictIterator *)
Initializes a FLDictIterator struct to iterate over a dictionary.
FLEECE_PUBLIC FLDictKey FLDictKey_Init(FLSlice string)
Initializes an FLDictKey struct with a key string.
FLEECE_PUBLIC bool FLDictIterator_Next(FLDictIterator *)
Advances the iterator to the next value, or returns false if at the end.
FLEECE_PUBLIC void FLDictIterator_End(FLDictIterator *)
Cleans up after an iterator.
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.
FLEECE_PUBLIC FLValue FL_NULLABLE FLDict_GetWithKey(FLDict FL_NULLABLE, FLDictKey *)
Looks up a key in a dictionary using an FLDictKey.
FLEECE_PUBLIC FLString FLDictIterator_GetKeyString(const FLDictIterator *)
Returns the current key's string value.
FLEECE_PUBLIC bool FLDict_IsEmpty(FLDict FL_NULLABLE) FLPURE
Returns true if a dictionary is empty (or NULL).
struct _FLDict * FLMutableDict
A reference to a mutable dictionary.
Definition: FLBase.h:40
const struct _FLDict * FLDict
A reference to a dictionary (map) value.
Definition: FLBase.h:37
struct _FLArray * FLMutableArray
A reference to a mutable array.
Definition: FLBase.h:39
const struct _FLArray * FLArray
A reference to an array value.
Definition: FLBase.h:36
const struct _FLValue * FLValue
A reference to a value of any type.
Definition: FLBase.h:35
Opaque array iterator.
Definition: FLCollections.h:73
Opaque dictionary iterator.
Definition: FLCollections.h:144
Opaque key for a dictionary.
Definition: FLCollections.h:187
A simple reference to a block of memory.
Definition: FLSlice.h:45