Couchbase Lite C
Couchbase Lite C API
Loading...
Searching...
No Matches
FLKeyPath.h
Go to the documentation of this file.
1//
2// FLKeyPath.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 _FLKEYPATH_H
15#define _FLKEYPATH_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
42
43#ifndef FL_IMPL
44 typedef struct _FLKeyPath* FLKeyPath;
45#endif
46
49 FLError* FL_NULLABLE outError) FLAPI;
50
53
56 FLValue root) FLAPI;
57
62 FLError* FL_NULLABLE outError) FLAPI;
63
66
69
72
82 size_t i,
83 FLSlice *outDictKey,
84 int32_t *outArrayIndex) FLAPI;
85
88
91
94
97 FLError* FL_NULLABLE outError) FLAPI;
98
101
103
104#ifdef __cplusplus
105}
106#endif
107
109
110#endif // _FLKEYPATH_H
#define FL_NULLABLE
Definition CompilerSupport.h:94
#define FLEECE_PUBLIC
Definition CompilerSupport.h:269
#define FL_ASSUME_NONNULL_BEGIN
Definition CompilerSupport.h:92
#define NODISCARD
Definition CompilerSupport.h:63
#define FL_ASSUME_NONNULL_END
Definition CompilerSupport.h:93
#define FLAPI
Definition CompilerSupport.h:292
NODISCARD FLEECE_PUBLIC FLKeyPath FL_NULLABLE FLKeyPath_New(FLSlice specifier, FLError *FL_NULLABLE outError)
Creates a new FLKeyPath object by compiling a path specifier string.
struct _FLKeyPath * FLKeyPath
A reference to a key path.
Definition FLKeyPath.h:44
FLEECE_PUBLIC void FLKeyPath_Free(FLKeyPath FL_NULLABLE)
Frees a compiled FLKeyPath object.
NODISCARD FLEECE_PUBLIC FLStringResult FLKeyPath_ToString(FLKeyPath path)
Returns a path in string form.
NODISCARD FLEECE_PUBLIC FLKeyPath FL_NULLABLE FLKeyPath_NewEmpty(void)
Creates a new empty FLKeyPath, for the purpose of adding components to it.
FLEECE_PUBLIC void FLKeyPath_DropComponents(FLKeyPath, size_t n)
Removes the first n components.
FLEECE_PUBLIC void FLKeyPath_AddIndex(FLKeyPath, int index)
Appends a single array index component to a path.
NODISCARD FLEECE_PUBLIC FLValue FL_NULLABLE FLKeyPath_Eval(FLKeyPath, FLValue root)
Evaluates a compiled key-path for a given Fleece root object.
FLEECE_PUBLIC bool FLKeyPath_GetElement(FLKeyPath path, size_t i, FLSlice *outDictKey, int32_t *outArrayIndex)
Returns an element of a path, either a key or an array index.
FLEECE_PUBLIC size_t FLKeyPath_GetCount(FLKeyPath)
The number of path components.
NODISCARD FLEECE_PUBLIC FLValue FL_NULLABLE FLKeyPath_EvalOnce(FLSlice specifier, FLValue root, FLError *FL_NULLABLE outError)
Evaluates a key-path from a specifier string, for a given Fleece root object.
NODISCARD FLEECE_PUBLIC bool FLKeyPath_AddComponents(FLKeyPath, FLString specifier, FLError *FL_NULLABLE outError)
Appends one or more components, encoded as a specifier like the one passed to FLKeyPath_New.
FLEECE_PUBLIC void FLKeyPath_AddProperty(FLKeyPath, FLString property)
Appends a single property/key component to a path.
FLEECE_PUBLIC bool FLKeyPath_Equals(FLKeyPath path1, FLKeyPath path2)
Equality test.
FLSliceResult FLStringResult
Definition FLSlice.h:99
FLSlice FLString
Definition FLSlice.h:98
FLError
Error codes returned from some API calls.
Definition FLBase.h:48
const struct _FLValue * FLValue
A reference to a value of any type.
Definition FLBase.h:35
A simple reference to a block of memory.
Definition FLSlice.h:45