A reader.
More...
#include <stdbool.h>
#include <stddef.h>
Go to the source code of this file.
A reader.
Copyright (C) 2019-2023 kaoru https://www.tetengo.org/
◆ tetengo_json_reader_baseReader()
const tetengo_json_reader_t * tetengo_json_reader_baseReader |
( |
const tetengo_json_reader_t * |
p_reader | ) |
|
Returns the base reader.
- Parameters
-
p_reader | A pointer to a reader. |
- Returns
- A pointer to the base reader. Or NULL when p_reader is NULL or the reader does not have a base reader.
◆ tetengo_json_reader_createCommentRemovingReader()
tetengo_json_reader_t * tetengo_json_reader_createCommentRemovingReader |
( |
tetengo_json_reader_t * |
p_base_reader, |
|
|
const char * |
single_line_begin |
|
) |
| |
Creates a comment removing reader.
There is no need to destroy the base reader after calling this function.
- Parameters
-
p_base_reader | A pointer to a base reader. |
single_line_begin | A beginning of a single line comment. |
- Returns
- A pointer to a reader. Or NULL when p_base_reader and/or single_line_begin are NULL.
◆ tetengo_json_reader_createLineCountingReader()
tetengo_json_reader_t * tetengo_json_reader_createLineCountingReader |
( |
tetengo_json_reader_t * |
p_base_reader | ) |
|
Creates a line counting reader.
There is no need to destroy the base reader after calling this function.
- Parameters
-
p_base_reader | A pointer to a base reader. |
- Returns
- A pointer to a reader. Or NULL when p_base_reader is NULL.
◆ tetengo_json_reader_createStreamReader()
tetengo_json_reader_t * tetengo_json_reader_createStreamReader |
( |
const char * |
file_path, |
|
|
size_t |
buffer_capacity |
|
) |
| |
Creates a stream reader.
- Parameters
-
file_path | A file path. |
buffer_capacity | A buffer capacity. |
- Returns
- A pointer to a reader. Or NULL when the file cannot be opened or buffer_capacity is 0.
◆ tetengo_json_reader_destroy()
void tetengo_json_reader_destroy |
( |
const tetengo_json_reader_t * |
p_reader | ) |
|
Destroys a reader.
- Parameters
-
p_reader | A pointer to a reader. |
◆ tetengo_json_reader_getLocation()
bool tetengo_json_reader_getLocation |
( |
const tetengo_json_reader_t * |
p_line_counting_reader, |
|
|
tetengo_json_location_t * |
p_location |
|
) |
| |
Returns the location.
- Parameters
-
p_line_counting_reader | A pointer to a line counting reader. |
p_location | The storage for a location. |
- Return values
-
true | When a location has been stored. |
false | When p_line_counting_reader is NULL or not a line counting reader. And/or when p_location is NULL. And/or when current position is beyond the termination point. |
◆ tetengo_json_reader_hasNext()
bool tetengo_json_reader_hasNext |
( |
const tetengo_json_reader_t * |
p_reader | ) |
|
Returns true when the next character exists.
- Parameters
-
p_reader | A pointer to a reader. |
- Return values
-
true | When the next character exists. |
false | Otherwise. |
◆ tetengo_json_reader_next()
void tetengo_json_reader_next |
( |
tetengo_json_reader_t * |
p_reader | ) |
|
Moves to the next character.
- Parameters
-
p_reader | A pointer to a reader. |
◆ tetengo_json_reader_peek()
char tetengo_json_reader_peek |
( |
const tetengo_json_reader_t * |
p_reader | ) |
|
Returns the current character.
- Parameters
-
p_reader | A pointer to a reader. |
- Returns
- The current character. Or 0 when current position is beyond the termination point.
◆ tetengo_json_reader_streamReaderDefaultBufferCapacity()
size_t tetengo_json_reader_streamReaderDefaultBufferCapacity |
( |
| ) |
|
Returns the default buffer capacity of the stream reader.
- Returns
- The default buffer capacity.