mirror of
https://github.com/UltraCoderRU/telebotxx.git
synced 2026-01-28 04:05:13 +00:00
Source code reformated.
This commit is contained in:
parent
81bb25f4fe
commit
592751a50c
23 changed files with 1118 additions and 1069 deletions
|
|
@ -6,11 +6,11 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace telebotxx
|
namespace telebotxx {
|
||||||
|
|
||||||
|
class Attachment
|
||||||
{
|
{
|
||||||
class Attachment
|
public:
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum class Type
|
enum class Type
|
||||||
{
|
{
|
||||||
Audio,
|
Audio,
|
||||||
|
|
@ -34,15 +34,15 @@ namespace telebotxx
|
||||||
|
|
||||||
void swap(Attachment& other) noexcept;
|
void swap(Attachment& other) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Type attachmentType_;
|
Type attachmentType_;
|
||||||
};
|
};
|
||||||
|
|
||||||
using AttachmentPtr = std::shared_ptr<Attachment>;
|
using AttachmentPtr = std::shared_ptr<Attachment>;
|
||||||
|
|
||||||
class PhotoSize
|
class PhotoSize
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PhotoSize();
|
PhotoSize();
|
||||||
PhotoSize(const PhotoSize&);
|
PhotoSize(const PhotoSize&);
|
||||||
PhotoSize(PhotoSize&&);
|
PhotoSize(PhotoSize&&);
|
||||||
|
|
@ -64,18 +64,18 @@ namespace telebotxx
|
||||||
|
|
||||||
const PhotoSize& operator=(PhotoSize other) noexcept;
|
const PhotoSize& operator=(PhotoSize other) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string fileId_;
|
std::string fileId_;
|
||||||
int width_;
|
int width_;
|
||||||
int height_;
|
int height_;
|
||||||
int fileSize_;
|
int fileSize_;
|
||||||
};
|
};
|
||||||
|
|
||||||
using PhotoSizePtr = std::shared_ptr<PhotoSize>;
|
using PhotoSizePtr = std::shared_ptr<PhotoSize>;
|
||||||
|
|
||||||
class PhotoSizeArray : public Attachment
|
class PhotoSizeArray : public Attachment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PhotoSizeArray();
|
PhotoSizeArray();
|
||||||
PhotoSizeArray(const PhotoSizeArray&);
|
PhotoSizeArray(const PhotoSizeArray&);
|
||||||
PhotoSizeArray(PhotoSizeArray&&);
|
PhotoSizeArray(PhotoSizeArray&&);
|
||||||
|
|
@ -88,15 +88,15 @@ namespace telebotxx
|
||||||
|
|
||||||
const PhotoSizeArray& operator=(PhotoSizeArray other) noexcept;
|
const PhotoSizeArray& operator=(PhotoSizeArray other) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<PhotoSize> array_;
|
std::vector<PhotoSize> array_;
|
||||||
};
|
};
|
||||||
|
|
||||||
using PhotoSizeArrayPtr = std::shared_ptr<PhotoSizeArray>;
|
using PhotoSizeArrayPtr = std::shared_ptr<PhotoSizeArray>;
|
||||||
|
|
||||||
class Audio : public Attachment
|
class Audio : public Attachment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Audio();
|
Audio();
|
||||||
Audio(const Audio&);
|
Audio(const Audio&);
|
||||||
Audio(Audio&&);
|
Audio(Audio&&);
|
||||||
|
|
@ -124,18 +124,18 @@ namespace telebotxx
|
||||||
|
|
||||||
const Audio& operator=(Audio other) noexcept;
|
const Audio& operator=(Audio other) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string fileId_;
|
std::string fileId_;
|
||||||
int duration_;
|
int duration_;
|
||||||
std::string performer_;
|
std::string performer_;
|
||||||
std::string title_;
|
std::string title_;
|
||||||
std::string mimeType_;
|
std::string mimeType_;
|
||||||
int fileSize_;
|
int fileSize_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Document : public Attachment
|
class Document : public Attachment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Document();
|
Document();
|
||||||
Document(const Document&);
|
Document(const Document&);
|
||||||
Document(Document&&);
|
Document(Document&&);
|
||||||
|
|
@ -160,17 +160,17 @@ namespace telebotxx
|
||||||
|
|
||||||
const Document& operator=(Document other) noexcept;
|
const Document& operator=(Document other) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string fileId_;
|
std::string fileId_;
|
||||||
PhotoSizePtr thumb_;
|
PhotoSizePtr thumb_;
|
||||||
std::string fileName_;
|
std::string fileName_;
|
||||||
std::string mimeType_;
|
std::string mimeType_;
|
||||||
int fileSize_;
|
int fileSize_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Sticker : public Attachment
|
class Sticker : public Attachment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Sticker();
|
Sticker();
|
||||||
Sticker(const Sticker&);
|
Sticker(const Sticker&);
|
||||||
Sticker(Sticker&&);
|
Sticker(Sticker&&);
|
||||||
|
|
@ -198,20 +198,21 @@ namespace telebotxx
|
||||||
|
|
||||||
const Sticker& operator=(Sticker other) noexcept;
|
const Sticker& operator=(Sticker other) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string fileId_;
|
std::string fileId_;
|
||||||
int width_;
|
int width_;
|
||||||
int height_;
|
int height_;
|
||||||
PhotoSizePtr thumb_;
|
PhotoSizePtr thumb_;
|
||||||
std::string emoji_;
|
std::string emoji_;
|
||||||
int fileSize_;
|
int fileSize_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void swap(PhotoSize& lhs, PhotoSize& rhs);
|
||||||
|
void swap(PhotoSizeArray& lhs, PhotoSizeArray& rhs);
|
||||||
|
void swap(Audio& lhs, Audio& rhs);
|
||||||
|
void swap(Document& lhs, Document& rhs);
|
||||||
|
void swap(Sticker& lhs, Sticker& rhs);
|
||||||
|
|
||||||
void swap(PhotoSize& lhs, PhotoSize& rhs);
|
|
||||||
void swap(PhotoSizeArray& lhs, PhotoSizeArray& rhs);
|
|
||||||
void swap(Audio& lhs, Audio& rhs);
|
|
||||||
void swap(Document& lhs, Document& rhs);
|
|
||||||
void swap(Sticker& lhs, Sticker& rhs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TELEBOTXX_ATTACHMENT_HPP
|
#endif // TELEBOTXX_ATTACHMENT_HPP
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef TELEBOTXX_BOTAPI_H
|
#ifndef TELEBOTXX_BOTAPI_HPP
|
||||||
#define TELEBOTXX_BOTAPI_H
|
#define TELEBOTXX_BOTAPI_HPP
|
||||||
|
|
||||||
#include "User.hpp"
|
#include "User.hpp"
|
||||||
#include "Message.hpp"
|
#include "Message.hpp"
|
||||||
|
|
@ -10,24 +10,24 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace telebotxx
|
namespace telebotxx {
|
||||||
{
|
|
||||||
template <typename RequestType, typename T>
|
|
||||||
void setRequestOption(RequestType& request, T t)
|
|
||||||
{
|
|
||||||
request.setOption(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename RequestType, typename T, typename... Ts>
|
template <typename RequestType, typename T>
|
||||||
void setRequestOption(RequestType& request, T&& t, Ts&&... ts)
|
void setRequestOption(RequestType& request, T t)
|
||||||
{
|
{
|
||||||
|
request.setOption(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename RequestType, typename T, typename... Ts>
|
||||||
|
void setRequestOption(RequestType& request, T&& t, Ts&&... ts)
|
||||||
|
{
|
||||||
setRequestOption(request, std::forward<T>(t));
|
setRequestOption(request, std::forward<T>(t));
|
||||||
setRequestOption(request, std::forward<Ts>(ts)...);
|
setRequestOption(request, std::forward<Ts>(ts)...);
|
||||||
};
|
};
|
||||||
|
|
||||||
class BotApi
|
class BotApi
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// \param [in] token bot's secret token
|
/// \param [in] token bot's secret token
|
||||||
BotApi(const std::string& token);
|
BotApi(const std::string& token);
|
||||||
|
|
@ -49,7 +49,7 @@ namespace telebotxx
|
||||||
/// \param text text
|
/// \param text text
|
||||||
/// \param args parameters
|
/// \param args parameters
|
||||||
/// \return Message object, recieved from the server
|
/// \return Message object, recieved from the server
|
||||||
template<typename... Ts>
|
template <typename... Ts>
|
||||||
Message sendMessage(ChatId&& chatId, Text&& text, Ts&&... args)
|
Message sendMessage(ChatId&& chatId, Text&& text, Ts&&... args)
|
||||||
{
|
{
|
||||||
SendMessageRequest request(getTelegramMainUrl(), std::forward<ChatId>(chatId), std::forward<Text>(text));
|
SendMessageRequest request(getTelegramMainUrl(), std::forward<ChatId>(chatId), std::forward<Text>(text));
|
||||||
|
|
@ -68,7 +68,7 @@ namespace telebotxx
|
||||||
/// \param [in] photo photo
|
/// \param [in] photo photo
|
||||||
/// \param [in] args parameters
|
/// \param [in] args parameters
|
||||||
/// \return Message object, recieved from the server
|
/// \return Message object, recieved from the server
|
||||||
template<typename... Ts>
|
template <typename... Ts>
|
||||||
Message sendPhoto(ChatId&& chatId, Photo&& photo, Ts&&... args)
|
Message sendPhoto(ChatId&& chatId, Photo&& photo, Ts&&... args)
|
||||||
{
|
{
|
||||||
SendPhotoRequest request(getTelegramMainUrl(), std::forward<ChatId>(chatId), std::forward<Photo>(photo));
|
SendPhotoRequest request(getTelegramMainUrl(), std::forward<ChatId>(chatId), std::forward<Photo>(photo));
|
||||||
|
|
@ -83,12 +83,13 @@ namespace telebotxx
|
||||||
/// \return Updates (vector of Update)
|
/// \return Updates (vector of Update)
|
||||||
Updates getUpdates(int offset = 0, unsigned short limit = 0, unsigned timeout = 0);
|
Updates getUpdates(int offset = 0, unsigned short limit = 0, unsigned timeout = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string getTelegramMainUrl() const;
|
std::string getTelegramMainUrl() const;
|
||||||
|
|
||||||
class Impl;
|
class Impl;
|
||||||
std::unique_ptr<Impl> impl_;
|
std::unique_ptr<Impl> impl_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TELEBOTXX_BOTAPI_H
|
#endif // TELEBOTXX_BOTAPI_HPP
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace telebotxx
|
namespace telebotxx {
|
||||||
|
|
||||||
|
class Chat
|
||||||
{
|
{
|
||||||
class Chat
|
public:
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum class Type
|
enum class Type
|
||||||
{
|
{
|
||||||
Private,
|
Private,
|
||||||
|
|
@ -48,7 +48,7 @@ namespace telebotxx
|
||||||
|
|
||||||
const Chat& operator=(Chat other) noexcept;
|
const Chat& operator=(Chat other) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::int64_t id_;
|
std::int64_t id_;
|
||||||
Type type_;
|
Type type_;
|
||||||
std::string title_;
|
std::string title_;
|
||||||
|
|
@ -56,13 +56,14 @@ namespace telebotxx
|
||||||
std::string firstName_;
|
std::string firstName_;
|
||||||
std::string lastName_;
|
std::string lastName_;
|
||||||
bool allAdmins_;
|
bool allAdmins_;
|
||||||
};
|
};
|
||||||
|
|
||||||
using ChatPtr = std::shared_ptr<Chat>;
|
using ChatPtr = std::shared_ptr<Chat>;
|
||||||
|
|
||||||
void swap(Chat& lhs, Chat& rhs);
|
void swap(Chat& lhs, Chat& rhs);
|
||||||
|
|
||||||
|
Chat::Type chatTypeFromString(const std::string& str);
|
||||||
|
|
||||||
Chat::Type chatTypeFromString(const std::string& str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TELEBOTXX_CHAT_HPP
|
#endif // TELEBOTXX_CHAT_HPP
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,20 @@
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace telebotxx
|
namespace telebotxx {
|
||||||
|
|
||||||
|
class ParseError : public std::invalid_argument
|
||||||
{
|
{
|
||||||
class ParseError : public std::invalid_argument
|
public:
|
||||||
{
|
|
||||||
public:
|
|
||||||
ParseError(const std::string& message)
|
ParseError(const std::string& message)
|
||||||
: std::invalid_argument(message)
|
: std::invalid_argument(message)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ApiError : public std::runtime_error
|
class ApiError : public std::runtime_error
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ApiError(int code, const std::string& message)
|
ApiError(int code, const std::string& message)
|
||||||
: std::runtime_error(message), code_(code)
|
: std::runtime_error(message), code_(code)
|
||||||
{
|
{
|
||||||
|
|
@ -27,9 +27,9 @@ namespace telebotxx
|
||||||
return code_;
|
return code_;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int code_;
|
int code_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
#ifndef TELEBOTXX_LOGGING_HPP
|
#ifndef TELEBOTXX_LOGGING_HPP
|
||||||
#define TELEBOTXX_LOGGING_HPP
|
#define TELEBOTXX_LOGGING_HPP
|
||||||
|
|
||||||
namespace telebotxx
|
namespace telebotxx {
|
||||||
{
|
|
||||||
extern bool debugMode;
|
extern bool debugMode;
|
||||||
|
|
||||||
|
/// \brief Enable/disable debug output
|
||||||
|
void setDebugMode(bool enabled);
|
||||||
|
|
||||||
/// \brief Enable/disable debug output
|
|
||||||
void setDebugMode(bool enabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TELEBOTXX_LOGGING_HPP
|
#endif // TELEBOTXX_LOGGING_HPP
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace telebotxx
|
namespace telebotxx {
|
||||||
|
|
||||||
|
class MessageEntity
|
||||||
{
|
{
|
||||||
class MessageEntity
|
public:
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum class Type
|
enum class Type
|
||||||
{
|
{
|
||||||
Mention,
|
Mention,
|
||||||
|
|
@ -53,24 +53,24 @@ namespace telebotxx
|
||||||
|
|
||||||
const MessageEntity& operator=(MessageEntity other);
|
const MessageEntity& operator=(MessageEntity other);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Type type_;
|
Type type_;
|
||||||
int offset_;
|
int offset_;
|
||||||
std::size_t length_;
|
std::size_t length_;
|
||||||
std::string url_;
|
std::string url_;
|
||||||
User user_;
|
User user_;
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageEntity::Type messageEntityTypeFromString(const std::string& str);
|
MessageEntity::Type messageEntityTypeFromString(const std::string& str);
|
||||||
|
|
||||||
using MessageEntities = std::vector<MessageEntity>;
|
using MessageEntities = std::vector<MessageEntity>;
|
||||||
|
|
||||||
class Message;
|
class Message;
|
||||||
using MessagePtr = std::shared_ptr<Message>;
|
using MessagePtr = std::shared_ptr<Message>;
|
||||||
|
|
||||||
class Message
|
class Message
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Message();
|
Message();
|
||||||
Message(const Message&);
|
Message(const Message&);
|
||||||
Message(Message&&);
|
Message(Message&&);
|
||||||
|
|
@ -152,7 +152,7 @@ namespace telebotxx
|
||||||
|
|
||||||
const Message& operator=(Message other) noexcept;
|
const Message& operator=(Message other) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int id_;
|
int id_;
|
||||||
UserPtr from_;
|
UserPtr from_;
|
||||||
std::time_t date_;
|
std::time_t date_;
|
||||||
|
|
@ -177,9 +177,10 @@ namespace telebotxx
|
||||||
std::int64_t migrateToChatId_;
|
std::int64_t migrateToChatId_;
|
||||||
std::int64_t migrateFromChatId_;
|
std::int64_t migrateFromChatId_;
|
||||||
MessagePtr pinnedMessage_;
|
MessagePtr pinnedMessage_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void swap(Message& lhs, Message& rhs);
|
||||||
|
|
||||||
void swap(Message& lhs, Message& rhs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TELEBOTXX_MESSAGE_HPP
|
#endif // TELEBOTXX_MESSAGE_HPP
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace telebotxx
|
namespace telebotxx {
|
||||||
|
|
||||||
|
class ChatId
|
||||||
{
|
{
|
||||||
class ChatId
|
public:
|
||||||
{
|
|
||||||
public:
|
|
||||||
ChatId(int);
|
ChatId(int);
|
||||||
ChatId(const std::string&);
|
ChatId(const std::string&);
|
||||||
ChatId(const ChatId&);
|
ChatId(const ChatId&);
|
||||||
|
|
@ -19,87 +19,87 @@ namespace telebotxx
|
||||||
Type getType() const;
|
Type getType() const;
|
||||||
const int getId() const;
|
const int getId() const;
|
||||||
const std::string getUsername() const;
|
const std::string getUsername() const;
|
||||||
private:
|
private:
|
||||||
Type type_;
|
Type type_;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
int id_;
|
int id_;
|
||||||
std::string username_;
|
std::string username_;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
using Text = std::string;
|
using Text = std::string;
|
||||||
using Caption = std::string;
|
using Caption = std::string;
|
||||||
|
|
||||||
enum class ParseMode
|
enum class ParseMode
|
||||||
{
|
{
|
||||||
Plain,
|
Plain,
|
||||||
Markdown,
|
Markdown,
|
||||||
Html
|
Html
|
||||||
};
|
};
|
||||||
|
|
||||||
class DisableWebPagePreview
|
class DisableWebPagePreview
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DisableWebPagePreview(bool disabled = true);
|
DisableWebPagePreview(bool disabled = true);
|
||||||
bool value() const;
|
bool value() const;
|
||||||
private:
|
private:
|
||||||
bool disable_;
|
bool disable_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DisableNotification
|
class DisableNotification
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DisableNotification(bool disabled = true);
|
DisableNotification(bool disabled = true);
|
||||||
bool value() const;
|
bool value() const;
|
||||||
private:
|
private:
|
||||||
bool disable_;
|
bool disable_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ReplyTo
|
class ReplyTo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit ReplyTo(int id);
|
explicit ReplyTo(int id);
|
||||||
int value() const;
|
int value() const;
|
||||||
private:
|
private:
|
||||||
int id_;
|
int id_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Buffer
|
class Buffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Buffer(const char* buffer, std::size_t size, const std::string& filename);
|
Buffer(const char *buffer, std::size_t size, const std::string& filename);
|
||||||
explicit Buffer(const std::vector<char>& data, const std::string& filename);
|
explicit Buffer(const std::vector<char>& data, const std::string& filename);
|
||||||
const char* data() const;
|
const char *data() const;
|
||||||
const std::size_t size() const;
|
const std::size_t size() const;
|
||||||
const std::string filename() const;
|
const std::string filename() const;
|
||||||
private:
|
private:
|
||||||
const char* data_;
|
const char *data_;
|
||||||
std::size_t size_;
|
std::size_t size_;
|
||||||
std::string filename_;
|
std::string filename_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class File
|
class File
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit File(const std::string& filename);
|
explicit File(const std::string& filename);
|
||||||
const std::string& getFilename() const;
|
const std::string& getFilename() const;
|
||||||
private:
|
private:
|
||||||
std::string filename_;
|
std::string filename_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Url
|
class Url
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Url(const std::string& url);
|
explicit Url(const std::string& url);
|
||||||
const std::string& getUrl() const;
|
const std::string& getUrl() const;
|
||||||
private:
|
private:
|
||||||
std::string url_;
|
std::string url_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Photo
|
class Photo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Photo(int id);
|
explicit Photo(int id);
|
||||||
explicit Photo(const Buffer&);
|
explicit Photo(const Buffer&);
|
||||||
explicit Photo(const File&);
|
explicit Photo(const File&);
|
||||||
|
|
@ -108,7 +108,7 @@ namespace telebotxx
|
||||||
Photo(Photo&&);
|
Photo(Photo&&);
|
||||||
~Photo();
|
~Photo();
|
||||||
|
|
||||||
enum class Type { Id, Buffer, File, Url};
|
enum class Type { Id, Buffer, File, Url };
|
||||||
Type getType() const;
|
Type getType() const;
|
||||||
|
|
||||||
int getId() const;
|
int getId() const;
|
||||||
|
|
@ -116,7 +116,7 @@ namespace telebotxx
|
||||||
const File& getFile() const;
|
const File& getFile() const;
|
||||||
const Url& getUrl() const;
|
const Url& getUrl() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Type type_;
|
Type type_;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
|
@ -125,7 +125,8 @@ namespace telebotxx
|
||||||
File file_;
|
File file_;
|
||||||
Url url_;
|
Url url_;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TELEBOTXX_REQUEST_OPTIONS_HPP
|
#endif // TELEBOTXX_REQUEST_OPTIONS_HPP
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,14 @@
|
||||||
#include <telebotxx/RequestOptions.hpp>
|
#include <telebotxx/RequestOptions.hpp>
|
||||||
#include <telebotxx/Message.hpp>
|
#include <telebotxx/Message.hpp>
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace telebotxx
|
namespace telebotxx {
|
||||||
|
|
||||||
|
class SendMessageRequest
|
||||||
{
|
{
|
||||||
class SendMessageRequest
|
public:
|
||||||
{
|
|
||||||
public:
|
|
||||||
SendMessageRequest(const std::string& telegramMainUrl, const ChatId& chat, const Text& text);
|
SendMessageRequest(const std::string& telegramMainUrl, const ChatId& chat, const Text& text);
|
||||||
~SendMessageRequest();
|
~SendMessageRequest();
|
||||||
|
|
||||||
|
|
@ -29,10 +27,11 @@ namespace telebotxx
|
||||||
|
|
||||||
Message execute();
|
Message execute();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Impl;
|
class Impl;
|
||||||
std::unique_ptr<Impl> impl_;
|
std::unique_ptr<Impl> impl_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TELEBOTXX_SEND_MESSAGE_REQUEST_HPP
|
#endif // TELEBOTXX_SEND_MESSAGE_REQUEST_HPP
|
||||||
|
|
|
||||||
|
|
@ -4,32 +4,32 @@
|
||||||
#include <telebotxx/RequestOptions.hpp>
|
#include <telebotxx/RequestOptions.hpp>
|
||||||
#include <telebotxx/Message.hpp>
|
#include <telebotxx/Message.hpp>
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace telebotxx
|
namespace telebotxx {
|
||||||
|
|
||||||
|
class SendPhotoRequest
|
||||||
{
|
{
|
||||||
class SendPhotoRequest
|
public:
|
||||||
{
|
|
||||||
public:
|
|
||||||
SendPhotoRequest(const std::string& telegramMainUrl, const ChatId& chat, const Photo& photo);
|
SendPhotoRequest(const std::string& telegramMainUrl, const ChatId& chat, const Photo& photo);
|
||||||
~SendPhotoRequest();
|
~SendPhotoRequest();
|
||||||
|
|
||||||
void setCaption(const Caption& caption);
|
void setCaption(const Caption& caption);
|
||||||
void setDisableNotification(const DisableNotification& disableNotification);
|
void setDisableNotification(const DisableNotification& disableNotification);
|
||||||
void setReplyToMessageId(const ReplyTo& replyToMessageId);
|
void setReplyToMessageId(const ReplyTo& replyToMessageId);
|
||||||
|
|
||||||
void setOption(const Caption& caption);
|
void setOption(const Caption& caption);
|
||||||
void setOption(const DisableNotification& disableNotification);
|
void setOption(const DisableNotification& disableNotification);
|
||||||
void setOption(const ReplyTo& replyToMessageId);
|
void setOption(const ReplyTo& replyToMessageId);
|
||||||
|
|
||||||
Message execute();
|
Message execute();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Impl;
|
class Impl;
|
||||||
std::unique_ptr<Impl> impl_;
|
std::unique_ptr<Impl> impl_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TELEBOTXX_SEND_PHOTO_REQUEST_HPP
|
#endif // TELEBOTXX_SEND_PHOTO_REQUEST_HPP
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace telebotxx
|
namespace telebotxx {
|
||||||
|
|
||||||
|
class Update
|
||||||
{
|
{
|
||||||
class Update
|
public:
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum class Type
|
enum class Type
|
||||||
{
|
{
|
||||||
Message,
|
Message,
|
||||||
|
|
@ -30,17 +30,17 @@ namespace telebotxx
|
||||||
|
|
||||||
void swap(Update& other) noexcept;
|
void swap(Update& other) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int id_;
|
int id_;
|
||||||
Type updateType_;
|
Type updateType_;
|
||||||
};
|
};
|
||||||
|
|
||||||
using UpdatePtr = std::shared_ptr<Update>;
|
using UpdatePtr = std::shared_ptr<Update>;
|
||||||
using Updates = std::vector<UpdatePtr>;
|
using Updates = std::vector<UpdatePtr>;
|
||||||
|
|
||||||
class MessageUpdate : public Update
|
class MessageUpdate : public Update
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MessageUpdate(int id, const Message& message);
|
MessageUpdate(int id, const Message& message);
|
||||||
MessageUpdate(const MessageUpdate&);
|
MessageUpdate(const MessageUpdate&);
|
||||||
MessageUpdate(MessageUpdate&&);
|
MessageUpdate(MessageUpdate&&);
|
||||||
|
|
@ -52,13 +52,13 @@ namespace telebotxx
|
||||||
|
|
||||||
const MessageUpdate& operator=(MessageUpdate other);
|
const MessageUpdate& operator=(MessageUpdate other);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Message message_;
|
Message message_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EditedMessageUpdate: public MessageUpdate
|
class EditedMessageUpdate : public MessageUpdate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EditedMessageUpdate(int id, const Message& message);
|
EditedMessageUpdate(int id, const Message& message);
|
||||||
EditedMessageUpdate(const EditedMessageUpdate&);
|
EditedMessageUpdate(const EditedMessageUpdate&);
|
||||||
EditedMessageUpdate(EditedMessageUpdate&&);
|
EditedMessageUpdate(EditedMessageUpdate&&);
|
||||||
|
|
@ -67,7 +67,7 @@ namespace telebotxx
|
||||||
void swap(EditedMessageUpdate& other) noexcept;
|
void swap(EditedMessageUpdate& other) noexcept;
|
||||||
|
|
||||||
const EditedMessageUpdate& operator=(EditedMessageUpdate other);
|
const EditedMessageUpdate& operator=(EditedMessageUpdate other);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace telebotxx
|
namespace telebotxx {
|
||||||
|
|
||||||
|
class User
|
||||||
{
|
{
|
||||||
class User
|
public:
|
||||||
{
|
|
||||||
public:
|
|
||||||
User();
|
User();
|
||||||
User(const User&);
|
User(const User&);
|
||||||
User(User&&);
|
User(User&&);
|
||||||
|
|
@ -45,16 +45,17 @@ namespace telebotxx
|
||||||
|
|
||||||
const User& operator=(User other);
|
const User& operator=(User other);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int id_;
|
int id_;
|
||||||
std::string firstName_;
|
std::string firstName_;
|
||||||
std::string lastName_;
|
std::string lastName_;
|
||||||
std::string username_;
|
std::string username_;
|
||||||
};
|
};
|
||||||
|
|
||||||
using UserPtr = std::shared_ptr<User>;
|
using UserPtr = std::shared_ptr<User>;
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& os, const User& user);
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const User& user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TELEBOTXX_USER_H
|
#endif // TELEBOTXX_USER_H
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <telebotxx/Attachment.hpp>
|
#include <telebotxx/Attachment.hpp>
|
||||||
|
|
||||||
using namespace telebotxx;
|
namespace telebotxx {
|
||||||
|
|
||||||
Attachment::Attachment(Type type)
|
Attachment::Attachment(Type type)
|
||||||
: attachmentType_(type)
|
: attachmentType_(type)
|
||||||
|
|
@ -8,7 +8,9 @@ Attachment::Attachment(Type type)
|
||||||
}
|
}
|
||||||
|
|
||||||
Attachment::Attachment(const Attachment&) = default;
|
Attachment::Attachment(const Attachment&) = default;
|
||||||
|
|
||||||
Attachment::Attachment(Attachment&&) = default;
|
Attachment::Attachment(Attachment&&) = default;
|
||||||
|
|
||||||
Attachment::~Attachment() = default;
|
Attachment::~Attachment() = default;
|
||||||
|
|
||||||
Attachment::Type Attachment::getType() const
|
Attachment::Type Attachment::getType() const
|
||||||
|
|
@ -31,7 +33,9 @@ PhotoSize::PhotoSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
PhotoSize::PhotoSize(const PhotoSize&) = default;
|
PhotoSize::PhotoSize(const PhotoSize&) = default;
|
||||||
|
|
||||||
PhotoSize::PhotoSize(PhotoSize&&) = default;
|
PhotoSize::PhotoSize(PhotoSize&&) = default;
|
||||||
|
|
||||||
PhotoSize::~PhotoSize() = default;
|
PhotoSize::~PhotoSize() = default;
|
||||||
|
|
||||||
const std::string& PhotoSize::getFileId() const
|
const std::string& PhotoSize::getFileId() const
|
||||||
|
|
@ -97,7 +101,9 @@ PhotoSizeArray::PhotoSizeArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
PhotoSizeArray::PhotoSizeArray(const PhotoSizeArray&) = default;
|
PhotoSizeArray::PhotoSizeArray(const PhotoSizeArray&) = default;
|
||||||
|
|
||||||
PhotoSizeArray::PhotoSizeArray(PhotoSizeArray&&) = default;
|
PhotoSizeArray::PhotoSizeArray(PhotoSizeArray&&) = default;
|
||||||
|
|
||||||
PhotoSizeArray::~PhotoSizeArray() = default;
|
PhotoSizeArray::~PhotoSizeArray() = default;
|
||||||
|
|
||||||
const std::vector<PhotoSize>& PhotoSizeArray::getArray() const
|
const std::vector<PhotoSize>& PhotoSizeArray::getArray() const
|
||||||
|
|
@ -132,7 +138,9 @@ Audio::Audio()
|
||||||
}
|
}
|
||||||
|
|
||||||
Audio::Audio(const Audio&) = default;
|
Audio::Audio(const Audio&) = default;
|
||||||
|
|
||||||
Audio::Audio(Audio&&) = default;
|
Audio::Audio(Audio&&) = default;
|
||||||
|
|
||||||
Audio::~Audio() = default;
|
Audio::~Audio() = default;
|
||||||
|
|
||||||
const std::string& Audio::getFileId() const
|
const std::string& Audio::getFileId() const
|
||||||
|
|
@ -222,7 +230,9 @@ Document::Document()
|
||||||
}
|
}
|
||||||
|
|
||||||
Document::Document(const Document&) = default;
|
Document::Document(const Document&) = default;
|
||||||
|
|
||||||
Document::Document(Document&&) = default;
|
Document::Document(Document&&) = default;
|
||||||
|
|
||||||
Document::~Document() = default;
|
Document::~Document() = default;
|
||||||
|
|
||||||
const std::string& Document::getFileId() const
|
const std::string& Document::getFileId() const
|
||||||
|
|
@ -301,7 +311,9 @@ Sticker::Sticker()
|
||||||
}
|
}
|
||||||
|
|
||||||
Sticker::Sticker(const Sticker&) = default;
|
Sticker::Sticker(const Sticker&) = default;
|
||||||
|
|
||||||
Sticker::Sticker(Sticker&&) = default;
|
Sticker::Sticker(Sticker&&) = default;
|
||||||
|
|
||||||
Sticker::~Sticker() = default;
|
Sticker::~Sticker() = default;
|
||||||
|
|
||||||
const std::string& Sticker::getFileId() const
|
const std::string& Sticker::getFileId() const
|
||||||
|
|
@ -384,27 +396,29 @@ const Sticker& Sticker::operator=(Sticker other) noexcept
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void telebotxx::swap(PhotoSize& lhs, PhotoSize& rhs)
|
void swap(PhotoSize& lhs, PhotoSize& rhs)
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void telebotxx::swap(PhotoSizeArray& lhs, PhotoSizeArray& rhs)
|
void swap(PhotoSizeArray& lhs, PhotoSizeArray& rhs)
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void telebotxx::swap(Audio& lhs, Audio& rhs)
|
void swap(Audio& lhs, Audio& rhs)
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void telebotxx::swap(Document& lhs, Document& rhs)
|
void swap(Document& lhs, Document& rhs)
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void telebotxx::swap(Sticker& lhs, Sticker& rhs)
|
void swap(Sticker& lhs, Sticker& rhs)
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
#include <cpr/cpr.h>
|
#include <cpr/cpr.h>
|
||||||
|
|
||||||
using namespace telebotxx;
|
namespace telebotxx {
|
||||||
|
|
||||||
class BotApi::Impl
|
class BotApi::Impl
|
||||||
{
|
{
|
||||||
|
|
@ -181,3 +181,5 @@ std::string BotApi::getTelegramMainUrl() const
|
||||||
{
|
{
|
||||||
return impl_->getTelegramMainUrl();
|
return impl_->getTelegramMainUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
10
src/Chat.cpp
10
src/Chat.cpp
|
|
@ -1,7 +1,7 @@
|
||||||
#include <telebotxx/Chat.hpp>
|
#include <telebotxx/Chat.hpp>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
using namespace telebotxx;
|
namespace telebotxx {
|
||||||
|
|
||||||
Chat::Chat()
|
Chat::Chat()
|
||||||
: id_(-1),
|
: id_(-1),
|
||||||
|
|
@ -11,7 +11,9 @@ Chat::Chat()
|
||||||
}
|
}
|
||||||
|
|
||||||
Chat::Chat(const Chat&) = default;
|
Chat::Chat(const Chat&) = default;
|
||||||
|
|
||||||
Chat::Chat(Chat&&) = default;
|
Chat::Chat(Chat&&) = default;
|
||||||
|
|
||||||
Chat::~Chat() = default;
|
Chat::~Chat() = default;
|
||||||
|
|
||||||
std::int64_t Chat::getId() const
|
std::int64_t Chat::getId() const
|
||||||
|
|
@ -102,12 +104,12 @@ const Chat& Chat::operator=(Chat other) noexcept
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void telebotxx::swap(Chat& lhs, Chat& rhs)
|
void swap(Chat& lhs, Chat& rhs)
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
Chat::Type telebotxx::chatTypeFromString(const std::string& str)
|
Chat::Type chatTypeFromString(const std::string& str)
|
||||||
{
|
{
|
||||||
if (str == "private")
|
if (str == "private")
|
||||||
return Chat::Type::Private;
|
return Chat::Type::Private;
|
||||||
|
|
@ -120,3 +122,5 @@ Chat::Type telebotxx::chatTypeFromString(const std::string& str)
|
||||||
else
|
else
|
||||||
throw std::invalid_argument("Unknown chat type");
|
throw std::invalid_argument("Unknown chat type");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,47 +3,47 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace telebotxx
|
namespace telebotxx {
|
||||||
|
namespace impl {
|
||||||
|
|
||||||
|
template<typename T> bool is(const rapidjson::Value& obj);
|
||||||
|
template<> bool is<int>(const rapidjson::Value& obj) { return obj.IsInt(); }
|
||||||
|
template<> bool is<std::int64_t>(const rapidjson::Value& obj) { return obj.IsInt64(); }
|
||||||
|
template<> bool is<bool>(const rapidjson::Value& obj) { return obj.IsBool(); }
|
||||||
|
template<> bool is<std::string>(const rapidjson::Value& obj) { return obj.IsString(); }
|
||||||
|
|
||||||
|
template<typename T> const T get(const rapidjson::Value& obj);
|
||||||
|
template<> const int get(const rapidjson::Value& obj) { return obj.GetInt(); }
|
||||||
|
template<> const std::int64_t get(const rapidjson::Value& obj) { return obj.GetInt64(); }
|
||||||
|
template<> const bool get(const rapidjson::Value& obj) { return obj.GetBool(); }
|
||||||
|
template<> const std::string get(const rapidjson::Value& obj) { return obj.GetString(); }
|
||||||
|
|
||||||
|
template<typename T> const T null();
|
||||||
|
template<> const int null() { return 0; }
|
||||||
|
template<> const std::int64_t null() { return 0; }
|
||||||
|
template<> const bool null() { return false; }
|
||||||
|
template<> const std::string null() { return ""; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
const T parse(const rapidjson::Value& obj, const char* name, bool required)
|
||||||
{
|
{
|
||||||
namespace impl
|
|
||||||
{
|
|
||||||
template<typename T> bool is(const rapidjson::Value& obj);
|
|
||||||
template<> bool is<int>(const rapidjson::Value& obj) { return obj.IsInt(); }
|
|
||||||
template<> bool is<std::int64_t>(const rapidjson::Value& obj) { return obj.IsInt64(); }
|
|
||||||
template<> bool is<bool>(const rapidjson::Value& obj) { return obj.IsBool(); }
|
|
||||||
template<> bool is<std::string>(const rapidjson::Value& obj) { return obj.IsString(); }
|
|
||||||
|
|
||||||
template<typename T> const T get(const rapidjson::Value& obj);
|
|
||||||
template<> const int get(const rapidjson::Value& obj) { return obj.GetInt(); }
|
|
||||||
template<> const std::int64_t get(const rapidjson::Value& obj) { return obj.GetInt64(); }
|
|
||||||
template<> const bool get(const rapidjson::Value& obj) { return obj.GetBool(); }
|
|
||||||
template<> const std::string get(const rapidjson::Value& obj) { return obj.GetString(); }
|
|
||||||
|
|
||||||
template<typename T> const T null();
|
|
||||||
template<> const int null() { return 0; }
|
|
||||||
template<> const std::int64_t null() { return 0; }
|
|
||||||
template<> const bool null() { return false; }
|
|
||||||
template<> const std::string null() { return ""; }
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
const T parse(const rapidjson::Value& obj, const char* name, bool required)
|
|
||||||
{
|
|
||||||
if (obj.HasMember(name))
|
if (obj.HasMember(name))
|
||||||
{
|
{
|
||||||
if (impl::is<T>(obj[name]))
|
if (impl::is<T>(obj[name]))
|
||||||
return impl::get<T>(obj[name]);
|
return impl::get<T>(obj[name]);
|
||||||
else
|
else
|
||||||
throw ParseError(std::string("Field '")+ name + "' has invalid type");
|
throw ParseError(std::string("Field '") + name + "' has invalid type");
|
||||||
}
|
}
|
||||||
else if (required)
|
else if (required)
|
||||||
throw ParseError(std::string("Field '")+ name + "' not found");
|
throw ParseError(std::string("Field '") + name + "' not found");
|
||||||
else
|
else
|
||||||
return impl::null<T>();
|
return impl::null<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
const rapidjson::Value& parseObject(const rapidjson::Value& parent, const char* name, bool required, bool& found)
|
const rapidjson::Value& parseObject(const rapidjson::Value& parent, const char* name, bool required, bool& found)
|
||||||
{
|
{
|
||||||
if (parent.HasMember(name))
|
if (parent.HasMember(name))
|
||||||
{
|
{
|
||||||
if (parent[name].IsObject())
|
if (parent[name].IsObject())
|
||||||
|
|
@ -52,19 +52,19 @@ namespace telebotxx
|
||||||
return parent[name];
|
return parent[name];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw ParseError(std::string("Field '")+ name + "' has invalid type");
|
throw ParseError(std::string("Field '") + name + "' has invalid type");
|
||||||
}
|
}
|
||||||
else if (required)
|
else if (required)
|
||||||
throw ParseError(std::string("Field '")+ name + "' not found");
|
throw ParseError(std::string("Field '") + name + "' not found");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
found = false;
|
found = false;
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const rapidjson::Value& parseArray(const rapidjson::Value& parent, const char* name, bool required, bool& found)
|
const rapidjson::Value& parseArray(const rapidjson::Value& parent, const char* name, bool required, bool& found)
|
||||||
{
|
{
|
||||||
if (parent.HasMember(name))
|
if (parent.HasMember(name))
|
||||||
{
|
{
|
||||||
if (parent[name].IsArray())
|
if (parent[name].IsArray())
|
||||||
|
|
@ -73,29 +73,29 @@ namespace telebotxx
|
||||||
return parent[name];
|
return parent[name];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw ParseError(std::string("Field '")+ name + "' has invalid type");
|
throw ParseError(std::string("Field '") + name + "' has invalid type");
|
||||||
}
|
}
|
||||||
else if (required)
|
else if (required)
|
||||||
throw ParseError(std::string("Field '")+ name + "' not found");
|
throw ParseError(std::string("Field '") + name + "' not found");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
found = false;
|
found = false;
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PhotoSize> parsePhotoSize(const rapidjson::Value& obj)
|
std::unique_ptr<PhotoSize> parsePhotoSize(const rapidjson::Value& obj)
|
||||||
{
|
{
|
||||||
auto photo = std::make_unique<PhotoSize>();
|
auto photo = std::make_unique<PhotoSize>();
|
||||||
photo->setFileId(parse<std::string>(obj, "file_id", REQUIRED));
|
photo->setFileId(parse<std::string>(obj, "file_id", REQUIRED));
|
||||||
photo->setWidth(parse<int>(obj, "width", REQUIRED));
|
photo->setWidth(parse<int>(obj, "width", REQUIRED));
|
||||||
photo->setHeight(parse<int>(obj, "height", REQUIRED));
|
photo->setHeight(parse<int>(obj, "height", REQUIRED));
|
||||||
photo->setFileSize(parse<int>(obj, "file_size", OPTIONAL));
|
photo->setFileSize(parse<int>(obj, "file_size", OPTIONAL));
|
||||||
return photo;
|
return photo;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PhotoSize> parsePhotoSize(const rapidjson::Value& parent, const char* name, bool required)
|
std::unique_ptr<PhotoSize> parsePhotoSize(const rapidjson::Value& parent, const char* name, bool required)
|
||||||
{
|
{
|
||||||
bool found;
|
bool found;
|
||||||
auto& obj = parseObject(parent, name, required, found);
|
auto& obj = parseObject(parent, name, required, found);
|
||||||
if (found)
|
if (found)
|
||||||
|
|
@ -104,10 +104,10 @@ namespace telebotxx
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PhotoSizeArray> parsePhotoSizeArray(const rapidjson::Value& parent, const char* name, bool required)
|
std::unique_ptr<PhotoSizeArray> parsePhotoSizeArray(const rapidjson::Value& parent, const char* name, bool required)
|
||||||
{
|
{
|
||||||
bool found;
|
bool found;
|
||||||
auto& obj = parseArray(parent, name, required, found);
|
auto& obj = parseArray(parent, name, required, found);
|
||||||
if (found)
|
if (found)
|
||||||
|
|
@ -124,10 +124,10 @@ namespace telebotxx
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Audio> parseAudio(const rapidjson::Value& parent, const char* name, bool required)
|
std::unique_ptr<Audio> parseAudio(const rapidjson::Value& parent, const char* name, bool required)
|
||||||
{
|
{
|
||||||
bool found;
|
bool found;
|
||||||
auto& obj = parseObject(parent, name, required, found);
|
auto& obj = parseObject(parent, name, required, found);
|
||||||
if (found)
|
if (found)
|
||||||
|
|
@ -143,10 +143,10 @@ namespace telebotxx
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Document> parseDocument(const rapidjson::Value& parent, const char* name, bool required)
|
std::unique_ptr<Document> parseDocument(const rapidjson::Value& parent, const char* name, bool required)
|
||||||
{
|
{
|
||||||
bool found;
|
bool found;
|
||||||
auto& obj = parseObject(parent, name, required, found);
|
auto& obj = parseObject(parent, name, required, found);
|
||||||
if (found)
|
if (found)
|
||||||
|
|
@ -161,10 +161,10 @@ namespace telebotxx
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Sticker> parseSticker(const rapidjson::Value& parent, const char* name, bool required)
|
std::unique_ptr<Sticker> parseSticker(const rapidjson::Value& parent, const char* name, bool required)
|
||||||
{
|
{
|
||||||
bool found;
|
bool found;
|
||||||
auto& obj = parseObject(parent, name, required, found);
|
auto& obj = parseObject(parent, name, required, found);
|
||||||
if (found)
|
if (found)
|
||||||
|
|
@ -180,10 +180,10 @@ namespace telebotxx
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Message> parseMessage(const rapidjson::Value& parent, const char* name, bool required)
|
std::unique_ptr<Message> parseMessage(const rapidjson::Value& parent, const char* name, bool required)
|
||||||
{
|
{
|
||||||
bool found;
|
bool found;
|
||||||
auto& obj = parseObject(parent, name, required, found);
|
auto& obj = parseObject(parent, name, required, found);
|
||||||
if (found)
|
if (found)
|
||||||
|
|
@ -227,10 +227,10 @@ namespace telebotxx
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Chat> parseChat(const rapidjson::Value& parent, const char* name, bool required)
|
std::unique_ptr<Chat> parseChat(const rapidjson::Value& parent, const char* name, bool required)
|
||||||
{
|
{
|
||||||
bool found;
|
bool found;
|
||||||
auto& obj = parseObject(parent, name, required, found);
|
auto& obj = parseObject(parent, name, required, found);
|
||||||
if (found)
|
if (found)
|
||||||
|
|
@ -247,10 +247,10 @@ namespace telebotxx
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Update> parseUpdate(const rapidjson::Value& obj)
|
std::unique_ptr<Update> parseUpdate(const rapidjson::Value& obj)
|
||||||
{
|
{
|
||||||
int id = parse<int>(obj, "update_id", REQUIRED);
|
int id = parse<int>(obj, "update_id", REQUIRED);
|
||||||
|
|
||||||
std::unique_ptr<Message> message;
|
std::unique_ptr<Message> message;
|
||||||
|
|
@ -261,10 +261,10 @@ namespace telebotxx
|
||||||
/// \todo: other updates
|
/// \todo: other updates
|
||||||
else
|
else
|
||||||
throw ParseError("Unknown update type");
|
throw ParseError("Unknown update type");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Updates> parseUpdates(const rapidjson::Value& parent, const char* name, bool required)
|
std::unique_ptr<Updates> parseUpdates(const rapidjson::Value& parent, const char* name, bool required)
|
||||||
{
|
{
|
||||||
bool found;
|
bool found;
|
||||||
auto& obj = parseArray(parent, name, required, found);
|
auto& obj = parseArray(parent, name, required, found);
|
||||||
if (found)
|
if (found)
|
||||||
|
|
@ -279,10 +279,10 @@ namespace telebotxx
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<User> parseUser(const rapidjson::Value& parent, const char* name, bool required)
|
std::unique_ptr<User> parseUser(const rapidjson::Value& parent, const char* name, bool required)
|
||||||
{
|
{
|
||||||
bool found;
|
bool found;
|
||||||
auto& obj = parseObject(parent, name, required, found);
|
auto& obj = parseObject(parent, name, required, found);
|
||||||
if (found)
|
if (found)
|
||||||
|
|
@ -296,10 +296,10 @@ namespace telebotxx
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkResponse(const rapidjson::Document& doc)
|
void checkResponse(const rapidjson::Document& doc)
|
||||||
{
|
{
|
||||||
if (!doc.IsObject())
|
if (!doc.IsObject())
|
||||||
throw ParseError("Object expected");
|
throw ParseError("Object expected");
|
||||||
|
|
||||||
|
|
@ -311,5 +311,6 @@ namespace telebotxx
|
||||||
std::string description(parse<std::string>(doc, "description", REQUIRED));
|
std::string description(parse<std::string>(doc, "description", REQUIRED));
|
||||||
throw ApiError(code, description);
|
throw ApiError(code, description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,44 +10,45 @@
|
||||||
|
|
||||||
#include <rapidjson/document.h>
|
#include <rapidjson/document.h>
|
||||||
|
|
||||||
namespace telebotxx
|
namespace telebotxx {
|
||||||
{
|
|
||||||
const bool REQUIRED = true;
|
|
||||||
const bool OPTIONAL = false;
|
|
||||||
|
|
||||||
/// \brief Parse JSON object to Chat
|
const bool REQUIRED = true;
|
||||||
/// \param parent reference to parent JSON object
|
const bool OPTIONAL = false;
|
||||||
/// \param name field with Chat object
|
|
||||||
/// \param required REQUIRED or OPTIONAL
|
|
||||||
/// \return pointer to Chat
|
|
||||||
std::unique_ptr<Chat> parseChat(const rapidjson::Value& parent, const char* name, bool required);
|
|
||||||
|
|
||||||
/// \brief Parse JSON object to User
|
/// \brief Parse JSON object to Chat
|
||||||
/// \param parent reference to parent JSON object
|
/// \param parent reference to parent JSON object
|
||||||
/// \param name field with Document object
|
/// \param name field with Chat object
|
||||||
/// \param required REQUIRED or OPTIONAL
|
/// \param required REQUIRED or OPTIONAL
|
||||||
/// \return pointer to User
|
/// \return pointer to Chat
|
||||||
std::unique_ptr<User> parseUser(const rapidjson::Value& parent, const char* name, bool required);
|
std::unique_ptr<Chat> parseChat(const rapidjson::Value& parent, const char* name, bool required);
|
||||||
|
|
||||||
/// \brief Parse JSON object to Message
|
/// \brief Parse JSON object to User
|
||||||
/// \param parent reference to parent JSON object
|
/// \param parent reference to parent JSON object
|
||||||
/// \param name field with Message object
|
/// \param name field with Document object
|
||||||
/// \param required REQUIRED or OPTIONAL
|
/// \param required REQUIRED or OPTIONAL
|
||||||
/// \return pointer to Message
|
/// \return pointer to User
|
||||||
std::unique_ptr<Message> parseMessage(const rapidjson::Value& parent, const char* name, bool required);
|
std::unique_ptr<User> parseUser(const rapidjson::Value& parent, const char* name, bool required);
|
||||||
|
|
||||||
/// \brief Parse JSON array of Update
|
/// \brief Parse JSON object to Message
|
||||||
/// \param parent reference to parent JSON object
|
/// \param parent reference to parent JSON object
|
||||||
/// \param name field with array of Update objects
|
/// \param name field with Message object
|
||||||
/// \param required REQUIRED or OPTIONAL
|
/// \param required REQUIRED or OPTIONAL
|
||||||
/// \return Updates (vector of UpdatePtr>
|
/// \return pointer to Message
|
||||||
std::unique_ptr<Updates> parseUpdates(const rapidjson::Value& parent, const char* name, bool required);
|
std::unique_ptr<Message> parseMessage(const rapidjson::Value& parent, const char* name, bool required);
|
||||||
|
|
||||||
|
/// \brief Parse JSON array of Update
|
||||||
|
/// \param parent reference to parent JSON object
|
||||||
|
/// \param name field with array of Update objects
|
||||||
|
/// \param required REQUIRED or OPTIONAL
|
||||||
|
/// \return Updates (vector of UpdatePtr>
|
||||||
|
std::unique_ptr<Updates> parseUpdates(const rapidjson::Value& parent, const char* name, bool required);
|
||||||
|
|
||||||
|
/// \brief Check JSON response
|
||||||
|
///
|
||||||
|
/// Throws an exception if error code recieved.
|
||||||
|
/// \param doc reference to JSON document
|
||||||
|
void checkResponse(const rapidjson::Document& doc);
|
||||||
|
|
||||||
/// \brief Check JSON response
|
|
||||||
///
|
|
||||||
/// Throws an exception if error code recieved.
|
|
||||||
/// \param doc reference to JSON document
|
|
||||||
void checkResponse(const rapidjson::Document& doc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TELEBOTXX_JSON_OBJECTS_HPP
|
#endif // TELEBOTXX_JSON_OBJECTS_HPP
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
#include <telebotxx/Logging.hpp>
|
#include <telebotxx/Logging.hpp>
|
||||||
|
|
||||||
namespace telebotxx
|
namespace telebotxx {
|
||||||
{
|
|
||||||
bool debugMode = false;
|
|
||||||
|
|
||||||
void setDebugMode(bool enabled)
|
bool debugMode = false;
|
||||||
{
|
|
||||||
|
void setDebugMode(bool enabled)
|
||||||
|
{
|
||||||
debugMode = enabled;
|
debugMode = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <telebotxx/Message.hpp>
|
#include <telebotxx/Message.hpp>
|
||||||
|
|
||||||
using namespace telebotxx;
|
namespace telebotxx {
|
||||||
|
|
||||||
MessageEntity::MessageEntity()
|
MessageEntity::MessageEntity()
|
||||||
: type_(Type::Mention),
|
: type_(Type::Mention),
|
||||||
|
|
@ -10,7 +10,9 @@ MessageEntity::MessageEntity()
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageEntity::MessageEntity(const MessageEntity&) = default;
|
MessageEntity::MessageEntity(const MessageEntity&) = default;
|
||||||
|
|
||||||
MessageEntity::MessageEntity(MessageEntity&&) = default;
|
MessageEntity::MessageEntity(MessageEntity&&) = default;
|
||||||
|
|
||||||
MessageEntity::~MessageEntity() = default;
|
MessageEntity::~MessageEntity() = default;
|
||||||
|
|
||||||
MessageEntity::Type MessageEntity::getType() const
|
MessageEntity::Type MessageEntity::getType() const
|
||||||
|
|
@ -79,7 +81,7 @@ const MessageEntity& MessageEntity::operator=(MessageEntity other)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageEntity::Type telebotxx::messageEntityTypeFromString(const std::string& str)
|
MessageEntity::Type messageEntityTypeFromString(const std::string& str)
|
||||||
{
|
{
|
||||||
if (str == "mention")
|
if (str == "mention")
|
||||||
return MessageEntity::Type::Mention;
|
return MessageEntity::Type::Mention;
|
||||||
|
|
@ -113,7 +115,9 @@ Message::Message()
|
||||||
}
|
}
|
||||||
|
|
||||||
Message::Message(const Message&) = default;
|
Message::Message(const Message&) = default;
|
||||||
|
|
||||||
Message::Message(Message&&) = default;
|
Message::Message(Message&&) = default;
|
||||||
|
|
||||||
Message::~Message() = default;
|
Message::~Message() = default;
|
||||||
|
|
||||||
int Message::getId() const
|
int Message::getId() const
|
||||||
|
|
@ -391,7 +395,9 @@ const Message& Message::operator=(Message other) noexcept
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void telebotxx::swap(Message& lhs, Message& rhs)
|
void swap(Message& lhs, Message& rhs)
|
||||||
{
|
{
|
||||||
lhs.swap(rhs);
|
lhs.swap(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <telebotxx/RequestOptions.hpp>
|
#include <telebotxx/RequestOptions.hpp>
|
||||||
|
|
||||||
using namespace telebotxx;
|
namespace telebotxx {
|
||||||
|
|
||||||
ChatId::ChatId(int id)
|
ChatId::ChatId(int id)
|
||||||
: type_(Type::Id), id_(id)
|
: type_(Type::Id), id_(id)
|
||||||
|
|
@ -95,7 +95,7 @@ int ReplyTo::value() const
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Buffer::Buffer(const char *buffer, std::size_t size, const std::string& filename)
|
Buffer::Buffer(const char* buffer, std::size_t size, const std::string& filename)
|
||||||
: data_(buffer), size_(size), filename_(filename)
|
: data_(buffer), size_(size), filename_(filename)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -207,7 +207,7 @@ Photo::~Photo()
|
||||||
{
|
{
|
||||||
if (type_ == Type::File)
|
if (type_ == Type::File)
|
||||||
file_.~File();
|
file_.~File();
|
||||||
else if(type_ == Type::Url)
|
else if (type_ == Type::Url)
|
||||||
url_.~Url();
|
url_.~Url();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -235,3 +235,5 @@ const Url& Photo::getUrl() const
|
||||||
{
|
{
|
||||||
return url_;
|
return url_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,9 @@
|
||||||
#include <rapidjson/writer.h>
|
#include <rapidjson/writer.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
using namespace telebotxx;
|
namespace telebotxx {
|
||||||
|
|
||||||
class SendMessageRequest::Impl
|
class SendMessageRequest::Impl
|
||||||
{
|
{
|
||||||
|
|
@ -61,7 +62,8 @@ public:
|
||||||
if (parseMode_)
|
if (parseMode_)
|
||||||
{
|
{
|
||||||
writer.String("parse_mode");
|
writer.String("parse_mode");
|
||||||
writer.String((parseMode_ == ParseMode::Markdown) ? "Markdown" : (parseMode_ == ParseMode::Html) ? "HTML" : "Plain");
|
writer.String(
|
||||||
|
(parseMode_ == ParseMode::Markdown) ? "Markdown" : (parseMode_ == ParseMode::Html) ? "HTML" : "Plain");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add disable_web_page_preview
|
// Add disable_web_page_preview
|
||||||
|
|
@ -173,3 +175,5 @@ Message SendMessageRequest::execute()
|
||||||
{
|
{
|
||||||
return impl_->execute();
|
return impl_->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
#include <telebotxx/SendPhotoRequest.hpp>
|
#include <telebotxx/SendPhotoRequest.hpp>
|
||||||
|
|
||||||
#include <telebotxx/Logging.hpp>
|
#include <telebotxx/Logging.hpp>
|
||||||
#include "JsonObjects.hpp"
|
#include "JsonObjects.hpp"
|
||||||
|
|
||||||
|
|
@ -8,8 +7,9 @@
|
||||||
#include <rapidjson/writer.h>
|
#include <rapidjson/writer.h>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
using namespace telebotxx;
|
namespace telebotxx {
|
||||||
|
|
||||||
class SendPhotoRequest::Impl
|
class SendPhotoRequest::Impl
|
||||||
{
|
{
|
||||||
|
|
@ -137,3 +137,5 @@ Message SendPhotoRequest::execute()
|
||||||
{
|
{
|
||||||
return impl_->execute();
|
return impl_->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <telebotxx/Update.hpp>
|
#include <telebotxx/Update.hpp>
|
||||||
|
|
||||||
using namespace telebotxx;
|
namespace telebotxx {
|
||||||
|
|
||||||
Update::Update(int id, Type type)
|
Update::Update(int id, Type type)
|
||||||
: id_(id),
|
: id_(id),
|
||||||
|
|
@ -80,3 +80,5 @@ const EditedMessageUpdate& EditedMessageUpdate::operator=(EditedMessageUpdate ot
|
||||||
swap(other);
|
swap(other);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#include <telebotxx/User.hpp>
|
#include <telebotxx/User.hpp>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
using namespace telebotxx;
|
namespace telebotxx {
|
||||||
|
|
||||||
User::User()
|
User::User()
|
||||||
: id_(-1)
|
: id_(-1)
|
||||||
|
|
@ -9,7 +9,9 @@ User::User()
|
||||||
}
|
}
|
||||||
|
|
||||||
User::User(const User&) = default;
|
User::User(const User&) = default;
|
||||||
|
|
||||||
User::User(User&&) = default;
|
User::User(User&&) = default;
|
||||||
|
|
||||||
User::~User() = default;
|
User::~User() = default;
|
||||||
|
|
||||||
int User::getId() const
|
int User::getId() const
|
||||||
|
|
@ -73,8 +75,10 @@ const User& User::operator=(User other)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& telebotxx::operator<<(std::ostream& os, const User& user)
|
std::ostream& operator<<(std::ostream& os, const User& user)
|
||||||
{
|
{
|
||||||
os << user.toString();
|
os << user.toString();
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue