1
0

attributes.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #ifndef NULLSOFT_WINAMP_ATTRIBUTES_H
  2. #define NULLSOFT_WINAMP_ATTRIBUTES_H
  3. #include "../Agave/Config/ifc_configitem.h"
  4. class _bool_base : public ifc_configitem
  5. {
  6. public:
  7. _bool_base();
  8. bool GetBool();
  9. void SetBool(bool boolValue);
  10. intptr_t GetInt();
  11. void SetInt(intptr_t intValue);
  12. operator intptr_t();
  13. intptr_t operator =(intptr_t intValue);
  14. bool operator =(bool boolValue);
  15. operator bool();
  16. operator UINT(); // for CheckDlgButton
  17. bool operator !();
  18. protected:
  19. bool value;
  20. };
  21. class _bool : public _bool_base
  22. {
  23. public:
  24. _bool(bool defaultValue);
  25. protected:
  26. RECVS_DISPATCH;
  27. };
  28. /* _mutable_bool allows the config item to be changed via users of api_config */
  29. class _mutable_bool : public _bool_base
  30. {
  31. public:
  32. _mutable_bool(bool defaultValue);
  33. protected:
  34. RECVS_DISPATCH;
  35. };
  36. class _unsigned : public ifc_configitem
  37. {
  38. public:
  39. _unsigned();
  40. _unsigned(uintptr_t defaultValue);
  41. uintptr_t GetUnsigned() { return value; }
  42. uintptr_t operator =(uintptr_t uintValue);
  43. operator uintptr_t() { return value; }
  44. protected:
  45. RECVS_DISPATCH;
  46. private:
  47. uintptr_t value;
  48. };
  49. class _int : public ifc_configitem
  50. {
  51. public:
  52. _int();
  53. _int(intptr_t defaultValue);
  54. intptr_t GetInt() { return value; }
  55. float GetFloat() { return (float)value; }
  56. intptr_t operator =(intptr_t uintValue);
  57. operator intptr_t() { return value; }
  58. protected:
  59. RECVS_DISPATCH;
  60. private:
  61. intptr_t value;
  62. };
  63. class _float : public ifc_configitem
  64. {
  65. public:
  66. _float();
  67. _float(float defaultValue);
  68. intptr_t GetInt() { return (intptr_t)value; }
  69. intptr_t operator =(intptr_t uintValue);
  70. operator intptr_t() { return static_cast<intptr_t>(value); }
  71. float GetFloat() { return value; }
  72. float operator =(float uintValue);
  73. operator float () { return value; }
  74. protected:
  75. RECVS_DISPATCH;
  76. private:
  77. float value;
  78. };
  79. #endif