finsih work with base interfaces

This commit is contained in:
Andrei Yankovich 2023-08-31 18:27:07 +02:00
parent 4456fd7c85
commit e3ccbc599d
8 changed files with 79 additions and 39 deletions

View File

@ -4,11 +4,11 @@
"src/build/Debug/qTbotEaxample.exe"
],
"clear": true,
"binPrefix": "/home/andrei/git/build-qTbot-Desktop_Qt_6_5_2_GCC_64bit-Debug",
"binPrefix": "/home/andrei/gitHub/build-qTbot-Desktop_Qt_6_5_2_GCC_64bit-Debug",
"libDir": [
"/home/andrei/git/qTbot",
"/media/D/builds/qTbot",
"/home/andrei/Qt/6.5.2/gcc_64",
"/home/andrei/git/build-qTbot-Desktop_Qt_6_5_2_GCC_64bit-Debug"
"/home/andrei/gitHub/build-qTbot-Desktop_Qt_6_5_2_GCC_64bit-Debug"
],
"recursiveDepth": "10",
"deploySystem": false,
@ -17,11 +17,11 @@
"qif": true,
"zip": true,
"ignoreEnv": [
"/home/andrei/git/qTbot/Distro"
"/media/D/builds/qTbot/Distro"
],
"extraLib": "crypto",
"targetDir": "/home/andrei/git/qTbot/Distro",
"deployVersion": "0.2.353e06f",
"targetDir": "/media/D/builds/qTbot/Distro",
"deployVersion": "0.3.4456fd7",
}

View File

@ -10,7 +10,7 @@
#include <QtCore/qglobal.h>
#define QTBOT_VERSION "0.2.353e06f"
#define QTBOT_VERSION "0.3.4456fd7"
#if defined(QTBOT_LIBRARY)
# define QTBOT_EXPORT Q_DECL_EXPORT

View File

@ -1,3 +1,10 @@
//#
//# Copyright (C) 2018-2023 QuasarApp.
//# Distributed under the GPLv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
#include "ibot.h"
namespace qTbot {
@ -7,7 +14,7 @@ IBot::IBot()
}
QByteArray &IBot::token() const {
const QByteArray &IBot::token() const {
return _token;
}
@ -15,7 +22,7 @@ void IBot::setToken(const QByteArray &newToken) {
_token = newToken;
}
QString IBot::name() const {
const QString &IBot::name() const {
return _name;
}

View File

@ -24,6 +24,13 @@ class QTBOT_EXPORT IBot
public:
IBot();
/**
* @brief login This method get bae information of the bot from remote server.
* @param token This is token value for login
* @return true if login request sent successful else false.
*/
virtual bool login(const QByteArray& token) = 0;
/**
* @brief sendMessage This method should be send message to the server.
* @param message This is data for sending.
@ -35,7 +42,21 @@ public:
* @brief token This is token value for authication on the remote server (bot)
* @return auth toke of the bot.
*/
QByteArray &token() const;
const QByteArray &token() const;
/**
* @brief name This is name of the bot. usualy it fields will be received from the server after autication.
* @return name if the bot.
*/
const QString& name() const;
/**
* @brief setName This method sets new value for the IBot::name field.
* @param newName This is new value of the IBot::name property
*/
void setName(const QString &newName);
protected:
/**
* @brief setToken This is setter of the IBot::token value.
@ -43,20 +64,8 @@ public:
*/
void setToken(const QByteArray &newToken);
/**
* @brief name This is name of the bot. usualy it fields will be received from the server after autication.
* @return
*/
QString name() const;
/**
* @brief setName This method sets new value for the IBot::name field.
* @param newName
*/
void setName(const QString &newName);
private:
QByteArray& _token;
QByteArray _token;
QString _name;
signals:

View File

@ -1,5 +1,14 @@
//#
//# Copyright (C) 2018-2023 QuasarApp.
//# Distributed under the GPLv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
#include "imessage.h"
namespace qTbot {
iMessage::iMessage() {
}
@ -19,3 +28,4 @@ const QByteArray &iMessage::userId() const {
void iMessage::setUserId(const QByteArray &newUserId) {
_userId = newUserId;
}
}

View File

@ -13,6 +13,9 @@
#include "qTbot/global.h"
#include <QByteArray>
namespace qTbot {
/**
* @brief The iMessage class - is main interface for all messages objects.
*/
@ -50,5 +53,5 @@ private:
QByteArray _rawData;
QByteArray _userId;
};
}
#endif // IMESSAGE_H

View File

@ -1,6 +1,20 @@
//#
//# Copyright (C) 2018-2023 QuasarApp.
//# Distributed under the GPLv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
#include "itelegrambot.h"
iTelegramBot::iTelegramBot()
{
namespace qTbot {
ITelegramBot::ITelegramBot() {
}
bool ITelegramBot::sendMessage(const QSharedPointer<iMessage> &message) {
}
}

View File

@ -10,26 +10,23 @@
#ifndef ITELEGRAMBOT_H
#define ITELEGRAMBOT_H
#include "qTbot/global.h"
#include "qTbot/imessage.h"
#include "ibot.h"
#include <QSharedPointer>
namespace qTbot {
struct TelegramMessage
{
};
class QTBOT_EXPORT iTelegramBot
/**
* @brief The ITelegramBot class This is base implementation of the all telegramm bots.
*/
class QTBOT_EXPORT ITelegramBot : public IBot
{
public:
iTelegramBot();
ITelegramBot();
virtual const QString& name() const;
virtual const QByteArray& token() const;
signals:
// IBot interface
public:
bool sendMessage(const QSharedPointer<iMessage> &message) override;
};
}
#endif // ITELEGRAMBOT_H