ConfigVarHandler.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #pragma once
  16. #include <OgreSingleton.h>
  17. #include <vector>
  18. #include "ConfigVar.h"
  19. /**
  20. * Configuration variable hanlder.
  21. */
  22. class ConfigVarHandler : public Ogre::Singleton<ConfigVarHandler>{
  23. public:
  24. /**
  25. * Constructor.
  26. */
  27. ConfigVarHandler();
  28. /**
  29. * Finds a variable by name.
  30. *
  31. * @param[in] name Name of the variable to retrieve.
  32. * @return The variable by the specified name, nullptr if there is no one by that name.
  33. */
  34. ConfigVar* Find(const Ogre::String& name) const;
  35. /**
  36. * Counts the configuration variables.
  37. *
  38. * @return The number of defined configuration variables.
  39. */
  40. unsigned int GetConfigVarNumber() const;
  41. /**
  42. * Retrieves a configuration variable by index.
  43. *
  44. * @param[in] i Index of the configuration variable.
  45. * @return Variable at the specified index.
  46. */
  47. ConfigVar* GetConfigVar(const unsigned int i) const;
  48. private:
  49. /**
  50. * List of configuration variables.
  51. */
  52. std::vector<ConfigVar*> config_vars_;
  53. };