Example #1
0
        protected override void AddNestedType(DefType nested)
        {
            if (nested.HasWrapType(WrapTypes.NativeDirector))
            {
                //Interface and native director are already declared before the declaration of this class.
                return;
            }

            base.AddNestedType(nested);
            _wrapper.CppAddType(nested, _sb);
        }
Example #2
0
        protected override void AddNestedType(DefType nested)
        {
            if (nested.HasWrapType(WrapTypes.NativeDirector))
            {
                //Interface and native director are already declared before the declaration of this class.
                //Just declare the method handlers of the class.
                IncNativeDirectorClassProducer.AddMethodHandlersClass((DefClass)nested, _sb);
                return;
            }

            base.AddNestedType(nested);
            _wrapper.IncAddType(nested, _sb);
        }
Example #3
0
        public void IncAddType(DefType t, IndentStringBuilder sb)
        {
            if (t.HasAttribute<CustomIncClassDefinitionAttribute>())
            {
                string txt = t.GetAttribute<CustomIncClassDefinitionAttribute>().Text;
                sb.AppendLine(txt);
                return;
            }

            if (t is DefClass)
            {
                if (!t.HasAttribute<WrapTypeAttribute>())
                {
                    //Ignore
                }
                else
                {
                    switch (t.GetAttribute<WrapTypeAttribute>().WrapType)
                    {
                        case WrapTypes.NonOverridable:
                            new IncNonOverridableClassProducer(this, t as DefClass, sb).Add();
                            break;
                        case WrapTypes.Overridable:
                            new IncOverridableClassProducer(this, t as DefClass, sb).Add();
                            break;
                        case WrapTypes.NativeDirector:
                            new IncNativeDirectorClassProducer(this, t as DefClass, sb).Add();
                            break;
                        case WrapTypes.Interface:
                            new IncInterfaceClassProducer(this, t as DefClass, sb).Add();
                            new IncOverridableClassProducer(this, t as DefClass, sb).Add();
                            break;
                        case WrapTypes.Singleton:
                            new IncSingletonClassProducer(this, t as DefClass, sb).Add();
                            break;
                        case WrapTypes.ReadOnlyStruct:
                            new IncReadOnlyStructClassProducer(this, t as DefClass, sb).Add();
                            break;
                        case WrapTypes.ValueType:
                            new IncValueClassProducer(this, t as DefClass, sb).Add();
                            break;
                        case WrapTypes.NativePtrValueType:
                            new IncNativePtrValueClassProducer(this, t as DefClass, sb).Add();
                            break;
                        case WrapTypes.CLRHandle:
                            new IncCLRHandleClassProducer(this, t as DefClass, sb).Add();
                            break;
                        case WrapTypes.PlainWrapper:
                            new IncPlainWrapperClassProducer(this, t as DefClass, sb).Add();
                            break;
                        case WrapTypes.SharedPtr:
                            IncAddSharedPtrType(t, sb);
                            break;
                    }
                }
            }
            else if (t is DefEnum)
            {
                IncAddEnum(t as DefEnum, sb);
            }
            else if (t is DefTypeDef)
            {
                DefTypeDef explicitType;

                if (t.IsUnnamedSTLContainer)
                    explicitType = t as DefTypeDef;
                else
                    explicitType = (t.IsNested) ? t.ParentClass.FindType<DefTypeDef>(t.Name) : t.NameSpace.FindType<DefTypeDef>(t.Name);

                if (t.HasWrapType(WrapTypes.SharedPtr))
                {
                    IncAddSharedPtrType(t, sb);
                }
                else if (explicitType.IsSTLContainer)
                {
                    IncAddSTLContainer(explicitType, sb);
                }
                else if (explicitType is DefIterator)
                {
                    IncAddIterator(explicitType as DefIterator, sb);
                }
                else if (explicitType.BaseType is DefInternal)
                {
                    IncAddInternalTypeDef(explicitType, sb);
                }
                else if (explicitType.BaseType.HasAttribute<ValueTypeAttribute>())
                {
                    IncAddValueTypeTypeDef(explicitType, sb);
                }
            }
        }
Example #4
0
        public virtual void CheckTypeForDependancy(DefType type)
        {
            if (type is DefEnum
                || (!(type is IDefString) && type is DefTypeDef && (type as DefTypeDef).BaseType is DefInternal)
                || type.HasWrapType(WrapTypes.NativePtrValueType)
                || type.HasWrapType(WrapTypes.ValueType))
                AddTypeDependancy(type);
            else if (type.ParentClass != null)
                AddTypeDependancy(type.ParentClass);
            else if (type is DefTypeDef)
                CheckTypeForDependancy((type as DefTypeDef).BaseType);

            if (!type.IsNested && type is DefClass)
                AddPragmaMakePublicForType(type);
        }
        protected override void AddNestedType(DefType nested)
        {
            if (nested.HasWrapType(WrapTypes.NativeDirector))
            {
                //Interface and native director are already declared before the declaration of this class.
                return;
            }

            base.AddNestedType(nested);
            _wrapper.CppAddType(nested, _sb);
        }
Example #6
0
        protected override void AddNestedType(DefType nested)
        {
            if (nested.HasWrapType(WrapTypes.NativeDirector))
            {
                //Interface and native director are already declared before the declaration of this class.
                //Just declare the method handlers of the class.
                IncNativeDirectorClassProducer.AddMethodHandlersClass((DefClass)nested, _sb);
                return;
            }

            base.AddNestedType(nested);
            _wrapper.IncAddType(nested, _sb);
        }