summaryrefslogtreecommitdiff
path: root/include/tgbot/tools
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/tools
parentec7affea995fef1c760f40fed7d39f1c6dafb980 (diff)
Initial support for shared builds.
Diffstat (limited to 'include/tgbot/tools')
-rw-r--r--include/tgbot/tools/FileTools.h4
-rw-r--r--include/tgbot/tools/StringTools.h8
2 files changed, 12 insertions, 0 deletions
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);
/**