Loading [MathJax]/extensions/TeX/AMSmath.js
Radium Engine  1.6.3
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TypesUtils.cpp
1#include <Core/RaCore.hpp>
2#include <Core/Utils/StringUtils.hpp>
3#include <Core/Utils/TypesUtils.hpp>
4#include <map>
5#include <string>
6#include <utility>
7
8namespace Ra {
9namespace Core {
10namespace Utils {
11namespace TypeInternal {
12
13RA_CORE_API auto makeTypeReadable( const std::string& fullType ) -> std::string {
14 static std::map<std::string, std::string> knownTypes {
15 { "std::", "" },
16 { "__cxx11::", "" },
17#ifndef CORE_USE_DOUBLE
18 { "float", "Scalar" },
19#else
20 { "double", "Scalar" },
21#endif
22 { ", std::allocator<float>", "" },
23 { ", std::allocator<double>", "" },
24 { ", std::allocator<int>", "" },
25 { ", std::allocator<unsigned int>", "" },
26 { "Ra::Core::VectorArray", "RaVector" },
27 { "Ra::Core::Utils::ColorBase<float>", "Color" },
28 { "Ra::Core::Utils::ColorBase<double>", "Color" },
29 { "Eigen::Matrix<float, 2, 1, 0, 2, 1>", "Vector2" },
30 { "Eigen::Matrix<double, 2, 1, 0, 2, 1>", "Vector2d" },
31 { "Eigen::Matrix<int, 2, 1, 0, 2, 1>", "Vector2i" },
32 { "Eigen::Matrix<unsigned int, 2, 1, 0, 2, 1>", "Vector2ui" },
33 { "Eigen::Matrix<float, 3, 1, 0, 3, 1>", "Vector3" },
34 { "Eigen::Matrix<double, 3, 1, 0, 3, 1>", "Vector3d" },
35 { "Eigen::Matrix<int, 3, 1, 0, 3, 1>", "Vector3i" },
36 { "Eigen::Matrix<unsigned int, 3, 1, 0, 3, 1>", "Vector3ui" },
37 { "Eigen::Matrix<float, 4, 1, 0, 4, 1>", "Vector4" },
38 { "Eigen::Matrix<double, 4, 1, 0, 4, 1>", "Vector4d" },
39 { "Eigen::Matrix<int, 4, 1, 0, 4, 1>", "Vector4i" },
40 { "Eigen::Matrix<unsigned int, 4, 1, 0, 4, 1>", "Vector4ui" },
41 // Windows (visual studio 2022) specific name fix
42 { " __ptr64", "" } };
43
44 auto processedType = fullType;
45 for ( const auto& [key, value] : knownTypes ) {
46 Ra::Core::Utils::replaceAllInString( processedType, key, value );
47 }
48 return processedType;
49}
50
51} // namespace TypeInternal
52} // namespace Utils
53} // namespace Core
54} // namespace Ra
hepler function to manage enum as underlying types in VariableSet
Definition Cage.cpp:4