Debian Codegraph @

src/engine/tinyconfig.h

raw symbols SCIP
1 /***************************************************************************
2 * fheroes2: https://github.com/ihhub/fheroes2 *
3 * Copyright (C) 2019 - 2026 *
4 * *
5 * Free Heroes2 Engine: http://sourceforge.net/projects/fheroes2 *
6 * Copyright (C) 2010 by Andrey Afletdinov <[email protected]> *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22 ***************************************************************************/
23
24 #pragma once
25
26 #include <functional>
27 #include <map>
28 #include <string>
29
30 #include "math_base.h"
31 #include "screen.h"
32
33 class TinyConfig : private std::map<std::string, std::string, std::less<>>
34 {
35 public:
36 TinyConfig( const char sep, const char com );
37
38 bool Load( const std::string & cfile );
39
40 bool Exists( const std::string & key ) const;
41
42 int IntParams( const std::string & key ) const;
43 std::string StrParams( const std::string & key ) const;
44 // Tries to find and return a Point-type struct stored as a string "[ x, y ]" for a given key.
45 // In case of any error, the fallback value is returned.
46 fheroes2::Point PointParams( const std::string & key, const fheroes2::Point & fallbackValue ) const;
47 // Tries to find and return a ResolutionInfo-type struct (multiple formats are supported, see the implementation for details)
48 // for a given key. In case of any error, the fallback value is returned.
49 fheroes2::ResolutionInfo ResolutionParams( const std::string & key, const fheroes2::ResolutionInfo & fallbackValue ) const;
50
51 private:
52 const char separator;
53 const char comment;
54 };