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/Wasabi/api/config/items/attrint.h | |
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/Wasabi/api/config/items/attrint.h')
-rw-r--r-- | Src/Wasabi/api/config/items/attrint.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/Src/Wasabi/api/config/items/attrint.h b/Src/Wasabi/api/config/items/attrint.h new file mode 100644 index 00000000..c63af8ce --- /dev/null +++ b/Src/Wasabi/api/config/items/attrint.h @@ -0,0 +1,65 @@ +#ifndef _ATTRINT_H +#define _ATTRINT_H + +#include "attribute.h" + +// inherit from this one, or just use it +/** + Boolean configuration attributes have two values, true or false. + They can be used like any other config item. + + @short Integer configuration attribute. + @ver 1.0 + @author Nullsoft + @see CfgItemI + @see _bool + @see _string + @see _float +*/ +class _int : public Attribute { +public: + /** + Optionally set the name and default value of + your configuration attribute during construction. + + @param name Name of the configuration attribute. + @param default_val Default value. + */ + _int(const wchar_t *name=NULL, int default_val=0) : Attribute(name) { + setValueAsInt(default_val, true); + } + + // from AttributeI + /** + Get the attribute type. This will return + a constant representing the attribute type. + + These constants can be: BOOL, FLOAT, STRING and INT. + + @see AttributeType + @ret The attribute type. + */ + virtual int getAttributeType() { return AttributeType::INT; } + + /** + Get the configuration group to be used to represent + this attribute in the registry. + + @ret Config group to be used. + */ + virtual const wchar_t *getConfigGroup() { return L"studio.configgroup.int"; } +// virtual int getPermissions(); + + // convenience operators + /** + Get the value of the attribute. + */ + operator int() { return getValueAsInt(); } + + /** + Set the value of the attribute. + */ + int operator =(int newval) { return setValueAsInt(newval) ? newval : getValueAsInt(); } +}; + +#endif |