cpp-mirai-client  v2.6.1
cpp client for mirai-api-http
EventTypes.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_EVENT_TYPES_HPP_
17#define MIRAI_EVENT_TYPES_HPP_
18
19#include <array>
20#include <string>
21
22namespace Mirai
23{
24
25enum class EventTypes
26{
38 BotMute,
40
42
48
58
69
74
76
77 Nudge,
78
82
85
88
89 // Used for counting
91};
92
93std::string to_string(EventTypes type);
94
95constexpr std::array<EventTypes, static_cast<size_t>(EventTypes::ENUM_END)> EventTypesList = []()
96{
97 std::array<EventTypes, static_cast<size_t>(EventTypes::ENUM_END)> arr{};
98 for (size_t i = 0; i < arr.size(); i++)
99 arr.at(i) = static_cast<EventTypes>(i);
100 return arr;
101}();
102
103/**
104 * @brief 用于类型之间转换的辅助模板
105 *
106 */
107template<EventTypes> struct GetEventType;
108
109template<EventTypes type> using GetEventType_t = typename GetEventType<type>::type;
110
111} // namespace Mirai
112
113#endif
所有mirai相关的对象的命名空间
std::string to_string(EventTypes type)
typename GetEventType< type >::type GetEventType_t
Definition: EventTypes.hpp:109
constexpr std::array< EventTypes, static_cast< size_t >(EventTypes::ENUM_END)> EventTypesList
Definition: EventTypes.hpp:95
用于类型之间转换的辅助模板
Definition: EventTypes.hpp:107