![]() |
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 106 of file as_geojson.h.
#include "as_geojson.h"
Inheritance diagram for as_geojson:
Collaboration diagram for as_geojson:Data Fields | |
| bool | free |
| size_t | len |
| char * | value |
Data Fields inherited from as_val | |
| cf_atomic32 | count |
| bool | free |
| enum as_val_t | type |
Private Attributes | |
| as_val | _ |
Related Functions | |
(Note that these are not member functions.) | |
| 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_geojson * | as_geojson_init (as_geojson *string, char *value, bool free) |
| as_geojson * | as_geojson_init_wlen (as_geojson *string, char *value, size_t len, bool free) |
| size_t | as_geojson_len (as_geojson *string) |
| as_geojson * | as_geojson_new (char *value, bool free) |
| 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 212 of file as_geojson.h.
|
related |
Convert from an as_val.
Definition at line 271 of file as_geojson.h.
|
related |
Get the string value.
Definition at line 247 of file as_geojson.h.
|
related |
Get the string value. If string is NULL, then return the fallback value.
Definition at line 237 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 261 of file as_geojson.h.
|
private |
as_boolean is a subtype of as_val. You can cast as_boolean to as_val.
Definition at line 113 of file as_geojson.h.
| bool as_geojson::free |
If true, then as_geojson.value can be freed.
Definition at line 118 of file as_geojson.h.
| size_t as_geojson::len |
The length of the string.
Definition at line 128 of file as_geojson.h.
| char* as_geojson::value |
The string value.
Definition at line 123 of file as_geojson.h.