Example #1
0
 public ClassCppProducer(MetaDefinition metaDef, Wrapper wrapper, ClassDefinition t, SourceCodeStringBuilder sb)
     : base(metaDef, wrapper, t, sb)
 {
     //if (AllowSubclassing)
     //{
     //    _wrapper.PreClassProducers.Add(new CppNativeProtectedTypesProxy(_wrapper, _t, _sb));
     //}
 }
Example #2
0
 public ParamDefinition(MetaDefinition metaDef, ITypeMember m, string name)
     : base(metaDef)
 {
     _name        = name;
     _type        = m.MemberType;
     _typename    = m.MemberTypeName;
     PassedByType = m.PassedByType;
     _isConst     = m.IsConst;
 }
        public NamespaceDefinition(MetaDefinition metaDef, XmlElement elem)
        {
            MetaDef = metaDef;

            // The child namespace names are stored in the attributes "second" and "third". Thus
            // we can only support up to three namespace levels (like "Level1::Level2::Level3").
            string second = elem.GetAttribute("second");
            string third  = elem.GetAttribute("third");

            NativeName = elem.GetAttribute("name");
            CLRName    = metaDef.ManagedNamespace;

            if (second != "")
            {
                NativeName += "::" + second;
                CLRName    += "::" + second;
            }

            if (third != "")
            {
                NativeName += "::" + third;
                CLRName    += "::" + third;
            }

            // If this is a child namespace, set parent and add itself to the parent.
            if (NativeName.Contains("::"))
            {
                // Is a child namespace.
                string parentNamespaceName = NativeName.Substring(0, NativeName.LastIndexOf("::"));
                ParentNamespace = metaDef.GetNameSpace(parentNamespaceName);

                ParentNamespace._childNamespaces.Add(this);
            }
            else
            {
                ParentNamespace = null;
            }

            //
            // Add types contained in this namespace.
            //
            foreach (XmlElement child in elem.ChildNodes)
            {
                AbstractTypeDefinition type = MetaDef.Factory.CreateType(this, null, child);
                if (type != null)
                {
                    _containedTypes.Add(type);
                }
            }
        }
Example #4
0
        static void Main(string[] args)
        {
            Globals.NativeNamespace = "Ogre";
            Globals.ManagedNamespace = "Mogre";

            MetaDefinition meta = new MetaDefinition(@"..\..\..\cpp2java\build\meta.xml", "Mogre");
            meta.AddAttributes(@"..\..\Attributes.xml");

            Wrapper wrapper = new Wrapper(meta, @"..\..\..\Mogre\include\auto", @"..\..\..\Mogre\src\auto", "Mogre", "Ogre");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1(wrapper));
        }
Example #5
0
        public ClassInclProducer(MetaDefinition metaDef, Wrapper wrapper, ClassDefinition t, SourceCodeStringBuilder sb)
            : base(metaDef, wrapper, t, sb)
        {
            AddPreDeclarations();

            if (_classDefinition.BaseClass != null)
            {
                AddTypeDependancy(_classDefinition.BaseClass);
            }

            if (AllowSubclassing)
            {
                _wrapper.AddPreClassProducer(new NativeProtectedTypesProxy(metaDef, _wrapper, _classDefinition, _codeBuilder));
                _wrapper.AddPostClassProducer(new NativeProtectedStaticsProxy(metaDef, _wrapper, _classDefinition, _codeBuilder));
                //_wrapper.PreClassProducers.Add(new IncNativeProtectedTypesProxy(_wrapper, _t, _code));
            }
        }
Example #6
0
        public ClassCodeProducer(MetaDefinition metaDef, Wrapper wrapper, ClassDefinition t, SourceCodeStringBuilder sb) : base(metaDef)
        {
            this._wrapper    = wrapper;
            _classDefinition = t;
            _codeBuilder     = sb;

            foreach (ClassDefinition iface in _classDefinition.GetInterfaces())
            {
                AddTypeDependancy(iface);
                _interfaces.Add(iface);
            }

            if (_classDefinition.IsInterface)
            {
                // Declaring an overridable class for interface
                _interfaces.Add(_classDefinition);
            }
        }
 public CppSubclassingClassProducer(MetaDefinition metaDef, Wrapper wrapper, ClassDefinition t, SourceCodeStringBuilder sb, ClassDefinition[] additionalInterfaces)
     : base(metaDef, wrapper, t, sb)
 {
     this._additionalInterfaces = additionalInterfaces;
 }
Example #8
0
 protected AttributeSet(MetaDefinition metaDef)
     : base(metaDef)
 {
 }
 public ReadOnlyStructClassInclProducer(MetaDefinition metaDef, Wrapper wrapper, ClassDefinition t, SourceCodeStringBuilder sb)
     : base(metaDef, wrapper, t, sb)
 {
 }
Example #10
0
        public Wrapper(MetaDefinition meta, string includePath, string sourcePath, string mngNamespace, string ntvNamespace)
        {
            this._includePath = includePath;
            this._sourcePath = sourcePath;
            this.ManagedNamespace = mngNamespace;
            this.NativeNamespace = ntvNamespace;

            foreach (DefNameSpace space in meta.NameSpaces)
            {
                foreach (DefType type in space.Types)
                {
                    if (TypeIsWrappable(type))
                    {
                        List<DefType> list;
                        if (!IncludeFiles.TryGetValue(type.IncludeFile, out list))
                        {
                            list = new List<DefType>();
                            IncludeFiles.Add(type.IncludeFile, list);
                        }

                        if (type is DefEnum || Producer.IsInternalTypeDef(type))
                        {
                            list.Insert(0, type);
                        }
                        else if (type.HasWrapType(WrapTypes.NativePtrValueType))
                        {
                            //put it after enums and before other classes
                            int i;
                            for (i = 0; i < list.Count; i++)
                            {
                                if (!(type is DefEnum || Producer.IsInternalTypeDef(type)))
                                    break;
                            }

                            list.Insert(i, type);
                        }
                        else
                            list.Add(type);

                        if (type.HasWrapType(WrapTypes.Overridable))
                            Overridables.Add((DefClass)type);
                    }
                }

                foreach (DefType type in space.Types)
                {
                    if (type is DefEnum && IncludeFiles.ContainsKey(type.IncludeFile))
                        if (!IncludeFiles[type.IncludeFile].Contains(type))
                            IncludeFiles[type.IncludeFile].Insert(0, type);
                }
            }
        }
 public NonOverridableClassInclProducer(MetaDefinition metaDef, Wrapper wrapper, ClassDefinition t, SourceCodeStringBuilder sb)
     : base(metaDef, wrapper, t, sb)
 {
 }
Example #12
0
 public ParamDefinition(MetaDefinition metaDef, XmlElement elem)
     : base(metaDef)
 {
     _elem        = elem;
     PassedByType = (PassedByType)Enum.Parse(typeof(PassedByType), elem.GetAttribute("passedBy"), true);
 }
 public CLRHandleClassCppProducer(MetaDefinition metaDef, Wrapper wrapper, ClassDefinition t, SourceCodeStringBuilder sb)
     : base(metaDef, wrapper, t, sb)
 {
 }
Example #14
0
 protected AbstractCodeProducer(MetaDefinition metaDef)
     : base(metaDef)
 {
 }
 public OverridableClassCppProducer(MetaDefinition metaDef, Wrapper wrapper, ClassDefinition t, SourceCodeStringBuilder sb)
     : base(metaDef, wrapper, t, sb)
 {
     _wrapper.AddPostClassProducer(new NativeProxyClassCppProducer(metaDef, _wrapper, _classDefinition, _codeBuilder));
 }
 public NativeDirectorClassCppProducer(MetaDefinition metaDef, Wrapper wrapper, ClassDefinition t, SourceCodeStringBuilder sb)
     : base(metaDef, wrapper, t, sb)
 {
 }
        //protected List<DefFunction> _protectedFunctions = new List<DefFunction>();

        public NativeProxyClassProducer(MetaDefinition metaDef, Wrapper wrapper, ClassDefinition t, SourceCodeStringBuilder sb)
            : base(metaDef, wrapper, t, sb)
        {
            //SearchProtectedFunctions(_t);
        }
Example #18
0
 public SingletonClassInclProducer(MetaDefinition metaDef, Wrapper wrapper, ClassDefinition t, SourceCodeStringBuilder sb)
     : base(metaDef, wrapper, t, sb)
 {
 }
 public NativePtrValueClassInclProducer(MetaDefinition metaDef, Wrapper wrapper, ClassDefinition t, SourceCodeStringBuilder sb)
     : base(metaDef, wrapper, t, sb)
 {
 }
 public virtual NamespaceDefinition CreateNamespace(MetaDefinition metaDef, XmlElement elem)
 {
     return(new NamespaceDefinition(metaDef, elem));
 }
 public NativeProtectedTypesProxy(MetaDefinition metaDef, Wrapper wrapper, ClassDefinition t, SourceCodeStringBuilder sb)
     : base(metaDef, wrapper, t, sb)
 {
 }