MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / TypeToString

Class TypeToString

Libraries/Reflection/ReflectionFoundation.h:177–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175/// @tparam T A type that will be converted to string
176template <typename T>
177struct TypeToString
178{
179#if SC_LANGUAGE_CPP_AT_LEAST_17
180 private:
181 // In C++ 17 we trim the long string producted by ClassName<T> to reduce executable size
182 [[nodiscard]] static constexpr auto TrimClassName()
183 {
184 constexpr auto className = ClNm<T>();
185
186 ArrayWithSize<char, className.length> trimmedName;
187 for (uint32_t i = 0; i < className.length; ++i)
188 {
189 trimmedName.values[i] = className.data[i];
190 }
191 trimmedName.size = className.length;
192 return trimmedName;
193 }
194
195 // Inline static constexpr requires C++17
196 static inline constexpr auto value = TrimClassName();
197
198 public:
199 [[nodiscard]] static constexpr TypeStringView get() { return TypeStringView(value.values, value.size); }
200#else
201 [[nodiscard]] static constexpr TypeStringView get()
202 {
203 auto className = ClNm<T>();
204 return TypeStringView(className.data, className.length);
205 }
206#endif
207};
208
209//! @}
210

Callers 8

checkStateMethod · 0.85
setupAsyncMethod · 0.85
activateAsyncMethod · 0.85
teardownAsyncMethod · 0.85
reportErrorMethod · 0.85
completeAsyncMethod · 0.85
cancelAsyncMethod · 0.85
stopMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected