Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

77 lines
2.3KB

  1. /*------------ -------------- -------- --- ----- --- -- - -
  2. * Libre Blackjack - configuration handling
  3. *
  4. * Copyright (C) 2020 jeremy theler
  5. *
  6. * This file is part of Libre Blackjack.
  7. *
  8. * Libre Blackjack 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 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * Libre Blackjack 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 Libre Blackjack. If not, see <http://www.gnu.org/licenses/>.
  20. *------------------- ------------ ---- -------- -- - - -
  21. */
  22. #ifndef CONF_H
  23. #define CONF_H
  24. #include <string>
  25. #include <list>
  26. #include <map>
  27. class Configuration {
  28. public:
  29. Configuration(int, char **);
  30. ~Configuration();
  31. int readConfigFile(std::string, bool = false);
  32. bool exists(std::string key) { return (data.count(key) != 0); }
  33. bool set(bool *, std::list<std::string>);
  34. bool set(int *, std::list<std::string>);
  35. bool set(unsigned int *, std::list<std::string>);
  36. bool set(long unsigned int *, std::list<std::string>);
  37. bool set(double *, std::list<std::string>);
  38. bool set(std::string &, std::list<std::string>);
  39. void show(void);
  40. bool getBool(std::string);
  41. int getInt(std::string);
  42. std::string getString(std::string);
  43. std::string getDealerName(void) { return dealer; };
  44. std::string getPlayerName(void) { return player; };
  45. unsigned int max_incorrect_commands = 10;
  46. std::string report_file_path;
  47. // TODO:
  48. unsigned int hands_per_char = false;
  49. bool show_help = false;
  50. bool show_version = false;
  51. private:
  52. std::map<std::string, std::string> data;
  53. std::string configFilePath = "./blackjack.conf";
  54. bool explicitConfigFile = false;
  55. std::string dealer;
  56. std::string player;
  57. // bool show_bar = false;
  58. // bool bar_already_alloced = false;
  59. };
  60. #endif