Couchbase Lite C
Couchbase Lite C API
FLDeepIterator.h
Go to the documentation of this file.
1//
2// FLDeepIterator.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 _FLDEEPITERATOR_H
15#define _FLDEEPITERATOR_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
33#ifndef FL_IMPL
34 typedef struct _FLDeepIterator* FLDeepIterator;
35#endif
36
41
43
46
49
52
55
58
61
64
65 typedef struct {
67 uint32_t index;
69
73 size_t* outDepth) FLAPI;
74
77
80
83#ifdef __cplusplus
84}
85#endif
86
88
89#endif // _FLDEEPITERATOR_H
#define FL_NONNULL
Definition: CompilerSupport.h:75
#define FL_NULLABLE
Definition: CompilerSupport.h:74
#define FLEECE_PUBLIC
Definition: CompilerSupport.h:241
#define FL_ASSUME_NONNULL_BEGIN
Definition: CompilerSupport.h:72
#define FL_ASSUME_NONNULL_END
Definition: CompilerSupport.h:73
#define FLAPI
Definition: CompilerSupport.h:247
struct _FLDeepIterator * FLDeepIterator
A reference to a deep iterator.
Definition: FLDeepIterator.h:34
FLEECE_PUBLIC FLDeepIterator FLDeepIterator_New(FLValue FL_NULLABLE)
Creates a FLDeepIterator to iterate over a dictionary.
FLEECE_PUBLIC FLValue FL_NULLABLE FLDeepIterator_GetParent(FLDeepIterator)
Returns the parent/container of the current value, or NULL at the end of iteration.
FLEECE_PUBLIC uint32_t FLDeepIterator_GetIndex(FLDeepIterator)
Returns the array index of the current value in its parent, or 0 if not in an array.
FLEECE_PUBLIC FLSliceResult FLDeepIterator_GetPathString(FLDeepIterator)
Returns the current path in JavaScript format.
FLEECE_PUBLIC FLSlice FLDeepIterator_GetKey(FLDeepIterator)
Returns the key of the current value in its parent, or an empty slice if not in a dictionary.
FLEECE_PUBLIC size_t FLDeepIterator_GetDepth(FLDeepIterator)
Returns the current depth in the hierarchy, starting at 1 for the top-level children.
FLEECE_PUBLIC bool FLDeepIterator_Next(FLDeepIterator)
Advances the iterator to the next value, or returns false if at the end.
FLEECE_PUBLIC void FLDeepIterator_GetPath(FLDeepIterator, FLPathComponent *FL_NONNULL *FL_NONNULL outPath, size_t *outDepth)
Returns the path as an array of FLPathComponents.
FLEECE_PUBLIC FLValue FL_NULLABLE FLDeepIterator_GetValue(FLDeepIterator)
Returns the current value being iterated over.
FLEECE_PUBLIC FLSliceResult FLDeepIterator_GetJSONPointer(FLDeepIterator)
Returns the current path in JSONPointer format (RFC 6901).
FLEECE_PUBLIC void FLDeepIterator_Free(FLDeepIterator FL_NULLABLE)
FLEECE_PUBLIC void FLDeepIterator_SkipChildren(FLDeepIterator)
Tells the iterator to skip the children of the current value.
const struct _FLValue * FLValue
A reference to a value of any type.
Definition: FLBase.h:35
Definition: FLDeepIterator.h:65
uint32_t index
Array index, only if there's no key.
Definition: FLDeepIterator.h:67
FLSlice key
Dict key, or kFLSliceNull if none.
Definition: FLDeepIterator.h:66
A simple reference to a block of memory.
Definition: FLSlice.h:45
A heap-allocated block of memory returned from an API call.
Definition: FLSlice.h:63