DDNet documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
censor.h
Go to the documentation of this file.
1
#ifndef GAME_CLIENT_COMPONENTS_CENSOR_H
2
#define GAME_CLIENT_COMPONENTS_CENSOR_H
3
#include <
base/lock.h
>
4
5
#include <
engine/console.h
>
6
#include <
engine/shared/config.h
>
7
#include <
engine/shared/jobs.h
>
8
9
#include <
game/client/component.h
>
10
11
#include <memory>
12
#include <optional>
13
#include <string>
14
#include <vector>
15
16
void
CensorReplaceWords
(
char
*pBuffer,
const
std::vector<std::string> &vWords,
char
Replacement);
17
18
/*
19
class IHttpRequest;
20
21
class CCensor : public CComponent
22
{
23
private:
24
std::vector<std::string> m_vCensoredWords;
25
26
class CCensorListDownloadJob : public IJob
27
{
28
public:
29
CCensorListDownloadJob(CCensor *pCensor, const char *pUrl, const char *pSaveFilePath);
30
31
bool Abort() override REQUIRES(!m_Lock);
32
33
std::optional<std::vector<std::string>> m_vLoadedWords;
34
35
protected:
36
void Run() override REQUIRES(!m_Lock);
37
38
private:
39
CCensor *m_pCensor;
40
char m_aUrl[IO_MAX_PATH_LENGTH];
41
char m_aSaveFilePath[IO_MAX_PATH_LENGTH];
42
CLock m_Lock;
43
std::shared_ptr<IHttpRequest> m_pGetRequest;
44
};
45
46
std::shared_ptr<CCensorListDownloadJob> m_pCensorListDownloadJob = nullptr;
47
48
static void ConchainRefreshCensorList(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
49
50
public:
51
CCensor();
52
int Sizeof() const override { return sizeof(*this); }
53
54
void Reset();
55
void OnInit() override;
56
void OnConsoleInit() override;
57
void OnRender() override;
58
void OnShutdown() override;
59
60
std::optional<std::vector<std::string>> LoadCensorListFromFile(const char *pFilePath) const;
61
std::optional<std::vector<std::string>> LoadCensorList(const void *pListText, size_t ListTextLen) const;
62
void CensorMessage(char *pMessage) const;
63
};
64
*/
65
66
class
CCensor
:
public
CComponent
67
{
68
public
:
69
int
Sizeof
()
const override
{
return
sizeof
(*this); }
70
};
71
72
#endif
// GAME_CLIENT_COMPONENTS_CENSOR_H
CensorReplaceWords
void CensorReplaceWords(char *pBuffer, const std::vector< std::string > &vWords, char Replacement)
Definition
censor.cpp:14
CCensor
Definition
censor.h:67
CCensor::Sizeof
int Sizeof() const override
Definition
censor.h:69
CComponent
Definition
component.h:165
component.h
console.h
jobs.h
lock.h
config.h
src
game
client
components
censor.h
Generated by
1.18.0