MCPcopy Create free account
hub / github.com/Icinga/icinga2 / FieldTypeToIcingaName

Function FieldTypeToIcingaName

tools/mkclass/classcompiler.cpp:142–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142static std::string FieldTypeToIcingaName(const Field& field, bool inner)
143{
144 std::string ftype = field.Type.TypeName;
145
146 if (!inner && field.Type.ArrayRank > 0)
147 return "Array";
148
149 if (field.Type.IsName)
150 return "String";
151
152 if (field.Attributes & FAEnum)
153 return "Number";
154
155 if (ftype == "int" || ftype == "int64_t" || ftype == "double")
156 return "Number";
157 else if (ftype == "bool")
158 return "Boolean";
159
160 if (ftype.find("::Ptr") != std::string::npos)
161 return ftype.substr(0, ftype.size() - strlen("::Ptr"));
162
163 return ftype;
164}
165
166void ClassCompiler::OptimizeStructLayout(std::vector<Field>& fields)
167{

Callers 1

HandleClassMethod · 0.85

Calls 2

findMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected