1 /***************************************************************************
2 commands.h - description
4 begin : mer ott 23 2002
5 copyright : (C) 2007 by Maurizio Monge
6 email : monge@linuz.sns.it
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
18 #ifndef __COMMANDS_H__
19 #define __COMMANDS_H__
23 /* class to store information about a command */
27 typedef void (Engine::*CmdFunc
)(int argc
, char *argv
[]);
38 Cmd(CmdFunc f
, const char *d
= NULL
)
45 Cmd(CmdFunc f
, int n
, const char *d
= NULL
)
52 Cmd(CmdFunc f
, int n
, int x
, const char *d
= NULL
)
59 int min() const { return m_min
; }
60 int max() const { return m_max
; }
61 const char* desc() const { return m_desc
; }
63 void run(int argc
, char *argv
[]);
66 class Engine::Variable
69 typedef void (Engine::*VarSetFunc
)(void* d
, const char* value
);
70 typedef char* (Engine::*VarGetFunc
)(void* d
, char* value
);
86 int (Engine::*m_int_var
);
90 char* (Engine::*m_string_var
);
94 VarSetFunc m_custom_set
;
95 VarGetFunc m_custom_get
;
102 Variable(int (Engine::*ivar
), int def_val
, const char *d
= NULL
);
103 Variable(int (Engine::*ivar
), int def_val
, int min
, int max
, const char *d
= NULL
);
104 Variable(char* (Engine::*svar
), const char* def_val
, const char *d
= NULL
);
105 Variable(VarSetFunc set
, VarGetFunc get
, const char *d
= NULL
);
106 Variable(VarSetFunc set
, VarGetFunc get
, void* data
, const char *d
= NULL
);
108 void from_string(const char *s
);
109 const char* to_string(char* buf64
);
110 const char* desc() { return m_desc
; }
113 #endif //__COMMANDS_H__