示例#1
0
文件: Field.cs 项目: yuckify/cppsharp
        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);
        }
示例#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;
        }
示例#3
0
文件: Arg.cs 项目: yuckify/cppsharp
 public void Add(Arg a)
 {
     if(_next != null) _next.Add(a);
     else _next = a;
 }
示例#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;
 }
示例#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;
 }
示例#6
0
 string CSCArgFixed(Arg a, int i)
 {
     return (a.Type.IsPRPod ? "_" + i : CSCArgEnum(a) + a.Name);
 }
示例#7
0
 string CSCArgEnum(Arg a)
 {
     return (a.Type.IsEnum ? "(long)" : "");
 }
示例#8
0
 string CSCArgClass(Arg a, int i)
 {
     return (CC.Converter.UseHandle(a.Type) ? a.Name + ".CppHandle" : CSCArgFixed(a, i));
 }
示例#9
0
 string CSCArg(Arg a, int i=0)
 {
     return (a.Next!=null ? CSCArgClass(a, i) + ", " + CSCArg(a.Next, i+1) : CSCArgClass(a, i));
 }
示例#10
0
 // CSB = C Sharp Body
 string CSBFixedWrite(Arg a, int i)
 {
     return "fixed("+cvt (a.Type)+" * _"+i+" = &"+a.Name+")\n";
 }
示例#11
0
 string CSBFixedArg(Arg a, int i=0)
 {
     return (a.HasPRPod ? CSBFixedWrite(a, i) : "") +
     (a.Next!=null ? CSBFixedArg(a.Next,i+1) : "");
 }
示例#12
0
 protected string CPCArgs(Arg a)
 {
     return a!=null ? (CC.Converter.CPCType(a) +
                                                         (a.Next!=null ? ", " : "") + CPCArgs(a.Next)) : "";
 }
示例#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;
     }
 }