aboutsummaryrefslogtreecommitdiff
path: root/Src/Winamp/attributes.h
blob: 419f8aabe9682d8dba3a81b730dbe8a63ce808ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef NULLSOFT_WINAMP_ATTRIBUTES_H
#define NULLSOFT_WINAMP_ATTRIBUTES_H

#include "../Agave/Config/ifc_configitem.h"

class _bool_base : public ifc_configitem
{
public:
	_bool_base();
	bool GetBool();
	void SetBool(bool boolValue);
	intptr_t GetInt();
	void SetInt(intptr_t intValue);
	operator intptr_t();
	intptr_t operator =(intptr_t intValue);
	bool operator =(bool boolValue);
	operator bool();
	operator UINT(); // for CheckDlgButton
	bool operator !();
protected:
	bool value;
};

class _bool : public _bool_base
{
public:
	_bool(bool defaultValue);
protected:
		RECVS_DISPATCH;
};

/* _mutable_bool allows the config item to be changed via users of api_config */
class _mutable_bool : public _bool_base
{
public:
	_mutable_bool(bool defaultValue);
protected:
	RECVS_DISPATCH;
};

class _unsigned : public ifc_configitem
{
public:
	_unsigned();
	_unsigned(uintptr_t defaultValue);
	
	uintptr_t GetUnsigned() { return value; }
	uintptr_t operator =(uintptr_t uintValue); 
	operator uintptr_t() { return value; }

protected:
	RECVS_DISPATCH;
private:
	uintptr_t value;
};

class _int : public ifc_configitem
{
public:
	_int();
	_int(intptr_t defaultValue);
	
	intptr_t GetInt() { return value; }
	float GetFloat() { return (float)value; }
	intptr_t operator =(intptr_t uintValue); 
	operator intptr_t() { return value; }

protected:
	RECVS_DISPATCH;
private:
	intptr_t value;
};

class _float : public ifc_configitem
{
public:
	_float();
	_float(float defaultValue);
	
	intptr_t GetInt() { return (intptr_t)value; }
	intptr_t operator =(intptr_t uintValue); 
	operator intptr_t() { return static_cast<intptr_t>(value); }

	float GetFloat() { return value; }
	float operator =(float uintValue); 
	operator float () { return value; }

protected:
	RECVS_DISPATCH;
private:
	float value;
};

#endif