本文整理汇总了C#中TypedefDecl类的典型用法代码示例。如果您正苦于以下问题:C# TypedefDecl类的具体用法?C# TypedefDecl怎么用?C# TypedefDecl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypedefDecl类属于命名空间,在下文中一共展示了TypedefDecl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: VisitTypedefDecl
public override bool VisitTypedefDecl(TypedefDecl typedef)
{
Type type = typedef.Type.Desugar();
List<TypedefDecl> typedefDecls;
if (TypeDefsPerType.ContainsKey(type))
typedefDecls = TypeDefsPerType[type];
else
TypeDefsPerType.Add(type, typedefDecls = new List<TypedefDecl>());
if (!typedefDecls.Contains(typedef))
typedefDecls.Add(typedef);
return base.VisitTypedefDecl(typedef);
}
开发者ID:RodolpheFouquet,项目名称:QtSharp,代码行数:12,代码来源:CollectTypeDefsPerTypePass.cs
示例2: VisitTypedefDecl
public override bool VisitTypedefDecl(TypedefDecl typedef)
{
TypeMap typeMap;
if (TypeMapDatabase.FindTypeMap(typedef, out typeMap))
{
if (typeMap.IsIgnored)
Ignore();
return false;
}
return base.VisitTypedefDecl(typedef);
}
开发者ID:ddobrev,项目名称:CppSharp,代码行数:12,代码来源:Types.cs
示例3: VisitTypedefDecl
public override bool VisitTypedefDecl(TypedefDecl typedef)
{
var @class = typedef.Namespace.FindClass(typedef.Name);
// Clang will walk the typedef'd tag decl and the typedef decl,
// so we ignore the class and process just the typedef.
if (@class != null)
typedef.ExplicityIgnored = true;
if (typedef.Type == null)
typedef.ExplicityIgnored = true;
return base.VisitTypedefDecl(typedef);
}
开发者ID:jijamw,项目名称:CppSharp,代码行数:15,代码来源:CleanInvalidDeclNamesPass.cs
示例4: VisitMethodDecl
public override bool VisitMethodDecl(Method method)
{
if (!base.VisitMethodDecl(method) || !method.IsVirtual || method.Ignore)
return false;
var @params = method.GatherInternalParams(Driver.Options.IsItaniumLikeAbi, true).ToList();
var delegateName = GenerateDelegateSignature(@params, method.ReturnType);
var @delegate = new TypedefDecl
{
Name = delegateName,
QualifiedType = new QualifiedType(
new PointerType(
new QualifiedType(
new FunctionType
{
CallingConvention = method.CallingConvention,
IsDependent = method.IsDependent,
Parameters = @params,
ReturnType = method.ReturnType
}))),
Namespace = namespaceDelegates
};
var delegateString = @delegate.Visit(TypePrinter).Type;
var existingDelegate = GetExistingDelegate(delegateString);
if (existingDelegate != null)
{
Driver.Delegates.Add(method, existingDelegate);
return true;
}
existingDelegate = new DelegateDefinition(Driver.Options.OutputNamespace, delegateString);
Driver.Delegates.Add(method, existingDelegate);
foreach (var library in Driver.Options.Libraries)
libsDelegates[library].Add(delegateString, existingDelegate);
namespaceDelegates.Declarations.Add(@delegate);
return true;
}
开发者ID:daxiazh,项目名称:CppSharp,代码行数:41,代码来源:DelegatesPass.cs
示例5: TypedefDecl
internal TypedefDecl(TypedefDecl.Internal* native)
: this(new global::System.IntPtr(native))
{
}
开发者ID:kidleon,项目名称:CppSharp,代码行数:4,代码来源:AST.cs
示例6: TypedefDecl
private TypedefDecl(TypedefDecl.Internal native)
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
}
开发者ID:KonajuGames,项目名称:CppSharp,代码行数:5,代码来源:AST.cs
示例7: VisitTypedefDecl
public override bool VisitTypedefDecl(TypedefDecl typedef)
{
if (!base.VisitTypedefDecl(typedef))
return false;
if (typedef.TranslationUnit.IsSystemHeader)
typedef.ExplicitlyIgnore();
return true;
}
开发者ID:ddobrev,项目名称:CppSharp,代码行数:10,代码来源:IgnoreSystemDeclarationsPass.cs
示例8: TypedefDecl
private TypedefDecl(TypedefDecl.Internal native)
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
开发者ID:RainsSoft,项目名称:CppSharp,代码行数:6,代码来源:AST.cs
示例9: __CreateInstance
public static TypedefDecl __CreateInstance(TypedefDecl.Internal native)
{
return new TypedefDecl(native);
}
开发者ID:RainsSoft,项目名称:CppSharp,代码行数:4,代码来源:AST.cs
示例10: TypedefDecl
private TypedefDecl(TypedefDecl.Internal native, bool skipVTables = false)
: this(__CopyValue(native), skipVTables)
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
开发者ID:CSRedRat,项目名称:CppSharp,代码行数:6,代码来源:AST.cs
示例11: __CopyValue
private static void* __CopyValue(TypedefDecl.__Internal native)
{
var ret = Marshal.AllocHGlobal(136);
global::CppSharp.Parser.AST.TypedefDecl.__Internal.cctor_1(ret, new global::System.IntPtr(&native));
return ret.ToPointer();
}
开发者ID:ddobrev,项目名称:CppSharp,代码行数:6,代码来源:CppSharp.CppParser.cs
示例12: VisitTypedefDecl
public override bool VisitTypedefDecl(TypedefDecl typedef)
{
throw new NotImplementedException();
}
开发者ID:corefan,项目名称:CppSharp,代码行数:4,代码来源:CLIMarshal.cs
示例13: AddInternalImplementation
private Class AddInternalImplementation(Class @class)
{
var internalImpl = GetInternalImpl(@class);
var abstractMethods = GetRelevantAbstractMethods(@class);
foreach (var abstractMethod in abstractMethods)
{
var method = new Method(abstractMethod) { Namespace = internalImpl };
internalImpl.Methods.Add(method);
var @delegate = new TypedefDecl
{
Name = ASTHelpers.GetDelegateName(abstractMethod),
QualifiedType = abstractMethod.GetFunctionType(),
IgnoreFlags = abstractMethod.IgnoreFlags,
Namespace = internalImpl,
Access = AccessSpecifier.Private
};
internalImpl.Typedefs.Add(@delegate);
}
internalImpl.Layout = new ClassLayout(@class.Layout);
FillVTable(@class, abstractMethods, internalImpl);
foreach (var method in internalImpl.Methods)
{
method.IsPure = false;
method.IsOverride = true;
method.IsSynthetized = true;
}
return internalImpl;
}
开发者ID:jijamw,项目名称:CppSharp,代码行数:32,代码来源:GenerateAbstractImplementationsPass.cs
示例14: VisitTypedefDecl
public override bool VisitTypedefDecl(TypedefDecl typedef)
{
if (!Targets.HasFlag(RenameTargets.Delegate))
return false;
return base.VisitTypedefDecl(typedef);
}
开发者ID:jijamw,项目名称:CppSharp,代码行数:7,代码来源:RenamePass.cs
示例15: VisitTypedefDecl
public override bool VisitTypedefDecl(TypedefDecl typedef)
{
if (!VisitDeclaration(typedef))
return false;
string msg;
if (HasInvalidType(typedef.Type, out msg))
{
typedef.ExplicitlyIgnore();
Log.Debug("Typedef '{0}' was ignored due to {1} type",
typedef.Name, msg);
return false;
}
return true;
}
开发者ID:daxiazh,项目名称:CppSharp,代码行数:16,代码来源:CheckIgnoredDecls.cs
示例16: CheckType
/// <summary>
/// Generates a new typedef for the given type if necessary and returns the new type.
/// </summary>
/// <param name="namespace">The namespace the typedef will be added to.</param>
/// <param name="type">The type to check.</param>
/// <returns>The new type.</returns>
private QualifiedType CheckType(DeclarationContext @namespace, QualifiedType type)
{
if (type.Type.IsDependent)
return type;
var pointerType = type.Type as PointerType;
if (pointerType == null)
return type;
var functionType = pointerType.Pointee as FunctionType;
if (functionType == null)
return type;
List<Typedef> typedefs;
if (!allTypedefs.TryGetValue(@namespace.QualifiedName, out typedefs))
{
typedefs = new List<Typedef>();
allTypedefs.Add(@namespace.QualifiedName, typedefs);
}
var typedef = FindMatchingTypedef(typedefs, functionType);
if (typedef == null)
{
for (int i = 0; i < functionType.Parameters.Count; i++)
{
functionType.Parameters[i].Name = string.Format("_{0}", i);
}
typedef = new TypedefDecl
{
Access = AccessSpecifier.Public,
Name = string.Format("__AnonymousDelegate{0}", typedefs.Count),
Namespace = @namespace,
QualifiedType = type,
IsSynthetized = true
};
typedefs.Add(new Typedef
{
Context = @namespace,
Declaration = typedef
});
}
var typedefType = new TypedefType
{
Declaration = typedef
};
return new QualifiedType(typedefType);
}
开发者ID:ddobrev,项目名称:CppSharp,代码行数:55,代码来源:GenerateAnonymousDelegatesPass.cs
示例17: __CreateInstance
public static TypedefDecl __CreateInstance(TypedefDecl.Internal native, bool skipVTables = false)
{
return new TypedefDecl(native, skipVTables);
}
开发者ID:CSRedRat,项目名称:CppSharp,代码行数:4,代码来源:AST.cs
示例18: GenerateTypedef
public bool GenerateTypedef(TypedefDecl typedef)
{
if (!typedef.IsGenerated)
return false;
FunctionType function;
if (typedef.Type.IsPointerTo(out function))
{
PushBlock(CLIBlockKind.Typedef, typedef);
GenerateDeclarationCommon(typedef);
var insideClass = typedef.Namespace is Class;
var attributedType = typedef.Type.GetPointee() as AttributedType;
if (attributedType != null)
{
var equivalentFunctionType = attributedType.Equivalent.Type as FunctionType;
var callingConvention = equivalentFunctionType.CallingConvention.ToInteropCallConv();
if (callingConvention != System.Runtime.InteropServices.CallingConvention.Winapi)
{
WriteLine("[{0}({1}::{2})] ",
"System::Runtime::InteropServices::UnmanagedFunctionPointer",
"System::Runtime::InteropServices::CallingConvention",
callingConvention);
}
}
WriteLine("{0}{1};",
!insideClass ? "public " : "",
string.Format(TypePrinter.VisitDelegate(function),
typedef.Name));
PopBlock(NewLineKind.BeforeNextBlock);
return true;
}
return false;
}
开发者ID:acklinr,项目名称:CppSharp,代码行数:38,代码来源:CLIHeadersTemplate.cs
示例19: VisitMethodDecl
public override bool VisitMethodDecl(Method method)
{
if (!base.VisitMethodDecl(method) || !method.IsVirtual || method.Ignore)
return false;
var @params = method.GatherInternalParams(Context.ParserOptions.IsItaniumLikeAbi, true).ToList();
var delegateName = GenerateDelegateSignature(@params, method.ReturnType);
var module = method.TranslationUnit.Module;
Namespace namespaceDelegates;
if (namespacesDelegates.ContainsKey(module))
{
namespaceDelegates = namespacesDelegates[module];
}
else
{
namespaceDelegates = new Namespace
{
Name = DelegatesNamespace,
Namespace = module.Units.Last()
};
namespacesDelegates.Add(module, namespaceDelegates);
}
var @delegate = new TypedefDecl
{
Name = delegateName,
QualifiedType = new QualifiedType(
new PointerType(
new QualifiedType(
new FunctionType
{
CallingConvention = method.CallingConvention,
IsDependent = method.IsDependent,
Parameters = @params,
ReturnType = method.ReturnType
}))),
Namespace = namespaceDelegates,
IsSynthetized = true
};
Generator.CurrentOutputNamespace = module.OutputNamespace;
var delegateString = @delegate.Visit(TypePrinter).Type;
var existingDelegate = GetExistingDelegate(
method.TranslationUnit.Module.Libraries, delegateString);
if (existingDelegate != null)
{
Context.Delegates.Add(method, existingDelegate);
return true;
}
existingDelegate = new DelegateDefinition(module.OutputNamespace, delegateString);
Context.Delegates.Add(method, existingDelegate);
foreach (var library in module.Libraries)
libsDelegates[library].Add(delegateString, existingDelegate);
namespaceDelegates.Declarations.Add(@delegate);
return true;
}
开发者ID:ddobrev,项目名称:CppSharp,代码行数:63,代码来源:DelegatesPass.cs
示例20: __CopyValue
private static TypedefDecl.Internal* __CopyValue(TypedefDecl.Internal native)
{
var ret = Marshal.AllocHGlobal(184);
CppSharp.Parser.AST.TypedefDecl.Internal.cctor_2(ret, new global::System.IntPtr(&native));
return (TypedefDecl.Internal*) ret;
}
开发者ID:RainsSoft,项目名称:CppSharp,代码行数:6,代码来源:AST.cs
注:本文中的TypedefDecl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论