From 8b397cec29460e2cb53b9be02b4e53da9cce60c9 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Thu, 24 Dec 2015 16:23:46 +0100 Subject: bye-bye header files the function-centric approach simply does not require them! --- akonadish/syntax_modules/core_syntax.cpp | 49 ++++++++++++++++---------------- 1 file changed, 25 insertions(+), 24 deletions(-) (limited to 'akonadish/syntax_modules/core_syntax.cpp') diff --git a/akonadish/syntax_modules/core_syntax.cpp b/akonadish/syntax_modules/core_syntax.cpp index 8fb1448..a0cd4c6 100644 --- a/akonadish/syntax_modules/core_syntax.cpp +++ b/akonadish/syntax_modules/core_syntax.cpp @@ -17,37 +17,16 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "core_syntax.h" - #include #include // tr() #include #include -namespace CoreSyntax -{ - -REGISTER_SYNTAX(CoreSyntax) +#include "state.h" +#include "syntaxtree.h" -Syntax::List syntax() +namespace CoreSyntax { - Syntax::List syntax; - syntax << Syntax("exit", QObject::tr("Exits the application. Ctrl-d also works!"), &CoreSyntax::exit); - - Syntax help(QObject::tr("help"), QObject::tr("Print command information: help [command]"), &CoreSyntax::showHelp); - help.completer = &CoreSyntax::showHelpCompleter; - syntax << help; - - Syntax set(QObject::tr("set"), QObject::tr("Sets settings for the session")); - set.children << Syntax(QObject::tr("debug"), QObject::tr("Set the debug level from 0 to 6"), &CoreSyntax::setDebugLevel); - syntax << set; - - Syntax get(QObject::tr("get"), QObject::tr("Gets settings for the session")); - get.children << Syntax(QObject::tr("debug"), QObject::tr("Set the debug level from 0 to 6"), &CoreSyntax::printDebugLevel); - syntax << get; - - return syntax; -} bool exit(const QStringList &, State &) { @@ -137,5 +116,27 @@ bool printDebugLevel(const QStringList &commands, State &state) return true; } +Syntax::List syntax() +{ + Syntax::List syntax; + syntax << Syntax("exit", QObject::tr("Exits the application. Ctrl-d also works!"), &CoreSyntax::exit); + + Syntax help(QObject::tr("help"), QObject::tr("Print command information: help [command]"), &CoreSyntax::showHelp); + help.completer = &CoreSyntax::showHelpCompleter; + syntax << help; + + Syntax set(QObject::tr("set"), QObject::tr("Sets settings for the session")); + set.children << Syntax(QObject::tr("debug"), QObject::tr("Set the debug level from 0 to 6"), &CoreSyntax::setDebugLevel); + syntax << set; + + Syntax get(QObject::tr("get"), QObject::tr("Gets settings for the session")); + get.children << Syntax(QObject::tr("debug"), QObject::tr("Set the debug level from 0 to 6"), &CoreSyntax::printDebugLevel); + syntax << get; + + return syntax; +} + +REGISTER_SYNTAX(CoreSyntax) + } // namespace CoreSyntax -- cgit v1.2.3