本文整理汇总了C#中ASTContext类的典型用法代码示例。如果您正苦于以下问题:C# ASTContext类的具体用法?C# ASTContext怎么用?C# ASTContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ASTContext类属于命名空间,在下文中一共展示了ASTContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Preprocess
public override void Preprocess(Driver driver, ASTContext ctx)
{
ctx.SetClassAsValueType("Bar");
ctx.SetClassAsValueType("Bar2");
ctx.SetMethodParameterUsage("Hello", "TestPrimitiveOut", 1, ParameterUsage.Out);
ctx.SetMethodParameterUsage("Hello", "TestPrimitiveOutRef", 1, ParameterUsage.Out);
}
开发者ID:kidleon,项目名称:CppSharp,代码行数:7,代码来源:Basic.cs
示例2: Preprocess
public void Preprocess(Driver driver, ASTContext lib)
{
string qtModule = "Qt" + this.module;
string moduleIncludes = Path.Combine(this.includePath, qtModule);
foreach (TranslationUnit unit in lib.TranslationUnits.Where(u => u.FilePath != "<invalid>"))
{
if (Path.GetDirectoryName(unit.FilePath) != moduleIncludes)
{
unit.ExplicityIgnored = true;
}
else
{
IgnorePrivateDeclarations(unit);
}
}
lib.SetClassAsValueType("QByteArray");
lib.SetClassAsValueType("QListData");
lib.SetClassAsValueType("QListData::Data");
lib.SetClassAsValueType("QLocale");
lib.SetClassAsValueType("QModelIndex");
lib.SetClassAsValueType("QPoint");
lib.SetClassAsValueType("QPointF");
lib.SetClassAsValueType("QSize");
lib.SetClassAsValueType("QSizeF");
lib.SetClassAsValueType("QRect");
lib.SetClassAsValueType("QRectF");
lib.SetClassAsValueType("QGenericArgument");
lib.SetClassAsValueType("QVariant");
// TODO: remove these when their symbols have been replaced or included
lib.IgnoreClassMethodWithName("QXmlStreamReader", "attributes");
lib.IgnoreClassMethodWithName("QTimeZone", "offsetData");
lib.IgnoreClassMethodWithName("QTimeZone", "nextTransition");
lib.IgnoreClassMethodWithName("QTimeZone", "previousTransition");
}
开发者ID:RodolpheFouquet,项目名称:QtSharp,代码行数:34,代码来源:QtSharp.cs
示例3: Preprocess
public override void Preprocess(Driver driver, ASTContext ctx)
{
driver.AddTranslationUnitPass(new GetterSetterToPropertyPass());
driver.AddTranslationUnitPass(new CheckMacroPass());
ctx.SetClassAsValueType("Bar");
ctx.SetClassAsValueType("Bar2");
}
开发者ID:nalkaro,项目名称:CppSharp,代码行数:7,代码来源:Basic.cs
示例4: Preprocess
public void Preprocess(Driver driver, ASTContext ctx)
{
ctx.IgnoreEnumWithMatchingItem("SDL_FALSE");
ctx.IgnoreEnumWithMatchingItem("DUMMY_ENUM_VALUE");
ctx.SetNameOfEnumWithMatchingItem("SDL_SCANCODE_UNKNOWN", "ScanCode");
ctx.SetNameOfEnumWithMatchingItem("SDLK_UNKNOWN", "Key");
ctx.SetNameOfEnumWithMatchingItem("KMOD_NONE", "KeyModifier");
ctx.SetNameOfEnumWithMatchingItem("SDL_LOG_CATEGORY_CUSTOM", "LogCategory");
ctx.GenerateEnumFromMacros("InitFlags", "SDL_INIT_(.*)").SetFlags();
ctx.GenerateEnumFromMacros("Endianness", "SDL_(.*)_ENDIAN");
ctx.GenerateEnumFromMacros("InputState", "SDL_RELEASED", "SDL_PRESSED");
ctx.GenerateEnumFromMacros("AlphaState", "SDL_ALPHA_(.*)");
ctx.GenerateEnumFromMacros("HatState", "SDL_HAT_(.*)");
ctx.IgnoreHeadersWithName("SDL_atomic*");
ctx.IgnoreHeadersWithName("SDL_endian*");
ctx.IgnoreHeadersWithName("SDL_main*");
ctx.IgnoreHeadersWithName("SDL_mutex*");
ctx.IgnoreHeadersWithName("SDL_stdinc*");
ctx.IgnoreHeadersWithName("SDL_error");
ctx.IgnoreEnumWithMatchingItem("SDL_ENOMEM");
ctx.IgnoreFunctionWithName("SDL_Error");
}
开发者ID:tritao,项目名称:CppSharp,代码行数:26,代码来源:SDL.cs
示例5: VisitASTContext
public virtual bool VisitASTContext(ASTContext context)
{
foreach (var unit in context.TranslationUnits)
VisitTranslationUnit(unit);
return true;
}
开发者ID:ddobrev,项目名称:CppSharp,代码行数:7,代码来源:Pass.cs
示例6: VisitLibrary
public virtual bool VisitLibrary(ASTContext context)
{
AstContext = context;
foreach (var unit in context.TranslationUnits)
VisitTranslationUnit(unit);
return true;
}
开发者ID:tritao,项目名称:CppSharp,代码行数:8,代码来源:Pass.cs
示例7: VisitLibrary
public override bool VisitLibrary(ASTContext context)
{
bool result = base.VisitLibrary(context);
Directory.CreateDirectory(Driver.Options.OutputDir);
WriteInlinesIncludes();
WriteInlinedSymbols();
return result;
}
开发者ID:kitsilanosoftware,项目名称:CppSharp,代码行数:8,代码来源:GenerateInlinesCodePass.cs
示例8: Preprocess
public void Preprocess(Driver driver, ASTContext lib)
{
lib.SetClassAsValueType("CppSharp::ParserOptions");
lib.SetClassAsValueType("CppSharp::ParserDiagnostic");
lib.SetClassAsValueType("CppSharp::ParserResult");
lib.RenameNamespace("CppSharp::CppParser", "Parser");
}
开发者ID:jijamw,项目名称:CppSharp,代码行数:8,代码来源:ParserGen.cs
示例9: Preprocess
public override void Preprocess(Driver driver, ASTContext ctx)
{
ctx.SetClassAsValueType("TestCopyConstructorVal");
ctx.SetClassAsValueType("QGenericArgument");
ctx.SetClassAsValueType("StructWithPrivateFields");
ctx.SetClassAsValueType("QSize");
ctx.IgnoreClassWithName("IgnoredTypeInheritingNonIgnoredWithNoEmptyCtor");
}
开发者ID:nalkaro,项目名称:CppSharp,代码行数:9,代码来源:CSharpTemp.cs
示例10: Postprocess
public void Postprocess(Driver driver, ASTContext lib)
{
CollectTypeDefsPerTypePass collectTypeDefsPerTypePass = new CollectTypeDefsPerTypePass();
collectTypeDefsPerTypePass.VisitLibrary(driver.ASTContext);
new ClearCommentsPass().VisitLibrary(driver.ASTContext);
new GetCommentsFromQtDocsPass(this.docs, this.module, collectTypeDefsPerTypePass.TypeDefsPerType).VisitLibrary(driver.ASTContext);
new CaseRenamePass(
RenameTargets.Function | RenameTargets.Method | RenameTargets.Property | RenameTargets.Delegate | RenameTargets.Field,
RenameCasePattern.UpperCamelCase).VisitLibrary(driver.ASTContext);
}
开发者ID:RodolpheFouquet,项目名称:QtSharp,代码行数:10,代码来源:QtSharp.cs
示例11: Preprocess
public override void Preprocess(Driver driver, ASTContext ctx)
{
foreach (TranslationUnit unit in ctx.TranslationUnits)
{
if (unit.FileName != "NamespacesDerived.h")
{
unit.GenerationKind = GenerationKind.Link;
}
}
}
开发者ID:corefan,项目名称:CppSharp,代码行数:10,代码来源:NamespacesDerived.cs
示例12: Preprocess
public override void Preprocess(Driver driver, ASTContext ctx)
{
driver.AddTranslationUnitPass(new CheckMacroPass());
ctx.SetClassAsValueType("Bar");
ctx.SetClassAsValueType("Bar2");
ctx.IgnoreClassWithName("IgnoredType");
ctx.FindCompleteClass("Foo").Enums.First(
e => string.IsNullOrEmpty(e.Name)).Name = "RenamedEmptyEnum";
}
开发者ID:ddobrev,项目名称:CppSharp,代码行数:10,代码来源:Common.cs
示例13: Postprocess
public override void Postprocess(Driver driver, ASTContext ctx)
{
// HACK: as seen above, GetterSetterToPropertyPass is called before all other passes
// that is a hack in order for the pass to generate properties in Common.h
// it is incapable of generating them in the proper manner
// so it generates a property in system type from a member which is later ignored
// so let's ignore that property manually
var @class = ctx.FindCompleteClass("basic_string");
foreach (var property in @class.Specializations.SelectMany(c => c.Properties))
property.ExplicitlyIgnore();
}
开发者ID:tritao,项目名称:CppSharp,代码行数:11,代码来源:Common.cs
示例14: Driver
public Driver(DriverOptions options, IDiagnosticConsumer diagnostics)
{
Options = options;
Diagnostics = diagnostics;
Project = new Project();
ASTContext = new ASTContext();
Symbols = new SymbolContext();
Delegates = new Dictionary<Function, DelegatesPass.DelegateDefinition>();
TypeDatabase = new TypeMapDatabase();
TranslationUnitPasses = new PassBuilder<TranslationUnitPass>(this);
GeneratorOutputPasses = new PassBuilder<GeneratorOutputPass>(this);
}
开发者ID:tritao,项目名称:CppSharp,代码行数:12,代码来源:Driver.cs
示例15: Preprocess
public override void Preprocess(Driver driver, ASTContext ctx)
{
driver.AddTranslationUnitPass(new GetterSetterToPropertyPass());
ctx.SetClassAsValueType("Bar");
ctx.SetClassAsValueType("Bar2");
ctx.SetMethodParameterUsage("Hello", "TestPrimitiveOut", 1, ParameterUsage.Out);
ctx.SetMethodParameterUsage("Hello", "TestPrimitiveOutRef", 1, ParameterUsage.Out);
ctx.SetMethodParameterUsage("Hello", "TestPrimitiveInOut", 1, ParameterUsage.InOut);
ctx.SetMethodParameterUsage("Hello", "TestPrimitiveInOutRef", 1, ParameterUsage.InOut);
ctx.SetMethodParameterUsage("Hello", "EnumOut", 2, ParameterUsage.Out);
ctx.SetMethodParameterUsage("Hello", "EnumOutRef", 2, ParameterUsage.Out);
}
开发者ID:kitsilanosoftware,项目名称:CppSharp,代码行数:12,代码来源:Basic.cs
示例16: Preprocess
public void Preprocess(Driver driver, ASTContext ctx)
{
ctx.RenameNamespace("CppSharp::CppParser", "Parser");
var exprClass = ctx.FindCompleteClass ("clang::Expr");
var exprUnit = ctx.TranslationUnits [0];
var subclassVisitor = new SubclassVisitor (exprClass);
exprUnit.Visit (subclassVisitor);
var subclasses = subclassVisitor.Classes;
}
开发者ID:daxiazh,项目名称:CppSharp,代码行数:12,代码来源:Bootstrap.cs
示例17: Postprocess
public void Postprocess(Driver driver, ASTContext ctx)
{
ctx.SetNameOfEnumWithName("PIXELTYPE", "PixelType");
ctx.SetNameOfEnumWithName("BITMAPORDER", "BitmapOrder");
ctx.SetNameOfEnumWithName("PACKEDORDER", "PackedOrder");
ctx.SetNameOfEnumWithName("ARRAYORDER", "ArrayOrder");
ctx.SetNameOfEnumWithName("PACKEDLAYOUT", "PackedLayout");
ctx.SetNameOfEnumWithName("PIXELFORMAT", "PixelFormats");
ctx.SetNameOfEnumWithName("assert_state", "AssertState");
ctx.SetClassBindName("assert_data", "AssertData");
ctx.SetNameOfEnumWithName("eventaction", "EventAction");
ctx.SetNameOfEnumWithName("LOG_CATEGORY", "LogCategory");
}
开发者ID:tritao,项目名称:CppSharp,代码行数:13,代码来源:SDL.cs
示例18: Preprocess
public void Preprocess(Driver driver, ASTContext lib)
{
var qtModule = "Qt" + this.module;
var moduleIncludes = Path.Combine(this.includePath, qtModule);
foreach (var unit in lib.TranslationUnits.Where(u => u.FilePath != "<invalid>"))
{
if (Path.GetDirectoryName(unit.FilePath) != moduleIncludes)
{
LinkDeclaration(unit);
}
else
{
IgnorePrivateDeclarations(unit);
}
}
lib.SetClassAsValueType("QByteArray");
lib.SetClassAsValueType("QListData");
lib.SetClassAsValueType("QListData::Data");
lib.SetClassAsValueType("QLocale");
lib.SetClassAsValueType("QModelIndex");
lib.SetClassAsValueType("QPoint");
lib.SetClassAsValueType("QPointF");
lib.SetClassAsValueType("QSize");
lib.SetClassAsValueType("QSizeF");
lib.SetClassAsValueType("QRect");
lib.SetClassAsValueType("QRectF");
lib.SetClassAsValueType("QGenericArgument");
lib.SetClassAsValueType("QGenericReturnArgument");
lib.SetClassAsValueType("QVariant");
lib.IgnoreClassMethodWithName("QString", "fromStdWString");
lib.IgnoreClassMethodWithName("QString", "toStdWString");
if (this.module == "Widgets")
{
// HACK: work around https://llvm.org/bugs/show_bug.cgi?id=24655
foreach (var method in lib.FindCompleteClass("QAbstractSlider").Methods.Where(m => m.Access == AccessSpecifier.Protected))
{
method.AccessDecl.PreprocessedEntities.Clear();
}
string[] classesWithTypeEnums =
{
"QGraphicsEllipseItem", "QGraphicsItemGroup", "QGraphicsLineItem",
"QGraphicsPathItem", "QGraphicsPixmapItem", "QGraphicsPolygonItem", "QGraphicsProxyWidget",
"QGraphicsRectItem", "QGraphicsSimpleTextItem", "QGraphicsTextItem", "QGraphicsWidget"
};
foreach (var enumeration in classesWithTypeEnums.Select(c => lib.FindCompleteClass(c)).SelectMany(
@class => @class.Enums.Where(e => string.IsNullOrEmpty(e.Name))))
{
enumeration.Name = "TypeEnum";
}
}
}
开发者ID:YekMX,项目名称:QtSharp,代码行数:51,代码来源:QtSharp.cs
示例19: ParseLibrary
protected void ParseLibrary(string file)
{
Options = new DriverOptions();
var testsPath = LibraryTest.GetTestsDirectory("Native");
Options.IncludeDirs.Add(testsPath);
Options.Headers.Add(file);
Driver = new Driver(Options, new TextDiagnosticPrinter());
if (!Driver.ParseCode())
throw new Exception("Error parsing the code");
AstContext = Driver.ASTContext;
}
开发者ID:jijamw,项目名称:CppSharp,代码行数:14,代码来源:HeaderTestFixture.cs
示例20: VisitASTContext
public override bool VisitASTContext(ASTContext context)
{
bool result = base.VisitASTContext(context);
foreach (var typedef in allTypedefs)
{
foreach (var foo in typedef.Value)
{
foo.Context.Declarations.Add(foo.Declaration);
}
}
allTypedefs.Clear();
return result;
}
开发者ID:ddobrev,项目名称:CppSharp,代码行数:15,代码来源:GenerateAnonymousDelegatesPass.cs
注:本文中的ASTContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论