blob: 9b0a09bb4405ebf74f0ce71eb343f138ba2650c0 (
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
|
//
//
// C++ Implementation: $MODULE$
//
// Description:
//
//
// Author: Gav Wood <gav@kde.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include <qregexp.h>
#include "prototype.h"
Prototype::Prototype()
{
original = "";
}
Prototype::Prototype(const QString &source)
{
original = source;
parse();
}
Prototype::~Prototype()
{
}
const QString Prototype::argumentList() const
{
QString ret = "";
for(unsigned i = 0; i < theTypes.count(); i++)
ret += (i ? ", " : "") + theTypes[i] + " " + theNames[i];
return ret;
}
const QString Prototype::argumentListNN() const
{
QString ret = "";
for(unsigned i = 0; i < theTypes.count(); i++)
ret += (i ? ", " : "") + theTypes[i];
return ret;
}
void Prototype::parse()
{
theNames.clear();
theTypes.clear();
QRegExp main("^(.*) (\\w[\\d\\w]*)\\((.*)\\)");
QRegExp parameters("^\\s*([^,\\s]+)(\\s+(\\w[\\d\\w]*))?(,(.*))?$");
if(main.search(original) == -1) return;
theReturn = main.cap(1);
theName = main.cap(2);
QString args = main.cap(3);
while(parameters.search(args) != -1)
{ theTypes += parameters.cap(1);
theNames += parameters.cap(3);
args = parameters.cap(5);
}
}
|