-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathTypedef.cpp
More file actions
44 lines (34 loc) · 799 Bytes
/
Copy pathTypedef.cpp
File metadata and controls
44 lines (34 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <string>
#include "Typedef.h"
std::map<std::string, TypeInfo> Typedef::typedef_; // typedef int32 ID
std::set<std::string> Typedef::custom_type; // struct name
void Typedef::addTypeInfo(const char * name, TypeInfo & info)
{
typedef_[name] = info;
}
TypeInfo * Typedef::getTypeInfo(const char * name)
{
auto it = typedef_.find(name);
if (it != typedef_.end())
{
return &(it->second);
}
return NULL;
}
bool Typedef::isVector(const char * name)
{
TypeInfo * info = getTypeInfo(name);
if (!info)
return false;
if (info->type == 0)
return false;
return true;
}
bool Typedef::isStruct(const char * name)
{
return custom_type.find(name) != custom_type.end();
}
void Typedef::addStruct(const char * key)
{
custom_type.insert(std::set<std::string>::value_type(key));
}