cpp-mirai-client  v2.6.1
cpp client for mirai-api-http
FileMessage.hpp
浏览该文件的文档.
1// Copyright (C) 2022 Numendacil and contributors
2//
3// This program is free software: you can redistribute it and/or modify
4// it under the terms of the GNU Affero General Public License as
5// published by the Free Software Foundation, either version 3 of the
6// License, or (at your option) any later version.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU Affero General Public License for more details.
12//
13// You should have received a copy of the GNU Affero General Public License
14// along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16#ifndef MIRAI_FILE_MESSAGE_HPP_
17#define MIRAI_FILE_MESSAGE_HPP_
18
19#include <string>
20
21#include "IMessage.hpp"
22
23namespace Mirai
24{
25
26/**
27 * @brief 文件消息
28 *
29 * 仅用于接收,发送时将会被无视
30 *
31 * Member Variable | Default Value
32 * --------------- | -------------
33 * `FileMessage::id_` | `""`
34 * `FileMessage::name_` | `""`
35 * `FileMessage::size_` | `0`
36 */
37class FileMessage final : public IMessageImpl<FileMessage>
38{
40
41protected:
42 std::string id_{};
43 std::string name_{};
44 int64_t size_ = 0;
45
46 bool isValid_() const final { return true; }
47
49 static constexpr bool SUPPORT_SEND_ = false;
50
51public:
52 FileMessage() = default;
53
54 bool operator==(const FileMessage& rhs) { return this->id_ == rhs.id_; }
55
56 bool operator!=(const FileMessage& rhs) { return !(*this == rhs); }
57
58 /// 获取文件id
59 std::string GetId() const { return this->id_; }
60 /// 获取文件名
61 std::string GetName() const { return this->name_; }
62 /// 获取文件大小
63 int64_t GetSize() const { return this->size_; }
64
65 struct Serializable;
66};
67
68template<> struct GetType<FileMessage::GetType()>
69{
71};
72
73} // namespace Mirai
74
75#endif
文件消息
Definition: FileMessage.hpp:38
std::string GetId() const
获取文件id
Definition: FileMessage.hpp:59
int64_t GetSize() const
获取文件大小
Definition: FileMessage.hpp:63
static constexpr bool SUPPORT_SEND_
Definition: FileMessage.hpp:49
static constexpr MessageTypes TYPE_
Definition: FileMessage.hpp:48
std::string name_
Definition: FileMessage.hpp:43
FileMessage()=default
std::string GetName() const
获取文件名
Definition: FileMessage.hpp:61
bool operator!=(const FileMessage &rhs)
Definition: FileMessage.hpp:56
bool operator==(const FileMessage &rhs)
Definition: FileMessage.hpp:54
bool isValid_() const final
Definition: FileMessage.hpp:46
CRTP helper layer
Definition: IMessage.hpp:78
所有mirai相关的对象的命名空间
用于类型之间转换的辅助模板