![]() |
#include <aerospike/as_util.h>
#include <aerospike/as_val.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
Go to the source code of this file.
Data Structures | |
struct | as_string |
Functions | |
const char * | as_basename (as_string *filename, const char *path) |
static void | as_string_destroy (as_string *string) |
static as_string * | as_string_fromval (const as_val *v) |
static char * | as_string_get (const as_string *string) |
static char * | as_string_getorelse (const as_string *string, char *fallback) |
as_string * | as_string_init (as_string *string, char *value, bool free) |
size_t | as_string_len (as_string *string) |
as_string * | as_string_new (char *value, bool free) |
as_string * | as_string_new_strdup (const char *value) |
static char * | as_string_tostring (const as_string *string) |
static as_val * | as_string_toval (const as_string *s) |
void | as_string_val_destroy (as_val *v) |
uint32_t | as_string_val_hashcode (const as_val *v) |
char * | as_string_val_tostring (const as_val *v) |
bool | as_strncpy (char *trg, const char *src, int size) |
const char * as_basename | ( | as_string * | filename, |
const char * | path | ||
) |
Return filename component of full path.
If path is empty, the current directory is returned. If path contains trailing directory slashes, create new string to hold filename without slashes. The input path is guaranteed not to be modified. as_string_destroy() must be called when finished with filename.
|
inlinestatic |
Destroy the as_string and associated resources.
Definition at line 179 of file as_string.h.
References as_val_destroy.
Convert from an as_val.
Definition at line 261 of file as_string.h.
References AS_STRING, and as_util_fromval.
|
inlinestatic |
Get the string value.
Definition at line 214 of file as_string.h.
References as_string::as_string_getorelse().
|
inlinestatic |
Get the string value. If string is NULL, then return the fallback value.
Definition at line 204 of file as_string.h.
Initialize a stack allocated as_string
.
If free is true, then the string value will be freed when the as_string is destroyed.
string | The stack allocated as_string to initialize |
value | The NULL terminated string of character. |
free | If true, then the value will be freed when as_string is destroyed. |
size_t as_string_len | ( | as_string * | string | ) |
The length of the string
string | The string to get the length of. |
as_string * as_string_new | ( | char * | value, |
bool | free | ||
) |
Create and initialize a new heap allocated as_string
.
If free is true, then the string value will be freed when the as_string is destroyed.
value | The NULL terminated string of character. |
free | If true, then the value will be freed when as_string is destroyed. |
as_string* as_string_new_strdup | ( | const char * | value | ) |
|
inlinestatic |
Get the string value.
Definition at line 225 of file as_string.h.
References as_string::as_string_getorelse().
Convert to an as_val.
Definition at line 251 of file as_string.h.
|
private |
Internal helper function for getting the hashcode of an as_val.
|
private |
Internal helper function for getting the string representation of an as_val.
|
private |
Copy null terminated src to trg up to a maximum size. If maximum size reached, null terminate last character and and return true that truncation occurred.
as_strncpy does not pad unused bytes with zeroes like the standard strncpy.