summaryrefslogtreecommitdiff
path: root/include/tgbot
diff options
context:
space:
mode:
authorEgor Pugin <egor.pugin@gmail.com>2020-03-13 17:38:20 +0300
committerEgor Pugin <egor.pugin@gmail.com>2020-03-13 17:38:20 +0300
commitb6f2240aea4a496b288215875814309275f3b4f0 (patch)
tree576f7b8ea25738eba1aceae63fef21777cd7db3b /include/tgbot
parentec7affea995fef1c760f40fed7d39f1c6dafb980 (diff)
Initial support for shared builds.
Diffstat (limited to 'include/tgbot')
-rw-r--r--include/tgbot/Api.h2
-rw-r--r--include/tgbot/Bot.h2
-rw-r--r--include/tgbot/EventBroadcaster.h3
-rw-r--r--include/tgbot/EventHandler.h2
-rw-r--r--include/tgbot/TgException.h4
-rw-r--r--include/tgbot/TgTypeParser.h3
-rw-r--r--include/tgbot/export.h8
-rw-r--r--include/tgbot/net/BoostHttpOnlySslClient.h2
-rw-r--r--include/tgbot/net/CurlHttpClient.h2
-rw-r--r--include/tgbot/net/HttpClient.h2
-rw-r--r--include/tgbot/net/HttpParser.h2
-rw-r--r--include/tgbot/net/HttpReqArg.h4
-rw-r--r--include/tgbot/net/TgLongPoll.h2
-rw-r--r--include/tgbot/net/Url.h4
-rw-r--r--include/tgbot/tools/FileTools.h4
-rw-r--r--include/tgbot/tools/StringTools.h8
16 files changed, 41 insertions, 13 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h
index 8406d01..9738596 100644
--- a/include/tgbot/Api.h
+++ b/include/tgbot/Api.h
@@ -37,7 +37,7 @@ class Bot;
*
* @ingroup general
*/
-class Api {
+class TGBOT_API Api {
typedef std::shared_ptr<std::vector<std::string>> StringArrayPtr;
diff --git a/include/tgbot/Bot.h b/include/tgbot/Bot.h
index 98876f3..49131d3 100644
--- a/include/tgbot/Bot.h
+++ b/include/tgbot/Bot.h
@@ -16,7 +16,7 @@ namespace TgBot {
*
* @ingroup general
*/
-class Bot {
+class TGBOT_API Bot {
public:
explicit Bot(std::string token, const HttpClient& httpClient = _getDefaultHttpClient())
diff --git a/include/tgbot/EventBroadcaster.h b/include/tgbot/EventBroadcaster.h
index 7424e5d..38d5be6 100644
--- a/include/tgbot/EventBroadcaster.h
+++ b/include/tgbot/EventBroadcaster.h
@@ -6,6 +6,7 @@
#include <vector>
#include <unordered_map>
+#include "tgbot/export.h"
#include "tgbot/types/Message.h"
#include "tgbot/types/InlineQuery.h"
#include "tgbot/types/ChosenInlineResult.h"
@@ -20,7 +21,7 @@ class EventHandler;
*
* @ingroup general
*/
-class EventBroadcaster {
+class TGBOT_API EventBroadcaster {
friend EventHandler;
diff --git a/include/tgbot/EventHandler.h b/include/tgbot/EventHandler.h
index 540544e..4e77e33 100644
--- a/include/tgbot/EventHandler.h
+++ b/include/tgbot/EventHandler.h
@@ -7,7 +7,7 @@
namespace TgBot {
-class EventHandler {
+class TGBOT_API EventHandler {
public:
explicit EventHandler(const EventBroadcaster& broadcaster) : _broadcaster(broadcaster) {
diff --git a/include/tgbot/TgException.h b/include/tgbot/TgException.h
index a83c3fc..47b11f2 100644
--- a/include/tgbot/TgException.h
+++ b/include/tgbot/TgException.h
@@ -1,6 +1,8 @@
#ifndef TGBOT_TGEXCEPTION_H
#define TGBOT_TGEXCEPTION_H
+#include "tgbot/export.h"
+
#include <string>
#include <stdexcept>
@@ -11,7 +13,7 @@ namespace TgBot {
*
* @ingroup general
*/
-class TgException : public std::runtime_error {
+class TGBOT_API TgException : public std::runtime_error {
public:
explicit TgException(const std::string description);
diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h
index eac3d05..02f8ee5 100644
--- a/include/tgbot/TgTypeParser.h
+++ b/include/tgbot/TgTypeParser.h
@@ -6,6 +6,7 @@
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
+#include "tgbot/export.h"
#include "tgbot/types/User.h"
#include "tgbot/types/Chat.h"
#include "tgbot/types/Message.h"
@@ -87,7 +88,7 @@
namespace TgBot {
-class TgTypeParser {
+class TGBOT_API TgTypeParser {
public:
template<typename T>
diff --git a/include/tgbot/export.h b/include/tgbot/export.h
new file mode 100644
index 0000000..55789d9
--- /dev/null
+++ b/include/tgbot/export.h
@@ -0,0 +1,8 @@
+#ifndef TGBOT_EXPORT_H
+#define TGBOT_EXPORT_H
+
+#ifndef TGBOT_API
+#define TGBOT_API
+#endif
+
+#endif //TGBOT_EXPORT_H
diff --git a/include/tgbot/net/BoostHttpOnlySslClient.h b/include/tgbot/net/BoostHttpOnlySslClient.h
index 8103bef..594b3fe 100644
--- a/include/tgbot/net/BoostHttpOnlySslClient.h
+++ b/include/tgbot/net/BoostHttpOnlySslClient.h
@@ -17,7 +17,7 @@ namespace TgBot {
*
* @ingroup net
*/
-class BoostHttpOnlySslClient : public HttpClient {
+class TGBOT_API BoostHttpOnlySslClient : public HttpClient {
public:
BoostHttpOnlySslClient();
diff --git a/include/tgbot/net/CurlHttpClient.h b/include/tgbot/net/CurlHttpClient.h
index 9409d7c..202cc40 100644
--- a/include/tgbot/net/CurlHttpClient.h
+++ b/include/tgbot/net/CurlHttpClient.h
@@ -19,7 +19,7 @@ namespace TgBot {
*
* @ingroup net
*/
-class CurlHttpClient : public HttpClient {
+class TGBOT_API CurlHttpClient : public HttpClient {
public:
CurlHttpClient();
diff --git a/include/tgbot/net/HttpClient.h b/include/tgbot/net/HttpClient.h
index 077a6c1..d9c72be 100644
--- a/include/tgbot/net/HttpClient.h
+++ b/include/tgbot/net/HttpClient.h
@@ -13,7 +13,7 @@ namespace TgBot {
*
* @ingroup net
*/
-class HttpClient {
+class TGBOT_API HttpClient {
public:
virtual ~HttpClient() = default;
diff --git a/include/tgbot/net/HttpParser.h b/include/tgbot/net/HttpParser.h
index 82da892..3f1095b 100644
--- a/include/tgbot/net/HttpParser.h
+++ b/include/tgbot/net/HttpParser.h
@@ -10,7 +10,7 @@
namespace TgBot {
-class HttpParser {
+class TGBOT_API HttpParser {
public:
std::string generateRequest(const Url& url, const std::vector<HttpReqArg>& args, bool isKeepAlive = false) const;
diff --git a/include/tgbot/net/HttpReqArg.h b/include/tgbot/net/HttpReqArg.h
index 4b6e428..72dfd7d 100644
--- a/include/tgbot/net/HttpReqArg.h
+++ b/include/tgbot/net/HttpReqArg.h
@@ -1,6 +1,8 @@
#ifndef TGBOT_HTTPPARAMETER_H
#define TGBOT_HTTPPARAMETER_H
+#include "tgbot/export.h"
+
#include <string>
#include <utility>
#include <vector>
@@ -15,7 +17,7 @@ namespace TgBot {
*
* @ingroup net
*/
-class HttpReqArg {
+class TGBOT_API HttpReqArg {
public:
template<typename T>
diff --git a/include/tgbot/net/TgLongPoll.h b/include/tgbot/net/TgLongPoll.h
index 2de9810..b55338c 100644
--- a/include/tgbot/net/TgLongPoll.h
+++ b/include/tgbot/net/TgLongPoll.h
@@ -14,7 +14,7 @@ namespace TgBot {
*
* @ingroup net
*/
-class TgLongPoll {
+class TGBOT_API TgLongPoll {
public:
TgLongPoll(const Api* api, const EventHandler* eventHandler, std::int32_t, std::int32_t, const std::shared_ptr<std::vector<std::string>>&);
diff --git a/include/tgbot/net/Url.h b/include/tgbot/net/Url.h
index dbea837..818cf69 100644
--- a/include/tgbot/net/Url.h
+++ b/include/tgbot/net/Url.h
@@ -1,6 +1,8 @@
#ifndef TGBOT_CPP_URL_H
#define TGBOT_CPP_URL_H
+#include "tgbot/export.h"
+
#include <string>
namespace TgBot {
@@ -10,7 +12,7 @@ namespace TgBot {
*
* @ingroup net
*/
-class Url {
+class TGBOT_API Url {
public:
Url(const std::string& url);
diff --git a/include/tgbot/tools/FileTools.h b/include/tgbot/tools/FileTools.h
index d497d7c..82291f4 100644
--- a/include/tgbot/tools/FileTools.h
+++ b/include/tgbot/tools/FileTools.h
@@ -1,6 +1,8 @@
#ifndef TGBOT_FILETOOLS_H
#define TGBOT_FILETOOLS_H
+#include "tgbot/export.h"
+
#include <string>
/**
@@ -14,6 +16,7 @@ namespace FileTools {
* @throws exception of type std::ifstream::failure if reading fails
* @return string with file contents
*/
+TGBOT_API
std::string read(const std::string& filePath);
/**
@@ -21,6 +24,7 @@ std::string read(const std::string& filePath);
* @param filePath Path to a file
* @throws exception of type std::ifstream::failure if writing fails
*/
+TGBOT_API
void write(const std::string& content, const std::string& filePath);
};
diff --git a/include/tgbot/tools/StringTools.h b/include/tgbot/tools/StringTools.h
index cb26bb5..fa3a2f5 100644
--- a/include/tgbot/tools/StringTools.h
+++ b/include/tgbot/tools/StringTools.h
@@ -1,6 +1,8 @@
#ifndef TGBOT_CPP_STRINGTOOLS_H
#define TGBOT_CPP_STRINGTOOLS_H
+#include "tgbot/export.h"
+
#include <cstddef>
#include <vector>
#include <string>
@@ -16,6 +18,7 @@ namespace StringTools {
* @param str1 First string
* @param str2 Second string
*/
+TGBOT_API
bool startsWith(const std::string& str1, const std::string& str2);
/**
@@ -23,6 +26,7 @@ bool startsWith(const std::string& str1, const std::string& str2);
* @param str1 First string
* @param str2 Second string
*/
+TGBOT_API
bool endsWith(const std::string& str1, const std::string& str2);
/**
@@ -31,12 +35,14 @@ bool endsWith(const std::string& str1, const std::string& str2);
* @param delimiter Delimiter
* @param dest Array to which substrings will be saved.
*/
+TGBOT_API
void split(const std::string& str, char delimiter, std::vector<std::string>& dest);
/**
* Generates pseudo random string. It's recommended to call srand before this method.
* @param length Length of resulting string.
*/
+TGBOT_API
std::string generateRandomString(std::size_t length);
/**
@@ -45,6 +51,7 @@ std::string generateRandomString(std::size_t length);
* @param additionalLegitChars Optional. String of chars which will be not encoded in source url string.
* @return Encoded url string
*/
+TGBOT_API
std::string urlEncode(const std::string& value, const std::string& additionalLegitChars = "");
/**
@@ -52,6 +59,7 @@ std::string urlEncode(const std::string& value, const std::string& additionalLeg
* @param value Encoded url string
* @return Decoded url string
*/
+TGBOT_API
std::string urlDecode(const std::string& value);
/**