summaryrefslogtreecommitdiffstats
path: root/src/kvirc/kvs/kvi_kvs_parameterprocessor.h
blob: 15b06e5a216ad7e54f0bad883cd28797167759ad (plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#ifndef _KVI_KVS_PARAMETERPROCESSOR_H_
#define _KVI_KVS_PARAMETERPROCESSOR_H_
//=============================================================================
//
//   File : kvi_kvs_parameterprocessor.h
//   Created on Sun 17 Apr 2005 16:47:09 by Szymon Stefanek
//
//   This file is part of the KVIrc IRC client distribution
//   Copyright (C) 2005 Szymon Stefanek <pragma at kvirc dot net>
//
//   This program is FREE software. You can redistribute it and/or
//   modify it under the terms of the GNU General Public License
//   as published by the Free Software Foundation; either version 2
//   of the License, or (at your opinion) any later version.
//
//   This program is distributed in the HOPE that it will be USEFUL,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//   See the GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program. If not, write to the Free Software Foundation,
//   Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
//=============================================================================

#include "kvi_settings.h"


// Data type: TQString
// Default: TQString()
#define KVS_PT_STRING 0

// Data type: TQString
// Default: TQString()
#define KVS_PT_NONEMPTYSTRING 1

// Data type: kvs_int_t
// Default: 0
#define KVS_PT_INT 2
	#define KVS_PT_INTEGER 2
	
// Data type: kvs_uint_t
// Default: 0
#define KVS_PT_UINT 3
	#define KVS_PT_UNSIGNEDINTEGER 3

// Data type: kvs_real_t
// default: 0.0
#define KVS_PT_DOUBLE 4
	#define KVS_PT_REAL 4
	
// Data type: bool
// default: false
#define KVS_PT_BOOL 5
	#define KVS_PT_BOOLEAN 5
	
// Data type: KviKvsHash *
// default: 0
#define KVS_PT_HASH 6

// Data type: KviKvsArrayCast
// default empty cast
#define KVS_PT_ARRAYCAST 7

// Data type: KviKvsVariant *
// default: 0
#define KVS_PT_VARIANT 8

// Data type: TQCString
// default null string (0)
#define KVS_PT_CSTRING 9

// Data type: TQCString
// default null string (0)
#define KVS_PT_NONEMPTYCSTRING 10

// Data type: TQStringList
// default: list cleared
// This eats all the remaining params in the list!
#define KVS_PT_STRINGLIST 11

// Data type: KviKvsVariantList
// default: list cleared
// This eats all the remaining params in the list!
// The list has autodelete set to off since the copies are SHALLOW!
#define KVS_PT_VARIANTLIST 12

// Data type: kvs_hobjec_t
// default: (kvs_hobject_t)0
#define KVS_PT_HOBJECT 13

// Data type: KviKvsArray *
// default 0
#define KVS_PT_ARRAY 14

// Data type: ignored
#define KVS_PT_IGNORE 15

// If omitted, set to default
#define KVS_PF_OPTIONAL 1
// Valid only for string types: it's the last parameter that eats all the remaining ones
#define KVS_PF_APPENDREMAINING 2

class KviKvsVariantList;
class KviKvsRunTimeContext;

namespace KviKvsParameterProcessor
{
	class KVIRC_API ParameterFormat
	{
	public:
		const char          * szName;
		const unsigned char   uType;
		const unsigned char   uFlags;
		void                * pContainer;
	public:
		ParameterFormat(const char * n,const unsigned char t,const unsigned char f,void * p)
		: szName(n), uType(t), uFlags(f), pContainer(p) {};
	};

	KVIRC_API bool process(KviKvsVariantList * pVariantList,KviKvsRunTimeContext * pContext,KviKvsParameterProcessor::ParameterFormat * pFmtArray);
};


#define KVS_PARAMETERS_BEGIN(__name) \
		KviKvsParameterProcessor::ParameterFormat __name[] = \
		{

#define KVS_PARAMETERS_END \
			KviKvsParameterProcessor::ParameterFormat(0,0,0,0) \
		};

#define KVS_PARAMETER(__name,__type,__flags,__void) \
			KviKvsParameterProcessor::ParameterFormat(__name,__type,__flags,((void *)(&(__void)))),

#define KVS_PARAMETER_IGNORED(__name) \
			KviKvsParameterProcessor::ParameterFormat(__name,KVS_PT_IGNORE,0,0),

#endif //!_KVI_KVS_PARAMETERPROCESSOR_H_