tetengo 1.8.1
A multipurpose library set
Loading...
Searching...
No Matches
element.h File Reference

An element. More...

#include <stddef.h>
+ Include dependency graph for element.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tetengo_json_element_type_tag
 
struct  tetengo_json_element_attributeKeyValue_tag
 
struct  tetengo_json_fileLocation_tag
 

Typedefs

typedef struct tetengo_json_element_type_tag tetengo_json_element_type_t
 
typedef struct tetengo_json_element_attributeKeyValue_tag tetengo_json_element_attributeKeyValue_t
 
typedef struct tetengo_json_fileLocation_tag tetengo_json_fileLocation_t
 

Functions

int tetengo_json_element_typeName_string ()
 Returns the type name of string.
 
int tetengo_json_element_typeName_number ()
 Returns the type name of number.
 
int tetengo_json_element_typeName_boolean ()
 Returns the type name of boolean.
 
int tetengo_json_element_typeName_null ()
 Returns the type name of null.
 
int tetengo_json_element_typeName_object ()
 Returns the type name of object.
 
int tetengo_json_element_typeName_member ()
 Returns the type name of member.
 
int tetengo_json_element_typeName_array ()
 Returns the type name of array.
 
int tetengo_json_element_typeCategory_primitive ()
 Returns the type category of primitive.
 
int tetengo_json_element_typeCategory_structureOpen ()
 Returns the type category of opening structure.
 
int tetengo_json_element_typeCategory_structureClose ()
 Returns the type category of closing structure.
 
tetengo_json_element_t * tetengo_json_element_create (const tetengo_json_element_type_t *p_type, const char *value, const tetengo_json_element_attributeKeyValue_t *p_attributes, size_t attribute_count, const tetengo_json_fileLocation_t *p_file_location)
 Creates an element.
 
tetengo_json_element_t * tetengo_json_element_copy (const tetengo_json_element_t *p_another)
 Copies an element.
 
void tetengo_json_element_destroy (const tetengo_json_element_t *p_element)
 Destroys an element.
 
const tetengo_json_element_type_ttetengo_json_element_type (const tetengo_json_element_t *p_element)
 Returns the type.
 
const char * tetengo_json_element_value (const tetengo_json_element_t *p_element)
 Returns the value.
 
size_t tetengo_json_element_attributeKeys (const tetengo_json_element_t *p_element, const char **p_keys)
 Returns the attribute keys.
 
const char * tetengo_json_element_attributeValueOf (const tetengo_json_element_t *p_element, const char *key)
 Returns the attribute value.
 
const tetengo_json_fileLocation_ttetengo_json_element_getFileLocation (const tetengo_json_element_t *p_element)
 Returns the file location.
 

Detailed Description

An element.

Copyright (C) 2019-2023 kaoru https://www.tetengo.org/

Typedef Documentation

◆ tetengo_json_element_attributeKeyValue_t

◆ tetengo_json_element_type_t

◆ tetengo_json_fileLocation_t

The file location type.

Function Documentation

◆ tetengo_json_element_attributeKeys()

size_t tetengo_json_element_attributeKeys ( const tetengo_json_element_t *  p_element,
const char **  p_keys 
)

Returns the attribute keys.

Parameters
p_elementA pointer to an element.
p_keysThe storage for a keys. Can be NULL.
Returns
The attribute count (== The key count). Or 0 when p_element is NULL.

◆ tetengo_json_element_attributeValueOf()

const char * tetengo_json_element_attributeValueOf ( const tetengo_json_element_t *  p_element,
const char *  key 
)

Returns the attribute value.

Parameters
p_elementA pointer to an element.
keyA key.
Returns
The value. Or NULL when p_element is NULL or key is NULL or key is not found.

◆ tetengo_json_element_copy()

tetengo_json_element_t * tetengo_json_element_copy ( const tetengo_json_element_t *  p_another)

Copies an element.

Parameters
p_anotherA pointer to another element.
Returns
A pointer to an element. Or NULL when p_another is NULL.

◆ tetengo_json_element_create()

tetengo_json_element_t * tetengo_json_element_create ( const tetengo_json_element_type_t p_type,
const char *  value,
const tetengo_json_element_attributeKeyValue_t p_attributes,
size_t  attribute_count,
const tetengo_json_fileLocation_t p_file_location 
)

Creates an element.

Parameters
p_typeA pointer to a type.
valueA value.
p_attributesA pointer to the head of attributes.
attribute_countAn attribute count.
p_file_locationA pointer to a file location.
Returns
A pointer to an element. Or NULL on error.

◆ tetengo_json_element_destroy()

void tetengo_json_element_destroy ( const tetengo_json_element_t *  p_element)

Destroys an element.

Parameters
p_elementA pointer to an element.

◆ tetengo_json_element_getFileLocation()

const tetengo_json_fileLocation_t * tetengo_json_element_getFileLocation ( const tetengo_json_element_t *  p_element)

Returns the file location.

Parameters
p_elementA pointer to an element.
Returns
A pointer to the file location. Or NULL when p_element is NULL.

◆ tetengo_json_element_type()

const tetengo_json_element_type_t * tetengo_json_element_type ( const tetengo_json_element_t *  p_element)

Returns the type.

Parameters
p_elementA pointer to an element.
Returns
The pointer to the type. Or NULL when p_element is NULL.

◆ tetengo_json_element_typeCategory_primitive()

int tetengo_json_element_typeCategory_primitive ( )

Returns the type category of primitive.

Returns
The type category.

◆ tetengo_json_element_typeCategory_structureClose()

int tetengo_json_element_typeCategory_structureClose ( )

Returns the type category of closing structure.

Returns
The type category.

◆ tetengo_json_element_typeCategory_structureOpen()

int tetengo_json_element_typeCategory_structureOpen ( )

Returns the type category of opening structure.

Returns
The type category.

◆ tetengo_json_element_typeName_array()

int tetengo_json_element_typeName_array ( )

Returns the type name of array.

Returns
The type name.

◆ tetengo_json_element_typeName_boolean()

int tetengo_json_element_typeName_boolean ( )

Returns the type name of boolean.

Returns
The type name.

◆ tetengo_json_element_typeName_member()

int tetengo_json_element_typeName_member ( )

Returns the type name of member.

Returns
The type name.

◆ tetengo_json_element_typeName_null()

int tetengo_json_element_typeName_null ( )

Returns the type name of null.

Returns
The type name.

◆ tetengo_json_element_typeName_number()

int tetengo_json_element_typeName_number ( )

Returns the type name of number.

Returns
The type name.

◆ tetengo_json_element_typeName_object()

int tetengo_json_element_typeName_object ( )

Returns the type name of object.

Returns
The type name.

◆ tetengo_json_element_typeName_string()

int tetengo_json_element_typeName_string ( )

Returns the type name of string.

Returns
The type name.

◆ tetengo_json_element_value()

const char * tetengo_json_element_value ( const tetengo_json_element_t *  p_element)

Returns the value.

Parameters
p_elementA pointer to an element.
Returns
The value. Or NULL when p_element is NULL.