當前位置: 首頁>>代碼示例>>C#>>正文


C# ClassTemplate類代碼示例

本文整理匯總了C#中ClassTemplate的典型用法代碼示例。如果您正苦於以下問題:C# ClassTemplate類的具體用法?C# ClassTemplate怎麽用?C# ClassTemplate使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ClassTemplate類屬於命名空間,在下文中一共展示了ClassTemplate類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: VisitClassTemplateDecl

        public override bool VisitClassTemplateDecl(ClassTemplate template)
        {
            if (!base.VisitClassTemplateDecl(template))
                return false;

            template.Specializations.RemoveAll(
                s => s.Fields.Any(f => f.Type.IsPrimitiveType(PrimitiveType.Void)));

            if (template.Specializations.Count == 0)
                return false;

            var groups = (from specialization in template.Specializations
                          group specialization by specialization.Arguments.All(
                              a => a.Type.Type != null && a.Type.Type.IsAddress()) into @group
                          select @group).ToList();

            var lastGroup = groups.Last();
            if (lastGroup.Key)
            {
                foreach (var specialization in lastGroup.Skip(1))
                    template.Specializations.Remove(specialization);
            }

            return true;
        }
開發者ID:acklinr,項目名稱:CppSharp,代碼行數:25,代碼來源:TrimSpecializationsPass.cs

示例2: VisitClassTemplateDecl

        public override bool VisitClassTemplateDecl(ClassTemplate template)
        {
            if (!base.VisitClassTemplateDecl(template) || template.IsIncomplete)
                return false;

            template.Specializations.RemoveAll(
                s => s.Fields.Any(f => f.Type.IsPrimitiveType(PrimitiveType.Void)));

            if (template.Specializations.Count == 0)
                return false;

            var groups = (from specialization in template.Specializations
                          group specialization by specialization.Arguments.All(
                              a => a.Type.Type != null && a.Type.Type.IsAddress()) into @group
                          select @group).ToList();

            foreach (var group in groups.Where(g => g.Key))
                foreach (var specialization in group.Skip(1))
                    template.Specializations.Remove(specialization);

            for (int i = template.Specializations.Count - 1; i >= 0; i--)
                if (template.Specializations[i] is ClassTemplatePartialSpecialization)
                    template.Specializations.RemoveAt(i);

            return true;
        }
開發者ID:ymlai87416,項目名稱:CppSharp,代碼行數:26,代碼來源:TrimSpecializationsPass.cs

示例3: VisitClassTemplateDecl

        public override bool VisitClassTemplateDecl(ClassTemplate template)
        {
            if (!base.VisitClassTemplateDecl(template))
                return false;

            // templates are not supported yet
            foreach (var specialization in template.Specializations)
                specialization.ExplicitlyIgnore();

            return true;
        }
開發者ID:acklinr,項目名稱:CppSharp,代碼行數:11,代碼來源:CheckIgnoredDecls.cs

示例4: VisitClassTemplateDecl

        public override bool VisitClassTemplateDecl(ClassTemplate template)
        {
            if (!base.VisitClassTemplateDecl(template))
                return false;

            EnsureCompleteDeclaration(template.TemplatedDecl);

            template.TemplatedDecl = template.TemplatedDecl.CompleteDeclaration ?? template.TemplatedDecl;

            return true;
        }
開發者ID:xistoso,項目名稱:CppSharp,代碼行數:11,代碼來源:ResolveIncompleteDeclsPass.cs

示例5: VisitClassTemplateDecl

        public override bool VisitClassTemplateDecl(ClassTemplate template)
        {
            if (!base.VisitClassTemplateDecl(template))
                return false;

            if (!Driver.Options.IsCLIGenerator && template.IsSupportedStdType())
                return false;

            // templates are not supported yet
            foreach (var specialization in template.Specializations)
                specialization.ExplicitlyIgnore();

            return true;
        }
開發者ID:tritao,項目名稱:CppSharp,代碼行數:14,代碼來源:CheckIgnoredDecls.cs

示例6: VisitClassTemplateDecl

        public override bool VisitClassTemplateDecl(ClassTemplate template)
        {
            if (!base.VisitClassTemplateDecl(template))
                return false;

            EnsureCompleteDeclaration(template.TemplatedDecl);

            template.TemplatedDecl = template.TemplatedDecl.CompleteDeclaration ?? template.TemplatedDecl;
            // store all spesializations in the real template class because ClassTemplateDecl only forwards
            foreach (var specialization in template.Specializations.Where(
                s => !s.IsIncomplete && !template.TemplatedClass.Specializations.Contains(s)))
                template.TemplatedClass.Specializations.Add(specialization);

            return true;
        }
開發者ID:ddobrev,項目名稱:CppSharp,代碼行數:15,代碼來源:ResolveIncompleteDeclsPass.cs

示例7: VisitClassTemplateDecl

        public override bool VisitClassTemplateDecl(ClassTemplate template)
        {
            if (!base.VisitClassTemplateDecl(template) ||
                template.Specializations.Count == 0 ||
                template.Specializations.All(s => s is ClassTemplatePartialSpecialization))
                return false;

            var @class = template.TemplatedDecl.Namespace as Class;
            if (@class == null || @class is ClassTemplateSpecialization ||
                @class.Namespace is Class)
                return false;

            if (movedClassTemplates.ContainsKey(@class.Namespace))
                movedClassTemplates[@class.Namespace].Add(template);
            else
                movedClassTemplates.Add(@class.Namespace, new List<ClassTemplate> { template });

            return true;
        }
開發者ID:ymlai87416,項目名稱:CppSharp,代碼行數:19,代碼來源:MoveNestedTemplateInternalsPass.cs

示例8: VisitClassTemplateDecl

        public override bool VisitClassTemplateDecl(ClassTemplate template)
        {
            if (!base.VisitClassTemplateDecl(template))
                return false;

            if (template.IsIncomplete)
            {
                var completeDeclaration = (ClassTemplate) template.CompleteDeclaration;
                foreach (var specialization in template.Specializations.Where(
                    spec => completeDeclaration.Specializations.All(s => s.USR != spec.USR)))
                {
                    specialization.TemplatedDecl = completeDeclaration;
                    completeDeclaration.Specializations.Add(specialization);
                }
            }

            EnsureCompleteDeclaration(template.TemplatedDecl);

            template.TemplatedDecl = template.TemplatedDecl.CompleteDeclaration ?? template.TemplatedDecl;

            return true;
        }
開發者ID:ymlai87416,項目名稱:CppSharp,代碼行數:22,代碼來源:ResolveIncompleteDeclsPass.cs

示例9: VisitClassTemplateDecl

        public override bool VisitClassTemplateDecl(ClassTemplate template)
        {
            var expansions = template.PreprocessedEntities.OfType<MacroExpansion>();

            var expansion = expansions.FirstOrDefault(e => e.Text.StartsWith(Prefix + "_CONSTRAINT"));
            if (expansion != null)
            {
                var args = GetArguments(expansion.Text);
                for (var i = 0; i < template.Parameters.Count && i < args.Length; ++i)
                {
                    var param = template.Parameters[i];
                    param.Constraint = args[i];
                    template.Parameters[i] = param;
                }
            }

            return base.VisitClassTemplateDecl(template);
        }
開發者ID:corefan,項目名稱:CppSharp,代碼行數:18,代碼來源:CheckMacrosPass.cs

示例10: ClassTemplate

 internal ClassTemplate(ClassTemplate.Internal native)
     : this(&native)
 {
 }
開發者ID:kidleon,項目名稱:CppSharp,代碼行數:4,代碼來源:AST.cs

示例11: ClassTemplate

 private ClassTemplate(ClassTemplate.Internal native)
     : this(__CopyValue(native))
 {
     __ownsNativeInstance = true;
 }
開發者ID:KonajuGames,項目名稱:CppSharp,代碼行數:5,代碼來源:AST.cs

示例12: VisitClassTemplateDecl

        public override bool VisitClassTemplateDecl(ClassTemplate template)
        {
            CheckForTemplateConstraints(template);

            return base.VisitClassTemplateDecl(template);
        }
開發者ID:ddobrev,項目名稱:CppSharp,代碼行數:6,代碼來源:CheckMacrosPass.cs

示例13: ClassTemplate

 private ClassTemplate(ClassTemplate.Internal native)
     : this(__CopyValue(native))
 {
     __ownsNativeInstance = true;
     NativeToManagedMap[__Instance] = this;
 }
開發者ID:RainsSoft,項目名稱:CppSharp,代碼行數:6,代碼來源:AST.cs

示例14: __CreateInstance

 public static ClassTemplate __CreateInstance(ClassTemplate.Internal native)
 {
     return new ClassTemplate(native);
 }
開發者ID:RainsSoft,項目名稱:CppSharp,代碼行數:4,代碼來源:AST.cs

示例15: ClassTemplate

 private ClassTemplate(ClassTemplate.Internal native, bool skipVTables = false)
     : this(__CopyValue(native), skipVTables)
 {
     __ownsNativeInstance = true;
     NativeToManagedMap[__Instance] = this;
 }
開發者ID:CSRedRat,項目名稱:CppSharp,代碼行數:6,代碼來源:AST.cs


注:本文中的ClassTemplate類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。