MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / gen_enum

Method gen_enum

dds/idl/itl_generator.cpp:162–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162bool itl_generator::gen_enum(AST_Enum*, UTL_ScopedName* /*name*/,
163 const std::vector<AST_EnumVal*>& contents, const char* repoid)
164{
165 new_type();
166
167 be_global->itl_ << Open(this)
168 << Indent(this) << "{\n"
169 << Open(this)
170 << Indent(this) << "\"kind\" : \"alias\",\n"
171 << Indent(this) << "\"name\" : \"" << repoid << "\",\n"
172 << Indent(this) << "\"type\" :\n"
173 << Open(this)
174 << Indent(this) << "{\n"
175 << Open(this)
176 << Indent(this) << "\"kind\" : \"int\",\n"
177 << Indent(this) << "\"bits\" : 32,\n"
178 << Indent(this) << "\"unsigned\" : true,\n"
179 << Indent(this) << "\"constrained\" : true,\n"
180 << Indent(this) << "\"values\" : {";
181
182 for (size_t i = 0; i < contents.size(); ++i) {
183 if (i > 0)
184 be_global->itl_ << ", ";
185 be_global->itl_ << '"' << contents[i]->local_name()->get_string() << '"'
186 << " : "
187 << '"' << i << '"';
188 }
189
190 be_global->itl_ << "}\n";
191 be_global->itl_ << Close(this)
192 << Indent(this) << "}\n"
193 << Close(this);
194
195 be_global->itl_ << Close(this)
196 << Indent(this) << "}\n"
197 << Close(this);
198
199 return true;
200}
201
202bool itl_generator::gen_typedef(AST_Typedef*, UTL_ScopedName* /*name*/,
203 AST_Type* base,

Callers 1

visit_enumMethod · 0.45

Calls 5

OpenClass · 0.85
IndentClass · 0.85
CloseClass · 0.85
sizeMethod · 0.45
get_stringMethod · 0.45

Tested by

no test coverage detected