VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
ProtoReflect.cpp
Go to the documentation of this file.
2
3#include <string>
4
5namespace VoltMod
6{
7
8const ProtoFieldDescriptor* ProtoField(const ProtoMessage& message, std::string_view name)
9{
10 const auto* descriptor = message.GetDescriptor();
11 // protobuf's ConstStringParam is a std::string on this build, so the view is materialized.
12 return descriptor ? descriptor->FindFieldByName(std::string(name)) : nullptr;
13}
14
15} // namespace VoltMod
Access CS user-message fields through protobuf reflection.
google::protobuf::Message ProtoMessage
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56
google::protobuf::FieldDescriptor ProtoFieldDescriptor
const ProtoFieldDescriptor * ProtoField(const ProtoMessage &message, std::string_view name)