The complete source code of IdealIRC
http://www.idealirc.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.5 KiB
53 lines
1.5 KiB
/*
|
|
* IdealIRC - Internet Relay Chat client
|
|
* Copyright (C) 2021 Tom-Andre Barstad.
|
|
* This software is licensed under the Software Attribution License.
|
|
* See LICENSE for more information.
|
|
*/
|
|
|
|
#ifndef ICOMMAND_H
|
|
#define ICOMMAND_H
|
|
|
|
#include "ICommand/CommandData.h"
|
|
#include <QObject>
|
|
#include <memory>
|
|
|
|
class IRC;
|
|
class IWinStatus;
|
|
class MdiManager;
|
|
|
|
struct ICommandPriv;
|
|
|
|
class ICommand : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
friend struct ICommandPriv;
|
|
|
|
public:
|
|
explicit ICommand(IRC& connection_);
|
|
~ICommand();
|
|
|
|
void parse(QString text);
|
|
IRC& getConnection();
|
|
|
|
private:
|
|
bool tryParseIRC(QString cmdLine);
|
|
bool tryParseInternal(QString cmdLine);
|
|
void print_notEnoughParameters(const QString& command);
|
|
void print_invalidCommandSwitch(const QString& command);
|
|
void print_invalidWindowTypeForCommand(const QString& command);
|
|
void print_notConnectedToServer(const QString& command);
|
|
|
|
/* Predicates for parsing commands */
|
|
static std::optional<std::string> prd_AnyWord(int& idx, const QString& line);
|
|
static std::optional<std::string> prd_AnyWordToUpper(int& idx, const QString& line);
|
|
static std::optional<std::string> prd_OptionalChannel(int& idx, const QString& line);
|
|
static std::optional<std::string> prd_NotSwitch(int& idx, const QString& line);
|
|
static std::optional<std::string> prd_Switch(int& idx, const QString& line);
|
|
static std::optional<std::string> prd_Message(int& idx, const QString& line);
|
|
|
|
std::unique_ptr<ICommandPriv> mp;
|
|
};
|
|
|
|
#endif // ICOMMAND_H
|
|
|