summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/tools/scriptfunction.h
blob: b25612c8e3daad70d07f02e2a295bc8d0dcba30b (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
/***************************************************************************
                          scriptfunction.h  -  description
                             -------------------
    begin                : Thu Apr 17 2003
    copyright            : (C) 2003 by Jason Harris
    email                : kstars@30doradus.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef SCRIPTFUNCTION_H
#define SCRIPTFUNCTION_H

#include <tqstring.h>

/**
 *
 * Jason Harris
 **/
class ScriptFunction
{
public:
	ScriptFunction( TQString name, TQString desc, bool clockfcn=false,
			TQString at1="", TQString an1="",
			TQString at2="", TQString an2="",
			TQString at3="", TQString an3="",
			TQString at4="", TQString an4="",
			TQString at5="", TQString an5="",
			TQString at6="", TQString an6=""
	);
	ScriptFunction( ScriptFunction *sf );
	~ScriptFunction();

	TQString name() const { return Name; }
	TQString prototype() const;
	TQString description() const { return Description; }
	TQString argType( unsigned int n ) const { return ArgType[n]; }
	TQString argName( unsigned int n ) const { return ArgName[n]; }
	TQString argVal( unsigned int n ) const { return ArgVal[n]; }

	void setValid( bool b ) { Valid = b; }
	bool valid() const { return Valid; }

	void setClockFunction( bool b=true ) { ClockFunction = b; }
	bool isClockFunction() const { return ClockFunction; }

	void setArg( unsigned int n, TQString newVal ) { ArgVal[n] = newVal; }
	bool checkArgs();
	unsigned int numArgs() const { return NumArgs; }

	TQString scriptLine() const;
	
	void    setINDIProperty(TQString prop) { INDIProp = prop; }
	TQString INDIProperty() const { return INDIProp; }

private:
	TQString Name, Description;
	TQString ArgType[6];
	TQString ArgName[6];
	TQString ArgVal[6];
	TQString INDIProp;
	bool Valid, ClockFunction;
	unsigned int NumArgs;
};

#endif