1#include "base/rust.h"
2#include "engine/console.h"
3#include "engine/rust.h"
4#include <cstddef>
5#include <cstdint>
6#include <memory>
7#include <new>
8#include <type_traits>
9#include <utility>
10
11namespace rust {
12inline namespace cxxbridge1 {
13// #include "rust/cxx.h"
14
15#ifndef CXXBRIDGE1_IS_COMPLETE
16#define CXXBRIDGE1_IS_COMPLETE
17namespace detail {
18namespace {
19template <typename T, typename = std::size_t>
20struct is_complete : std::false_type {};
21template <typename T>
22struct is_complete<T, decltype(sizeof(T))> : std::true_type {};
23} // namespace
24} // namespace detail
25#endif // CXXBRIDGE1_IS_COMPLETE
26
27#ifndef CXXBRIDGE1_RELOCATABLE
28#define CXXBRIDGE1_RELOCATABLE
29namespace detail {
30template <typename... Ts>
31struct make_void {
32 using type = void;
33};
34
35template <typename... Ts>
36using void_t = typename make_void<Ts...>::type;
37
38template <typename Void, template <typename...> class, typename...>
39struct detect : std::false_type {};
40template <template <typename...> class T, typename... A>
41struct detect<void_t<T<A...>>, T, A...> : std::true_type {};
42
43template <template <typename...> class T, typename... A>
44using is_detected = detect<void, T, A...>;
45
46template <typename T>
47using detect_IsRelocatable = typename T::IsRelocatable;
48
49template <typename T>
50struct get_IsRelocatable
51 : std::is_same<typename T::IsRelocatable, std::true_type> {};
52} // namespace detail
53
54template <typename T>
55struct IsRelocatable
56 : std::conditional<
57 detail::is_detected<detail::detect_IsRelocatable, T>::value,
58 detail::get_IsRelocatable<T>,
59 std::integral_constant<
60 bool, std::is_trivially_move_constructible<T>::value &&
61 std::is_trivially_destructible<T>::value>>::type {};
62#endif // CXXBRIDGE1_RELOCATABLE
63
64namespace {
65template <bool> struct deleter_if {
66 template <typename T> void operator()(T *) {}
67};
68
69template <> struct deleter_if<true> {
70 template <typename T> void operator()(T *ptr) { ptr->~T(); }
71};
72} // namespace
73} // namespace cxxbridge1
74} // namespace rust
75
76using IConsole_IResult = ::IConsole_IResult;
77using IConsole = ::IConsole;
78
79static_assert(
80 ::rust::IsRelocatable<::ColorRGBA>::value,
81 "type ColorRGBA should be trivially move constructible and trivially destructible in C++ to be used as an argument of `Print` in Rust");
82static_assert(
83 ::rust::IsRelocatable<::ColorHSLA>::value,
84 "type ColorHSLA should be trivially move constructible and trivially destructible in C++ to be used as a return value of `GetColor` in Rust");
85static_assert(
86 ::rust::IsRelocatable<::StrRef>::value,
87 "type StrRef should be trivially move constructible and trivially destructible in C++ to be used as an argument of `ExecuteLine`, `Print`, `Register` or return value of `GetString` in Rust");
88static_assert(
89 ::rust::IsRelocatable<::UserPtr>::value,
90 "type UserPtr should be trivially move constructible and trivially destructible in C++ to be used as an argument of `Register` in Rust");
91static_assert(
92 ::rust::IsRelocatable<::IConsole_FCommandCallback>::value,
93 "type IConsole_FCommandCallback should be trivially move constructible and trivially destructible in C++ to be used as an argument of `Register` in Rust");
94
95extern "C" {
96::std::int32_t cxxbridge1$IConsole_IResult$GetInteger(const ::IConsole_IResult &self, ::std::uint32_t Index) noexcept {
97 ::std::int32_t (::IConsole_IResult::*GetInteger$)(::std::uint32_t) const = &::IConsole_IResult::GetInteger;
98 return (self.*GetInteger$)(Index);
99}
100
101float cxxbridge1$IConsole_IResult$GetFloat(const ::IConsole_IResult &self, ::std::uint32_t Index) noexcept {
102 float (::IConsole_IResult::*GetFloat$)(::std::uint32_t) const = &::IConsole_IResult::GetFloat;
103 return (self.*GetFloat$)(Index);
104}
105
106void cxxbridge1$IConsole_IResult$GetString(const ::IConsole_IResult &self, ::std::uint32_t Index, ::StrRef *return$) noexcept {
107 ::StrRef (::IConsole_IResult::*GetString$)(::std::uint32_t) const = &::IConsole_IResult::GetString;
108 new (return$) ::StrRef((self.*GetString$)(Index));
109}
110
111void cxxbridge1$IConsole_IResult$GetColor(const ::IConsole_IResult &self, ::std::uint32_t Index, bool Light, ::ColorHSLA *return$) noexcept {
112 ::ColorHSLA (::IConsole_IResult::*GetColor$)(::std::uint32_t, bool) const = &::IConsole_IResult::GetColor;
113 new (return$) ::ColorHSLA((self.*GetColor$)(Index, Light));
114}
115
116::std::int32_t cxxbridge1$IConsole_IResult$NumArguments(const ::IConsole_IResult &self) noexcept {
117 ::std::int32_t (::IConsole_IResult::*NumArguments$)() const = &::IConsole_IResult::NumArguments;
118 return (self.*NumArguments$)();
119}
120
121::std::int32_t cxxbridge1$IConsole_IResult$GetVictim(const ::IConsole_IResult &self) noexcept {
122 ::std::int32_t (::IConsole_IResult::*GetVictim$)() const = &::IConsole_IResult::GetVictim;
123 return (self.*GetVictim$)();
124}
125
126void cxxbridge1$IConsole$ExecuteLine(::IConsole &self, ::StrRef *pStr, ::std::int32_t ClientId, bool InterpretSemicolons) noexcept {
127 void (::IConsole::*ExecuteLine$)(::StrRef, ::std::int32_t, bool) = &::IConsole::ExecuteLine;
128 (self.*ExecuteLine$)(::std::move(*pStr), ClientId, InterpretSemicolons);
129}
130
131void cxxbridge1$IConsole$Print(const ::IConsole &self, ::std::int32_t Level, ::StrRef *pFrom, ::StrRef *pStr, ::ColorRGBA *PrintColor) noexcept {
132 void (::IConsole::*Print$)(::std::int32_t, ::StrRef, ::StrRef, ::ColorRGBA) const = &::IConsole::Print;
133 (self.*Print$)(Level, ::std::move(*pFrom), ::std::move(*pStr), ::std::move(*PrintColor));
134}
135
136void cxxbridge1$IConsole$Register(::IConsole &self, ::StrRef *pName, ::StrRef *pParams, ::std::int32_t Flags, ::IConsole_FCommandCallback *pfnFunc, ::UserPtr *pUser, ::StrRef *pHelp) noexcept {
137 void (::IConsole::*Register$)(::StrRef, ::StrRef, ::std::int32_t, ::IConsole_FCommandCallback, ::UserPtr, ::StrRef) = &::IConsole::Register;
138 (self.*Register$)(::std::move(*pName), ::std::move(*pParams), Flags, ::std::move(*pfnFunc), ::std::move(*pUser), ::std::move(*pHelp));
139}
140
141::IConsole *cxxbridge1$CreateConsole(::std::int32_t FlagMask) noexcept {
142 ::std::unique_ptr<::IConsole> (*CreateConsole$)(::std::int32_t) = ::CreateConsole;
143 return CreateConsole$(FlagMask).release();
144}
145
146static_assert(::rust::detail::is_complete<::IConsole>::value, "definition of IConsole is required");
147static_assert(sizeof(::std::unique_ptr<::IConsole>) == sizeof(void *), "");
148static_assert(alignof(::std::unique_ptr<::IConsole>) == alignof(void *), "");
149void cxxbridge1$unique_ptr$IConsole$null(::std::unique_ptr<::IConsole> *ptr) noexcept {
150 ::new (ptr) ::std::unique_ptr<::IConsole>();
151}
152void cxxbridge1$unique_ptr$IConsole$raw(::std::unique_ptr<::IConsole> *ptr, ::IConsole *raw) noexcept {
153 ::new (ptr) ::std::unique_ptr<::IConsole>(raw);
154}
155const ::IConsole *cxxbridge1$unique_ptr$IConsole$get(const ::std::unique_ptr<::IConsole>& ptr) noexcept {
156 return ptr.get();
157}
158::IConsole *cxxbridge1$unique_ptr$IConsole$release(::std::unique_ptr<::IConsole>& ptr) noexcept {
159 return ptr.release();
160}
161void cxxbridge1$unique_ptr$IConsole$drop(::std::unique_ptr<::IConsole> *ptr) noexcept {
162 ::rust::deleter_if<::rust::detail::is_complete<::IConsole>::value>{}(ptr);
163}
164} // extern "C"
165