float_setting.h 876 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2012-2014 Daniele Bartolini and individual contributors.
  3. * License: https://github.com/taylor001/crown/blob/master/LICENSE
  4. */
  5. #pragma once
  6. #include "types.h"
  7. namespace crown
  8. {
  9. /// Facility to store global float settings.
  10. class FloatSetting
  11. {
  12. public:
  13. FloatSetting(const char* name, const char* synopsis, float value, float min, float max);
  14. const char* name() const;
  15. const char* synopsis() const;
  16. float value() const;
  17. float min() const;
  18. float max() const;
  19. operator float();
  20. FloatSetting& operator=(const float value);
  21. public:
  22. /// Returns the setting @name or NULL if not found.
  23. static FloatSetting* find_setting(const char* name);
  24. private:
  25. const char* m_name;
  26. const char* m_synopsis;
  27. float m_value;
  28. float m_min;
  29. float m_max;
  30. FloatSetting* m_next;
  31. };
  32. } // namespace crown