• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Declaration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Declaration的典型用法代码示例。如果您正苦于以下问题:C# Declaration类的具体用法?C# Declaration怎么用?C# Declaration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Declaration类属于命名空间,在下文中一共展示了Declaration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: VisitDeclaration

        public override bool VisitDeclaration(Declaration decl)
        {
            if (!base.VisitDeclaration(decl))
                return false;

            if (Driver.Options.IsCSharpGenerator)
            {
                // C# cannot have protected members in static classes.
                var @class = decl.Namespace as Class;
                if (    decl.Access == AccessSpecifier.Protected &&
                        decl.GenerationKind == GenerationKind.Generate &&
                        @class != null &&
                        @class.IsStatic)
                {
                    // By setting it to private it will appear
                    // as an internal in the final C# wrapper.
                    decl.Access = AccessSpecifier.Private;

                    // We need to explicity set the generation else the
                    // now private declaration will get filtered out later.
                    decl.GenerationKind = GenerationKind.Generate;
                }
            }

            return true;
        }
开发者ID:nalkaro,项目名称:CppSharp,代码行数:26,代码来源:CheckStaticClass.cs


示例2: IntellisenseItem

        public IntellisenseItem(Declaration dtt)
        {
            Overrides = new List<IntellisenseOverride>();
            Name = dtt.Name;
            Glyph = dtt.Glyph;

            StringBuilder docs = new StringBuilder();
            foreach (var element in dtt.DescriptionText.Item)
            {
                if (element.IsDataTipElement)
                {
                    var x = (DataTipElement.DataTipElement)element;
                    Documentation = x.Item1;
                }
                else if (element.IsDataTipElementGroup)
                {
                    foreach (var subElement in ((DataTipElement.DataTipElementGroup)element).Item)
                    {
                        docs.AppendLine(subElement.Item1);
                        Overrides.Add(new IntellisenseOverride
                        {
                            Name = subElement.Item1
                        });
                    }
                }
            }

            if (String.IsNullOrEmpty(Documentation))
            {
                Documentation = docs.ToString();
            }
        }
开发者ID:panesofglass,项目名称:FSharpWebIntellisense,代码行数:32,代码来源:IntellisenseItem.cs


示例3: CheckDeclarationAccess

        public bool CheckDeclarationAccess(Declaration decl)
        {
            var generateNonPublicDecls = Driver.Options.IsCSharpGenerator;

            switch (decl.Access)
            {
                case AccessSpecifier.Public:
                    return true;
                case AccessSpecifier.Protected:
                    var @class = decl.Namespace as Class;
                    if (@class != null && @class.IsValueType)
                        return false;
                    return generateNonPublicDecls;
                case AccessSpecifier.Private:
                    var method = decl as Method;
                    var isOverride = false;
                    if (method != null && method.IsOverride)
                    {
                        var baseMethod = ((Class) method.Namespace).GetBaseMethod(method);
                        isOverride = baseMethod.IsGenerated;
                    }
                    return generateNonPublicDecls && (isOverride || decl.IsExplicitlyGenerated);
            }

            return true;
        }
开发者ID:ymlai87416,项目名称:CppSharp,代码行数:26,代码来源:CheckIgnoredDecls.cs


示例4: Add

    public void Add(Declaration d)
    {
        if (d == null)
            return;

        decls.Add (d);
    }
开发者ID:nagyist,项目名称:monotouch-binding-generator,代码行数:7,代码来源:parse.cs


示例5: GetMethod

        public static AddSignatures GetMethod(Declaration dec)
        {
            switch (dec.PropertyName.Text.ToLowerInvariant())
            {
                case "margin":
                case "padding":
                case "border-width":
                case "outline-width":
                    return Margins;

                case "border-radius":
                    return Corners;

                case "border":
                    return Borders;

                case "font":
                    return Fonts;

                case "columns":
                    return Columns;
            }

            return null;
        }
开发者ID:GProulx,项目名称:WebEssentials2013,代码行数:25,代码来源:ValueOrderFactory.cs


示例6: GenericSetter

 public GenericSetter(Token Source, Declaration Function, String MemberName, Node Object)
     : base(Source)
 {
     this.Function = Function;
     this.Object = Object;
     this.MemberName = MemberName;
 }
开发者ID:Blecki,项目名称:EtcScript,代码行数:7,代码来源:GenericSetter.cs


示例7: VisitDeclaration

        public override bool VisitDeclaration(Declaration decl)
        {
            if (decl.CompleteDeclaration != null)
                return true;

            return !decl.IsIncomplete;
        }
开发者ID:jijamw,项目名称:CppSharp,代码行数:7,代码来源:Types.cs


示例8: DocumentRoot

 /// <summary>
 /// Initializes a new instance of the DocumentRoot class.
 /// </summary>
 /// <param name="document">
 /// The document that this element belongs to.
 /// </param>
 /// <param name="declaration">
 /// The declaration class for this element.
 /// </param>
 /// <param name="generated">
 /// Indicates whether the element contains generated code.
 /// </param>
 internal DocumentRoot(CsDocument document, Declaration declaration, bool generated)
     : base(document, null, ElementType.Root, Strings.DocumentRoot, null, null, declaration, false, generated)
 {
     Param.AssertNotNull(document, "document");
     Param.AssertNotNull(declaration, "declaration");
     Param.Ignore(generated);
 }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:19,代码来源:DocumentRoot.cs


示例9: ExplicitIndexSetter

 public ExplicitIndexSetter(Token Source, Declaration Function, Node Object, Node Index)
     : base(Source)
 {
     this.Function = Function;
     this.Object = Object;
     this.Index = Index;
 }
开发者ID:Blecki,项目名称:EtcScript,代码行数:7,代码来源:ExplicitIndexSetter.cs


示例10: VisitDeclaration

        public override bool VisitDeclaration(Declaration decl)
        {
            if (AlreadyVisited(decl))
                return false;

            if (decl.GenerationKind == GenerationKind.None)
                return true;

            if (!CheckDeclarationAccess(decl))
            {
                Log.Debug("Decl '{0}' was ignored due to invalid access",
                    decl.Name);
                decl.GenerationKind = decl is Field ? GenerationKind.Internal : GenerationKind.None;
                return true;
            }

            if (decl.IsDependent)
            {
                decl.GenerationKind = decl is Field ? GenerationKind.Internal : GenerationKind.None;
                Log.Debug("Decl '{0}' was ignored due to dependent context",
                    decl.Name);
                return true;
            }

            return true;
        }
开发者ID:daxiazh,项目名称:CppSharp,代码行数:26,代码来源:CheckIgnoredDecls.cs


示例11: RenderDeclaration

 public static void RenderDeclaration(StringBuilder sb, Declaration decl)
 {
     sb.AppendFormat("{0}:", decl.Name);
     RenderExpression(sb, decl.Expression);
     if (decl.Important)
         sb.Append(" !important");
 }
开发者ID:bpaciao,项目名称:pagereleaser,代码行数:7,代码来源:CSSRenderer.cs


示例12: VisitDeclaration

        public override bool VisitDeclaration(Declaration decl)
        {
            if (AlreadyVisited(decl))
                return false;

            return !decl.Ignore;
        }
开发者ID:kidleon,项目名称:CppSharp,代码行数:7,代码来源:ResolveIncompleteDeclsPass.cs


示例13: VisitDeclaration

        public override bool VisitDeclaration(Declaration decl)
        {
            if (AlreadyVisited(decl))
                return false;

            if (decl.ExplicityIgnored)
                return true;

            if (!CheckDeclarationAccess(decl))
            {
                Log.Debug("Decl '{0}' was ignored due to invalid access",
                    decl.Name);
                decl.ExplicityIgnored = true;
                return true;
            }

            if (decl.IsDependent)
            {
                decl.ExplicityIgnored = true;
                Log.Debug("Decl '{0}' was ignored due to dependent context",
                    decl.Name);
                return true;
            }

            return true;
        }
开发者ID:kidleon,项目名称:CppSharp,代码行数:26,代码来源:CheckIgnoredDecls.cs


示例14: IsSupportedStdType

 private static bool IsSupportedStdType(Declaration declaration)
 {
     return declaration.Namespace != null &&
         declaration.TranslationUnit.IsSystemHeader &&
         IsNameSpaceStd(declaration.Namespace) &&
         supportedStdTypes.Contains(declaration.OriginalName);
 }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:7,代码来源:MarkSupportedClassTemplateSpecializationsPass.cs


示例15: VisitDeclaration

        public override bool VisitDeclaration(Declaration decl)
        {
            if (AlreadyVisited(decl))
                return false;

            return decl.IsGenerated;
        }
开发者ID:corefan,项目名称:CppSharp,代码行数:7,代码来源:ResolveIncompleteDeclsPass.cs


示例16: VisitDeclaration

        public override bool VisitDeclaration(Declaration decl)
        {
            if (!base.VisitDeclaration(decl))
                return false;

            // Do not clean up namespace names since it can mess up with the
            // names of anonymous or the global namespace.
            if (decl is Namespace)
                return true;

            // types with empty names are assumed to be private
            if (decl is Class && string.IsNullOrWhiteSpace(decl.Name))
            {
                decl.Name = decl.Namespace.Name == "_" ? "__" : "_";
                decl.ExplicitlyIgnore();
                return true;
            }

            Function function = decl as Function;
            if ((function == null || !function.IsOperator) && !(decl is Enumeration))
                decl.Name = CheckName(decl.Name);

            StringHelpers.CleanupText(ref decl.DebugText);
            return true;
        }
开发者ID:daxiazh,项目名称:CppSharp,代码行数:25,代码来源:CleanInvalidDeclNamesPass.cs


示例17: Declare

 public Declaration Declare(Type type, string name)
 {
     _declarationCounter++;
     string declarationName = name ?? string.Format("$var{0}$", _declarationCounter);
     var declaration = new Declaration(type, declarationName, FullName);
     Add(declaration);
     return declaration;
 }
开发者ID:hebert26,项目名称:NRules,代码行数:8,代码来源:SymbolTable.cs


示例18: IdentifyTopLevelDecl

 private void IdentifyTopLevelDecl(Declaration decl)
 {
     if (decl is ClassDecl)
         IdentifyClass((ClassDecl) decl);
     else if (decl is LiteralModuleDecl) {
         var literalModule = (LiteralModuleDecl) decl;
         IdentifyModule(literalModule.ModuleDef);
     }
 }
开发者ID:ggrov,项目名称:tacny,代码行数:9,代码来源:RemovableTypeFinder.cs


示例19: add

        public void add(Declaration declaration)
        {
            // an identifier cannot be declared more than once in the same scope
            if (locals.ContainsKey(declaration.identifier)) {
                throw new ScopeException(declaration.identifier.row, declaration.identifier.col, "An identifier cannot be used twice within the same scope.");
            }

            locals.Add(declaration.identifier, declaration);
        }
开发者ID:noilly,项目名称:ginger,代码行数:9,代码来源:Scope.cs


示例20: AddDeclaration

 public void AddDeclaration(Declaration decl)
 {
     decl.IfStack = new List<string>(this.ifStack);
     if (!this.declarations.Any(d => DeclaratorsSame(d, decl)
             && IfStacksSame(d, decl)))
     {
         this.declarations.Add(decl);
     }
 }
开发者ID:juntalis,项目名称:CHeaderGenerator,代码行数:9,代码来源:CSourceFile.cs



注:本文中的Declaration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DeclarationContext类代码示例发布时间:2022-05-24
下一篇:
C# Deck类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap