![]() |
Container for NULL-terminates GeoJSON string values.
An as_geojson should be initialized via one of the provided function.
To initialize a stack allocated as_geojson, use as_geojson_init():
The 3rd argument indicates whether the string value should be free()
d when as_geojson is destroyed.
To create and initialize a heap allocated as_integer, use as_integer_new():
When the as_geojson instance is no longer required, then you should release the resources associated with it via as_geojson_destroy():
There are two functions for getting the boxed value contained by as_geojson:
as_geojson_get() returns the contained value. If an error occurred, then NULL is returned. Possible errors is the as_integer instance is NULL.
as_geojson_getorelse() allows you to return a default value if an error occurs:
as_geojson is derived from as_val, so it is generally safe to down cast:
However, upcasting is more error prone. When doing so, you should use as_geojson_fromval(). If conversion fails, then the return value is NULL.
Definition at line 103 of file as_geojson.h.
#include "as_geojson.h"
Data Fields | |
bool | free |
size_t | len |
char * | value |
![]() | |
uint32_t | count |
bool | free |
as_val_t | type |
Related Symbols | |
(Note that these are not member symbols.) | |
static void | as_geojson_destroy (as_geojson *string) |
static as_geojson * | as_geojson_fromval (const as_val *v) |
static char * | as_geojson_get (const as_geojson *string) |
static char * | as_geojson_getorelse (const as_geojson *string, char *fallback) |
AS_EXTERN as_geojson * | as_geojson_init (as_geojson *string, char *value, bool free) |
AS_EXTERN as_geojson * | as_geojson_init_wlen (as_geojson *string, char *value, size_t len, bool free) |
AS_EXTERN size_t | as_geojson_len (as_geojson *string) |
AS_EXTERN as_geojson * | as_geojson_new (char *value, bool free) |
AS_EXTERN as_geojson * | as_geojson_new_wlen (char *value, size_t len, bool free) |
static as_val * | as_geojson_toval (const as_geojson *s) |
|
related |
Destroy the as_geojson and associated resources.
Definition at line 209 of file as_geojson.h.
References as_val_destroy.
|
related |
Convert from an as_val.
Definition at line 268 of file as_geojson.h.
References AS_GEOJSON, and as_util_fromval.
|
related |
Get the string value.
Definition at line 244 of file as_geojson.h.
References as_geojson_getorelse().
|
related |
Get the string value. If string is NULL, then return the fallback value.
Definition at line 234 of file as_geojson.h.
|
related |
Initialize a stack allocated as_geojson
.
If free is true, then the string value will be freed when the as_geojson is destroyed.
string | The stack allocated as_geojson to initialize |
value | The NULL terminated string of character. |
free | If true, then the value will be freed when as_geojson is destroyed. |
|
related |
Initialize a stack allocated as_geojson
and its length.
If free is true, then the string value will be freed when the as_geojson is destroyed.
string | The stack allocated as_geojson to initialize |
value | The NULL terminated string of character. |
len | The length of the string. |
free | If true, then the value will be freed when as_geojson is destroyed. |
|
related |
The length of the string
string | The string to get the length of. |
|
related |
Create and initialize a new heap allocated as_geojson
.
If free is true, then the string value will be freed when the as_geojson is destroyed.
value | The NULL terminated string of character. |
free | If true, then the value will be freed when as_geojson is destroyed. |
|
related |
Create and initialize a new heap allocated as_geojson
and its length.
If free is true, then the string value will be freed when the as_geojson is destroyed.
value | The NULL terminated string of character. |
len | The length of the string. |
free | If true, then the value will be freed when as_geojson is destroyed. |
|
related |
Convert to an as_val.
Definition at line 258 of file as_geojson.h.
bool as_geojson::free |
If true, then as_geojson.value
can be freed.
Definition at line 115 of file as_geojson.h.
size_t as_geojson::len |
The length of the string.
Definition at line 125 of file as_geojson.h.
char* as_geojson::value |
The string value.
Definition at line 120 of file as_geojson.h.