summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgor Pugin <egor.pugin@gmail.com>2020-03-14 17:56:27 +0300
committerEgor Pugin <egor.pugin@gmail.com>2020-03-14 17:56:27 +0300
commit38e4b3867b50065aeb6110fac0ce001031242349 (patch)
treeffa3de27c79f1df1c40e9b0cdb9c84979df58ad5
parenta7a90aaa572f0a6e06697d9a09089dbffbbda5f0 (diff)
Move Bot ctor in its own file.
-rw-r--r--include/tgbot/Bot.h10
-rw-r--r--src/Bot.cpp14
2 files changed, 17 insertions, 7 deletions
diff --git a/include/tgbot/Bot.h b/include/tgbot/Bot.h
index d966c1b..58d667c 100644
--- a/include/tgbot/Bot.h
+++ b/include/tgbot/Bot.h
@@ -2,7 +2,6 @@
#define TGBOT_CPP_BOT_H
#include "tgbot/Api.h"
-#include "tgbot/EventBroadcaster.h"
#include "tgbot/EventHandler.h"
#include "tgbot/net/HttpClient.h"
#include "tgbot/net/BoostHttpOnlySslClient.h"
@@ -13,6 +12,8 @@
namespace TgBot {
+class EventBroadcaster;
+
/**
* @brief This object holds other objects specific for this bot instance.
*
@@ -21,12 +22,7 @@ namespace TgBot {
class TGBOT_API Bot {
public:
- explicit Bot(std::string token, const HttpClient& httpClient = _getDefaultHttpClient())
- : _token(std::move(token))
- , _api(_token, httpClient)
- , _eventBroadcaster(std::make_unique<EventBroadcaster>())
- , _eventHandler(getEvents()) {
- }
+ explicit Bot(std::string token, const HttpClient &httpClient = _getDefaultHttpClient());
/**
* @return Token for accessing api.
diff --git a/src/Bot.cpp b/src/Bot.cpp
new file mode 100644
index 0000000..b1e1ea5
--- /dev/null
+++ b/src/Bot.cpp
@@ -0,0 +1,14 @@
+#include "tgbot/Bot.h"
+
+#include "tgbot/EventBroadcaster.h"
+
+namespace TgBot {
+
+Bot::Bot(std::string token, const HttpClient& httpClient)
+ : _token(std::move(token))
+ , _api(_token, httpClient)
+ , _eventBroadcaster(std::make_unique<EventBroadcaster>())
+ , _eventHandler(getEvents()) {
+}
+
+}