ConfigVarManager.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 manager.
  21. */
  22. class ConfigVarManager : public Ogre::Singleton<ConfigVarManager>{
  23. public:
  24. /**
  25. * Constructor.
  26. */
  27. ConfigVarManager();
  28. /**
  29. * Finds a variable by name.
  30. *
  31. * @param name[in] Name of the variable to retrieve.
  32. * @return The variable by the specified name, nullptr if there is no
  33. * one by that name.
  34. */
  35. ConfigVar* Find(const Ogre::String& name) const;
  36. /**
  37. * Counts the configuration variables.
  38. *
  39. * @return The number of defined configuration variables.
  40. */
  41. unsigned int GetConfigVarNumber() const;
  42. /**
  43. * Retrieves a configuration variable by index.
  44. *
  45. * @param i[in] Index of the configuration variable.
  46. * @return Variable at the specified index.
  47. */
  48. ConfigVar* GetConfigVar(const unsigned int i) const;
  49. private:
  50. /**
  51. * List of configuration variables.
  52. */
  53. std::vector<ConfigVar*> config_vars_;
  54. };