Exemple #1
0
        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);
        }
Exemple #2
0
        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;
        }
Exemple #3
0
 public void Add(Arg a)
 {
     if(_next != null) _next.Add(a);
     else _next = a;
 }
Exemple #4
0
 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;
 }
Exemple #5
0
 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;
 }
Exemple #6
0
 string CSCArgFixed(Arg a, int i)
 {
     return (a.Type.IsPRPod ? "_" + i : CSCArgEnum(a) + a.Name);
 }
Exemple #7
0
 string CSCArgEnum(Arg a)
 {
     return (a.Type.IsEnum ? "(long)" : "");
 }
Exemple #8
0
 string CSCArgClass(Arg a, int i)
 {
     return (CC.Converter.UseHandle(a.Type) ? a.Name + ".CppHandle" : CSCArgFixed(a, i));
 }
Exemple #9
0
 string CSCArg(Arg a, int i=0)
 {
     return (a.Next!=null ? CSCArgClass(a, i) + ", " + CSCArg(a.Next, i+1) : CSCArgClass(a, i));
 }
Exemple #10
0
 // CSB = C Sharp Body
 string CSBFixedWrite(Arg a, int i)
 {
     return "fixed("+cvt (a.Type)+" * _"+i+" = &"+a.Name+")\n";
 }
Exemple #11
0
 string CSBFixedArg(Arg a, int i=0)
 {
     return (a.HasPRPod ? CSBFixedWrite(a, i) : "") +
     (a.Next!=null ? CSBFixedArg(a.Next,i+1) : "");
 }
Exemple #12
0
 protected string CPCArgs(Arg a)
 {
     return a!=null ? (CC.Converter.CPCType(a) +
                                                         (a.Next!=null ? ", " : "") + CPCArgs(a.Next)) : "";
 }
Exemple #13
0
 void addArguement()
 {
     if(lastFunction_ != null)
     {
         Arg arg = new Arg(reader_, this);
         if(lastFunction_.Args != null)
             lastFunction_.Args.Add(arg);
         else
             lastFunction_.Args = arg;
     }
 }