Beispiel #1
0
 public ContextObject(ContextObject obj)
 {
     _id = obj._id;
     _name = obj._name;
     _contextId = obj._contextId;
     _access = obj._access;
     _attr = obj._attr;
     _file = obj._file;
     _line = obj._line;
     _cc = obj._cc;
 }
Beispiel #2
0
 public ContextObject(XmlTextReader reader, CsharpGen cc)
 {
     _id = reader["id"];
     _name = reader["name"];
     _contextId = reader["context"];
     _access = reader["access"];
     if(_access == null) _access = "public";
     _attr = new Attributes(reader);
     _file = reader["file"];
     _line = reader["line"];
     _cc = cc;
 }
Beispiel #3
0
 public Attributes(Attributes attr)
 {
     _enabled = attr._enabled;
     _getId = attr._getId;
     _setId = attr._setId;
     _attr = attr._attr;
     _nodtor = attr._nodtor;
     _export = attr._export;
     _import = attr._import;
     _get = attr._get;
     _set = attr._set;
 }
Beispiel #4
0
        public string CPCRetCast(DataType arg, Attributes attr, string str)
        {
            if(arg == null)
                return str;

            string ret = "";
            if(!arg.isVoid)
                ret = "return ";

            if(arg.IsRClass)
                ret += "&";

            if(arg.IsEnum)
                ret += "(long long int)";

            if(arg.Namespace == "::std::string")
                ret += "mono_string_new(mono_domain_get(), " + str + ".c_str())";
            else if(arg.IsPVClass || (arg.IsPClass && !attr.NoDestructor))
                ret += "new " + arg.Namespace + "(" + (arg.isPointer ? "*" : "") + str + ")";
            else
                ret += str;

            return ret;
        }
Beispiel #5
0
 public void merge(Attributes attr)
 {
     if(!_import) _import = attr.Import;
     if(!_export) _export = attr.Export;
     if(_get == null)
     {
         _get = attr.Get;
         _getId = attr.GetId;
     }
     if(_set == null)
     {
         _set = attr.Set;
         _setId = attr.SetId;
     }
 }
Beispiel #6
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;
 }
Beispiel #7
0
        public Function(String type, XmlTextReader reader, CsharpGen cc)
        {
            _cc = cc;
            _id = reader["id"];
            _name = reader["name"];
            _access = reader["access"];
            if(_access == null) _access = "public";
            _context = reader["context"];
            _returnId = reader["returns"];
            _file = reader["file"];
            _line = reader["line"];
            _memberFunc = true;

            _artificial = false;
            string artificial = reader["artificial"];
            if(artificial != null)
                if(artificial == "1")
                    _artificial = true;

            //*****************************************************************
            //  setup the attributes for this function
            _attr = new Attributes(reader);
            if(_attr.Export)
            {
                if(_context != null)
                    CC.ContextMap[_context].GenStructors = true;
            }

            // TODO handle __import

            String staticc = reader["static"];
            _static = false;
            if(staticc != null)
                if(staticc == "1") _static = true;
        }
Beispiel #8
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;
 }