diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Winamp/BoolAttribute.cpp | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Winamp/BoolAttribute.cpp')
-rw-r--r-- | Src/Winamp/BoolAttribute.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/Src/Winamp/BoolAttribute.cpp b/Src/Winamp/BoolAttribute.cpp new file mode 100644 index 00000000..7fbcc5df --- /dev/null +++ b/Src/Winamp/BoolAttribute.cpp @@ -0,0 +1,87 @@ +#include "main.h" +#include "attributes.h" + +_bool_base::_bool_base() : value(false) {} + +bool _bool_base::GetBool() +{ + return value; +} + +void _bool_base::SetBool(bool boolValue) +{ + value = boolValue; +} + +intptr_t _bool_base::GetInt() +{ + return value ? 1 : 0; +} + +void _bool_base::SetInt(intptr_t intValue) +{ + value = !!intValue; +} + +_bool_base::operator intptr_t() +{ + return GetInt(); +} + +intptr_t _bool_base::operator =(intptr_t intValue) +{ + value = !!intValue; + return GetInt(); +} + +bool _bool_base::operator =(bool boolValue) +{ + value = boolValue; + return GetBool(); +} + + +_bool_base::operator bool() +{ + return value; +} + +_bool_base::operator UINT() +{ + return value?1:0; +} + +bool _bool_base::operator !() +{ + return !value; +} + +/* --------------------- */ + +_bool::_bool(bool defaultValue) +{ + value = defaultValue; +} + +#define CBCLASS _bool +START_DISPATCH; +CB(IFC_CONFIGITEM_GETBOOL, GetBool) +CB(IFC_CONFIGITEM_GETINT, GetInt) +END_DISPATCH; +#undef CBCLASS + +/* --------------------- */ + +_mutable_bool::_mutable_bool(bool defaultValue) +{ + value = defaultValue; +} + +#define CBCLASS _mutable_bool +START_DISPATCH; +CB(IFC_CONFIGITEM_GETBOOL, GetBool) +CB(IFC_CONFIGITEM_GETINT, GetInt) +VCB(IFC_CONFIGITEM_SETINT, SetInt) +VCB(IFC_CONFIGITEM_SETBOOL, SetBool) +END_DISPATCH; +#undef CBCLASS
\ No newline at end of file |