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

Function java_class_gen

java/idl2jni/codegen/im_java.cpp:74–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72};
73
74bool java_class_gen(const JavaName &jn, JavaFileType jft, const char *body,
75 const char *extends = "",
76 const char *implements = "")
77{
78 string file, pkgdecl;
79
80 for_each(jn.pkg_.begin(), jn.pkg_.end(), concat(file, '/'));
81 for_each(jn.pkg_.begin(), jn.pkg_.end(), concat(pkgdecl, '.'));
82
83 //remove trailing dot
84 if (jn.pkg_.size() > 0) pkgdecl.resize(pkgdecl.size() - 1);
85
86 //create directories
87 string path;
88
89 for (size_t i = 0; i < jn.pkg_.size(); ++i) {
90 path += jn.pkg_[i] + '/';
91
92 if (0 != ACE_OS::mkdir(path.c_str()) && errno != EEXIST) {
93 cerr << "ERROR - couldn't create directory " << path << "\n";
94 return false;
95 }
96 }
97
98 file += jn.clazz_;
99 file += ".java";
100
101 string classkeyw;
102
103 switch (jft) {
104 case JCLASS:
105 classkeyw = "class";
106 break;
107 case JINTERFACE:
108 classkeyw = "interface";
109 break;
110 case JABSTRACT_CLASS:
111 classkeyw = "abstract class";
112 break;
113 case JFINAL_CLASS:
114 classkeyw = "final class";
115 break;
116 }
117
118 string nlib = be_global->native_lib_name().c_str();
119 string nativeLoader;
120
121 if (nlib != "" && ACE_OS::strstr(body, " native ")) {
122 nativeLoader = "\n"
123 " static {\n"
124 " String propVal = System.getProperty(\"opendds.native.debug\");\n"
125 " if (propVal != null && (\"1\".equalsIgnoreCase(propVal) ||\n"
126 " \"y\".equalsIgnoreCase(propVal) ||\n"
127 " \"yes\".equalsIgnoreCase(propVal) ||\n"
128 " \"t\".equalsIgnoreCase(propVal) ||\n"
129 " \"true\".equalsIgnoreCase(propVal)))\n"
130 " System.loadLibrary(\"" + nlib + "d\");\n"
131 " else System.loadLibrary(\"" + nlib + "\");\n"

Callers 7

gen_helperFunction · 0.85
gen_holderFunction · 0.85
gen_constMethod · 0.85
gen_enumMethod · 0.85
gen_structMethod · 0.85
gen_interfMethod · 0.85
gen_unionMethod · 0.85

Calls 6

concatClass · 0.85
native_lib_nameMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected