Couchbase Lite C
Couchbase Lite C API
Typedefs | Enumerations | Functions | Variables
CBLBlob.h File Reference
#include "CBLBase.h"

Go to the source code of this file.

Typedefs

typedef struct CBLBlobReadStream CBLBlobReadStream
 A stream for reading a blob's content. More...
 
typedef struct CBLBlobWriteStream CBLBlobWriteStream
 A stream for writing a new blob to the database. More...
 

Enumerations

enum  CBLSeekBase : uint8_t { kCBLSeekModeFromStart , kCBLSeekModeRelative , kCBLSeekModeFromEnd }
 Defines the interpretation of offset in CBLBlobReader_Seek. More...
 

Functions

static const CBLBlobCBLBlob_Retain (const CBLBlob *t)
 
static void CBLBlob_Release (const CBLBlob *t)
 
bool FLDict_IsBlob (FLDict _cbl_nullable)
 Returns true if a dictionary in a document is a blob reference. More...
 
const CBLBlob *_cbl_nullable FLDict_GetBlob (FLDict _cbl_nullable blobDict)
 Returns a CBLBlob object corresponding to a blob dictionary in a document. More...
 
uint64_t CBLBlob_Length (const CBLBlob *)
 Returns the length in bytes of a blob's content (from its length property). More...
 
FLString CBLBlob_ContentType (const CBLBlob *)
 Returns a blob's MIME type, if its metadata has a content_type property. More...
 
FLString CBLBlob_Digest (const CBLBlob *)
 Returns the cryptographic digest of a blob's content (from its digest property). More...
 
FLDict CBLBlob_Properties (const CBLBlob *)
 Returns a blob's metadata. More...
 
_cbl_warn_unused FLStringResult CBLBlob_CreateJSON (const CBLBlob *blob)
 Returns a blob's metadata as JSON. More...
 
_cbl_warn_unused FLSliceResult CBLBlob_Content (const CBLBlob *blob, CBLError *_cbl_nullable outError)
 Reads the blob's content into memory and returns them. More...
 
_cbl_warn_unused CBLBlobReadStream *_cbl_nullable CBLBlob_OpenContentStream (const CBLBlob *blob, CBLError *_cbl_nullable)
 Opens a stream for reading a blob's content. More...
 
int CBLBlobReader_Read (CBLBlobReadStream *stream, void *dst, size_t maxLength, CBLError *_cbl_nullable outError)
 Reads data from a blob. More...
 
int64_t CBLBlobReader_Seek (CBLBlobReadStream *stream, int64_t offset, CBLSeekBase base, CBLError *_cbl_nullable outError)
 Sets the position of a CBLBlobReadStream. More...
 
uint64_t CBLBlobReader_Position (CBLBlobReadStream *stream)
 Returns the current position of a CBLBlobReadStream. More...
 
void CBLBlobReader_Close (CBLBlobReadStream *_cbl_nullable)
 Closes a CBLBlobReadStream. More...
 
bool CBLBlob_Equals (CBLBlob *blob, CBLBlob *anotherBlob)
 Compares whether the two given blobs are equal based on their content. More...
 
_cbl_warn_unused CBLBlobCBLBlob_CreateWithData (FLString contentType, FLSlice contents)
 Creates a new blob given its contents as a single block of data. More...
 
_cbl_warn_unused CBLBlobWriteStream *_cbl_nullable CBLBlobWriter_Create (CBLDatabase *db, CBLError *_cbl_nullable)
 Opens a stream for writing a new blob. More...
 
void CBLBlobWriter_Close (CBLBlobWriteStream *_cbl_nullable)
 Closes a blob-writing stream, if you need to give up without creating a CBLBlob. More...
 
bool CBLBlobWriter_Write (CBLBlobWriteStream *writer, const void *data, size_t length, CBLError *_cbl_nullable outError)
 Writes data to a new blob. More...
 
_cbl_warn_unused CBLBlobCBLBlob_CreateWithStream (FLString contentType, CBLBlobWriteStream *writer)
 Creates a new blob after its data has been written to a CBLBlobWriteStream. More...
 
static bool FLValue_IsBlob (FLValue _cbl_nullable v)
 Returns true if a value in a document is a blob reference. More...
 
static const CBLBlob *_cbl_nullable FLValue_GetBlob (FLValue _cbl_nullable value)
 Instantiates a CBLBlob object corresponding to a blob dictionary in a document. More...
 
void FLSlot_SetBlob (FLSlot slot, CBLBlob *blob)
 
static void FLMutableArray_SetBlob (FLMutableArray array, uint32_t index, CBLBlob *blob)
 Stores a blob reference into an array. More...
 
static void FLMutableArray_AppendBlob (FLMutableArray array, CBLBlob *blob)
 Appends a blob reference to an array. More...
 
static void FLMutableDict_SetBlob (FLMutableDict dict, FLString key, CBLBlob *blob)
 Stores a blob reference into a Dict. More...
 
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. More...
 
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. More...
 

Variables

CBL_PUBLIC const FLSlice kCBLBlobType
 "blob" More...
 
CBL_PUBLIC const FLSlice kCBLBlobDigestProperty
 "digest" More...
 
CBL_PUBLIC const FLSlice kCBLBlobLengthProperty
 "length" More...
 
CBL_PUBLIC const FLSlice kCBLBlobContentTypeProperty
 "content_type" More...