Mercurial > minori
annotate include/core/ini.h @ 305:91ac90a34003
core/time: remove Duration class, use regular functions instead
this class was pretty useless anyway
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Sun, 19 May 2024 15:56:20 -0400 |
parents | b1f625b0227c |
children |
rev | line source |
---|---|
301
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
1 #ifndef MINORI_CORE_INI_H_ |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
2 #define MINORI_CORE_INI_H_ |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
3 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
4 #define MINI_CASE_SENSITIVE |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
5 #include "core/strings.h" |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
6 #include "mini/ini.h" |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
7 #include <string> |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
8 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
9 namespace INI { |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
10 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
11 std::string GetIniString(const mINI::INIStructure& ini, const std::string& section, const std::string& key, const std::string& def); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
12 bool GetIniBool(const mINI::INIStructure& ini, const std::string& section, const std::string& key, bool def); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
13 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
14 template<typename T> |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
15 T GetIniInteger(const mINI::INIStructure& ini, const std::string& section, const std::string& key, T def) { |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
16 return Strings::ToInt<T>(GetIniString(ini, section, key, ""), def); |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
17 } |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
18 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
19 } // namespace INI |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
20 |
b1f625b0227c
*: convert all files CRLF -> LF
Paper <paper@paper.us.eu.org>
parents:
276
diff
changeset
|
21 #endif |