droplet
1.3.0
A multipurpose Discord bot with the hacker in mind
Toggle main menu visibility
Loading...
Searching...
No Matches
PortalIndex.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstdint>
4
#include <mutex>
5
#include <string>
6
#include <unordered_set>
7
#include <vector>
8
9
class
PortalDTO
;
10
11
class
PortalIndex
{
12
public
:
13
void
rebuild
(
const
std::vector<PortalDTO>& portals);
14
void
add
(std::uint64_t channel_id);
15
void
remove
(std::uint64_t channel_id);
16
[[nodiscard]]
bool
contains
(std::uint64_t channel_id)
const
;
17
18
private
:
19
mutable
std::mutex mutex_;
20
std::unordered_set<std::uint64_t> channel_ids_;
21
};
22
23
class
BlacklistIndex
{
24
public
:
25
void
rebuild
(
const
std::vector<std::string>& usernames);
26
void
add
(std::string username);
27
void
remove
(
const
std::string& username);
28
[[nodiscard]]
bool
contains
(
const
std::string& username)
const
;
29
30
private
:
31
mutable
std::mutex mutex_;
32
std::unordered_set<std::string> usernames_;
33
};
BlacklistIndex
Definition
PortalIndex.hpp:23
BlacklistIndex::contains
bool contains(const std::string &username) const
Definition
PortalIndex.cpp:46
BlacklistIndex::add
void add(std::string username)
Definition
PortalIndex.cpp:36
BlacklistIndex::remove
void remove(const std::string &username)
Definition
PortalIndex.cpp:41
BlacklistIndex::rebuild
void rebuild(const std::vector< std::string > &usernames)
Definition
PortalIndex.cpp:28
PortalDTO
Definition
PortalDTO.hpp:28
PortalIndex
Definition
PortalIndex.hpp:11
PortalIndex::add
void add(std::uint64_t channel_id)
Definition
PortalIndex.cpp:13
PortalIndex::rebuild
void rebuild(const std::vector< PortalDTO > &portals)
Definition
PortalIndex.cpp:5
PortalIndex::contains
bool contains(std::uint64_t channel_id) const
Definition
PortalIndex.cpp:23
PortalIndex::remove
void remove(std::uint64_t channel_id)
Definition
PortalIndex.cpp:18
src
bot_library
persistence
PortalIndex.hpp
Generated by
1.18.0