VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
ProtoReflect.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <google/protobuf/descriptor.h>
4#include <google/protobuf/message.h>
5#include <string_view>
6
7namespace VoltMod
8{
9
10/**
11 * @file ProtoReflect.hpp
12 * @brief Access CS user-message fields through protobuf reflection.
13 *
14 * Consumer builds do not generate the CS-specific messages from cstrike15_usermessages.proto.
15 * Their engine-registered descriptors still support name-based lookup. A renamed field therefore
16 * appears missing at runtime, and each caller chooses its fallback.
17 */
18
19using ProtoMessage = google::protobuf::Message;
20using ProtoFieldDescriptor = google::protobuf::FieldDescriptor;
21
22/** Descriptor for @p name, or nullptr when the field is absent. */
23const ProtoFieldDescriptor* ProtoField(const ProtoMessage& message, std::string_view name);
24
25} // namespace VoltMod
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)