MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / AddStruct

Method AddStruct

source/fbe.cpp:156–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154}
155
156void Statements::AddStruct(std::shared_ptr<StructType>& s)
157{
158 if (s == nullptr)
159 yyerror("Struct is null!");
160 if (s->name->empty())
161 yyerror("Struct name is invalid!");
162 if (!s->body)
163 yyerror("Struct is empty - " + *s->name.get());
164
165 // Check for duplicates
166 auto it = std::find_if(structs.begin(), structs.end(), [&s](auto item)->bool { return *item->name.get() == *s->name.get(); });
167 if (it != structs.end())
168 yyerror("Duplicate struct name " + *s->name.get());
169 it = std::find_if(structs.begin(), structs.end(), [&s](auto item)->bool { return (item->type == s->type) && item->fixed && s->fixed; });
170 if (it != structs.end())
171 yyerror("Duplicate struct type " + std::to_string(s->type));
172
173 structs.push_back(s);
174}
175
176void Import::AddImport(std::string* i)
177{

Callers

nothing calls this directly

Calls 5

beginMethod · 0.80
endMethod · 0.80
push_backMethod · 0.80
emptyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected