summaryrefslogtreecommitdiff
path: root/src/config.h
blob: 2a3e0d0f16dcf2ba89d0f8e4c74aa2d3b80f5667 (plain)
    1 /**
    2  * A class to help with parsing standard config files
    3  *
    4  * Copyright (C) 2014 Aaron Ball
    5  *
    6  * This program is free software: you can redistribute it and/or modify
    7  * it under the terms of the GNU General Public License as published by
    8  * the Free Software Foundation, either version 3 of the License, or
    9  * (at your option) any later version.
   10  *
   11  * This program is distributed in the hope that it will be useful,
   12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14  * GNU General Public License for more details.
   15  *
   16  * You should have received a copy of the GNU General Public License
   17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
   18  */
   19 #ifndef NOTELESS_CONFIG_H
   20 #define NOTELESS_CONFIG_H
   21 
   22 #include <stdlib.h>
   23 #include <stdio.h>
   24 #include <string.h>
   25 
   26 /**
   27  * Represents a config file in memory. Provides a friendly interface for
   28  * checking configuration variables without having to parse multiple times.
   29  */
   30 typedef struct config {
   31   int count;
   32   char path[256];
   33   char note_path[256];
   34   char extension[16];
   35   char** keys;
   36   char** values;
   37 } config_t;
   38 
   39 int config_new(config_t*, char*);
   40 
   41 void config_free(config_t*);
   42 
   43 int config_isset(config_t*, char*);
   44 
   45 char* config_get(config_t*, char*);
   46 
   47 int config_valid_line_count(char*);
   48 
   49 // int parse_line(char*);
   50 
   51 #endif

Generated by cgit