Project Lucy has retired. For details please refer to its Attic page.
Clownfish::Blob – C API Documentation
Apache Lucy™

Clownfish::Blob

parcel Clownfish
class variable CFISH_BLOB
struct symbol cfish_Blob
class nickname cfish_Blob
header file Clownfish/Blob.h

Name

Clownfish::Blob – Immutable buffer holding arbitrary bytes.

Functions

new
cfish_Blob* // incremented
cfish_Blob_new(
    void *bytes,
    size_t size
);

Return a new Blob which holds a copy of the passed-in bytes.

bytes

Pointer to an array of bytes.

size

Size of the array in bytes.

init
cfish_Blob*
cfish_Blob_init(
    cfish_Blob *self,
    void *bytes,
    size_t size
);

Initialize a Blob which holds a copy of the passed-in bytes.

bytes

Pointer to an array of bytes.

size

Size of the array in bytes.

new_steal
cfish_Blob* // incremented
cfish_Blob_new_steal(
    void *bytes,
    size_t size
);

Return a new Blob which assumes ownership of the passed-in bytes.

bytes

Pointer to an array of bytes.

size

Size of the array in bytes.

init_steal
cfish_Blob*
cfish_Blob_init_steal(
    cfish_Blob *self,
    void *bytes,
    size_t size
);

Initialize a Blob which assumes ownership of the passed-in bytes.

bytes

Pointer to an array of bytes.

size

Size of the array in bytes.

new_wrap
cfish_Blob* // incremented
cfish_Blob_new_wrap(
    void *bytes,
    size_t size
);

Return a new Blob which wraps an external buffer. The buffer must stay unchanged for the lifetime of the Blob.

bytes

Pointer to an array of bytes.

size

Size of the array in bytes.

init_wrap
cfish_Blob*
cfish_Blob_init_wrap(
    cfish_Blob *self,
    void *bytes,
    size_t size
);

Initialize a Blob which wraps an external buffer. The buffer must stay unchanged for the lifetime of the Blob.

bytes

Pointer to an array of bytes.

size

Size of the array in bytes.

Methods

Get_Size
size_t
cfish_Blob_Get_Size(
    cfish_Blob *self
);

Return the number of bytes held by the Blob.

Get_Buf
char*
cfish_Blob_Get_Buf(
    cfish_Blob *self
);

Accessor for raw internal buffer.

Equals
bool
cfish_Blob_Equals(
    cfish_Blob *self,
    cfish_Obj *other
);

Equality test.

Returns: true if other is a Blob and has the same content as self.

Equals_Bytes
bool
cfish_Blob_Equals_Bytes(
    cfish_Blob *self,
    void *bytes,
    size_t size
);

Test whether the Blob matches the passed-in bytes.

bytes

Pointer to an array of bytes.

size

Size of the array in bytes.

Compare_To
int32_t
cfish_Blob_Compare_To(
    cfish_Blob *self,
    cfish_Obj *other
);

Indicate whether one Blob is less than, equal to, or greater than another. The byte contents of the Blobs are compared lexicographically. Throws an exception if other is not a Blob.

Returns: 0 if the Blobs are equal, a negative number if self is less than other, and a positive number if self is greater than other.

Clone
cfish_Blob* // incremented
cfish_Blob_Clone(
    cfish_Blob *self
);

Return a clone of the object.

Inheritance

Clownfish::Blob is a Clownfish::Obj.