| 1 |
/* |
| 2 |
* This file is part of the apvlv package |
| 3 |
* |
| 4 |
* Copyright (C) 2008 Alf. |
| 5 |
* |
| 6 |
* Contact: Alf <[email protected]> |
| 7 |
* |
| 8 |
* This program is free software; you can redistribute it and/or |
| 9 |
* modify it under the terms of the GNU General Public License |
| 10 |
* as published by the Free Software Foundation; either version 2.0 of |
| 11 |
* the License, or (at your option) any later version. |
| 12 |
* |
| 13 |
* This program is distributed in the hope that it will be useful, but |
| 14 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
* General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU General Public |
| 19 |
* License along with this program; if not, write to the Free Software |
| 20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 |
* |
| 22 |
*/ |
| 23 |
/* @CPPFILE ApvlvParams.h |
| 24 |
* |
| 25 |
* Author: Alf <[email protected]> |
| 26 |
*/ |
| 27 |
|
| 28 |
#ifndef _APVLV_PARAMS_H_ |
| 29 |
#define _APVLV_PARAMS_H_ |
| 30 |
|
| 31 |
#include <map> |
| 32 |
#include <string> |
| 33 |
#include <string_view> |
| 34 |
|
| 35 |
namespace apvlv |
| 36 |
{ |
| 37 |
|
| 38 |
class ApvlvParams final |
| 39 |
{ |
| 40 |
public: |
| 41 |
ApvlvParams (const ApvlvParams &) = delete; |
| 42 |
const ApvlvParams &operator= (const ApvlvParams &) = delete; |
| 43 |
ApvlvParams (const ApvlvParams &&) = delete; |
| 44 |
const ApvlvParams &&operator= (const ApvlvParams &&) = delete; |
| 45 |
|
| 46 |
bool loadFile (const std::string &filename); |
| 47 |
|
| 48 |
bool push (std::string_view ch, std::string_view str); |
| 49 |
|
| 50 |
std::string getGroupStringOrDefault (std::string_view entry, |
| 51 |
std::string_view key, |
| 52 |
const std::string &defs = ""); |
| 53 |
|
| 54 |
std::string getStringOrDefault (std::string_view key, |
| 55 |
const std::string &defs = ""); |
| 56 |
|
| 57 |
int getIntOrDefault (std::string_view key, int defi = 0); |
| 58 |
|
| 59 |
bool getBoolOrDefault (std::string_view key, bool defb = false); |
| 60 |
|
| 61 |
static ApvlvParams * |
| 62 |
instance () |
| 63 |
{ |
| 64 |
static ApvlvParams inst; |
| 65 |
return &inst; |
| 66 |
} |
| 67 |
|
| 68 |
private: |
| 69 |
ApvlvParams (); |
| 70 |
~ApvlvParams (); |
| 71 |
|
| 72 |
std::map<std::string, std::string> mParamMap; |
| 73 |
}; |
| 74 |
|
| 75 |
} |
| 76 |
|
| 77 |
#endif |
| 78 |
|
| 79 |
/* Local Variables: */ |
| 80 |
/* mode: c++ */ |
| 81 |
/* End: */ |