public Field(XmlTextReader reader, CsharpGen cc) : base(reader, cc) { _typeId = reader["type"]; String staticc = reader["static"]; _static = false; if(staticc != null) if(staticc == "1") _static = true; if(Attr.Set != null) _arg = new Arg(Type, CC); }
public string CPCType(Arg arg) { string ret = ""; if(arg.Type.IsEnum) ret = "(" + arg.Type.Namespace + ")"; if(arg.Type.IsRVClass || arg.Type.IsRPod) ret = "*"; if(arg.Type.Namespace == "::std::string") ret = "mono_string_to_utf8(" + arg.Name + ")"; else ret = ret + arg.Name; return ret; }
public void Add(Arg a) { if(_next != null) _next.Add(a); else _next = a; }
public Function(Field field) { _cc = field.CC; _id = field.Id; _name = field.Name; _access = "public"; _context = field.ContextId; if(field.Attr.Get != null) _returnId = field.TypeId; else _returnId = CC.Types.VoidTypeId; _file = field.File; _line = field.Line; _memberFunc = true; _artificial = false; _attr = field.Attr; if(_attr.Get != null || _attr.Set != null) { if(_context != null) CC.ContextMap[_context].GenStructors = true; } _static = false; _head = field.Args; }
public Function(Function func) { _cc = func._cc; _id = func._id; _name = func._name; _access = func._access; _context = func._context; _returnId = func._returnId; _file = func._file; _line = func._line; _attr = new Attributes(func._attr); _static = func._static; _head = func._head; _artificial = func._artificial; _memberFunc = false; }
string CSCArgFixed(Arg a, int i) { return (a.Type.IsPRPod ? "_" + i : CSCArgEnum(a) + a.Name); }
string CSCArgEnum(Arg a) { return (a.Type.IsEnum ? "(long)" : ""); }
string CSCArgClass(Arg a, int i) { return (CC.Converter.UseHandle(a.Type) ? a.Name + ".CppHandle" : CSCArgFixed(a, i)); }
string CSCArg(Arg a, int i=0) { return (a.Next!=null ? CSCArgClass(a, i) + ", " + CSCArg(a.Next, i+1) : CSCArgClass(a, i)); }
// CSB = C Sharp Body string CSBFixedWrite(Arg a, int i) { return "fixed("+cvt (a.Type)+" * _"+i+" = &"+a.Name+")\n"; }
string CSBFixedArg(Arg a, int i=0) { return (a.HasPRPod ? CSBFixedWrite(a, i) : "") + (a.Next!=null ? CSBFixedArg(a.Next,i+1) : ""); }
protected string CPCArgs(Arg a) { return a!=null ? (CC.Converter.CPCType(a) + (a.Next!=null ? ", " : "") + CPCArgs(a.Next)) : ""; }
void addArguement() { if(lastFunction_ != null) { Arg arg = new Arg(reader_, this); if(lastFunction_.Args != null) lastFunction_.Args.Add(arg); else lastFunction_.Args = arg; } }