telebotxx/include/telebotxx/Update.hpp
Kirill Kirilenko 79ea1a08a1 Changed Updates hierarchy.
ChannelPost and EditedChannelPost now supported.
2017-02-16 21:48:22 +03:00

69 lines
1.1 KiB
C++

#ifndef TELEBOTXX_UPDATE_HPP
#define TELEBOTXX_UPDATE_HPP
#include "Message.hpp"
#include <vector>
#include <memory>
namespace telebotxx {
class Update
{
public:
enum class Type
{
Message,
InlineQuery,
ChosenInlineResult,
CallbackQuery
};
Update(int id, Type type);
Update(const Update&);
Update(Update&&);
virtual ~Update() = 0;
int getId() const;
Type getType() const;
void swap(Update& other) noexcept;
private:
int id_;
Type updateType_;
};
using UpdatePtr = std::shared_ptr<Update>;
using Updates = std::vector<UpdatePtr>;
class MessageUpdate : public Update
{
public:
enum class MessageType
{
Message,
EditedMessage,
ChannelPost,
EditedChannelPost
};
MessageUpdate(int id, MessageType type, const Message& message);
MessageUpdate(const MessageUpdate&);
MessageUpdate(MessageUpdate&&);
~MessageUpdate();
MessageType getMessageType() const;
const Message& getMessage() const;
void swap(MessageUpdate& other) noexcept;
const MessageUpdate& operator=(MessageUpdate other);
private:
MessageType type_;
Message message_;
};
}
#endif // TELEBOTXX_UPDATE_HPP