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

Method gen_struct

java/idl2jni/codegen/im_java.cpp:619–649  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

617}
618
619bool idl_mapping_java::gen_struct(UTL_ScopedName *name,
620 const std::vector<AST_Field *> &fields, const char *repoid)
621{
622 string fieldDecl, ctorArgs, ctorBody;
623
624 for (size_t i = 0; i < fields.size(); ++i) {
625 string fname = fields[i]->local_name()->get_string();
626 string ftype = type(fields[i]->field_type());
627 fieldDecl += " public " + ftype + " " + fname + ";\n";
628 ctorArgs += ftype + " _" + fname;
629
630 if (i != fields.size() - 1) ctorArgs += ", ";
631
632 ctorBody += " " + fname + " = _" + fname + ";\n";
633 }
634
635 const char *struct_name = name->last_component()->get_string();
636
637 string body =
638 fieldDecl + "\n"
639 " public " + struct_name + "() {}\n\n"
640 " public " + struct_name + "(" + ctorArgs + ") {\n" +
641 ctorBody +
642 " }\n";
643
644 JavaName jn(name);
645
646 return java_class_gen(jn, JFINAL_CLASS,
647 body.c_str(), "", "java.io.Serializable")
648 && gen_helper(jn, repoid) && gen_holder(jn);
649}
650
651bool idl_mapping_java::gen_typedef(UTL_ScopedName *name, AST_Type *base,
652 const char *repoid)

Callers

nothing calls this directly

Calls 5

java_class_genFunction · 0.85
gen_helperFunction · 0.85
gen_holderFunction · 0.85
sizeMethod · 0.45
get_stringMethod · 0.45

Tested by

no test coverage detected