18 #include "cableArrayType.h"
19 #include "cableClass.h"
20 #include "cableClassType.h"
21 #include "cableConstructor.h"
22 #include "cableEnumeration.h"
23 #include "cableEnumerationType.h"
24 #include "cableField.h"
25 #include "cableFunctionType.h"
26 #include "cableFundamentalType.h"
27 #include "cableMethod.h"
28 #include "cablePointerType.h"
29 #include "cableReferenceType.h"
30 #include "cableType.h"
31 #include "cableTypedef.h"
33 #include "cxxFundamentalType.h"
35 #include "gxsys/RegularExpression.hxx"
36 #include "gxsys/SystemTools.hxx"
37 #include "gxsys/ios/sstream"
38 #include "gxsys/stl/algorithm"
39 #include "gxsys/stl/map"
40 #include "gxsys/stl/set"
41 #include "gxsys/stl/string"
42 #include "gxsys/stl/vector"
68 gxsys_stl::string elDllVariableName(this->
GetSettings()->GetGroup());
69 elDllVariableName +=
"EL_dll";
76 gxsys_stl::map<const gxsys_stl::string, gxsys_stl::string>::iterator it;
119 gxsys_stl::vector<gxsys_stl::string> hints;
120 gxsys_stl::string line;
122 gxsys::RegularExpression re;
123 re.compile(
"([^\t ]+)[\t ]+([^\t ]+)[\t ]+([^\t ]+)[\t ]+([^\t ]+)");
132 for (i= 1; i<=n; ++i)
140 gxsys_stl::string className = re.match(1);
141 gxsys_stl::string methodName = re.match(2);
142 gxsys_stl::string type = re.match(3);
143 gxsys_stl::string count = re.match(4);
144 gxsys_stl::string key(className +
"::" + methodName);
153 "More than one line in the hints file for " << className
154 <<
"::" << methodName);
168 "AddTargetInterface being called more than once. " <<
169 "Implementation currently only supports 1 interface. " <<
170 "Clobbering existing target interface: " <<
193 static gxsys_stl::set<gxsys_stl::string> keywords;
195 if (0 == keywords.size())
197 keywords.insert(
"abstract");
198 keywords.insert(
"as");
199 keywords.insert(
"base");
200 keywords.insert(
"bool");
201 keywords.insert(
"break");
202 keywords.insert(
"byte");
203 keywords.insert(
"case");
204 keywords.insert(
"catch");
205 keywords.insert(
"char");
206 keywords.insert(
"checked");
207 keywords.insert(
"class");
208 keywords.insert(
"const");
209 keywords.insert(
"continue");
210 keywords.insert(
"decimal");
211 keywords.insert(
"default");
212 keywords.insert(
"delegate");
213 keywords.insert(
"do");
214 keywords.insert(
"double");
215 keywords.insert(
"else");
216 keywords.insert(
"enum");
217 keywords.insert(
"event");
218 keywords.insert(
"explicit");
219 keywords.insert(
"extern");
220 keywords.insert(
"false");
221 keywords.insert(
"finally");
222 keywords.insert(
"fixed");
223 keywords.insert(
"float");
224 keywords.insert(
"for");
225 keywords.insert(
"foreach");
226 keywords.insert(
"goto");
227 keywords.insert(
"if");
228 keywords.insert(
"implicit");
229 keywords.insert(
"in");
230 keywords.insert(
"int");
231 keywords.insert(
"interface");
232 keywords.insert(
"internal");
233 keywords.insert(
"is");
234 keywords.insert(
"lock");
235 keywords.insert(
"long");
236 keywords.insert(
"namespace");
237 keywords.insert(
"new");
238 keywords.insert(
"null");
239 keywords.insert(
"object");
240 keywords.insert(
"operator");
241 keywords.insert(
"out");
242 keywords.insert(
"override");
243 keywords.insert(
"params");
244 keywords.insert(
"private");
245 keywords.insert(
"protected");
246 keywords.insert(
"public");
247 keywords.insert(
"readonly");
248 keywords.insert(
"ref");
249 keywords.insert(
"return");
250 keywords.insert(
"sbyte");
251 keywords.insert(
"sealed");
252 keywords.insert(
"short");
253 keywords.insert(
"sizeof");
254 keywords.insert(
"stackalloc");
255 keywords.insert(
"static");
256 keywords.insert(
"string");
257 keywords.insert(
"struct");
258 keywords.insert(
"switch");
259 keywords.insert(
"this");
260 keywords.insert(
"throw");
261 keywords.insert(
"true");
262 keywords.insert(
"try");
263 keywords.insert(
"typeof");
264 keywords.insert(
"uint");
265 keywords.insert(
"ulong");
266 keywords.insert(
"unchecked");
267 keywords.insert(
"unsafe");
268 keywords.insert(
"ushort");
269 keywords.insert(
"using");
270 keywords.insert(
"virtual");
271 keywords.insert(
"void");
272 keywords.insert(
"volatile");
273 keywords.insert(
"while");
276 gxsys_stl::set<gxsys_stl::string>::iterator it = keywords.find(gxsys_stl::string(p));
277 if (it != keywords.end())
291 name ==
"Finalize" ||
292 name ==
"GetHashCode" ||
294 name ==
"MemberwiseClone" ||
305 if (cable::Type::FundamentalTypeId == t->GetTypeId())
307 switch (cxx::FundamentalType::SafeDownCast(t->GetCxxType().GetType())->GetId())
309 case cxx::FundamentalType::UnsignedChar:
313 case cxx::FundamentalType::UnsignedShortInt:
317 case cxx::FundamentalType::UnsignedInt:
318 case cxx::FundamentalType::UnsignedLongInt:
322 case cxx::FundamentalType::SignedChar:
323 case cxx::FundamentalType::Char:
327 case cxx::FundamentalType::ShortInt:
331 case cxx::FundamentalType::Int:
332 case cxx::FundamentalType::LongInt:
336 case cxx::FundamentalType::Bool:
340 case cxx::FundamentalType::Float:
344 case cxx::FundamentalType::Double:
348 case cxx::FundamentalType::Void:
352 case cxx::FundamentalType::UnsignedLongLongInt:
356 case cxx::FundamentalType::LongLongInt:
375 <<
"Unhandled variable type. GetFundamentalTypeString returning the empty string...");
385 gxsys_stl::string name(m->GetName());
389 name = name +
"Wrapper";
392 <<
"Reserved method name '" << m->GetName() <<
"' used. Rename it to eliminate this warning...");
402 gxsys_stl::string ename(e->GetName());
407 strstr(ename.c_str(),
"$"))
409 if (e->Begin() != e->End())
411 ename = *(e->Begin());
412 ename +=
"_WrapperEnum";
416 ename =
"WARNING_unnamed_enum";
420 "Unnamed enum found. Name it to eliminate this warning...");
429 const gxsys_stl::string& hint,
430 gxsys_stl::string& type,
431 gxsys_stl::string& count
434 gxsys::RegularExpression re;
435 re.compile(
"([^\t ]+)[\t ]+([^\t ]+)[\t ]+([^\t ]+)[\t ]+([^\t ]+)");
453 const gxsys_stl::string& type
456 gxsys_stl::string utype = gxsys::SystemTools::UpperCase(type);
460 cxx::FundamentalType::Id ftid = cxx::FundamentalType::NumberOfTypes;
464 if (utype ==
"301") { ftid = cxx::FundamentalType::Float; }
465 else if (utype ==
"304") { ftid = cxx::FundamentalType::Int; }
466 else if (utype ==
"307") { ftid = cxx::FundamentalType::Double; }
467 else if (utype ==
"30A") { ftid = cxx::FundamentalType::Int; }
468 else if (utype ==
"2307") { ftid = cxx::FundamentalType::Double; }
470 if (cxx::FundamentalType::NumberOfTypes == ftid)
485 const gxsys_stl::string& line,
486 gxsys_stl::string& count
497 gxsys::RegularExpression re;
499 re.compile(
"^[\t ]*vtkGetVector([0-9]+)Macro\\(.*,.*\\)");
506 re.compile(
"^[\t ]*vtkGetVectorMacro\\(.*,.*,.*([0-9]+).*\\)");
513 re.compile(
"^[\t ]*vtkViewportCoordinateMacro\\(.*\\)");
520 re.compile(
"^[\t ]*vtkWorldCoordinateMacro\\(.*\\)");
535 #define RETURN_VALUE (0x84848484)
540 const cable::Method *m,
const cable::FunctionType *ft,
unsigned int i)
542 gxsys_stl::string argArraySize;
543 cable::Type *retType = 0;
547 gxsys_stl::string atts;
551 atts = m->GetAttributes();
555 atts = ft->GetArgumentAttributes(i);
565 if ((argArraySize ==
"") && (this->
HintsMap.size() > 0))
573 retType = ft->GetReturns();
576 gxsys_stl::string methodName(m->GetName());
577 gxsys_stl::map<const gxsys_stl::string, gxsys_stl::string>::iterator it;
579 const cable::Class *cIt = c;
580 while (cIt != NULL && (argArraySize ==
""))
583 gxsys_stl::string key(fullClassName +
"::" + methodName);
584 gxsys_stl::string hintline;
589 hintline = it->second;
591 gxsys_stl::string type;
592 gxsys_stl::string count;
596 argArraySize = count;
597 LogVerboseInfo(
"using external array size hint: " << argArraySize <<
" " << key);
605 if (argArraySize ==
"")
617 if (argArraySize ==
"")
621 retType = ft->GetReturns();
625 gxsys_stl::string count;
629 argArraySize = count;
634 "inferred array size hint '" << count <<
635 "' from method declaration '" << line <<
"'");
653 gxsys_ios::ostringstream os;
655 cable::FunctionType *ft = m->GetFunctionType();
656 unsigned int cArgs = ft->GetNumberOfArguments();
658 cable::Type *argType = 0;
667 for (i= 0; i<cArgs; ++i)
669 argType = ft->GetArgument(i);
679 if (argArraySize !=
"")
700 const char *p = ftype->GetArgumentName(i);
709 sprintf(buf,
"arg%u", i);
717 if (cable::Type::FundamentalTypeId == t->GetTypeId())
719 switch (cxx::FundamentalType::SafeDownCast(t->GetCxxType().GetType())->GetId())
721 case cxx::FundamentalType::UnsignedChar:
722 case cxx::FundamentalType::UnsignedShortInt:
723 case cxx::FundamentalType::UnsignedInt:
724 case cxx::FundamentalType::UnsignedLongInt:
725 case cxx::FundamentalType::SignedChar:
726 case cxx::FundamentalType::Char:
727 case cxx::FundamentalType::ShortInt:
728 case cxx::FundamentalType::Int:
729 case cxx::FundamentalType::LongInt:
730 case cxx::FundamentalType::Bool:
731 case cxx::FundamentalType::Float:
732 case cxx::FundamentalType::Double:
733 case cxx::FundamentalType::Void:
734 case cxx::FundamentalType::UnsignedLongLongInt:
735 case cxx::FundamentalType::LongLongInt:
739 case cxx::FundamentalType::WChar_t:
740 case cxx::FundamentalType::LongDouble:
741 case cxx::FundamentalType::ComplexFloat:
742 case cxx::FundamentalType::ComplexDouble:
743 case cxx::FundamentalType::ComplexLongDouble:
744 case cxx::FundamentalType::NumberOfTypes:
757 bool wrappable =
false;
759 switch (t->GetTypeId())
761 case cable::Type::EnumerationTypeId:
765 case cable::Type::FundamentalTypeId:
769 case cable::Type::ArrayTypeId:
773 case cable::Type::ClassTypeId:
774 wrappable =
ClassIsWrappable(cable::ClassType::SafeDownCast(t)->GetClass());
777 case cable::Type::PointerTypeId:
779 cable::Type *nested_type = cable::PointerType::SafeDownCast(t)->GetTarget();
780 cable::Type::TypeIdType nested_type_id = nested_type->GetTypeId();
794 if (cable::Type::EnumerationTypeId == nested_type_id ||
795 cable::Type::FundamentalTypeId == nested_type_id ||
796 cable::Type::ClassTypeId == nested_type_id)
800 else if (cable::Type::FunctionTypeId == nested_type_id)
809 cable::FunctionType::SafeDownCast(nested_type), s);
818 case cable::Type::ReferenceTypeId:
820 cable::Type *nested_type = cable::ReferenceType::SafeDownCast(t)->GetTarget();
821 cable::Type::TypeIdType nested_type_id = nested_type->GetTypeId();
825 if (cable::Type::EnumerationTypeId == nested_type_id ||
826 cable::Type::FundamentalTypeId == nested_type_id ||
827 cable::Type::ClassTypeId == nested_type_id)
831 else if (cable::Type::PointerTypeId == nested_type_id)
836 cable::Type *doubly_nested_type = cable::PointerType::SafeDownCast(nested_type)->GetTarget();
837 cable::Type::TypeIdType doubly_nested_type_id = doubly_nested_type->GetTypeId();
839 if (cable::Type::ClassTypeId == doubly_nested_type_id)
847 case cable::Type::OffsetTypeId:
848 case cable::Type::MethodTypeId:
852 case cable::Type::FunctionTypeId:
872 if (i < ft->GetNumberOfArguments()-1 &&
873 gxsys_stl::string(
"argc") == ft->GetArgumentName(i) &&
874 cable::Type::FundamentalTypeId == ft->GetArgument(i)->GetTypeId() &&
875 cxx::FundamentalType::Int == cxx::FundamentalType::SafeDownCast(ft->GetArgument(i)->GetCxxType().GetType())->GetId() &&
876 gxsys_stl::string(
"argv") == ft->GetArgumentName(i+1) &&
890 bool wrappable =
true;
892 cable::Type *argType = 0;
893 cable::Type *retType = 0;
895 unsigned int cArgs = ft->GetNumberOfArguments();
897 retType = ft->GetReturns();
900 for (i= 0; wrappable && i<cArgs; ++i)
902 argType = ft->GetArgument(i);
921 bool wrappableAsEvent =
false;
922 gxsys_stl::string atts;
926 if (cable::Context::Public == access)
928 if (cable::Function::FunctionId == m->GetFunctionId() ||
929 cable::Function::MethodId == m->GetFunctionId())
936 return wrappableAsEvent;
942 bool wrappable =
false;
943 bool hasDeprecatedAttribute =
false;
944 bool hasExcludeAttribute =
false;
945 bool isExcludedViaBtxEtx =
false;
949 if (cable::Context::Public == access)
951 if (cable::Function::FunctionId == m->GetFunctionId() ||
952 cable::Function::MethodId == m->GetFunctionId())
965 hasExcludeAttribute =
HasAttribute(m,
"gccxml(iwhExclude)");
967 if (hasDeprecatedAttribute || hasExcludeAttribute)
975 cable::Class* c = cable::Class::SafeDownCast(m->GetContext());
985 isExcludedViaBtxEtx =
true;
994 if (cable::Context::Public == access)
996 if (cable::Function::FunctionId == m->GetFunctionId() ||
997 cable::Function::MethodId == m->GetFunctionId())
1002 <<
"' is wrappable..." << gxsys_ios::endl);
1006 if (hasDeprecatedAttribute)
1009 <<
"' could not be wrapped because it is marked with the 'deprecated' attribute..." << gxsys_ios::endl);
1011 else if (hasExcludeAttribute)
1014 <<
"' could not be wrapped because it is marked with the 'gccxml(iwhExclude)' attribute..." << gxsys_ios::endl);
1016 else if (isExcludedViaBtxEtx)
1019 <<
"' could not be wrapped because it is in between begin/end exclude markers (BTX/ETX)..." << gxsys_ios::endl);
1024 <<
"' could not be wrapped because of its return type or one of its arguments' types..." << gxsys_ios::endl);
1031 <<
"' could not be wrapped because it's not a function or method..." << gxsys_ios::endl);
1037 <<
"' is not considered for wrapping because of its non-public access level..." << gxsys_ios::endl);
1067 return wrappableParent;
1083 cable::Type *nested_type = 0;
1085 if (cable::Type::ReferenceTypeId == t->GetTypeId())
1087 nested_type = cable::ReferenceType::SafeDownCast(t)->GetTarget();
1088 cable::Type::TypeIdType nested_type_id = nested_type->GetTypeId();
1090 if (cable::Type::EnumerationTypeId == nested_type_id ||
1091 cable::Type::FundamentalTypeId == nested_type_id)
1104 gxsys_stl::string s;
1105 cable::Enumeration* e = cable::EnumerationType::SafeDownCast(t)->GetEnumeration();
1111 if (strstr(s.c_str(),
"$"))
1113 s =
"uint /* WARNING_unnamed_enum */";
1128 gxsys_stl::string s;
1129 cable::Type *nested_type = 0;
1131 switch (t->GetTypeId())
1133 case cable::Type::EnumerationTypeId:
1137 case cable::Type::FundamentalTypeId:
1148 case cable::Type::ArrayTypeId:
1149 s =
"ERROR_ArrayTypeId_not_yet_implemented";
1153 case cable::Type::ClassTypeId:
1158 case cable::Type::PointerTypeId:
1159 nested_type = cable::PointerType::SafeDownCast(t)->GetTarget();
1163 if (forReturn || forDelegate)
1169 cable::Class *c = cable::ClassType::SafeDownCast(nested_type)->GetClass();
1181 else if (
IsChar(nested_type))
1192 else if (
IsVoid(nested_type))
1196 else if (cable::Type::FundamentalTypeId == nested_type->GetTypeId())
1198 if (isArray && !forReturn)
1207 else if (cable::Type::PointerTypeId == nested_type->GetTypeId())
1211 s =
"[In, Out] string[]";
1215 s =
"IntPtr /* pointer-to-pointer */";
1218 else if (cable::Type::FunctionTypeId == nested_type->GetTypeId())
1221 cable::FunctionType::SafeDownCast(nested_type), s))
1223 s =
"ERROR_No_equivalent_typedef_name_for_function_pointer";
1229 s =
"ERROR_PointerTypeId_not_yet_implemented_for_nested_type";
1234 case cable::Type::ReferenceTypeId:
1236 cable::Type *nested_type = cable::ReferenceType::SafeDownCast(t)->GetTarget();
1237 cable::Type::TypeIdType nested_type_id = nested_type->GetTypeId();
1239 s =
"ERROR_ReferenceTypeId_not_yet_implemented_for_nested_type";
1241 if (cable::Type::EnumerationTypeId == nested_type_id ||
1242 cable::Type::FundamentalTypeId == nested_type_id ||
1243 cable::Type::ClassTypeId == nested_type_id)
1247 if (!isArray && (cable::Type::EnumerationTypeId == nested_type_id ||
1248 cable::Type::FundamentalTypeId == nested_type_id))
1256 s = gxsys_stl::string(
"ref ") + s;
1260 else if (cable::Type::PointerTypeId == nested_type_id)
1265 cable::Type *doubly_nested_type = cable::PointerType::SafeDownCast(nested_type)->GetTarget();
1266 cable::Type::TypeIdType doubly_nested_type_id = doubly_nested_type->GetTypeId();
1268 if (cable::Type::ClassTypeId == doubly_nested_type_id)
1274 if (s ==
"ERROR_ReferenceTypeId_not_yet_implemented_for_nested_type")
1281 case cable::Type::OffsetTypeId:
1282 case cable::Type::MethodTypeId:
1283 case cable::Type::FunctionTypeId:
1285 s =
"ERROR_No_CSharp_type_for_cable_Type_TypeId";
1302 gxsys_stl::string s;
1303 cable::Type *nested_type = 0;
1305 switch (t->GetTypeId())
1307 case cable::Type::EnumerationTypeId:
1311 case cable::Type::FundamentalTypeId:
1315 case cable::Type::ArrayTypeId:
1316 s =
"ERROR_ArrayTypeId_not_yet_implemented";
1320 case cable::Type::ClassTypeId:
1325 case cable::Type::PointerTypeId:
1326 nested_type = cable::PointerType::SafeDownCast(t)->GetTarget();
1332 else if (
IsChar(nested_type))
1336 else if (
IsVoid(nested_type))
1340 else if (cable::Type::FundamentalTypeId == nested_type->GetTypeId())
1351 else if (cable::Type::PointerTypeId == nested_type->GetTypeId())
1361 s +=
" /* pointer-to-pointer */ ";
1364 else if (cable::Type::FunctionTypeId == nested_type->GetTypeId())
1370 s =
"ERROR_PointerTypeId_not_yet_implemented_for_nested_type";
1375 case cable::Type::ReferenceTypeId:
1377 cable::Type *nested_type = cable::ReferenceType::SafeDownCast(t)->GetTarget();
1378 cable::Type::TypeIdType nested_type_id = nested_type->GetTypeId();
1380 s =
"ERROR_ReferenceTypeId_not_yet_implemented_for_nested_type";
1382 if (cable::Type::EnumerationTypeId == nested_type_id ||
1383 cable::Type::FundamentalTypeId == nested_type_id ||
1384 cable::Type::ClassTypeId == nested_type_id)
1388 if (!isArray && (cable::Type::EnumerationTypeId == nested_type_id ||
1389 cable::Type::FundamentalTypeId == nested_type_id))
1395 else if (s ==
"bool")
1403 s = gxsys_stl::string(
"ref byte");
1407 s = gxsys_stl::string(
"ref ") + s;
1411 else if (cable::Type::PointerTypeId == nested_type_id)
1416 cable::Type *doubly_nested_type = cable::PointerType::SafeDownCast(nested_type)->GetTarget();
1417 cable::Type::TypeIdType doubly_nested_type_id = doubly_nested_type->GetTypeId();
1419 if (cable::Type::ClassTypeId == doubly_nested_type_id)
1425 if (s ==
"ERROR_ReferenceTypeId_not_yet_implemented_for_nested_type")
1432 case cable::Type::FunctionTypeId:
1434 cable::FunctionType::SafeDownCast(t), s))
1436 s =
"ERROR_No_equivalent_typedef_name_for_function_pointer";
1441 case cable::Type::OffsetTypeId:
1442 case cable::Type::MethodTypeId:
1444 s =
"ERROR_No_CSharp_type_for_cable_Type_TypeId";
1509 for(cable::Context::Iterator it = c->Begin(); it != c->End(); ++it)
1511 cable::Method *m = cable::Method::SafeDownCast(*it);
1515 if (m->GetVirtual())
1519 else if (m->GetStatic())
1531 cable::Enumeration *e = cable::Enumeration::SafeDownCast(*it);
1533 if (e && (cable::Context::Public == it.GetAccess()))
1546 gxsys_stl::map<gxsys_stl::string, MethodInstance>::iterator it;
1586 gxsys_stl::map<gxsys_stl::string, MethodInstance>::iterator it =
1595 gxsys_stl::map<gxsys_stl::string, MethodInstance>::iterator it =
1604 gxsys_stl::map<gxsys_stl::string, MethodInstance>::iterator it =
1613 gxsys_stl::map<gxsys_stl::string, MethodInstance>::iterator it =
1622 gxsys_stl::map<gxsys_stl::string, MethodInstance>::iterator it =
1631 if (m->GetStatic() &&
1632 0 == m->GetFunctionType()->GetNumberOfArguments() &&
1645 if (m->GetVirtual() &&
1646 0 == m->GetFunctionType()->GetNumberOfArguments() &&
1669 gxsys_stl::string countedMethodsRegex(this->
GetSettings()->GetCountedMethodsRegex(c));
1670 if (!countedMethodsRegex.empty())
1672 gxsys::RegularExpression re;
1673 re.compile(countedMethodsRegex.c_str());
1674 if (re.find(m->GetName()))
1677 <<
"MethodReturnValueIsCounted match:" << gxsys_ios::endl
1678 <<
" countedMethodsRegex: " << countedMethodsRegex << gxsys_ios::endl
1679 <<
" method: " << c->GetName() <<
"::" << m->GetName()
1704 unsigned int methodId = 0;
1706 gxsys_stl::map<const cable::Method*, unsigned int>::iterator it = this->
MethodIdMap.find(m);
1709 methodId = it->second;
1720 sprintf(idStr,
"%02u", methodId);
1738 gxsys_stl::string arraySize;
1739 gxsys_stl::string s;
1740 cable::FunctionType *ft = m->GetFunctionType();
1741 unsigned int cArgs = ft->GetNumberOfArguments();
1743 cable::Type *argType = 0;
1744 cable::Type *retType = ft->GetReturns();
1753 if (asProperty && useArg0AsReturn)
1758 "Method transformed to a property 'set' returns non-void. The return value will be ignored in generated code.");
1764 "Unexpected number of arguments for method transformed to a property 'set' - cArgs: " << cArgs);
1775 retType = ft->GetArgument(0);
1786 Emit(os, accessLevel.c_str());
1799 Emit(os,
"static ");
1804 if (m->GetVirtual())
1810 Emit(os,
"override ");
1821 Emit(os,
"virtual ");
1837 gxsys_stl::string mname = m->GetName();
1839 if ((mname ==
"GetEnumerator") &&
1842 Emit(os,
"System.Collections.IEnumerator");
1844 else if ((mname ==
"GetCurrent") &&
1852 if (arraySize !=
"")
1868 Emit(os, s.c_str());
1876 for (i= 0; i<cArgs; ++i)
1886 argType = ft->GetArgument(i);
1896 if (arraySize !=
"")
1921 gxsys_stl::string arraySize;
1922 cable::FunctionType *ft = m->GetFunctionType();
1923 unsigned int cArgs = ft->GetNumberOfArguments();
1924 unsigned int cArgsEmitted = 0;
1926 cable::Type *argType = 0;
1927 cable::Type *retType = ft->GetReturns();
1929 Emit(os,
"[DllImport(");
1931 Emit(os,
", EntryPoint = \"");
1941 Emit(os,
"internal static extern ");
1945 Emit(os,
"IntPtr ");
1947 Emit(os,
"(ref uint mteStatus, ref uint mteIndex, ref uint rawRefCount");
1950 if (emitExceptionParams)
1952 Emit(os,
", ref uint mteExceptionIndex, ref IntPtr clonedException");
1958 else if (mname ==
"delete")
1962 Emit(os,
"(HandleRef pThis");
1965 if (emitExceptionParams)
1967 Emit(os,
", ref uint mteExceptionIndex, ref IntPtr clonedException");
1980 if (!m->GetStatic())
1982 Emit(os,
"HandleRef pThis");
1991 for (i= 0; i<cArgs; ++i)
1993 argType = ft->GetArgument(i);
2000 if (arraySize !=
"")
2002 Emit(os,
"[MarshalAs(UnmanagedType.LPArray, SizeConst = ");
2003 Emit(os, arraySize.c_str());
2011 if (arraySize !=
"")
2037 Emit(os,
"ref uint mteStatus, ref uint mteIndex, ref uint rawRefCount");
2043 if (emitExceptionParams)
2050 Emit(os,
"ref uint mteExceptionIndex, ref IntPtr clonedException");
2064 const cable::Class *c = cable::ClassType::SafeDownCast(
2065 cable::PointerType::SafeDownCast(
2066 m->GetFunctionType()->GetReturns()
2067 )->GetTarget())->GetClass();
2069 gxsys_stl::string eventName;
2071 if (c && c->GetContext())
2073 eventName = c->GetContext()->GetName();
2078 eventName =
"ERROR_invalid_input_to_GetQualifiedEventName";
2090 cable::ClassType::SafeDownCast(cable::PointerType::SafeDownCast(
2091 m->GetFunctionType()->GetReturns()
2092 )->GetTarget())->GetClass()
2108 gxsys_stl::string e(eventName);
2109 gxsys_stl::string eFull;
2110 gxsys_stl::string mname(m->GetName());
2117 cable::FunctionType *ft = m->GetFunctionType();
2118 cable::Type *retType = ft->GetReturns();
2120 if (retType->GetTypeId() != cable::Type::PointerTypeId)
2123 "iwhEvent method '" << mname <<
"' does not return a pointer to an event object");
2127 if (cable::PointerType::SafeDownCast(retType)->GetTarget()->GetTypeId() !=
2128 cable::Type::ClassTypeId)
2131 "iwhEvent method '" << mname <<
"' does not return a pointer to an event object");
2136 cable::PointerType::SafeDownCast(retType)->GetTarget())->GetClass());
2153 Emit(os,
"#region ");
2154 Emit(os, e.c_str());
2155 Emit(os,
" event implementation details\n");
2161 Emit(os,
"private ");
2162 Emit(os, e.c_str());
2163 Emit(os,
"EventHandler ");
2164 Emit(os, e.c_str());
2165 Emit(os,
"Impl;\n");
2171 Emit(os,
"private ");
2172 Emit(os, eFull.c_str());
2174 Emit(os, e.c_str());
2175 Emit(os,
"Instance;\n");
2181 Emit(os,
"private ");
2182 Emit(os, eFull.c_str());
2183 Emit(os,
".Handler ");
2184 Emit(os, e.c_str());
2185 Emit(os,
"RelayHandler;\n");
2187 Emit(os,
"private uint ");
2188 Emit(os, e.c_str());
2189 Emit(os,
"RelayHandlerId;\n");
2199 Emit(os,
"private void ");
2200 Emit(os, e.c_str());
2201 Emit(os,
"RelayHandlerMethod(IntPtr rawSender, IntPtr rawArgs)\n");
2205 Emit(os,
"if (this.");
2206 Emit(os, e.c_str());
2207 Emit(os,
"Impl != null)\n");
2211 Emit(os, eFull.c_str());
2212 Emit(os,
"EventArgs rv = null;\n");
2214 Emit(os,
"if (IntPtr.Zero != rawArgs)\n");
2221 const cable::Class* cRetType = cable::ClassType::SafeDownCast(
2222 cable::PointerType::SafeDownCast(retType)->GetTarget()
2235 Emit(os,
"rv = new ");
2236 Emit(os, eFull.c_str());
2237 Emit(os,
"EventArgs(rawArgs, ");
2239 if (!registerMethod.empty())
2248 Emit(os,
", false);\n");
2250 if (!registerMethod.empty())
2254 Emit(os, registerMethod.c_str());
2332 Emit(os, e.c_str());
2333 Emit(os,
"Impl(this, rv);\n");
2343 Emit(os,
"private void Add");
2344 Emit(os, e.c_str());
2345 Emit(os,
"RelayHandler()\n");
2349 Emit(os,
"if (0 == this.");
2350 Emit(os, e.c_str());
2351 Emit(os,
"RelayHandlerId)\n");
2357 Emit(os, e.c_str());
2358 Emit(os,
"RelayHandler =\n");
2361 Emit(os, eFull.c_str());
2362 Emit(os,
".Handler(\n");
2365 Emit(os, e.c_str());
2366 Emit(os,
"RelayHandlerMethod);\n");
2371 Emit(os, e.c_str());
2372 Emit(os,
"Instance =\n");
2375 Emit(os, mname.c_str());
2381 Emit(os, e.c_str());
2382 Emit(os,
"RelayHandlerId =\n");
2385 Emit(os, e.c_str());
2386 Emit(os,
"Instance.AddHandler(\n");
2389 Emit(os, e.c_str());
2390 Emit(os,
"RelayHandler);\n");
2399 Emit(os,
"private void Remove");
2400 Emit(os, e.c_str());
2401 Emit(os,
"RelayHandler()\n");
2405 Emit(os,
"if (0 != this.");
2406 Emit(os, e.c_str());
2407 Emit(os,
"RelayHandlerId)\n");
2412 Emit(os,
"if (System.IntPtr.Zero != this.");
2413 Emit(os, e.c_str());
2414 Emit(os,
"Instance.GetCppThis().Handle)\n");
2419 Emit(os, e.c_str());
2420 Emit(os,
"Instance.RemoveHandler(\n");
2423 Emit(os, e.c_str());
2424 Emit(os,
"RelayHandlerId);\n");
2431 Emit(os, e.c_str());
2432 Emit(os,
"Instance = null;\n");
2436 Emit(os, e.c_str());
2437 Emit(os,
"RelayHandler = null;\n");
2441 Emit(os, e.c_str());
2442 Emit(os,
"RelayHandlerId = 0;\n");
2453 Emit(os,
"#endregion\n");
2461 Emit(os,
"/// <summary>\n");
2463 Emit(os,
"/// Delegate signature for the ");
2464 Emit(os, e.c_str());
2465 Emit(os,
" event.\n");
2467 Emit(os,
"/// </summary>\n");
2469 Emit(os,
"public delegate void ");
2470 Emit(os, e.c_str());
2471 Emit(os,
"EventHandler(");
2472 Emit(os, c->GetName());
2473 Emit(os,
" sender, ");
2474 Emit(os, eFull.c_str());
2475 Emit(os,
"EventArgs args);\n");
2480 gxsys_stl::vector<gxsys_stl::string> docblock;
2487 Emit(os,
"public event ");
2488 Emit(os, e.c_str());
2489 Emit(os,
"EventHandler ");
2490 Emit(os, e.c_str());
2501 Emit(os,
"if (this.");
2502 Emit(os, e.c_str());
2503 Emit(os,
"Impl == null)\n");
2508 Emit(os, e.c_str());
2509 Emit(os,
"RelayHandler();\n");
2515 Emit(os, e.c_str());
2516 Emit(os,
"Impl += value;\n");
2522 Emit(os,
"remove\n");
2527 Emit(os, e.c_str());
2528 Emit(os,
"Impl -= value;\n");
2531 Emit(os,
"if (this.");
2532 Emit(os, e.c_str());
2533 Emit(os,
"Impl == null)\n");
2538 Emit(os, e.c_str());
2539 Emit(os,
"RelayHandler();\n");
2553 gxsys_stl::string fGet;
2554 gxsys_stl::string fSet;
2555 unsigned int indent = 3;
2556 const cable::Method *declMethod = propGetMethod;
2579 declMethod = propSetMethod;
2592 gxsys_stl::vector<gxsys_stl::string> docblock;
2614 Emit(os,
"// iwhPropGet\n");
2634 Emit(os,
"// iwhPropSet\n");
2652 Emit(os,
"if (IntPtr.Zero != clonedException)\n");
2657 Emit(os,
"bool mteCreatedException;\n");
2659 Emit(os,
"System.Exception wrappedException = (System.Exception)\n");
2661 Emit(os,
"Kitware.mummy.Runtime.Methods.CreateWrappedObject(\n");
2663 Emit(os,
"0, mteExceptionIndex, 0, clonedException, true, out mteCreatedException);\n");
2665 Emit(os,
"throw wrappedException;\n");
2681 gxsys_stl::string cname(c->GetName());
2683 gxsys_stl::string retArraySize;
2684 gxsys_stl::string argArraySize;
2685 cable::FunctionType *ft = m->GetFunctionType();
2686 unsigned int cArgs = ft->GetNumberOfArguments();
2687 unsigned int cArgsEmitted = 0;
2689 cable::Type *argType = 0;
2690 cable::Type *retType = ft->GetReturns();
2691 bool voidReturn =
false;
2692 gxsys_stl::string rvType;
2693 gxsys_stl::string rvpType;
2694 bool argIsRef =
false;
2695 gxsys_stl::string argTypeString;
2696 gxsys_stl::string emittedArg;
2697 bool callGetCppThis =
false;
2720 if (emitExceptionParams)
2723 Emit(os,
"uint mteExceptionIndex = 0;\n");
2725 Emit(os,
"IntPtr clonedException = IntPtr.Zero;\n");
2735 if (retArraySize !=
"")
2737 Emit(os, rvpType.c_str());
2738 Emit(os,
" rvp = ");
2742 Emit(os, rvType.c_str());
2743 Emit(os,
" rv = null;\n");
2748 Emit(os,
"uint mteStatus = 0;\n");
2750 Emit(os,
"uint mteIndex = UInt32.MaxValue;\n");
2752 Emit(os,
"uint rawRefCount = 0;\n");
2755 Emit(os, rvpType.c_str());
2756 Emit(os,
" rvp = ");
2760 Emit(os, rvType.c_str());
2769 Emit(os,
"Marshal.PtrToStringAnsi(");
2774 Emit(os, f.c_str());
2779 if (!m->GetStatic())
2781 Emit(os,
"this.GetCppThis()");
2790 for (i= 0; i<cArgs; ++i)
2798 Emit(os,
".Length");
2802 argType = ft->GetArgument(i);
2816 if (!argIsRef && (argTypeString ==
"bool"))
2818 Emit(os,
"(byte)(");
2821 if (impliedArg0 && 0==i)
2823 emittedArg = impliedArg0;
2830 Emit(os, emittedArg.c_str());
2835 <<
"reference arg: "
2836 << cname <<
"." << m->GetName()
2837 <<
" " << argType->GetCxxType().GetName() <<
" " << emittedArg
2838 <<
" (arg " << i <<
")"
2842 callGetCppThis =
false;
2846 const cable::Class* argClass = cable::ClassType::SafeDownCast(
2847 cable::PointerType::SafeDownCast(argType)->GetTarget())->GetClass();
2850 callGetCppThis =
true;
2855 const cable::PointerType* ptrClass = cable::PointerType::SafeDownCast(
2856 cable::ReferenceType::SafeDownCast(argType)->GetTarget());
2857 const cable::Class* argClass = cable::ClassType::SafeDownCast(
2858 ptrClass->GetTarget())->GetClass();
2861 callGetCppThis =
true;
2867 Emit(os,
" == null ? new HandleRef() : ");
2868 Emit(os, emittedArg.c_str());
2869 Emit(os,
".GetCppThis()");
2872 if (!argIsRef && (argTypeString ==
"bool"))
2874 Emit(os,
" ? 1 : 0)");
2893 Emit(os,
"ref mteStatus, ref mteIndex, ref rawRefCount");
2897 if (emitExceptionParams)
2904 Emit(os,
"ref mteExceptionIndex, ref clonedException");
2915 const cable::Class* cRetType = cable::ClassType::SafeDownCast(
2916 cable::PointerType::SafeDownCast(retType)->GetTarget()
2925 Emit(os,
"if (IntPtr.Zero != rvp)\n");
2930 Emit(os,
"bool mteCreated;\n");
2933 Emit(os, rvType.c_str());
2936 Emit(os,
"Kitware.mummy.Runtime.Methods.CreateWrappedObject(\n");
2938 Emit(os,
"mteStatus, mteIndex, rawRefCount, rvp, ");
2940 if (!unRegisterMethod.empty())
2949 Emit(os,
", out mteCreated");
2952 if (!registerMethod.empty())
2957 Emit(os,
"// Returned object is counted already, (factory method or iwhCounted hint),\n");
2959 Emit(os,
"// no 'rv.");
2960 Emit(os, registerMethod.c_str());
2961 Emit(os,
"' call is necessary...\n");
2966 Emit(os,
"if (mteCreated)\n");
2971 Emit(os, registerMethod.c_str());
2987 else if (rvType ==
"bool")
2989 Emit(os,
" == 0 ? false : true;\n");
2997 if (emitExceptionParams)
3006 if (retArraySize !=
"")
3009 Emit(os, rvType.c_str());
3010 Emit(os,
"[] rv = null;");
3014 Emit(os,
"if (IntPtr.Zero != rvp)");
3020 Emit(os,
"rv = new ");
3021 Emit(os, rvType.c_str());
3023 Emit(os, retArraySize.c_str());
3030 if (rvType ==
"uint")
3033 Emit(os,
"int[] rv2 = new int[");
3034 Emit(os, retArraySize.c_str());
3039 Emit(os,
"Marshal.Copy(rvp, rv2, 0, rv.Length);");
3043 Emit(os,
"for (int rv2i = 0; rv2i < ");
3044 Emit(os, retArraySize.c_str());
3045 Emit(os,
"; ++rv2i)");
3053 Emit(os,
"rv[rv2i] = (uint)rv2[rv2i];");
3063 Emit(os,
"Marshal.Copy(rvp, rv, 0, rv.Length);");
3076 Emit(os,
"return rv;");
3083 void MummyCsharpGenerator::EmitCSharpMethod(gxsys_ios::ostream &os,
const char *dllname,
const cable::Class *c,
const cable::Method *m,
const gxsys_stl::string& mname,
const gxsys_stl::string& accessLevel,
bool emitExceptionParams)
3095 gxsys_stl::vector<gxsys_stl::string> docblock;
3122 gxsys_stl::vector<gxsys_stl::string> docblock;
3124 for (cable::Context::Iterator it = c->Begin(); it != c->End(); ++it)
3126 cable::Enumeration *e = cable::Enumeration::SafeDownCast(*it);
3128 if (e && (cable::Context::Public == it.GetAccess()))
3142 Emit(os,
"public ");
3148 Emit(os, ename.c_str());
3154 for (cable::Enumeration::Iterator eit = e->Begin(); eit != e->End(); ++eit)
3157 Emit(os,
"/// <summary>enum member</summary>\n");
3180 gxsys_stl::string cname(c->GetName());
3181 gxsys_stl::string f;
3188 f = cname +
"Shadow_CreateShadow";
3191 Emit(os,
"[DllImport(");
3193 Emit(os,
", EntryPoint = \"");
3194 Emit(os, f.c_str());
3199 Emit(os,
"static extern IntPtr ");
3200 Emit(os, f.c_str());
3201 Emit(os,
"(IntPtr primary);\n");
3206 gxsys_stl::vector<gxsys_stl::string> docblock;
3212 Emit(os,
"public ");
3213 Emit(os, cname.c_str());
3214 Emit(os,
"() : this(IntPtr.Zero, false, false)\n");
3220 Emit(os,
"IntPtr primary = Marshal.GetIDispatchForObject(this);\n");
3223 Emit(os,
"this.SetCppThis(");
3224 Emit(os, f.c_str());
3225 Emit(os,
"(primary), true, false);\n");
3228 Emit(os,
"Marshal.Release(primary);\n");
3259 if (this->
GetSettings()->GetEmitDefaultFactoryMethod(c))
3273 gxsys_stl::vector<gxsys_stl::string> docblock;
3278 Emit(os,
"public ");
3279 Emit(os, cname.c_str());
3282 Emit(os,
": base(IntPtr.Zero, false, false)\n");
3288 Emit(os,
"// mummy generated default C# constructor\n");
3290 Emit(os,
"uint mteStatus = 0;\n");
3292 Emit(os,
"uint mteIndex = UInt32.MaxValue;\n");
3294 Emit(os,
"uint rawRefCount = 0;\n");
3297 if (emitExceptionParams)
3300 Emit(os,
"uint mteExceptionIndex = UInt32.MaxValue;\n");
3302 Emit(os,
"IntPtr clonedException = IntPtr.Zero;\n");
3307 Emit(os,
"IntPtr rawCppThis = ");
3308 Emit(os, f.c_str());
3309 Emit(os,
"(ref mteStatus, ref mteIndex, ref rawRefCount");
3311 if (emitExceptionParams)
3313 Emit(os,
", ref mteExceptionIndex, ref clonedException");
3318 if (emitExceptionParams)
3326 Emit(os,
"this.SetCppThis(rawCppThis, true, (0==mteStatus || rawRefCount<2 ? false : true));\n");
3342 void MummyCsharpGenerator::EmitCSharpDispose(gxsys_ios::ostream &os,
const char *dllname,
const cable::Class *c,
const cable::Method *m,
const gxsys_stl::string& mname,
const unsigned int eventCount,
bool emitExceptionParams)
3344 cable::FunctionType *ft = 0;
3345 cable::Type *argType = 0;
3346 unsigned int cArgs = 0;
3348 gxsys_stl::string f;
3352 ft = m->GetFunctionType();
3353 cArgs = ft->GetNumberOfArguments();
3364 gxsys_stl::vector<gxsys_stl::string> docblock;
3371 Emit(os,
"/// <summary>\n");
3373 Emit(os,
"/// Automatically generated protected Dispose method - called from\n");
3375 Emit(os,
"/// public Dispose or the C# destructor. DO NOT call directly.\n");
3377 Emit(os,
"/// </summary>\n");
3382 Emit(os,
"protected override void Dispose(bool disposing)\n");
3392 bool openedTryFinally =
false;
3393 unsigned int indent = 2;
3394 if ((0 != eventCount) || m)
3396 openedTryFinally =
true;
3406 if (0 != eventCount)
3409 Emit(os,
"this.RemoveAllRelayHandlers();\n");
3415 Emit(os,
"if (this.GetCallDisposalMethod())\n");
3419 if (emitExceptionParams)
3422 Emit(os,
"uint mteExceptionIndex = 0;\n");
3424 Emit(os,
"IntPtr clonedException = IntPtr.Zero;\n");
3429 Emit(os, f.c_str());
3430 Emit(os,
"(this.GetCppThis()");
3432 for (i = 0; i<cArgs; ++i)
3434 argType = ft->GetArgument(i);
3438 Emit(os,
", new HandleRef()");
3442 Emit(os,
", System.IntPtr.Zero");
3450 if (emitExceptionParams)
3452 Emit(os,
", ref mteExceptionIndex, ref clonedException");
3457 Emit(os,
"this.ClearCppThis();\n");
3459 if (emitExceptionParams)
3470 if (openedTryFinally)
3475 Emit(os,
"finally\n");
3481 Emit(os,
"base.Dispose(disposing);\n");
3483 if (openedTryFinally)
3499 return f1->GetOffset() < f2->GetOffset();
3507 gxsys_stl::vector<cable::Field*> fields;
3508 gxsys_stl::vector<cable::Field*>::iterator fit;
3509 gxsys_stl::string derivedName;
3510 gxsys_stl::string fieldType;
3511 gxsys_stl::vector<gxsys_stl::string> docblock;
3513 bool fieldAccess = !
HasAttribute(c,
"gccxml(iwhNoFieldAccess)");
3517 for (cable::Context::Iterator it = c->Begin(); it != c->End(); ++it)
3519 cable::Field* f = cable::Field::SafeDownCast(*it);
3522 fields.push_back(f);
3533 Emit(os,
"public ");
3536 Emit(os,
"partial ");
3538 Emit(os,
"struct ");
3549 for (fit = fields.begin(); fit != fields.end(); ++fit)
3551 cable::Field* f = *fit;
3565 if (fieldType ==
"bool")
3571 Emit(os,
"private ");
3572 Emit(os, fieldType.c_str());
3574 Emit(os, derivedName.c_str());
3582 for (fit = fields.begin(); fieldAccess && fit != fields.end(); ++fit)
3584 cable::Field* f = *fit;
3597 Emit(os,
"public ");
3598 Emit(os, fieldType.c_str());
3600 Emit(os, derivedName.c_str());
3614 Emit(os,
"return this.m_");
3615 Emit(os, derivedName.c_str());
3616 if (fieldType ==
"bool")
3620 Emit(os,
" == 0 ? false : true");
3636 Emit(os,
"this.m_");
3637 Emit(os, derivedName.c_str());
3639 if (fieldType ==
"bool")
3643 Emit(os,
"(byte)(value ? 1 : 0)");
3667 const cable::Class *c,
3668 gxsys_stl::vector<cable::Method*>& wrapped_methods,
3669 cable::Method*& factoryM,
3670 cable::Method*& disposalM,
3671 cable::Method*& registerM,
3672 cable::Method*& unRegisterM,
3673 bool includeParentMethods
3683 gxsys_stl::string factoryMethod(this->
GetSettings()->GetFactoryMethod(c));
3684 gxsys_stl::string disposalMethod(this->
GetSettings()->GetDisposalMethod(c));
3685 gxsys_stl::string registerMethod(this->
GetSettings()->GetRegisterMethod(c));
3686 gxsys_stl::string unRegisterMethod(this->
GetSettings()->GetUnRegisterMethod(c));
3696 wrapped_methods.clear();
3707 if (includeParentMethods)
3710 factoryM, disposalM, registerM, unRegisterM,
true);
3716 for (cable::Context::Iterator it = c->Begin(); it != c->End(); ++it)
3718 cable::Method *m = cable::Method::SafeDownCast(*it);
3724 if ((c == this->
GetTargetClass()) && signature == factoryMethod +
"()")
3726 LogVerboseInfo(<<
"Found factory method, signature: " << signature);
3730 else if (signature == disposalMethod +
"()")
3732 LogVerboseInfo(<<
"Found disposal method, signature: " << signature);
3736 else if (gxsys::SystemTools::StringStartsWith(registerMethod.c_str(),
3737 (gxsys_stl::string(m->GetName())+
"(").c_str()))
3739 LogVerboseInfo(<<
"Found register method, signature: " << signature);
3743 else if (gxsys::SystemTools::StringStartsWith(unRegisterMethod.c_str(),
3744 (gxsys_stl::string(m->GetName())+
"(").c_str()))
3746 LogVerboseInfo(<<
"Found unregister method, signature: " << signature);
3753 wrapped_methods.push_back(m);
3777 << (*it)->GetNameOfClass()
3780 <<
"' not wrapped because it's not a method...\n"
3791 bool operator()(
const cable::Method* m1,
const cable::Method* m2)
3793 return m1->GetLine() < m2->GetLine();
3800 const cable::Class *,
3801 gxsys_stl::vector<cable::Method*>& wrapped_methods,
3809 gxsys_stl::vector<cable::Method*> wrapped_methods_local;
3810 gxsys_stl::vector<cable::Method*>::iterator mit;
3811 cable::Method* m = 0;
3812 gxsys::RegularExpression reGet;
3813 gxsys::RegularExpression reSet;
3815 reGet.compile(
"^[Gg]et");
3816 reSet.compile(
"^[Ss]et");
3821 gxsys_stl::copy(wrapped_methods.begin(), wrapped_methods.end(),
3822 gxsys_stl::back_inserter(wrapped_methods_local));
3827 gxsys_stl::sort(wrapped_methods_local.begin(), wrapped_methods_local.end(),
3830 for (mit = wrapped_methods_local.begin(); mit != wrapped_methods_local.end(); ++mit)
3834 cable::FunctionType *ft = m->GetFunctionType();
3835 unsigned int cArgs = ft->GetNumberOfArguments();
3836 unsigned int cReqArgs = ft->GetNumberOfRequiredArguments();
3837 cable::Type *retType = ft->GetReturns();
3838 bool voidReturn =
false;
3839 bool iwhPropGetExempt =
false;
3846 if (cArgs != cReqArgs)
3852 "ignoring default argument values for method '" << m->GetName() <<
"'.");
3855 if (reGet.find(m->GetName()))
3862 if (gxsys_stl::string(
"GetEnumerator") == m->GetName())
3864 iwhPropGetExempt =
true;
3874 "'Getter' method '" << m->GetName() <<
"' returns void.");
3880 "'Getter' method '" << m->GetName() <<
"' has arguments. Should it?");
3883 if (!iwhPropGetExempt && !
HasAttribute(m,
"gccxml(iwhPropGet)"))
3885 if (!voidReturn && 0==cArgs)
3888 "'Getter' method '" << m->GetName() <<
"' is a perfect candidate for the 'iwhPropGet' hint. Add the 'iwhPropGet' hint to eliminate this warning.");
3893 "'Getter' method '" << m->GetName() <<
"' does not have the 'iwhPropGet' hint. Should it?");
3897 if (!m->GetConst() && !m->GetStatic())
3900 "'Getter' method '" << m->GetName() <<
"' is not const. Should it be const?");
3904 if (reSet.find(m->GetName()))
3910 if (voidReturn && 1==cArgs)
3913 "'Setter' method '" << m->GetName() <<
"' is a perfect candidate for the 'iwhPropSet' hint. Add the 'iwhPropSet' hint to eliminate this warning.");
3918 "'Setter' method '" << m->GetName() <<
"' does not have the 'iwhPropSet' hint. Should it?");
3925 "'Setter' method '" << m->GetName() <<
"' has " << cArgs <<
" arguments. Should it have exactly one argument instead?");
3936 gxsys_stl::vector<cable::Method*>& wrapped_methods,
3937 gxsys_stl::map<gxsys_stl::string, gxsys_stl::pair<cable::Method*, cable::Method*> >& wrapped_properties
3940 gxsys_stl::vector<cable::Method*>::iterator mit;
3941 gxsys_stl::map<gxsys_stl::string, gxsys_stl::pair<cable::Method*, cable::Method*> >::iterator gsit;
3942 bool addingPropGet =
false;
3943 bool addingPropSet =
false;
3944 cable::Method* propGetMethod = 0;
3945 cable::Method* propSetMethod = 0;
3946 gxsys_stl::string propName;
3948 for (mit = wrapped_methods.begin(); mit != wrapped_methods.end(); ++mit)
3950 addingPropGet =
HasAttribute(*mit,
"gccxml(iwhPropGet)");
3951 addingPropSet = addingPropGet ?
false :
HasAttribute(*mit,
"gccxml(iwhPropSet)");
3953 if (addingPropGet || addingPropSet)
3957 propGetMethod = *mit;
3966 propSetMethod = *mit;
3976 gsit = wrapped_properties.find(propName);
3978 if (gsit == wrapped_properties.end())
3982 wrapped_properties.insert(gxsys_stl::make_pair(propName,
3983 gxsys_stl::make_pair(propGetMethod, propSetMethod)));
3995 propSetMethod = gsit->second.second;
4000 propGetMethod = gsit->second.first;
4006 gsit->second = gxsys_stl::make_pair(propGetMethod, propSetMethod);
4016 if (!wrapped_properties.empty())
4018 gxsys_stl::string comment;
4025 for (gsit = wrapped_properties.begin(); gsit != wrapped_properties.end(); ++gsit)
4027 if (gsit->second.first!=0 && gsit->second.second!=0)
4029 comment =
"ReadWrite property.";
4031 else if (gsit->second.first!=0)
4033 comment =
"ReadOnly property.";
4035 else if (gsit->second.second!=0)
4038 gsit->second.second->GetLine(),
4040 "A WriteOnly property '" << gsit->first <<
4041 "' is very unusual - did you forget to mark the 'Get' method with 'iwhPropGet'?");
4051 <<
" propGetMethod: " << gsit->second.first
4052 <<
" propSetMethod: " << gsit->second.second
4065 gxsys_stl::vector<cable::Method*> wrapped_methods;
4066 gxsys_stl::vector<cable::Method*>::iterator mit;
4067 cable::Method *factoryM = 0;
4068 cable::Method *disposalM = 0;
4069 cable::Method *registerM = 0;
4070 cable::Method *unRegisterM = 0;
4072 gxsys_stl::string atts(c->GetAttributes());
4073 gxsys_stl::string mname;
4078 gxsys_stl::string target_namespace;
4079 gxsys_stl::string base_namespace(this->
GetSettings()->GetPackage());
4084 if (class_namespace ==
"::")
4086 class_namespace =
"";
4089 if (base_namespace ==
"")
4091 target_namespace = class_namespace;
4093 else if (class_namespace ==
"")
4095 target_namespace = base_namespace;
4099 target_namespace = base_namespace +
"." + class_namespace;
4111 if (mapToType !=
"")
4114 Emit(os,
"//----------------------------------------------------------------------------\n");
4115 Emit(os,
"// Unmanaged class '");
4117 Emit(os,
"' maps directly to type '");
4118 Emit(os, mapToType.c_str());
4120 Emit(os,
"// No code generated for '");
4134 Emit(os,
"//----------------------------------------------------------------------------\n");
4135 Emit(os,
"using System;\n");
4136 Emit(os,
"using System.Runtime.InteropServices; // DllImport and HandleRef both live here\n");
4143 gxsys_stl::vector<gxsys_stl::string> refs;
4147 Emit(os,
"// References\n");
4148 gxsys_stl::vector<gxsys_stl::string>::iterator rit;
4149 for (rit = refs.begin(); rit != refs.end(); ++rit)
4152 Emit(os, rit->c_str());
4161 if (target_namespace !=
"")
4163 Emit(os,
"namespace ");
4164 Emit(os, target_namespace.c_str());
4173 gxsys_stl::vector<gxsys_stl::string> docblock;
4192 cable::Method* um = 0;
4193 bool bVirtual =
false;
4194 for (cable::Context::Iterator umit = c->Begin(); !bVirtual && umit != c->End(); ++umit)
4196 um = cable::Method::SafeDownCast(*umit);
4197 if (um && um->GetVirtual())
4206 "A utility class cannot have any virtual methods. The '" << um->GetName() <<
4207 "' method should not be virtual.");
4222 this->
GatherWrappedMethods(c, wrapped_methods, factoryM, disposalM, registerM, unRegisterM,
false);
4235 gxsys_stl::map<gxsys_stl::string, gxsys_stl::pair<cable::Method*, cable::Method*> > wrapped_properties;
4241 gxsys_stl::map<gxsys_stl::string, gxsys_stl::pair<cable::Method*, cable::Method*> >::iterator gsit;
4242 for (gsit = wrapped_properties.begin(); gsit != wrapped_properties.end(); ++gsit)
4244 if (gsit->second.first)
4246 mit = gxsys_stl::find(wrapped_methods.begin(), wrapped_methods.end(),
4247 gsit->second.first);
4248 if (mit != wrapped_methods.end())
4250 wrapped_methods.erase(mit);
4258 if (gsit->second.second)
4260 mit = gxsys_stl::find(wrapped_methods.begin(), wrapped_methods.end(),
4261 gsit->second.second);
4262 if (mit != wrapped_methods.end())
4264 wrapped_methods.erase(mit);
4287 Emit(os,
"public ");
4288 if (c->GetAbstract())
4290 Emit(os,
"abstract ");
4294 Emit(os,
"partial ");
4307 if (wrappedObjectBase.empty())
4309 wrappedObjectBase =
"Kitware.mummy.Runtime.WrappedObject";
4312 Emit(os, wrappedObjectBase.c_str());
4323 if (iface ==
"IEnumerable")
4326 Emit(os,
", System.Collections.IEnumerable");
4328 else if (iface ==
"IEnumerator")
4331 Emit(os,
", System.Collections.IEnumerator");
4337 Emit(os, iface.c_str());
4355 gxsys_stl::string fullCSharpName;
4356 if (target_namespace !=
"")
4373 Emit(os,
"/// <summary>\n");
4375 Emit(os,
"/// Automatically generated type registration mechanics.\n");
4377 Emit(os,
"/// </summary>\n");
4379 Emit(os,
"public new static readonly string MRClassNameKey = \"");
4385 Emit(os,
"/// <summary>\n");
4387 Emit(os,
"/// Automatically generated type registration mechanics.\n");
4389 Emit(os,
"/// </summary>\n");
4391 Emit(os,
"public new const string MRFullTypeName = \"");
4392 Emit(os, fullCSharpName.c_str());
4397 Emit(os,
"/// <summary>\n");
4399 Emit(os,
"/// Automatically generated type registration mechanics.\n");
4401 Emit(os,
"/// </summary>\n");
4403 Emit(os,
"static ");
4410 Emit(os,
"Kitware.mummy.Runtime.Methods.RegisterType(\n");
4412 Emit(os,
"System.Reflection.Assembly.GetExecutingAssembly(),\n");
4414 Emit(os,
"MRClassNameKey,\n");
4416 Emit(os,
"System.Type.GetType(MRFullTypeName)\n");
4434 unsigned int eventCount = 0;
4435 gxsys_stl::map<gxsys_stl::string, int> event_name_counter;
4436 gxsys_stl::map<const cable::Method*, gxsys_stl::string> methodEventNames;
4437 gxsys_stl::string eventName;
4441 for (mit = wrapped_methods.begin(); mit != wrapped_methods.end(); ++mit)
4449 event_name_counter[eventName]++;
4459 for (mit = wrapped_methods.begin(); mit != wrapped_methods.end(); ++mit)
4465 if (1 == event_name_counter[eventName])
4467 methodEventNames[*mit] = eventName;
4480 gxsys_stl::map<const cable::Method*, gxsys_stl::string>::iterator menIt;
4481 event_name_counter.clear();
4482 for (mit = wrapped_methods.begin(); mit != wrapped_methods.end(); ++mit)
4486 menIt = methodEventNames.find(*mit);
4488 if (menIt != methodEventNames.end())
4490 eventName = menIt->second;
4491 event_name_counter[eventName]++;
4493 if (event_name_counter[eventName] > 1)
4496 <<
"duplicate event name found: " << eventName.c_str()
4497 <<
" (a C# compile error will likely follow...)"
4504 <<
"event method not found in methodEventNames map...");
4512 gxsys_stl::string ctorModifier(this->
GetSettings()->GetCsharpConstructorModifier(c));
4513 if (ctorModifier.empty())
4515 ctorModifier =
"public";
4518 Emit(os,
"/// <summary>\n");
4520 Emit(os,
"/// Automatically generated constructor - called from generated code.\n");
4522 Emit(os,
"/// DO NOT call directly.\n");
4524 Emit(os,
"/// </summary>\n");
4526 Emit(os, ctorModifier.c_str());
4529 Emit(os,
"(IntPtr rawCppThis, bool callDisposalMethod, bool strong) :\n");
4531 Emit(os,
"base(rawCppThis, callDisposalMethod, strong)\n");
4540 const cable::Method* fmp = 0;
4544 if (!factoryMethod.empty() && factoryMethod!=
"new")
4549 mname = fmp->GetName();
4570 mname = registerM->GetName();
4587 const cable::Method* dmp = 0;
4591 if (!unRegisterMethod.empty())
4596 mname = dmp->GetName();
4599 else if (!disposalMethod.empty())
4604 mname = dmp->GetName();
4627 for (cable::Context::Iterator it = c->Begin(); it != c->End(); ++it)
4629 cable::Typedef *t = cable::Typedef::SafeDownCast(*it);
4631 if (t && (cable::Context::Public == it.GetAccess()))
4633 bool isDelegate =
false;
4634 gxsys_stl::string tname(t->GetName());
4638 cable::PointerType *pt = cable::PointerType::SafeDownCast(t->GetType());
4639 cable::FunctionType *ft = 0;
4642 ft = cable::FunctionType::SafeDownCast(pt->GetTarget());
4659 Emit(os,
"public delegate ");
4661 unsigned int cArgs = ft->GetNumberOfArguments();
4662 cable::Type *argType = 0;
4663 cable::Type *retType = ft->GetReturns();
4671 gxsys_stl::string arraySize =
"";
4672 atts = t->GetAttributes();
4690 if (arraySize !=
"")
4697 Emit(os, t->GetName());
4704 for (i= 0; i<cArgs; ++i)
4706 argType = ft->GetArgument(i);
4711 atts = ft->GetArgumentAttributes(i);
4724 if (arraySize !=
"")
4753 if (0 != eventCount)
4755 for (mit = wrapped_methods.begin(); mit != wrapped_methods.end(); ++mit)
4762 menIt = methodEventNames.find(*mit);
4763 if (menIt != methodEventNames.end())
4765 eventName = menIt->second;
4771 <<
"event method not found in methodEventNames map...");
4785 Emit(os,
"/// <summary>\n");
4787 Emit(os,
"/// Method to disconnect all RelayHandler event members.\n");
4789 Emit(os,
"/// Called automatically from Dispose. DO NOT call directly.\n");
4791 Emit(os,
"/// </summary>\n");
4793 Emit(os,
"private void RemoveAllRelayHandlers()\n");
4797 for (mit = wrapped_methods.begin(); mit != wrapped_methods.end(); ++mit)
4801 menIt = methodEventNames.find(*mit);
4802 if (menIt != methodEventNames.end())
4804 eventName = menIt->second;
4810 <<
"event method not found in methodEventNames map...");
4814 Emit(os,
"this.Remove");
4815 Emit(os, eventName.c_str());
4816 Emit(os,
"RelayHandler();\n");
4827 for (gsit = wrapped_properties.begin(); gsit != wrapped_properties.end(); ++gsit)
4831 EmitCSharpProperty(os, dllname, c, gsit->second.first, gsit->second.second, emitExceptionParams);
4837 for (mit = wrapped_methods.begin(); mit != wrapped_methods.end(); ++mit)
4841 EmitCSharpMethod(os, dllname, c, *mit, (*mit)->GetName(),
"public", emitExceptionParams);
4853 if (extraCode !=
"")
4857 Emit(os,
"// Begin extraCsharpCode\n");
4861 Emit(os,
"// End extraCsharpCode\n");
4873 if (target_namespace !=
"")
bool IsChar(const cable::Type *t)
virtual void CacheExternalHints(const gxsys_stl::string &hintsfile)
gxsys_stl::string GetQualifiedEventName(const cable::Method *m)
virtual bool WrappedEnumExists(const gxsys_stl::string &name)
virtual void GetFirstCommentBlock(gxsys_stl::vector< gxsys_stl::string > &block)
Retrieve the first block of comment lines, if any, in the file.
virtual MummyLineOrientedTextFileReader * GetHeaderFileReader(const cable::Class *c)
Get or create a header file reader. Only uses class 'c' on the first call. Subsequent calls retrieve ...
virtual void SetFileName(const char *filename)
Set the filename.
bool IsCharPointerPointer(const cable::Type *t)
void Emit(gxsys_ios::ostream &os, const char *s)
virtual void AddLookupEntries(const cable::Class *c)
virtual const char * GetArgName(cable::FunctionType *ftype, unsigned int i)
bool IsCharPointer(const cable::Type *t)
virtual void EmitCSharpDispose(gxsys_ios::ostream &os, const char *dllname, const cable::Class *c, const cable::Method *m, const gxsys_stl::string &mname, const unsigned int eventCount, bool emitExceptionParams)
virtual bool WrappedMethodExists(const gxsys_stl::string &signature)
virtual void EmitCSharpMethodDeclaration(gxsys_ios::ostream &os, const cable::Class *c, const cable::Method *m, bool asProperty, bool useArg0AsReturn, const gxsys_stl::string &accessLevel)
#define LogVerboseInfo(m)
virtual gxsys_stl::string GetExportLayerFunctionName(const cable::Class *c, const cable::Method *m, const gxsys_stl::string &mname)
gxsys_stl::string GetEnumerationTypeString(const cable::Type *t)
void EmitIndent(gxsys_ios::ostream &os, const unsigned int n)
const cable::Class * GetParentClass(const cable::Class *c)
virtual void EmitCSharpConstructor(gxsys_ios::ostream &os, const char *dllname, const cable::Class *c, const cable::Method *m, const gxsys_stl::string &mname, bool emitExceptionParams)
const cable::Method * Method
virtual void EmitCSharpWrapperClassAsStruct(gxsys_ios::ostream &os, const cable::Class *c)
unsigned int CurrentMethodId
gxsys_stl::map< gxsys_stl::string, MethodInstance > VirtualMethods
gxsys_stl::map< gxsys_stl::string, MethodInstance > WrappedMethods
virtual gxsys_stl::string GetMethodSignature(const cable::Class *c, const cable::Method *m)
virtual bool TypeIsWrappable(const cable::Type *t)
gxsys_stl::string GetEventName(const cable::Method *m)
virtual bool VirtualMethodOverridden(const gxsys_stl::string &signature)
bool IsObject(const cable::Type *t)
bool EquivalentTypedefNameExists(const cable::Class *c, const cable::FunctionType *target, gxsys_stl::string &s)
gxsys_stl::map< gxsys_stl::string, MethodInstance > WrappedEnums
virtual bool IsDisposalMethod(const cable::Class *c, const cable::Method *m)
bool HasAttribute(const cable::SourceObject *o, const char *attr)
virtual bool MethodIsWrappable(const cable::Method *m, const cable::Context::Access &access)
bool HasMapToType(const cable::Type *t)
virtual gxsys_stl::string GetWrappedMethodName(const cable::Method *m)
bool IsObjectPointerReference(const cable::Type *t)
virtual void EmitCSharpWrapperClass(gxsys_ios::ostream &os, const char *dllname, const cable::Class *c)
gxsys_stl::string GetFullyQualifiedNameForCPlusPlus(const cable::Named *n)
gxsys_stl::string GetFullyQualifiedNameForCSharp(const cable::Named *n)
virtual const cable::Class * GetWrappableParentClass(const cable::Class *c)
virtual gxsys_stl::string GetDisposalMethod(const cable::Class *c)
virtual void SetTargetClass(const cable::Class *c)
Set the current target class.
virtual void EmitCSharpEnums(gxsys_ios::ostream &os, const cable::Class *c)
bool operator()(const cable::Field *f1, const cable::Field *f2)
bool ReturnTypeMatchesHintType(cable::Type *t, const gxsys_stl::string &type)
bool IsUtilityClass(const cable::Class *c)
bool IsVoid(const cable::Type *t)
gxsys_stl::string GetFullyQualifiedName(const cable::Named *n, const char *sep)
bool ExtractTypeAndCountFromHintLine(const gxsys_stl::string &hint, gxsys_stl::string &type, gxsys_stl::string &count)
#define LogFileLineErrorMsg(file, line, n, m)
gxsys_stl::map< gxsys_stl::string, MethodInstance > OtherMethods
bool IsObjectPointer(const cable::Type *t)
virtual unsigned int GetNumberOfLines()
Retrieve the total number of lines currently cached.
gxsys_stl::string GetWrappedEnumName(const cable::Enumeration *e)
virtual void DumpLookupEntries()
MethodInstance(const cable::Class *c, const cable::Method *m)
gxsys_stl::map< const gxsys_stl::string, gxsys_stl::string > HintsMap
virtual void EmitCSharpRegister(gxsys_ios::ostream &os, const char *dllname, const cable::Class *c, const cable::Method *m, const gxsys_stl::string &mname, bool emitExceptionParams)
const char * GetAccessString(cable::Context::Access access)
virtual bool ValidateWrappedMethods(const cable::Class *c, gxsys_stl::vector< cable::Method * > &wrapped_methods, cable::Method *&factoryM, cable::Method *&disposalM, cable::Method *®isterM, cable::Method *&unRegisterM)
virtual void SetTargetClass(const cable::Class *c)
Set the current target class.
gxsys_stl::string ExtractMapToType(const cable::SourceObject *o)
gxsys_stl::map< const cable::Method *, unsigned int > MethodIdMap
gxsys_stl::string ExtractArraySize(const gxsys_stl::string &atts)
virtual bool GetPartialClass(const cable::Class *c)
virtual void AddTargetInterface(const gxsys_stl::string &iface)
bool IsCxxMainStyleParamPair(const cable::FunctionType *ft, unsigned int i)
virtual gxsys_stl::string GetMethodArgumentArraySize(const cable::Class *c, const cable::Method *m, const cable::FunctionType *ft, unsigned int i)
virtual void BuildPropGetsAndSetsMap(gxsys_stl::vector< cable::Method * > &wrapped_methods, gxsys_stl::map< gxsys_stl::string, gxsys_stl::pair< cable::Method *, cable::Method * > > &wrapped_properties)
virtual void GetReferences(gxsys_stl::vector< gxsys_stl::string > &references)
gxsys_stl::map< gxsys_stl::string, MethodInstance > StaticMethods
virtual bool GetVerbose()
virtual ~MummyCsharpGenerator()
virtual void EmitCSharpMethodBody(gxsys_ios::ostream &os, unsigned int indent, const cable::Class *c, const cable::Method *m, gxsys_stl::string &f, const char *impliedArg0, bool emitExceptionParams)
gxsys_stl::string GetFullyQualifiedCPlusPlusTypeIdName(const cable::Named *n)
virtual bool FunctionTypeIsWrappable(const cable::FunctionType *ft)
virtual bool HasTargetInterface(const char *iface) const
gxsys_stl::string GetWrappedClassName(const cable::Class *c)
virtual bool IsLineExcluded(unsigned int lineNumber)
Query whether the given line number should be excluded based on the exclude flag and the line number'...
gxsys_stl::string ExtractDerivedName(const char *s, const cable::Named *n, bool verbose)
virtual gxsys_stl::string GetFundamentalTypeString(const cable::Type *t)
bool ExtractCountFromMethodDeclarationLine(const gxsys_stl::string &line, gxsys_stl::string &count)
#define LogFileLineInfoMsg(file, line, n, m)
virtual gxsys_stl::string GetFactoryMethod(const cable::Class *c)
virtual const cable::Class * GetTargetClass()
Get the current target class.
virtual gxsys_stl::string GetCSharpTypeString(const cable::Type *t, bool forReturn, bool isArray)
virtual bool ClassIsWrappable(const cable::Class *c)
virtual bool StaticMethodRedefined(const gxsys_stl::string &signature)
virtual gxsys_stl::string GetPInvokeTypeString(const cable::Type *t, bool forReturn, bool isArray, bool forDelegate)
void EmitFile(gxsys_ios::ostream &os, const char *filename)
Class that reads a text file and caches its lines and information about those lines for quick queries...
virtual gxsys_stl::string GetUnRegisterMethod(const cable::Class *c)
virtual bool MethodReturnValueIsCounted(const cable::Class *c, const cable::Method *m)
const cable::Constructor * FindNonAbstractPublicDefaultConstructor(const cable::Class *c)
virtual void EmitCSharpMethod(gxsys_ios::ostream &os, const char *dllname, const cable::Class *c, const cable::Method *m, const gxsys_stl::string &mname, const gxsys_stl::string &accessLevel, bool emitExceptionParams)
virtual gxsys_stl::string GetExtraCsharpCode(const cable::Class *c)
gxsys_stl::string ExtractImplementsInterface(const gxsys_stl::string &atts)
virtual void GatherWrappedMethods(const cable::Class *c, gxsys_stl::vector< cable::Method * > &wrapped_methods, cable::Method *&factoryM, cable::Method *&disposalM, cable::Method *®isterM, cable::Method *&unRegisterM, bool includeParentMethods)
gxsys_stl::string wrappedObjectBase
void EmitDocumentationBlock(gxsys_ios::ostream &os, const gxsys_stl::vector< gxsys_stl::string > &block, const unsigned int indent, bool isClassDoc)
virtual bool MethodWrappableAsEvent(const cable::Method *m, const cable::Context::Access &access)
virtual bool OtherMethodRedefined(const gxsys_stl::string &signature)
bool IsFundamentalPointer(const cable::Type *t, cxx::FundamentalType::Id tid)
virtual bool GetIsRefArg(const cable::Type *t)
virtual void EmitMummyVersionComments(gxsys_ios::ostream &os, const char *lineCommentString)
virtual void GetCommentBlockBefore(unsigned int lineNumber, gxsys_stl::vector< gxsys_stl::string > &block, unsigned int smallestAcceptableLineNumber)
Retrieve the nearest preceding block of comment lines relative to line number 'lineNumber'. Valid 'lineNumber' values are 2 through GetNumberOfLines inclusive.
virtual bool GenerateWrappers()
virtual gxsys_stl::string GetRegisterMethod(const cable::Class *c)
bool IsVoidPointer(const cable::Type *t)
gxsys_stl::string GetWrappedClassNameFullyQualified(const cable::Class *c)
virtual bool ClassIsWrappable(const cable::Class *c)
gxsys_stl::string exceptionBaseClass
const cable::Class * Class
bool operator()(const cable::Method *m1, const cable::Method *m2)
virtual void EmitCSharpDllImportDeclaration(gxsys_ios::ostream &os, const char *dllname, const cable::Class *c, const cable::Method *m, const gxsys_stl::string &mname, const char *f, bool emitExceptionParams)
virtual gxsys_stl::string GetLine(unsigned int lineNumber)
Retrieve line number 'lineNumber' as a string from the currently cached text file. Valid 'lineNumber' values are 1 through GetNumberOfLines inclusive.
virtual void EmitCSharpEvent(gxsys_ios::ostream &os, const char *dllname, const cable::Class *c, const cable::Method *m, const gxsys_stl::string &eventName)
virtual bool FundamentalTypeIsWrappable(const cable::Type *t)
virtual void EmitCSharpProperty(gxsys_ios::ostream &os, const char *dllname, const cable::Class *c, const cable::Method *propGetMethod, const cable::Method *propSetMethod, bool emitExceptionParams)
void EmitThrowClonedException(gxsys_ios::ostream &os, unsigned int indent)
unsigned int ClassLineNumber
virtual void ClearLookupEntries()
virtual bool IsKeyword(const char *p)
virtual MummySettings * GetSettings()
Get the associated settings object.
gxsys_stl::string TargetInterface
#define LogFileLineWarningMsg(file, line, n, m)
virtual bool GetUseShadow(const cable::Class *c)
virtual bool IsReservedMethodName(const gxsys_stl::string &name)
void EmitInt(gxsys_ios::ostream &os, const int i)
virtual bool IsFactoryMethod(const cable::Class *c, const cable::Method *m)