1
1
#ifndef _CONFIGURATION_H
2
2
#define _CONFIGURATION_H
3
3
4
- #include < string.h >
5
- #include < stdint.h >
4
+ #include < cstring >
5
+ #include < cstdint >
6
6
#include < boost/algorithm/string/replace.hpp>
7
7
8
8
#if defined(__linux__)
14
14
#endif
15
15
16
16
17
- #include " Exception.h "
18
- #include " XMLReader.h "
19
- #include " board/logger.h "
17
+ #include " Exception.hpp "
18
+ #include " XMLReader.hpp "
19
+ #include " board/logger.hpp "
20
20
21
21
namespace chesspp
22
22
{
@@ -26,7 +26,7 @@ namespace chesspp
26
26
{
27
27
protected:
28
28
std::string res_path;
29
-
29
+
30
30
// Linux and Windows, resource path is defined as the absolute path the folder where the application executable is stored.
31
31
// <exe_location>/res/img/... should be where resources are stored.
32
32
// OS x, resource path is defined as the absolute path to the Resources folder of the .app structure.
@@ -49,7 +49,7 @@ namespace chesspp
49
49
ret = buf;
50
50
boost::replace_all (ret, " \\ " , " /" );
51
51
ret = ret.substr (0 , ret.find_last_of (' /' )+1 );
52
-
52
+
53
53
#elif defined(__APPLE__)
54
54
if (_NSGetExecutablePath (buf, &size) != 0 )
55
55
throw chesspp::exception (" Unable to determine executable path on OS x. (Buffer size too small?)" );
@@ -60,7 +60,7 @@ namespace chesspp
60
60
61
61
#else
62
62
throw chesspp::exception (" Unknown OS. Unable to determine executable path." );
63
- #endif
63
+ #endif
64
64
65
65
return ret;
66
66
}
@@ -69,7 +69,7 @@ namespace chesspp
69
69
public:
70
70
configuration (const std::string &configFile) : res_path(getResourcePath()), reader(getResourcePath() + configFile) {}
71
71
virtual ~configuration () {}
72
-
72
+
73
73
};
74
74
75
75
class BoardConfig : public configuration
@@ -79,15 +79,15 @@ namespace chesspp
79
79
uint16_t cell_width, cell_height;
80
80
81
81
public:
82
- BoardConfig () : configuration(" config.xml" )
82
+ BoardConfig () : configuration(" config.xml" )
83
83
{
84
84
initial_layout = res_path + reader.getProperty <std::string>(" chesspp.data.board.initial_layout" );
85
85
board_width = reader.getProperty <uint8_t >(" chesspp.data.board.width" );
86
86
board_height = reader.getProperty <uint8_t >(" chesspp.data.board.height" );
87
87
cell_width = reader.getProperty <uint16_t >(" chesspp.data.board.cell_width" );
88
88
cell_height = reader.getProperty <uint16_t >(" chesspp.data.board.cell_height" );
89
89
}
90
-
90
+
91
91
std::string getInitialLayout () { return initial_layout; }
92
92
uint8_t getBoardWidth () { return board_width; }
93
93
uint8_t getBoardHeight () { return board_height; }
@@ -111,7 +111,7 @@ namespace chesspp
111
111
std::string getSpritePath_pieces () { return path_pieces; }
112
112
std::string getSpritePath_validMove () { return path_validMove; }
113
113
};
114
- }
114
+ }
115
115
}
116
116
117
- #endif
117
+ #endif
0 commit comments