summaryrefslogtreecommitdiffstats
path: root/akonadi2_cli
diff options
context:
space:
mode:
authorAaron Seigo <aseigo@kde.org>2015-12-23 20:33:42 +0100
committerAaron Seigo <aseigo@kde.org>2015-12-23 20:33:42 +0100
commitce6f9b1eb4320a08b059cfb4f9a81f8d99653b1a (patch)
tree517251f789233ca167b19b7869bc87afe593ab41 /akonadi2_cli
parent5e9c1172ca196bdc8bcdc842e54efc5a74908fff (diff)
downloadsink-ce6f9b1eb4320a08b059cfb4f9a81f8d99653b1a.tar.gz
sink-ce6f9b1eb4320a08b059cfb4f9a81f8d99653b1a.zip
SyntaxTree::SyntaxList -> Syntax::List
Diffstat (limited to 'akonadi2_cli')
-rw-r--r--akonadi2_cli/repl/replStates.cpp2
-rw-r--r--akonadi2_cli/syntax_modules/akonadi_list.cpp4
-rw-r--r--akonadi2_cli/syntax_modules/akonadi_list.h2
-rw-r--r--akonadi2_cli/syntax_modules/core_syntax.cpp4
-rw-r--r--akonadi2_cli/syntax_modules/core_syntax.h2
-rw-r--r--akonadi2_cli/syntaxtree.cpp8
-rw-r--r--akonadi2_cli/syntaxtree.h9
7 files changed, 16 insertions, 15 deletions
diff --git a/akonadi2_cli/repl/replStates.cpp b/akonadi2_cli/repl/replStates.cpp
index 0179779..ceb95ed 100644
--- a/akonadi2_cli/repl/replStates.cpp
+++ b/akonadi2_cli/repl/replStates.cpp
@@ -149,7 +149,7 @@ static char **akonadi2_cli_tab_completion(const char *text, int start, int end)
149 149
150static char *akonadi2_cli_next_tab_complete_match(const char *text, int state) 150static char *akonadi2_cli_next_tab_complete_match(const char *text, int state)
151{ 151{
152 SyntaxTree::SyntaxList nearest = SyntaxTree::self()->nearestSyntax(tab_completion_full_state, QString(text)); 152 Syntax::List nearest = SyntaxTree::self()->nearestSyntax(tab_completion_full_state, QString(text));
153 153
154 if (nearest.size() > state) { 154 if (nearest.size() > state) {
155 return qstrdup(nearest[state].keyword.toUtf8()); 155 return qstrdup(nearest[state].keyword.toUtf8());
diff --git a/akonadi2_cli/syntax_modules/akonadi_list.cpp b/akonadi2_cli/syntax_modules/akonadi_list.cpp
index 62824ee..6abc853 100644
--- a/akonadi2_cli/syntax_modules/akonadi_list.cpp
+++ b/akonadi2_cli/syntax_modules/akonadi_list.cpp
@@ -39,9 +39,9 @@
39namespace AkonadiList 39namespace AkonadiList
40{ 40{
41 41
42SyntaxTree::SyntaxList syntax() 42Syntax::List syntax()
43{ 43{
44 SyntaxTree::SyntaxList syntax; 44 Syntax::List syntax;
45 syntax << Syntax("list", QObject::tr("List all resources, or the contents of one or more resources"), &AkonadiList::list, Syntax::EventDriven); 45 syntax << Syntax("list", QObject::tr("List all resources, or the contents of one or more resources"), &AkonadiList::list, Syntax::EventDriven);
46 46
47 return syntax; 47 return syntax;
diff --git a/akonadi2_cli/syntax_modules/akonadi_list.h b/akonadi2_cli/syntax_modules/akonadi_list.h
index f2a123d..61effc5 100644
--- a/akonadi2_cli/syntax_modules/akonadi_list.h
+++ b/akonadi2_cli/syntax_modules/akonadi_list.h
@@ -23,7 +23,7 @@
23 23
24namespace AkonadiList 24namespace AkonadiList
25{ 25{
26 SyntaxTree::SyntaxList syntax(); 26 Syntax::List syntax();
27 bool list(const QStringList &commands, State &state); 27 bool list(const QStringList &commands, State &state);
28} 28}
29 29
diff --git a/akonadi2_cli/syntax_modules/core_syntax.cpp b/akonadi2_cli/syntax_modules/core_syntax.cpp
index 1231e29..407fcbf 100644
--- a/akonadi2_cli/syntax_modules/core_syntax.cpp
+++ b/akonadi2_cli/syntax_modules/core_syntax.cpp
@@ -27,9 +27,9 @@
27namespace CoreSyntax 27namespace CoreSyntax
28{ 28{
29 29
30SyntaxTree::SyntaxList syntax() 30Syntax::List syntax()
31{ 31{
32 SyntaxTree::SyntaxList syntax; 32 Syntax::List syntax;
33 syntax << Syntax("exit", QObject::tr("Exits the application. Ctrl-d also works!"), &CoreSyntax::exit); 33 syntax << Syntax("exit", QObject::tr("Exits the application. Ctrl-d also works!"), &CoreSyntax::exit);
34 syntax << Syntax(QObject::tr("help"), QObject::tr("Print command information: help [command]"), &CoreSyntax::showHelp); 34 syntax << Syntax(QObject::tr("help"), QObject::tr("Print command information: help [command]"), &CoreSyntax::showHelp);
35 35
diff --git a/akonadi2_cli/syntax_modules/core_syntax.h b/akonadi2_cli/syntax_modules/core_syntax.h
index 4afd69d..521cb8e 100644
--- a/akonadi2_cli/syntax_modules/core_syntax.h
+++ b/akonadi2_cli/syntax_modules/core_syntax.h
@@ -23,7 +23,7 @@
23 23
24namespace CoreSyntax 24namespace CoreSyntax
25{ 25{
26 SyntaxTree::SyntaxList syntax(); 26 Syntax::List syntax();
27 bool exit(const QStringList &commands, State &state); 27 bool exit(const QStringList &commands, State &state);
28 bool showHelp(const QStringList &commands, State &state); 28 bool showHelp(const QStringList &commands, State &state);
29 bool setDebugLevel(const QStringList &commands, State &state); 29 bool setDebugLevel(const QStringList &commands, State &state);
diff --git a/akonadi2_cli/syntaxtree.cpp b/akonadi2_cli/syntaxtree.cpp
index a4f5d40..968802d 100644
--- a/akonadi2_cli/syntaxtree.cpp
+++ b/akonadi2_cli/syntaxtree.cpp
@@ -43,7 +43,7 @@ Syntax::Syntax(const QString &k, const QString &helpText, std::function<bool(con
43 43
44SyntaxTree::SyntaxTree() 44SyntaxTree::SyntaxTree()
45{ 45{
46 QVector<std::function<SyntaxList()> > syntaxSyntaxTrees; 46 QVector<std::function<Syntax::List()> > syntaxSyntaxTrees;
47 syntaxSyntaxTrees << &CoreSyntax::syntax 47 syntaxSyntaxTrees << &CoreSyntax::syntax
48 << &AkonadiList::syntax 48 << &AkonadiList::syntax
49 ; 49 ;
@@ -61,7 +61,7 @@ SyntaxTree *SyntaxTree::self()
61 return s_module; 61 return s_module;
62} 62}
63 63
64SyntaxTree::SyntaxList SyntaxTree::syntax() const 64Syntax::List SyntaxTree::syntax() const
65{ 65{
66 return m_syntax; 66 return m_syntax;
67} 67}
@@ -115,9 +115,9 @@ SyntaxTree::Command SyntaxTree::match(const QStringList &commandLine) const
115 return Command(); 115 return Command();
116} 116}
117 117
118SyntaxTree::SyntaxList SyntaxTree::nearestSyntax(const QStringList &words, const QString &fragment) const 118Syntax::List SyntaxTree::nearestSyntax(const QStringList &words, const QString &fragment) const
119{ 119{
120 SyntaxList matches; 120 Syntax::List matches;
121 121
122 //qDebug() << "words are" << words; 122 //qDebug() << "words are" << words;
123 if (words.isEmpty()) { 123 if (words.isEmpty()) {
diff --git a/akonadi2_cli/syntaxtree.h b/akonadi2_cli/syntaxtree.h
index 7282955..c7df104 100644
--- a/akonadi2_cli/syntaxtree.h
+++ b/akonadi2_cli/syntaxtree.h
@@ -27,6 +27,8 @@
27class Syntax 27class Syntax
28{ 28{
29public: 29public:
30 typedef QVector<Syntax> List;
31
30 enum Interactivity { 32 enum Interactivity {
31 NotInteractive = 0, 33 NotInteractive = 0,
32 EventDriven 34 EventDriven
@@ -51,13 +53,12 @@ class SyntaxTree
51public: 53public:
52 54
53 typedef std::pair<const Syntax *, QStringList> Command; 55 typedef std::pair<const Syntax *, QStringList> Command;
54 typedef QVector<Syntax> SyntaxList;
55 56
56 static SyntaxTree *self(); 57 static SyntaxTree *self();
57 58
58 SyntaxList syntax() const; 59 Syntax::List syntax() const;
59 Command match(const QStringList &commands) const; 60 Command match(const QStringList &commands) const;
60 SyntaxList nearestSyntax(const QStringList &words, const QString &fragment) const; 61 Syntax::List nearestSyntax(const QStringList &words, const QString &fragment) const;
61 62
62 bool run(const QStringList &commands); 63 bool run(const QStringList &commands);
63 64
@@ -67,7 +68,7 @@ private:
67 SyntaxTree(); 68 SyntaxTree();
68 Command matches(const QStringList &commands) const; 69 Command matches(const QStringList &commands) const;
69 70
70 SyntaxList m_syntax; 71 Syntax::List m_syntax;
71 State m_state; 72 State m_state;
72 static SyntaxTree *s_module; 73 static SyntaxTree *s_module;
73}; 74};