78#pragma mark - BLOB METADATA:
99#pragma mark - READING:
155#pragma mark - CREATING:
206#pragma mark - FLEECE UTILITIES:
250#pragma mark - BINDING DEV SUPPORT FOR BLOB:
#define CBLAPI
Definition: CBL_Compat.h:104
#define _cbl_nullable
Definition: CBL_Compat.h:92
#define CBL_CAPI_BEGIN
Definition: CBL_Compat.h:105
#define CBL_CAPI_END
Definition: CBL_Compat.h:106
#define CBL_PUBLIC
Definition: CBL_Compat.h:123
#define CBL_ENUM(_type, _name)
Definition: CBL_Compat.h:62
#define _cbl_warn_unused
Definition: CBL_Compat.h:40
FLEECE_PUBLIC FLDict FL_NULLABLE FLValue_AsDict(FLValue FL_NULLABLE) FLPURE
If a FLValue represents a dictionary, returns it as an FLDict, else NULL.
NODISCARD FLEECE_PUBLIC FLSlot FLMutableArray_Append(FLMutableArray)
Appends a null value to the array and returns an FLSlot that refers to that position.
NODISCARD FLEECE_PUBLIC FLSlot FLMutableArray_Set(FLMutableArray, uint32_t index)
Returns an FLSlot that refers to the given index of the given array.
NODISCARD FLEECE_PUBLIC FLSlot FLMutableDict_Set(FLMutableDict, FLString key)
Returns an FLSlot that refers to the given key/value pair of the given dictionary.
_cbl_warn_unused CBLBlob * CBLBlob_CreateWithData(FLString contentType, FLSlice contents)
Creates a new blob given its contents as a single block of data.
CBL_PUBLIC const FLSlice kCBLBlobContentTypeProperty
"content_type"
bool CBLBlob_Equals(CBLBlob *blob, CBLBlob *anotherBlob)
Compares whether the two given blobs are equal based on their content.
bool CBLDatabase_SaveBlob(CBLDatabase *db, CBLBlob *blob, CBLError *_cbl_nullable outError)
Save a new CBLBlob object into the database without associating it with any documents.
int64_t CBLBlobReader_Seek(CBLBlobReadStream *stream, int64_t offset, CBLSeekBase base, CBLError *_cbl_nullable outError)
Sets the position of a CBLBlobReadStream.
bool FLDict_IsBlob(FLDict _cbl_nullable)
Returns true if a dictionary in a document is a blob reference.
static bool FLValue_IsBlob(FLValue _cbl_nullable v)
Returns true if a value in a document is a blob reference.
Definition: CBLBlob.h:211
_cbl_warn_unused CBLBlob * CBLBlob_CreateWithStream(FLString contentType, CBLBlobWriteStream *writer)
Creates a new blob after its data has been written to a CBLBlobWriteStream.
uint64_t CBLBlobReader_Position(CBLBlobReadStream *stream)
Returns the current position of a CBLBlobReadStream.
int CBLBlobReader_Read(CBLBlobReadStream *stream, void *dst, size_t maxLength, CBLError *_cbl_nullable outError)
Reads data from a blob.
FLString CBLBlob_Digest(const CBLBlob *)
Returns the cryptographic digest of a blob's content (from its digest property).
_cbl_warn_unused FLStringResult CBLBlob_CreateJSON(const CBLBlob *blob)
Returns a blob's metadata as JSON.
FLString CBLBlob_ContentType(const CBLBlob *)
Returns a blob's MIME type, if its metadata has a content_type property.
CBLSeekBase
Defines the interpretation of offset in CBLBlobReader_Seek.
Definition: CBLBlob.h:128
void CBLBlobWriter_Close(CBLBlobWriteStream *_cbl_nullable)
Closes a blob-writing stream, if you need to give up without creating a CBLBlob.
const CBLBlob *_cbl_nullable CBLDatabase_GetBlob(CBLDatabase *db, FLDict properties, CBLError *_cbl_nullable outError)
Get a CBLBlob object from the database using the CBLBlob properties.
static void FLMutableArray_SetBlob(FLMutableArray array, uint32_t index, CBLBlob *blob)
Stores a blob reference into an array.
Definition: CBLBlob.h:229
void FLSlot_SetBlob(FLSlot slot, CBLBlob *blob)
static void FLMutableDict_SetBlob(FLMutableDict dict, FLString key, CBLBlob *blob)
Stores a blob reference into a Dict.
Definition: CBLBlob.h:244
struct CBLBlobReadStream CBLBlobReadStream
A stream for reading a blob's content.
Definition: CBLBlob.h:109
static void FLMutableArray_AppendBlob(FLMutableArray array, CBLBlob *blob)
Appends a blob reference to an array.
Definition: CBLBlob.h:236
FLDict CBLBlob_Properties(const CBLBlob *)
Returns a blob's metadata.
CBL_PUBLIC const FLSlice kCBLBlobLengthProperty
"length"
struct CBLBlobWriteStream CBLBlobWriteStream
A stream for writing a new blob to the database.
Definition: CBLBlob.h:168
CBL_PUBLIC const FLSlice kCBLBlobType
"blob"
_cbl_warn_unused CBLBlobReadStream *_cbl_nullable CBLBlob_OpenContentStream(const CBLBlob *blob, CBLError *_cbl_nullable)
Opens a stream for reading a blob's content.
CBL_PUBLIC const FLSlice kCBLBlobDigestProperty
"digest"
const CBLBlob *_cbl_nullable FLDict_GetBlob(FLDict _cbl_nullable blobDict)
Returns a CBLBlob object corresponding to a blob dictionary in a document.
_cbl_warn_unused CBLBlobWriteStream *_cbl_nullable CBLBlobWriter_Create(CBLDatabase *db, CBLError *_cbl_nullable)
Opens a stream for writing a new blob.
struct CBLBlob CBLBlob
A binary data value associated with a CBLDocument.
Definition: CBLBase.h:209
_cbl_warn_unused FLSliceResult CBLBlob_Content(const CBLBlob *blob, CBLError *_cbl_nullable outError)
Reads the blob's content into memory and returns them.
uint64_t CBLBlob_Length(const CBLBlob *)
Returns the length in bytes of a blob's content (from its length property).
void CBLBlobReader_Close(CBLBlobReadStream *_cbl_nullable)
Closes a CBLBlobReadStream.
static const CBLBlob *_cbl_nullable FLValue_GetBlob(FLValue _cbl_nullable value)
Instantiates a CBLBlob object corresponding to a blob dictionary in a document.
Definition: CBLBlob.h:219
bool CBLBlobWriter_Write(CBLBlobWriteStream *writer, const void *data, size_t length, CBLError *_cbl_nullable outError)
Writes data to a new blob.
@ kCBLSeekModeRelative
Offset is relative to the current stream position.
Definition: CBLBlob.h:130
@ kCBLSeekModeFromStart
Offset is an absolute position starting from 0.
Definition: CBLBlob.h:129
@ kCBLSeekModeFromEnd
Offset is relative to the end of the blob.
Definition: CBLBlob.h:131
struct CBLDatabase CBLDatabase
A connection to an open database.
Definition: CBLBase.h:182
#define CBL_REFCOUNTED(TYPE, NAME)
Definition: CBLBase.h:170
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
const struct _FLValue * FLValue
A reference to a value of any type.
Definition: FLBase.h:35
A struct holding information about an error.
Definition: CBLBase.h:104
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