From e3ccbc599d2e7aacd543cdc9efa2b8e4762f9bf3 Mon Sep 17 00:00:00 2001 From: EndrII <EndrIIMail@gmail.com> Date: Thu, 31 Aug 2023 18:27:07 +0200 Subject: [PATCH] finsih work with base interfaces --- src/example/deploy/qTbot.json | 12 +++---- src/qTbot/src/public/qTbot/global.h | 2 +- src/qTbot/src/public/qTbot/ibot.cpp | 11 ++++-- src/qTbot/src/public/qTbot/ibot.h | 37 +++++++++++++-------- src/qTbot/src/public/qTbot/imessage.cpp | 10 ++++++ src/qTbot/src/public/qTbot/imessage.h | 5 ++- src/qTbot/src/public/qTbot/itelegrambot.cpp | 18 ++++++++-- src/qTbot/src/public/qTbot/itelegrambot.h | 23 ++++++------- 8 files changed, 79 insertions(+), 39 deletions(-) diff --git a/src/example/deploy/qTbot.json b/src/example/deploy/qTbot.json index 66caffb..477255f 100644 --- a/src/example/deploy/qTbot.json +++ b/src/example/deploy/qTbot.json @@ -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", } diff --git a/src/qTbot/src/public/qTbot/global.h b/src/qTbot/src/public/qTbot/global.h index f88d84a..08f8ae0 100644 --- a/src/qTbot/src/public/qTbot/global.h +++ b/src/qTbot/src/public/qTbot/global.h @@ -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 diff --git a/src/qTbot/src/public/qTbot/ibot.cpp b/src/qTbot/src/public/qTbot/ibot.cpp index 7af6e7e..f2a5754 100644 --- a/src/qTbot/src/public/qTbot/ibot.cpp +++ b/src/qTbot/src/public/qTbot/ibot.cpp @@ -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; } diff --git a/src/qTbot/src/public/qTbot/ibot.h b/src/qTbot/src/public/qTbot/ibot.h index 953f40f..0d0939b 100644 --- a/src/qTbot/src/public/qTbot/ibot.h +++ b/src/qTbot/src/public/qTbot/ibot.h @@ -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: diff --git a/src/qTbot/src/public/qTbot/imessage.cpp b/src/qTbot/src/public/qTbot/imessage.cpp index 9dd99fd..a1c35af 100644 --- a/src/qTbot/src/public/qTbot/imessage.cpp +++ b/src/qTbot/src/public/qTbot/imessage.cpp @@ -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; } +} diff --git a/src/qTbot/src/public/qTbot/imessage.h b/src/qTbot/src/public/qTbot/imessage.h index e10aeee..c8d1977 100644 --- a/src/qTbot/src/public/qTbot/imessage.h +++ b/src/qTbot/src/public/qTbot/imessage.h @@ -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 diff --git a/src/qTbot/src/public/qTbot/itelegrambot.cpp b/src/qTbot/src/public/qTbot/itelegrambot.cpp index 14def28..77bb50e 100644 --- a/src/qTbot/src/public/qTbot/itelegrambot.cpp +++ b/src/qTbot/src/public/qTbot/itelegrambot.cpp @@ -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) { + +} } diff --git a/src/qTbot/src/public/qTbot/itelegrambot.h b/src/qTbot/src/public/qTbot/itelegrambot.h index 7bcb6d6..140c487 100644 --- a/src/qTbot/src/public/qTbot/itelegrambot.h +++ b/src/qTbot/src/public/qTbot/itelegrambot.h @@ -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