SMACC
Loading...
Searching...
No Matches
string_type_walker.h
Go to the documentation of this file.
1/*****************************************************************************************************************
2 * ReelRobotix Inc. - Software License Agreement Copyright (c) 2018
3 * Authors: Pablo Inigo Blasco, Brett Aldrich
4 *
5 ******************************************************************************************************************/
6
7#pragma once
8#include <string>
9#include <memory>
10#include <vector>
11#include <typeinfo>
12#include <map>
13
14namespace smacc
15{
16namespace introspection
17{
19{
20public:
21 typedef std::shared_ptr<TypeInfo> Ptr;
22
23 //---- FACTORY STATIC METHODS -----------
24 static TypeInfo::Ptr getTypeInfoFromString(std::string inputtext);
25 static TypeInfo::Ptr getFromStdTypeInfo(const std::type_info &tid);
26
27 template <typename T>
29 {
30 return TypeInfo::getFromStdTypeInfo(typeid(T));
31 }
32 //---------------------------------------
33
34 std::vector<Ptr> templateParameters;
35
36 TypeInfo(std::string tkey, std::string codedtype, std::string finaltype)
37 {
38 this->tkey = tkey;
39 this->codedtype = codedtype;
40 this->finaltype = finaltype;
41 }
42
43 std::string toString()
44 {
45 return this->tkey + ":" + this->finaltype;
46 }
47
49 {
50 auto index = this->finaltype.find("<");
51 return this->finaltype.substr(0, index);
52 }
53
54
55 const std::string &getFullName()
56 {
57 return this->finaltype;
58 }
59
60 static std::map<std::string, Ptr> typeInfoDatabase;
61
62private:
63 std::string tkey;
64 std::string codedtype;
65 std::string finaltype;
66};
67} // namespace introspection
68} // namespace smacc
const std::string & getFullName()
static TypeInfo::Ptr getTypeInfoFromString(std::string inputtext)
static TypeInfo::Ptr getTypeInfoFromType()
std::shared_ptr< TypeInfo > Ptr
static std::map< std::string, Ptr > typeInfoDatabase
static TypeInfo::Ptr getFromStdTypeInfo(const std::type_info &tid)
TypeInfo(std::string tkey, std::string codedtype, std::string finaltype)
std::vector< Ptr > templateParameters