summaryrefslogtreecommitdiffstats
path: root/kdelirc/kdelirc/prototype.h
blob: fa101b7c1d38640c5ec67dd65fa7964ccc219cce (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
//
//
// C++ Interface: $MODULE$
//
// Description:
//
//
// Author: Gav Wood <gav@kde.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef PROTOTYPE_H
#define PROTOTYPE_H

#include <tqstringlist.h>
#include <tqpair.h>
#include <tqstring.h>

/**
@author Gav Wood
*/

class Prototype
{
	TQString original, theName, theReturn;
	TQStringList theNames, theTypes;

	void parse();

public:
	unsigned count() const{ return theTypes.count(); }
	const TQPair<TQString, TQString> operator[](int i) const { return tqMakePair(theTypes[i], theNames[i]); }
	const TQString &name(int i) const { return theNames[i]; }
	const TQString &type(int i) const { return theTypes[i]; }
	const TQString &returnType() const { return theReturn; }
	const TQString &name() const { return theName; }
	const TQString &prototype() const { return original; }
	const TQString argumentList() const;
	const TQString argumentListNN() const;
	const int argumentCount() { return theTypes.count(); }
	const TQString prototypeNR() const { return theName + "(" + argumentListNN() + ")"; }

	void setPrototype(const TQString &source) { original = source; parse(); }

	Prototype &operator=(const TQString &source) { setPrototype(source); return *this; }

	Prototype(const TQString &source);
	Prototype();
	~Prototype();

};

#endif