canfigger v0.3.x
Lightweight config file parser library
Loading...
Searching...
No Matches
Data Structures | Functions
canfigger.h File Reference

Header file for the Canfigger configuration parser. More...

Go to the source code of this file.

Data Structures

struct  attributes
 Structure to hold attribute details of a configuration key. More...
 
struct  Canfigger
 Structure to represent a key-value pair with attributes in the configuration. More...
 

Functions

struct Canfiggercanfigger_parse_file (const char *file, const int delimiter)
 Parses a configuration file and creates a linked list of key-value pairs.
 
void canfigger_free_current_key_node_advance (struct Canfigger **list)
 Frees the current key node and advances to the next node in the list.
 
void canfigger_free_current_attr_str_advance (struct attributes *attributes, char **attr)
 Frees the current attribute string and advances to the next attribute.
 

Detailed Description

Header file for the Canfigger configuration parser.

Canfigger is a lightweight C language library designed to parse configuration files. It provides functionality to read them and represent their contents as a linked list of key-value pairs, along with associated attributes for each pair.

Part of canfigger (https://github.com/andy5995/canfigger).

Copyright (C) 2021-2024 Andy Alt (arch_.nosp@m.stan.nosp@m.ton59.nosp@m.95@p.nosp@m.roton.nosp@m..me)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file canfigger.h.


Data Structure Documentation

◆ attributes

struct attributes

Structure to hold attribute details of a configuration key.

Definition at line 43 of file canfigger.h.

Data Fields
char * current
char * iter_ptr
char * str

◆ Canfigger

struct Canfigger

Structure to represent a key-value pair with attributes in the configuration.

Examples
example.c.

Definition at line 59 of file canfigger.h.

Data Fields
struct attributes * attributes
char * key
struct Canfigger * next
char * value

Function Documentation

◆ canfigger_free_current_attr_str_advance()

void canfigger_free_current_attr_str_advance ( struct attributes * attributes,
char ** attr )

Frees the current attribute string and advances to the next attribute.

Parameters
attributesPointer to the attributes structure of the current node.
attrCurrent attribute that will get reassigned after the function call.
Examples
example.c.

Definition at line 75 of file canfigger.c.

◆ canfigger_free_current_key_node_advance()

void canfigger_free_current_key_node_advance ( struct Canfigger ** list)

Frees the current key node and advances to the next node in the list.

Parameters
listDouble pointer to the current node in the linked list.
Examples
example.c.

Definition at line 114 of file canfigger.c.

◆ canfigger_parse_file()

struct Canfigger * canfigger_parse_file ( const char * file,
const int delimiter )

Parses a configuration file and creates a linked list of key-value pairs.

Parameters
filePath to the configuration file to parse.
delimiterThe character used to delimit the attributes following 'value'.
Returns
Pointer to the head of the linked list of configuration entries.
Examples
example.c.

Definition at line 330 of file canfigger.c.