コード例 #1
0
ファイル: TypeMetadata.cs プロジェクト: StKob/tpa-model
        private Tuple <AccessLevel, SealedEnum, AbstractEnum> EmitModifiers(Type type)
        {
            AccessLevel accessModifier = Model.AccessLevel.Private;

            if (type.IsPublic || type.IsNestedPublic)
            {
                accessModifier = Model.AccessLevel.Public;
            }
            else if (type.IsNestedFamily)
            {
                accessModifier = Model.AccessLevel.Protected;
            }
            else
            {
                accessModifier = Model.AccessLevel.Internal;
            }

            SealedEnum sealedModifier = Model.SealedEnum.NotSealed;

            if (type.IsSealed)
            {
                sealedModifier = Model.SealedEnum.Sealed;
            }

            AbstractEnum abstractModifier = Model.AbstractEnum.NotAbstract;

            if (type.IsAbstract)
            {
                abstractModifier = Model.AbstractEnum.Abstract;
            }

            return(new Tuple <AccessLevel, SealedEnum, AbstractEnum>(accessModifier, sealedModifier, abstractModifier));
        }
コード例 #2
0
ファイル: TypeMetadata.cs プロジェクト: msalah89/TP
        static Tuple <AccessLevel, SealedEnum, AbstractENum> EmitModifiers(Type type)
        {
            //set defaults
            AccessLevel  _access   = AccessLevel.IsPrivate;
            AbstractENum _abstract = AbstractENum.NotAbstract;
            SealedEnum   _sealed   = SealedEnum.NotSealed;

            // check if not default
            if (type.IsPublic)
            {
                _access = AccessLevel.IsPublic;
            }
            else if (type.IsNestedPublic)
            {
                _access = AccessLevel.IsPublic;
            }
            else if (type.IsNestedFamily)
            {
                _access = AccessLevel.IsProtected;
            }
            else if (type.IsNestedFamANDAssem)
            {
                _access = AccessLevel.IsProtectedInternal;
            }
            if (type.IsSealed)
            {
                _sealed = SealedEnum.Sealed;
            }
            if (type.IsAbstract)
            {
                _abstract = AbstractENum.Abstract;
            }
            return(new Tuple <AccessLevel, SealedEnum, AbstractENum>(_access, _sealed, _abstract));
        }
コード例 #3
0
 internal static string Stringify(this SealedEnum sealedEnum)
 {
     if (sealedEnum == SealedEnum.Sealed)
     {
         return("Seald ");
     }
     return("");
 }
コード例 #4
0
        public static SealedEnumBaseDTO ToBaseDTO(this SealedEnum enumType)
        {
            switch (enumType)
            {
            case SealedEnum.NotSealed:
                return(SealedEnumBaseDTO.NotSealed);

            case SealedEnum.Sealed:
                return(SealedEnumBaseDTO.Sealed);
            }
            throw new Exception();
        }
コード例 #5
0
        public static Tuple <AccessLevel, SealedEnum, AbstractEnum> MapToObject(this Tuple <AccessLevelBaseDTO, SealedEnumBaseDTO, AbstractEnumBaseDTO> tuple)
        {
            if (tuple == null)
            {
                return(null);
            }
            AccessLevel  accessLevelBase  = tuple.Item1.MapToObject();
            SealedEnum   sealedEnumBase   = tuple.Item2.MapToObject();
            AbstractEnum abstractEnumBase = tuple.Item3.MapToObject();

            return(new Tuple <AccessLevel, SealedEnum, AbstractEnum>(accessLevelBase, sealedEnumBase, abstractEnumBase));
        }
コード例 #6
0
        internal static Enums.SealedEnum ToLogicEnum(this SealedEnum baseEnum)
        {
            switch (baseEnum)
            {
            case SealedEnum.NotSealed:
                return(Enums.SealedEnum.NotSealed);

            case SealedEnum.Sealed:
                return(Enums.SealedEnum.Sealed);

            default:
                throw new Exception();
            }
        }
コード例 #7
0
        private void InsertRedundantData(DbAssemblyMetadata loadedRoot)
        {
            foreach (DbNamespaceMetadata _namespace in loadedRoot.EFNamespaces)
            {
                foreach (DbTypeMetadata type in _namespace.EFTypes)
                {
                    type.NamespaceName = _namespace.Name;
                    AbstractEnum isAbstract = AbstractEnum.NotAbstract;
                    if (type.IsAbstract)
                    {
                        isAbstract = AbstractEnum.Abstract;
                    }
                    SealedEnum isSealed = SealedEnum.NotSealed;
                    if (type.IsSealed)
                    {
                        isSealed = SealedEnum.Sealed;
                    }

                    type.Modifiers = new Tuple <AccessLevelEnum, SealedEnum, AbstractEnum>(
                        type.AccessLevel, isSealed, isAbstract);
                    foreach (DbMethodMetadata method in type.EFMethodsAndConstructors)
                    {
                        isAbstract = AbstractEnum.NotAbstract;
                        if (method.IsAbstract)
                        {
                            isAbstract = AbstractEnum.Abstract;
                        }
                        StaticEnum isStatic = StaticEnum.NotStatic;
                        if (method.IsStatic)
                        {
                            isStatic = StaticEnum.Static;
                        }
                        VirtualEnum isVirtual = VirtualEnum.NotVirtual;
                        if (method.IsVirtual)
                        {
                            isVirtual = VirtualEnum.Virtual;
                        }

                        method.Modifiers = new Tuple <AccessLevelEnum, AbstractEnum, StaticEnum, VirtualEnum>(
                            method.AccessLevel, isAbstract, isStatic, isVirtual);
                    }
                }
            }
        }
コード例 #8
0
ファイル: TypeMetadata.cs プロジェクト: MikP0/TPA_Projekt
        static TypeModifiers EmitModifiers(Type type)
        {
            AccessLevel _access = AccessLevel.Private;

            if (type.IsPublic)
            {
                _access = AccessLevel.Public;
            }
            else if (type.IsNestedPublic)
            {
                _access = AccessLevel.Public;
            }
            else if (type.IsNestedFamily)
            {
                _access = AccessLevel.Protected;
            }
            else if (type.IsNestedFamANDAssem)
            {
                _access = AccessLevel.ProtectedInternal;
            }
            SealedEnum _sealed = SealedEnum.NotSealed;

            if (type.IsSealed)
            {
                _sealed = SealedEnum.Sealed;
            }
            AbstractEnum _abstract = AbstractEnum.NotAbstract;
            StaticEnum   _static   = StaticEnum.NotStatic;

            if (type.IsAbstract)
            {
                _abstract = AbstractEnum.Abstract;
                _static   = StaticEnum.Static;
            }

            return(new TypeModifiers()
            {
                AbstractEnum = _abstract,
                StaticEnum = _static,
                SealedEnum = _sealed,
                AccessLevel = _access
            });
        }
コード例 #9
0
ファイル: TypeLoader.cs プロジェクト: LearnaeanHydra/APT
        private Tuple <AccessLevel, SealedEnum, AbstractEnum> EmitModifiers(Type type)
        {
            AccessLevel accessLevel = AccessLevel.IsPrivate;

            // check if not default
            if (type.IsPublic)
            {
                accessLevel = AccessLevel.IsPublic;
            }
            else if (type.IsNestedPublic)
            {
                accessLevel = AccessLevel.IsPublic;
            }
            else if (type.IsNestedFamily)
            {
                accessLevel = AccessLevel.IsProtected;
            }
            else if (type.IsNestedFamANDAssem)
            {
                accessLevel = AccessLevel.IsProtectedInternal;
            }

            SealedEnum sealedEnum = SealedEnum.NotSealed;

            if (type.IsSealed)
            {
                sealedEnum = SealedEnum.Sealed;
            }

            AbstractEnum abstractEnum = AbstractEnum.NotAbstract;

            if (type.IsAbstract)
            {
                abstractEnum = AbstractEnum.Abstract;
            }

            return(new Tuple <AccessLevel, SealedEnum, AbstractEnum>(accessLevel, sealedEnum, abstractEnum));
        }
コード例 #10
0
        static Tuple <AccessLevelEnum, SealedEnum, AbstractEnum> EmitModifiers(Type type)
        {
            AccessLevelEnum _access = AccessLevelEnum.IsPrivate;

            if (type.IsPublic)
            {
                _access = AccessLevelEnum.IsPublic;
            }
            else if (type.IsNestedPublic)
            {
                _access = AccessLevelEnum.IsPublic;
            }
            else if (type.IsNestedFamily)
            {
                _access = AccessLevelEnum.IsProtected;
            }
            else if (type.IsNestedFamANDAssem)
            {
                _access = AccessLevelEnum.IsProtectedInternal;
            }

            SealedEnum _sealed = SealedEnum.NotSealed;

            if (type.IsSealed)
            {
                _sealed = SealedEnum.Sealed;
            }

            AbstractEnum _abstract = AbstractEnum.NotAbstract;

            if (type.IsAbstract)
            {
                _abstract = AbstractEnum.Abstract;
            }

            return(new Tuple <AccessLevelEnum, SealedEnum, AbstractEnum>(_access, _sealed, _abstract));
        }
コード例 #11
0
ファイル: TypeModel.cs プロジェクト: DooMLooRD/TPAProject
        private static TypeModifiers EmitModifiers(Type type)
        {
            AccessLevel _access = type.IsPublic || type.IsNestedPublic ? AccessLevel.Public :
                                  type.IsNestedFamily ? AccessLevel.Protected :
                                  type.IsNestedPrivate ? AccessLevel.Private :
                                  AccessLevel.Internal;
            StaticEnum   _static   = type.IsSealed && type.IsAbstract ? StaticEnum.Static : StaticEnum.NotStatic;
            SealedEnum   _sealed   = SealedEnum.NotSealed;
            AbstractEnum _abstract = AbstractEnum.NotAbstract;

            if (_static == StaticEnum.NotStatic)
            {
                _sealed   = type.IsSealed ? SealedEnum.Sealed : SealedEnum.NotSealed;
                _abstract = type.IsAbstract ? AbstractEnum.Abstract : AbstractEnum.NotAbstract;
            }

            return(new TypeModifiers()
            {
                AbstractEnum = _abstract,
                AccessLevel = _access,
                SealedEnum = _sealed,
                StaticEnum = _static
            });
        }
コード例 #12
0
ファイル: KeywordUtils.cs プロジェクト: Pawci0/TPA
 public static string SealedToString(SealedEnum sealedEnum)
 {
     return(sealedEnum == SealedEnum.Sealed ? "sealed" : "");
 }