LiteCore
Couchbase Lite cross-platform core implementation
Loading...
Searching...
No Matches
c4Document+Fleece.h
Go to the documentation of this file.
1//
2// c4Document+Fleece.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
15#include "c4Document.h"
16
19
29#define kC4ObjectTypeProperty "@type"
30
31
33#define kC4ObjectType_Blob "blob"
34
36#define kC4BlobDigestProperty "digest"
37
39#define kC4BlobDataProperty "data"
40
42#define kC4LegacyAttachmentsProperty "_attachments"
43
44
46#define kC4ObjectType_Encryptable "encryptable"
47
49#define kC4EncryptableValueProperty "value"
50
51
55
60
66 FLDict C4NULLABLE mergedProperties, C4RevisionFlags mergedFlags,
67 C4Error* C4NULLABLE error) C4API;
68
71
75
81
86 C4Error* C4NULLABLE outError) C4API;
87
93
100
105
117 C4Error* C4NULLABLE outError) C4API;
118
126
130
134
139
143
147
#define NODISCARD
Definition CompilerSupport.h:59
#define CBL_CORE_API
Definition c4Compat.h:134
#define C4NULLABLE
Definition c4Compat.h:38
#define C4API
Definition c4Compat.h:114
#define C4_ASSUME_NONNULL_BEGIN
Definition c4Compat.h:36
#define C4API_END_DECLS
Definition c4Compat.h:116
#define C4NONNULL
Definition c4Compat.h:39
#define C4API_BEGIN_DECLS
Definition c4Compat.h:115
#define C4_ASSUME_NONNULL_END
Definition c4Compat.h:37
struct C4BlobStore C4BlobStore
Opaque handle for an object that manages storage of blobs.
Definition c4Base.h:120
struct C4Database C4Database
Opaque handle to an opened database.
Definition c4Base.h:136
NODISCARD CBL_CORE_API bool c4doc_getDictBlobKey(FLDict dict, C4BlobKey *outKey)
Decodes the dict's "digest" property to a C4BlobKey.
CBL_CORE_API bool c4doc_dictContainsBlobs(FLDict dict)
Returns true if the given dictionary is a [reference to a] blob;.
NODISCARD CBL_CORE_API bool c4doc_dictIsBlob(FLDict dict, C4BlobKey *outKey)
Returns true if the given dictionary is a [reference to a] blob; if so, gets its key.
CBL_CORE_API C4SliceResult c4doc_getBlobData(FLDict dict, C4BlobStore *blobStore, C4Error *outError)
Returns the contents of a blob dictionary, whether they're inline in the "data" property,...
CBL_CORE_API C4SliceResult c4doc_encodeStrippingOldMetaProperties(FLDict doc, FLSharedKeys sk, C4Error *outError)
Re-encodes to Fleece, without any 1.x metadata properties.
CBL_CORE_API FLSharedKeys c4db_getFLSharedKeys(C4Database *db)
Returns the FLSharedKeys object used by the given database.
CBL_CORE_API C4SliceResult c4db_encodeJSON(C4Database *, C4String jsonData, C4Error *outError)
Encodes JSON data to Fleece, to store into a document.
NODISCARD CBL_CORE_API FLEncoder c4db_createFleeceEncoder(C4Database *db)
Creates a Fleece encoder for creating documents for a given database.
CBL_CORE_API bool c4doc_isOldMetaProperty(C4String prop)
Returns true if this is the name of a 1.x metadata property ("_id", "_rev", "_deleted"....
CBL_CORE_API FLEncoder c4db_getSharedFleeceEncoder(C4Database *db)
Returns a shared Fleece encoder for creating documents for a given database.
CBL_CORE_API bool c4doc_blobIsCompressible(FLDict blobDict)
Given a dictionary that's a reference to a blob, determines whether it's worth trying to compress the...
CBL_CORE_API bool c4doc_hasOldMetaProperties(FLDict doc)
Returns true if the document contains 1.x metadata properties at top level.
CBL_CORE_API C4StringResult c4doc_bodyAsJSON(C4Document *doc, bool canonical, C4Error *outError)
Translates the body of the selected revision from Fleece to JSON.
NODISCARD CBL_CORE_API bool c4doc_resolveConflict2(C4Document *doc, C4String winningRevID, C4String losingRevID, FLDict mergedProperties, C4RevisionFlags mergedFlags, C4Error *error)
Resolves a conflict between two leaf revisions.
CBL_CORE_API FLDict c4doc_getProperties(C4Document *)
Returns the properties of the selected revision, i.e.
CBL_CORE_API C4Document * c4doc_containingValue(FLValue value)
Returns the C4Document, if any, that contains the given Fleece value.
NODISCARD CBL_CORE_API FLDoc c4doc_createFleeceDoc(C4Document *)
Returns a Fleece document reference created from the selected revision.
C4RevisionFlags
Definition c4DocumentTypes.h:33
const struct _FLDict * FLDict
A reference to a dictionary (map) value.
Definition FLBase.h:37
struct _FLDoc * FLDoc
A reference to a document.
Definition FLBase.h:42
struct _FLEncoder * FLEncoder
A reference to an encoder.
Definition FLBase.h:41
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
A unique identifier of a blob based on a SHA-1 digest of its contents.
Definition c4BlobStoreTypes.h:33
Describes a version-controlled document.
Definition c4DocumentStruct.h:32
An error value.
Definition c4Error.h:133
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