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

A JSON parser. More...

#include <stdbool.h>
#include <stddef.h>
#include <tetengo/json/element.h>
#include <tetengo/json/reader.h>
+ Include dependency graph for jsonParser.h:

Go to the source code of this file.

Functions

size_t tetengo_json_jsonParser_defaultBufferCapacity (void)
 Returns the default buffer capacity.
 
tetengo_json_jsonParser_t * tetengo_json_jsonParser_create (tetengo_json_reader_t *p_reader, size_t buffer_capacity)
 Creates a JSON parser.
 
void tetengo_json_jsonParser_destroy (const tetengo_json_jsonParser_t *p_parser)
 Destroys a JSON parser.
 
bool tetengo_json_jsonParser_hasNext (const tetengo_json_jsonParser_t *p_parser)
 Returns true when the next element exists.
 
const tetengo_json_element_t * tetengo_json_jsonParser_peek (const tetengo_json_jsonParser_t *p_parser)
 Returns the current element.
 
void tetengo_json_jsonParser_next (tetengo_json_jsonParser_t *p_parser)
 Moves to the next element.
 

Detailed Description

A JSON parser.

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

Function Documentation

◆ tetengo_json_jsonParser_create()

tetengo_json_jsonParser_t * tetengo_json_jsonParser_create ( tetengo_json_reader_t *  p_reader,
size_t  buffer_capacity 
)

Creates a JSON parser.

There is no need to destroy the reader after calling this function.

Based on RFC 8259.

Parameters
p_readerA pointer to a reader.
buffer_capacityA buffer capacity.
Returns
A pointer to a JSON parser. Or NULL when p_reader is NULL.

◆ tetengo_json_jsonParser_defaultBufferCapacity()

size_t tetengo_json_jsonParser_defaultBufferCapacity ( void  )

Returns the default buffer capacity.

Returns
The default buffer capacity.

◆ tetengo_json_jsonParser_destroy()

void tetengo_json_jsonParser_destroy ( const tetengo_json_jsonParser_t *  p_parser)

Destroys a JSON parser.

Parameters
p_parserA pointer to a perser.

◆ tetengo_json_jsonParser_hasNext()

bool tetengo_json_jsonParser_hasNext ( const tetengo_json_jsonParser_t *  p_parser)

Returns true when the next element exists.

Parameters
p_parserA pointer to a perser.
Return values
trueWhen the next element exists.
falseOtherwise.

◆ tetengo_json_jsonParser_next()

void tetengo_json_jsonParser_next ( tetengo_json_jsonParser_t *  p_parser)

Moves to the next element.

Parameters
p_parserA pointer to a perser.

◆ tetengo_json_jsonParser_peek()

const tetengo_json_element_t * tetengo_json_jsonParser_peek ( const tetengo_json_jsonParser_t *  p_parser)

Returns the current element.

Parameters
p_parserA pointer to a perser.
Returns
The pointer to the current element. Or NULL when p_parser is NULL and/or the current position is beyond the termination point.