summaryrefslogtreecommitdiff
path: root/src/lib/config.h
blob: 8a52bd76df1e70c59654fd68f753cfc6a3564e4d (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 using namespace std;
   20 #include <stdlib.h>
   21 #include <iostream>
   22 #include <vector>
   23 #include <string>
   24 #include <fstream>
   25 #ifndef LIB_CONFIG_H
   26 #define LIB_CONFIG_H
   27 
   28 /**
   29  * Represents a config file in memory. Provides a friendly interface for
   30  * checking configuration variables without having to parse multiple times.
   31  */
   32 class config {
   33 public:
   34   // Class global variables
   35   vector<string> values;
   36   const char* path;
   37 
   38   // Constructors
   39   config( const char* );
   40 
   41   // Public helper methods
   42   string get( string );
   43   bool isset( string );
   44 
   45 private:
   46   // Private helper methods
   47   int parse_line( string );
   48 };
   49 
   50 #endif

Generated by cgit