node-addon-layer
C API For writing Node modules
|
Typedefs | |
typedef void(* | shim_buffer_free )(char *, void *) |
Functions | |
shim_val_t * | shim_buffer_new (shim_ctx_t *, size_t) |
shim_val_t * | shim_buffer_new_copy (shim_ctx_t *, const char *, size_t) |
shim_val_t * | shim_buffer_new_external (shim_ctx_t *, char *, size_t, shim_buffer_free, void *) |
char * | shim_buffer_value (shim_val_t *) |
size_t | shim_buffer_length (shim_val_t *) |
Methods for Buffers
typedef void(* shim_buffer_free)(char *, void *) |
The callback that will be called when the Buffer is to be freed
size_t shim_buffer_length | ( | shim_val_t * | val) |
Get the size of the buffer
val | The given buffer |
shim_val_t* shim_buffer_new | ( | shim_ctx_t * | ctx, |
size_t | len | ||
) |
Create a new buffer of length
ctx | Current executing context |
len | Size of buffer to create |
shim_val_t* shim_buffer_new_copy | ( | shim_ctx_t * | ctx, |
const char * | data, | ||
size_t | len | ||
) |
Copy into a new buffer
ctx | Current executing context |
data | Data to be copied |
len | Length of data to be copied |
shim_val_t* shim_buffer_new_external | ( | shim_ctx_t * | ctx, |
char * | data, | ||
size_t | len, | ||
shim_buffer_free | cb, | ||
void * | hint | ||
) |
Create a new buffer and be notified when the buffer is to be freed
ctx | Current executing context |
data | Data to be used for underlying memory |
len | Size of memory being used |
cb | Callback that is called when buffer is to be freed |
hint | Arbitrary data passed to the callback |
The underlying memory is not copied, but used in place
char* shim_buffer_value | ( | shim_val_t * | val) |
Get the underlying memory for the Buffer
val | THe given buffer |