| 1111 | } |
| 1112 | |
| 1113 | void write_native_attribute_r(UTL_ScopedName *name, const char *javaStub, |
| 1114 | AST_Attribute *attr, bool local) |
| 1115 | { |
| 1116 | const char *attrname = attr->local_name()->get_string(); |
| 1117 | string cxx = idl_mapping_jni::scoped(name); |
| 1118 | vector<string> params, *pparams = attr->readonly() ? 0 : ¶ms; |
| 1119 | string fnName = jni_function_name(javaStub, attrname, pparams); |
| 1120 | string retconv, ret_exception, tao_retconv, array_cast; |
| 1121 | string ret = idl_mapping_jni::type(attr->field_type()); |
| 1122 | string retval = idl_mapping_jni::taoType(attr->field_type()); |
| 1123 | string tao_ret = idl_mapping_jni::taoParam(attr->field_type(), |
| 1124 | AST_Argument::dir_IN /*ignored*/, true); |
| 1125 | string tao_retval = ret; |
| 1126 | string jniFn = idl_mapping_jni::jniFnName(attr->field_type()); |
| 1127 | string ret_jsig = idl_mapping_jni::jvmSignature(attr->field_type()); |
| 1128 | string suffix, extra_type, extra_init, extra_retn; |
| 1129 | bool is_array = isArray(attr->field_type()), |
| 1130 | is_objref = isObjref(attr->field_type()); |
| 1131 | |
| 1132 | if (is_array || attr->field_type()->size_type() != AST_Type::FIXED) { |
| 1133 | if (!is_array && !is_objref) suffix = ".in ()"; |
| 1134 | |
| 1135 | if (is_array) { |
| 1136 | extra_type = "_forany"; |
| 1137 | retval = append_forany(retval); |
| 1138 | } else if (isSSU(attr->field_type())) { |
| 1139 | extra_type = "_var"; |
| 1140 | extra_init = " = new " + retval; |
| 1141 | retval = append_var(retval); |
| 1142 | } |
| 1143 | |
| 1144 | extra_retn = "._retn ()"; |
| 1145 | } |
| 1146 | |
| 1147 | if (ret.size() > 5 && ret.substr(ret.size() - 5) == "Array") |
| 1148 | array_cast = "static_cast<" + ret + "> ("; |
| 1149 | |
| 1150 | retval += " _c_ret = "; |
| 1151 | tao_retval += " _j_ret = "; |
| 1152 | retconv = " return _c_ret;\n"; |
| 1153 | tao_retconv = " return _j_ret;\n"; |
| 1154 | ret_exception = " return 0;\n"; |
| 1155 | |
| 1156 | if (!isPrimitive(attr->field_type())) { |
| 1157 | retconv = |
| 1158 | " " + ret + " _j_ret = 0;\n" |
| 1159 | " copyToJava (_jni, _j_ret, _c_ret" + suffix + ", true);\n" |
| 1160 | " return _j_ret;\n"; |
| 1161 | tao_retconv = |
| 1162 | " " + idl_mapping_jni::taoType(attr->field_type()) + extra_type |
| 1163 | + " _c_ret" + extra_init + ";\n" |
| 1164 | " copyToCxx (_jni, _c_ret, _j_ret);\n" |
| 1165 | " return _c_ret" + extra_retn + ";\n"; |
| 1166 | } |
| 1167 | |
| 1168 | //for the JavaPeer (local interfaces only) |
| 1169 | string tao_args, java_args, args_jsig, tao_argconv_in, tao_argconv_out; |
| 1170 |
no test coverage detected