本文整理汇总了C#中Declaration类的典型用法代码示例。如果您正苦于以下问题:C# Declaration类的具体用法?C# Declaration怎么用?C# Declaration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Declaration类属于命名空间,在下文中一共展示了Declaration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
}
示例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;
}
示例4: Add
public void Add(Declaration d)
{
if (d == null)
return;
decls.Add (d);
}
示例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;
}
示例6: GenericSetter
public GenericSetter(Token Source, Declaration Function, String MemberName, Node Object)
: base(Source)
{
this.Function = Function;
this.Object = Object;
this.MemberName = MemberName;
}
示例7: VisitDeclaration
public override bool VisitDeclaration(Declaration decl)
{
if (decl.CompleteDeclaration != null)
return true;
return !decl.IsIncomplete;
}
示例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);
}
示例9: ExplicitIndexSetter
public ExplicitIndexSetter(Token Source, Declaration Function, Node Object, Node Index)
: base(Source)
{
this.Function = Function;
this.Object = Object;
this.Index = Index;
}
示例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;
}
示例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");
}
示例12: VisitDeclaration
public override bool VisitDeclaration(Declaration decl)
{
if (AlreadyVisited(decl))
return false;
return !decl.Ignore;
}
示例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;
}
示例14: IsSupportedStdType
private static bool IsSupportedStdType(Declaration declaration)
{
return declaration.Namespace != null &&
declaration.TranslationUnit.IsSystemHeader &&
IsNameSpaceStd(declaration.Namespace) &&
supportedStdTypes.Contains(declaration.OriginalName);
}
示例15: VisitDeclaration
public override bool VisitDeclaration(Declaration decl)
{
if (AlreadyVisited(decl))
return false;
return decl.IsGenerated;
}