-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwnt_FunctionSignature.h
72 lines (56 loc) · 1.65 KB
/
wnt_FunctionSignature.h
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*=====================================================================
FunctionSignature.h
-------------------
Copyright Glare Technologies Limited 2016 -
File created by ClassTemplate on Tue Jun 17 05:29:02 2008
=====================================================================*/
#pragma once
#include "wnt_Type.h"
#include <vector>
#include <string>
namespace Winter
{
/*=====================================================================
FunctionSignature
-----------------
=====================================================================*/
class FunctionSignature
{
public:
FunctionSignature(const std::string& name_, const std::vector<TypeVRef>& param_types_)
: name(name_), param_types(param_types_)
{}
~FunctionSignature(){}
//static const FunctionSignature makeSig(const std::string& sig);
const std::string toString() const;
const std::string typeMangledName() const; // Return something like f_float_int
std::string name;
std::vector<TypeVRef> param_types;
};
inline bool operator < (const FunctionSignature& a, const FunctionSignature& b)
{
if(a.name < b.name)
return true;
else if(a.name > b.name)
return false;
else
{
if(a.param_types.size() < b.param_types.size())
return true;
else if(a.param_types.size() > b.param_types.size())
return false;
else
{
for(unsigned int i=0; i<a.param_types.size(); ++i)
{
if(*a.param_types[i] < *b.param_types[i])
return true;
else if(*b.param_types[i] < *a.param_types[i]) // else if a > b
return false;
}
}
}
// If we got here a == b
return false;
}
} //end namespace Winter