Pharos
0.7.23
Modern Web Framework & Web App Hosting Service.
Toggle main menu visibility
Loading...
Searching...
No Matches
native_json_config.h
Go to the documentation of this file.
1
/**
2
* @file
3
* @brief Declares lightweight JSON and conf value lookup helpers.
4
*/
5
6
#ifndef PHAROS_NATIVE_JSON_CONFIG_H
7
#define PHAROS_NATIVE_JSON_CONFIG_H
8
9
/** @name JSON and conf lookup helpers
10
* @{
11
*/
12
/**
13
* @brief Finds a JSON string value for a key after a given scan position.
14
* @param text JSON text to search.
15
* @param key Key name to locate.
16
* @param start_at Pointer within text where scanning should begin.
17
* @return Newly allocated string value, or NULL when the key is not found.
18
*/
19
char
*
json_find_string_after
(
const
char
*text,
const
char
*key,
const
char
*start_at);
20
/**
21
* @brief Finds the first JSON string value associated with a key.
22
* @param text JSON text to search.
23
* @param key Key name to locate.
24
* @return Newly allocated string value, or NULL when the key is not found.
25
*/
26
char
*
json_find_string
(
const
char
*text,
const
char
*key);
27
/**
28
* @brief Finds a JSON string value for a key inside a named section object.
29
* @param text JSON text to search.
30
* @param section Section name that should contain the key.
31
* @param key Key name to locate inside the section.
32
* @return Newly allocated string value, or NULL when the key is not found.
33
*/
34
char
*
json_find_string_in_section
(
const
char
*text,
const
char
*section,
const
char
*key);
35
/**
36
* @brief Extracts the raw JSON array text for a key inside a named section.
37
* @param text JSON text to search.
38
* @param section Section name that should contain the array.
39
* @param key Array-valued key to locate.
40
* @return Newly allocated raw array text, or NULL when the array is not found.
41
*/
42
char
*
json_extract_array_in_section
(
const
char
*text,
const
char
*section,
const
char
*key);
43
/**
44
* @brief Looks up one key from Pharos conf-format text.
45
* @param text Config text to search.
46
* @param key Config key to locate.
47
* @return Newly allocated config value, or NULL when the key is not found.
48
*/
49
char
*
conf_lookup_value_in_text
(
const
char
*text,
const
char
*key);
50
/**
51
* @brief Reads a Pharos conf file and looks up one key.
52
* @param path Path to the config file.
53
* @param key Config key to locate.
54
* @return Newly allocated config value, or NULL when the key is not found or the file cannot be read.
55
*/
56
char
*
conf_lookup_value
(
const
char
*path,
const
char
*key);
57
58
59
/** @} */
60
#endif
json_find_string_after
char * json_find_string_after(const char *text, const char *key, const char *start_at)
Finds a JSON string value for a key after a given scan position.
Definition
native_json_config.c:20
conf_lookup_value_in_text
char * conf_lookup_value_in_text(const char *text, const char *key)
Looks up one key from Pharos conf-format text.
Definition
native_json_config.c:139
conf_lookup_value
char * conf_lookup_value(const char *path, const char *key)
Reads a Pharos conf file and looks up one key.
Definition
native_json_config.c:179
json_extract_array_in_section
char * json_extract_array_in_section(const char *text, const char *section, const char *key)
Extracts the raw JSON array text for a key inside a named section.
Definition
native_json_config.c:81
json_find_string
char * json_find_string(const char *text, const char *key)
Finds the first JSON string value associated with a key.
Definition
native_json_config.c:58
json_find_string_in_section
char * json_find_string_in_section(const char *text, const char *section, const char *key)
Finds a JSON string value for a key inside a named section object.
Definition
native_json_config.c:62
src
native_runtime
c
native_json_config.h
Generated by
1.17.0