Couchbase Lite C
Couchbase Lite C API
Loading...
Searching...
No Matches
FLBase.h
Go to the documentation of this file.
1//
2// FLBase.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 _FLBASE_H
15#define _FLBASE_H
16
17#include "CompilerSupport.h"
18#include "FLSlice.h"
19
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26 // This is the C API! For the C++ API, see Fleece.hh.
27
28
29 //====== BASIC TYPES
30
33
34#ifndef FL_IMPL
35 typedef const struct _FLValue* FLValue;
36 typedef const struct _FLArray* FLArray;
37 typedef const struct _FLDict* FLDict;
38 typedef struct _FLSlot* FLSlot;
39 typedef struct _FLArray* FLMutableArray;
40 typedef struct _FLDict* FLMutableDict;
41 typedef struct _FLEncoder* FLEncoder;
42 typedef struct _FLDoc* FLDoc;
43 typedef struct _FLSharedKeys* FLSharedKeys;
44#endif
45
46
48 typedef enum {
50 kFLMemoryError, // Out of memory, or allocation failed
51 kFLOutOfRange, // Array index or iterator out of range
52 kFLInvalidData, // Bad input data (NaN, non-string key, etc.)
53 kFLEncodeError, // Structural error encoding (missing value, too many ends, etc.)
54 kFLJSONError, // Error parsing JSON
55 kFLUnknownValue, // Unparseable data in a Value (corrupt? Or from some distant future?)
56 kFLInternalError, // Something that shouldn't happen
57 kFLNotFound, // Key not found
58 kFLSharedKeysStateError, // Misuse of shared keys (not in transaction, etc.)
60 kFLUnsupported, // Operation is unsupported
61 } FLError;
62
63
78
79
80 //====== TIMESTAMPS
81
82
91
93 typedef int64_t FLTimestamp;
94
96 #define FLTimestampNone INT64_MIN
97
100
108
113
115
117
118#ifdef __cplusplus
119}
120#endif
121
123
124#endif // _FLBASE_H
#define FLEECE_PUBLIC
Definition CompilerSupport.h:269
#define FL_ASSUME_NONNULL_BEGIN
Definition CompilerSupport.h:92
#define FL_ASSUME_NONNULL_END
Definition CompilerSupport.h:93
#define FLAPI
Definition CompilerSupport.h:292
FLSliceResult FLStringResult
Definition FLSlice.h:99
FLSlice FLString
Definition FLSlice.h:98
int64_t FLTimestamp
A point in time, expressed as milliseconds since the Unix epoch (1-1-1970 midnight UTC....
Definition FLBase.h:93
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 _FLSlot * FLSlot
A reference to a mutable array/dict item.
Definition FLBase.h:38
struct _FLArray * FLMutableArray
A reference to a mutable array.
Definition FLBase.h:39
FLError
Error codes returned from some API calls.
Definition FLBase.h:48
struct _FLDoc * FLDoc
A reference to a document.
Definition FLBase.h:42
const struct _FLArray * FLArray
A reference to an array value.
Definition FLBase.h:36
FLEECE_PUBLIC FLTimestamp FLTimestamp_Now(void)
Returns an FLTimestamp corresponding to the current time.
struct _FLEncoder * FLEncoder
A reference to an encoder.
Definition FLBase.h:41
FLEECE_PUBLIC FLStringResult FLTimestamp_ToString(FLTimestamp timestamp, bool asUTC)
Formats a timestamp as a date-time string in ISO-8601 format.
FLTrust
Specifies whether not input data is trusted to be 100% valid Fleece.
Definition FLBase.h:65
struct _FLSharedKeys * FLSharedKeys
A reference to a shared-keys mapping.
Definition FLBase.h:43
const struct _FLValue * FLValue
A reference to a value of any type.
Definition FLBase.h:35
FLEECE_PUBLIC FLTimestamp FLTimestamp_FromString(FLString str)
Parses an ISO-8601 date-time string to a timestamp.
@ kFLNotFound
Definition FLBase.h:57
@ kFLInvalidData
Definition FLBase.h:52
@ kFLInternalError
Definition FLBase.h:56
@ kFLSharedKeysStateError
Definition FLBase.h:58
@ kFLOutOfRange
Definition FLBase.h:51
@ kFLEncodeError
Definition FLBase.h:53
@ kFLMemoryError
Definition FLBase.h:50
@ kFLUnsupported
Definition FLBase.h:60
@ kFLUnknownValue
Definition FLBase.h:55
@ kFLJSONError
Definition FLBase.h:54
@ kFLPOSIXError
Definition FLBase.h:59
@ kFLNoError
Definition FLBase.h:49
@ kFLTrusted
Input data is trusted to be valid.
Definition FLBase.h:75
@ kFLUntrusted
Input data is not trusted to be valid, and will be fully validated by the API call.
Definition FLBase.h:67
@ _kFLTrustInternalUseOnly
Definition FLBase.h:76