Virtual Testbed
Ship dynamics simulator for extreme conditions
ini_settings.hh
1 #ifndef VTESTBED_INI_INI_SETTINGS_HH
2 #define VTESTBED_INI_INI_SETTINGS_HH
3 
4 #include <string>
5 #include <vector>
6 
7 #include <vtestbed/ini/ini.hh>
8 #include <vtestbed/ini/types.hh>
9 
10 namespace vtb {
11 
12  namespace ini {
13 
14  class Ini_settings: public Ini {
15 
16  private:
17  using string_cref = const string_type&;
19 
20  private:
21  string_type _settings_directory;
22  string_array _user_prefix;
23  string_type _system_prefix;
24  string_type _filename;
25 
26  public:
27  Ini_settings() = default;
28 
29  inline explicit
31  const string_array& user_prefix,
32  const string_type& system_prefix,
33  const string_type& filename
34  ):
35  _user_prefix(user_prefix),
36  _system_prefix(system_prefix),
37  _filename(filename) {}
38 
39  inline const string_array& user_prefix() const { return this->_user_prefix; }
40  inline const string_type& system_prefix() const { return this->_system_prefix; }
41  inline const string_type& filename() const { return this->_filename; }
42  inline void filename(const string_type& rhs) { this->_filename = rhs; }
43  inline void user_prefix(string_array&& rhs) { this->_user_prefix = std::move(rhs); }
44  inline void user_prefix(const string_array& rhs) { this->_user_prefix = rhs; }
45  inline void system_prefix(string_type&& rhs) { this->_system_prefix = std::move(rhs); }
46  inline void system_prefix(string_cref rhs) { this->_system_prefix = rhs; }
47 
48  void load();
49  void save();
50 
51  private:
52  void make_directory(string_cref dir);
53  static string_array prefix();
54 
55  };
56 
57  }
58 }
59 
60 #endif // vim:filetype=cpp
Main namespace.
Definition: convert.hh:9