VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
ButtonPressMessage.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
VoltMod/Core/Result.hpp
>
4
#include <string>
5
#include <string_view>
6
7
namespace
VoltMod
8
{
9
10
/**
11
* @brief The button id a custom HUD Button press carries, read out of a user message's `msg_data`.
12
*
13
* Hand-parsed: the body is not a registered message and the SDK's protos do not declare it, so
14
* there is nothing to reflect on. Every other field is skipped, so a field CS2 adds later does not
15
* stop the id from being read. SDK-free for its tests.
16
*/
17
struct
ButtonPressMessage
18
{
19
/** Error::Invalid when the bytes are not well-formed protobuf, a length runs past the end, or the
20
* button id is missing or carries the wrong wire type. */
21
static
Result<ButtonPressMessage>
Parse
(std::string_view
bytes
);
22
23
std::string
ButtonId
;
///< field 2, length-delimited: the Button's `id` attribute
24
};
25
26
}
// namespace VoltMod
Result.hpp
VoltMod
Definition
Options.hpp:13
VoltMod::ReadFile
static std::string ReadFile(const std::filesystem::path &path)
Definition
Loader.cpp:56
VoltMod::Result
std::expected< T, Error > Result
Definition
Result.hpp:64
VoltMod::ButtonPressMessage
The button id a custom HUD Button press carries, read out of a user message's msg_data.
Definition
ButtonPressMessage.hpp:18
VoltMod::ButtonPressMessage::Parse
static Result< ButtonPressMessage > Parse(std::string_view bytes)
Definition
ButtonPressMessage.cpp:83
VoltMod::ButtonPressMessage::ButtonId
std::string ButtonId
field 2, length-delimited: the Button's id attribute
Definition
ButtonPressMessage.hpp:23
src
Host
Input
ButtonPressMessage.hpp
Generated by
1.9.8