LeechCraft Azoth 0.6.70-14794-g33744ae6ce
Modular multiprotocol IM plugin for LeechCraft
Loading...
Searching...
No Matches
iprovidecommands.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <variant>
12#include <functional>
13#include <stdexcept>
14#include <QStringList>
15#include <QtPlugin>
16
17namespace LC
18{
19namespace Azoth
20{
21 class ICLEntry;
22
24 {
26 QString Message_;
27 };
29 {
30 QString NewText_;
31 };
32 typedef std::variant<bool, StringCommandResult, TextMorphResult> CommandResult_t;
33
34 typedef std::function<CommandResult_t (ICLEntry*, QString&)> Command_f;
35
36 class CommandException : public std::runtime_error
37 {
38 const QString Error_;
39 const bool TryOtherCommands_;
40 public:
41 CommandException (const QString& error, bool canTryOthers = false)
42 : std::runtime_error { error.toUtf8 ().constData () }
43 , Error_ { error }
44 , TryOtherCommands_ { canTryOthers }
45 {
46 }
47
48 const QString& GetError () const
49 {
50 return Error_;
51 }
52
53 bool CanTryOtherCommands () const
54 {
55 return TryOtherCommands_;
56 }
57 };
58
60 {
61 QStringList Names_;
63
64 QString Description_ = {};
65 QString Help_ = {};
66 };
67
69
71 {
72 public:
73 virtual ~IProvideCommands () {}
74
76 };
77}
78}
79
80Q_DECLARE_INTERFACE (LC::Azoth::IProvideCommands, "org.LeechCraft.Azoth.IProvideCommands/1.0")
const QString & GetError() const
CommandException(const QString &error, bool canTryOthers=false)
Represents a single entry in contact list.
Definition: iclentry.h:121
virtual StaticCommands_t GetStaticCommands(ICLEntry *)=0
std::variant< bool, StringCommandResult, TextMorphResult > CommandResult_t
std::function< CommandResult_t(ICLEntry *, QString &)> Command_f
QList< StaticCommand > StaticCommands_t