63 lines
1.4 KiB
C
63 lines
1.4 KiB
C
|
|
||
|
#ifndef RR_INI_PARSER_H
|
||
|
#define RR_INI_PARSER_H
|
||
|
|
||
|
#include <librr/types.h>
|
||
|
|
||
|
typedef struct rr_ini_section rr_ini_section_s;
|
||
|
typedef struct rr_ini_field rr_ini_field_s;
|
||
|
|
||
|
typedef enum
|
||
|
{
|
||
|
RR_INI_VALUE_INVALID,
|
||
|
RR_INI_VALUE_REAL,
|
||
|
RR_INI_VALUE_NUMBER,
|
||
|
RR_INI_VALUE_STRING,
|
||
|
RR_INI_VALUE_IPV4,
|
||
|
RR_INI_VALUE_IPV6,
|
||
|
RR_INI_VALUE_ARBITRARY
|
||
|
|
||
|
} rr_ini_value_e;
|
||
|
|
||
|
struct rr_ini_section
|
||
|
{
|
||
|
/// @brief The last part of the name of this section. If this is a subsection, this only is the name
|
||
|
/// of the subsection, not including the name of the section this section is contained in.
|
||
|
char *last_name;
|
||
|
|
||
|
usz_t num_fields;
|
||
|
rr_ini_field_s *fields;
|
||
|
};
|
||
|
|
||
|
struct rr_ini_value
|
||
|
{
|
||
|
rr_ini_value_e type;
|
||
|
union rr_ini_value_specifics
|
||
|
{
|
||
|
double real;
|
||
|
long number;
|
||
|
char *string;
|
||
|
struct rr_ini_ipv4_value
|
||
|
{
|
||
|
u8_t values[4];
|
||
|
} ipv4;
|
||
|
struct rr_ini_ipv4_value
|
||
|
{
|
||
|
u8_t values[16];
|
||
|
} ipv6;
|
||
|
struct rr_ini_arbitrary_value
|
||
|
{
|
||
|
char *
|
||
|
} arbitrary;
|
||
|
} specifics;
|
||
|
};
|
||
|
|
||
|
struct rr_ini_field
|
||
|
{
|
||
|
char *name;
|
||
|
};
|
||
|
|
||
|
|
||
|
|
||
|
#endif // RR_INI_PARSER
|