#ifndef GOOGLE_PROTOBUF_HPB_INTERNAL_INTERNAL_H__ #define GOOGLE_PROTOBUF_HPB_INTERNAL_INTERNAL_H__ #include #include #include "upb/mem/arena.h" #include "upb/message/message.h" namespace hpb::internal { struct PrivateAccess { template static auto* GetInternalMsg(T&& message) { return message->msg(); } template static auto Proxy(upb_Message* p, upb_Arena* arena) { return typename T::Proxy(p, arena); } template static auto CProxy(const upb_Message* p, upb_Arena* arena) { return typename T::CProxy(p, arena); } template static auto CreateMessage(upb_Arena* arena) { return typename T::Proxy(upb_Message_New(T::minitable(), arena), arena); } template static constexpr uint32_t GetExtensionNumber(const ExtensionId& id) { return id.number(); } }; template auto* GetInternalMsg(T&& message) { return PrivateAccess::GetInternalMsg(std::forward(message)); } template typename T::Proxy CreateMessageProxy(upb_Message* msg, upb_Arena* arena) { return typename T::Proxy(msg, arena); } } // namespace hpb::internal #endif // GOOGLE_PROTOBUF_HPB_INTERNAL_INTERNAL_H__