blob: 69ad577614cd4dc74bb9747b95bbcfb61d60f994 (
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
|
#include <contextregistryinfo.h>
#include <contextpropertyinfo.h>
#include <QCoreApplication>
#include <QString>
#include <QStringList>
#include <QMap>
#include <QDebug>
#include <stdlib.h>
int main(int argc, char **argv)
{
int retValue = 1;
{
QCoreApplication app(argc, argv);
QStringList args = app.arguments();
QString backendName = "";
bool doc = false;
bool provided = false;
bool longListing = false;
bool hasFilter = false;
QString filter = "*";
args.pop_front();
foreach (QString arg, args) {
if (arg == "--xml" || arg == "-x") {
backendName = "xml";
} else if (arg == "--cdb" || arg == "-c") {
backendName = "cdb";
} else if (arg == "--provided" || arg == "-p") {
provided = true;
} else if (arg == "--long" || arg == "-l") {
longListing = true;
} else if (arg == "--doc" || arg == "-d") {
doc = true;
} else {
if (hasFilter) {
qWarning("WARNING: Only the first filter string is considered.");
} else {
hasFilter = true;
filter = arg;
}
}
}
ContextRegistryInfo *regInfo = ContextRegistryInfo::instance(backendName);
QStringList keys = regInfo->listKeys();
keys.sort();
QRegExp rx(filter, Qt::CaseSensitive, QRegExp::Wildcard);
QTextStream out(stdout);
foreach (QString key, keys) {
if (!rx.exactMatch(key))
continue;
ContextPropertyInfo info(key);
if (provided && !info.provided())
continue;
if (longListing) {
// Print the key and the type even if we don't have providers
if (info.providers().size() == 0)
out << key << "\t" << info.typeInfo().name() << endl;
for (int i = 0; i < info.providers().size(); i++ )
out << key << "\t" << info.typeInfo().name() << "\t" << info.providers()[i].plugin << "\t"
<< info.providers()[i].constructionString << endl;
} else
out << key << "\n";
if (doc) {
out << "Documentation: " << info.doc() << "\n";
}
retValue = 0;
}
out.flush();
}
return retValue;
}
|