本文整理汇总了C#中TypedefType类的典型用法代码示例。如果您正苦于以下问题:C# TypedefType类的具体用法?C# TypedefType怎么用?C# TypedefType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypedefType类属于命名空间,在下文中一共展示了TypedefType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitTypedefType
public override bool VisitTypedefType(TypedefType typedef,
TypeQualifiers quals)
{
TypeMap typeMap;
if (TypeMapDatabase.FindTypeMap(typedef, out typeMap)
&& typeMap.IsIgnored)
{
Ignore();
return false;
}
return base.VisitTypedefType(typedef, quals);
}
示例2: TypedefType
protected TypedefType(TypedefType.Internal* native, bool skipVTables = false)
: base((CppSharp.Parser.AST.Type.Internal*) null)
{
__PointerAdjustment = 0;
if (native == null)
return;
__Instance = new global::System.IntPtr(native);
}
示例3: __CreateInstance
public static TypedefType __CreateInstance(TypedefType.Internal native, bool skipVTables = false)
{
return new TypedefType(native, skipVTables);
}
示例4: __CopyValue
private static void* __CopyValue(TypedefType.__Internal native)
{
var ret = Marshal.AllocHGlobal(12);
global::CppSharp.Parser.AST.TypedefType.__Internal.cctor_2(ret, new global::System.IntPtr(&native));
return ret.ToPointer();
}
示例5: TypedefType
internal TypedefType(TypedefType.Internal native)
: this(&native)
{
}
示例6: VisitTypedefType
public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals)
{
var decl = typedef.Declaration;
TypeMap typeMap;
if (Context.Driver.TypeDatabase.FindTypeMap(decl, out typeMap) && typeMap.DoesMarshalling)
{
typeMap.CLIMarshalToNative(Context);
return typeMap.IsValueType;
}
FunctionType func;
if (decl.Type.IsPointerTo(out func))
{
// Use the original typedef name if available, otherwise just use the function pointer type
string cppTypeName;
if (!decl.IsSynthetized)
cppTypeName = "::" + typedef.Declaration.QualifiedOriginalName;
else
{
var cppTypePrinter = new CppTypePrinter(Context.Driver.TypeDatabase);
cppTypeName = decl.Type.Visit(cppTypePrinter, quals);
}
VisitDelegateType(func, cppTypeName);
return true;
}
PrimitiveType primitive;
if (decl.Type.IsPrimitiveType(out primitive))
{
Context.Return.Write("(::{0})", typedef.Declaration.QualifiedOriginalName);
}
return decl.Type.Visit(this);
}
示例7: TypedefType
private TypedefType(TypedefType.Internal native)
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
NativeToManagedMap[__Instance] = this;
}
示例8: TypedefType
internal TypedefType(TypedefType.Internal native)
: this(__CopyValue(native))
{
}
示例9: GetType
protected AST.Type GetType(string typeName)
{
if (typeCache == null)
typeCache = new Dictionary<string, AST.Type>();
AST.Type result;
if (!typeCache.TryGetValue(typeName, out result))
{
var typeDef = Driver.ASTContext.FindTypedef(typeName)
.FirstOrDefault();
if (typeDef != null)
result = new TypedefType() { Declaration = typeDef };
typeCache.Add(typeName, result);
}
return result;
}
示例10: VisitTypedefType
public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals)
{
if (!VisitType(typedef, quals))
return false;
var decl = typedef.Declaration;
FunctionType function;
if (decl.Type.IsPointerTo(out function))
{
var ptrName = Generator.GeneratedIdentifier("ptr") +
Context.ParameterIndex;
Context.SupportBefore.WriteLine("var {0} = {1};", ptrName,
Context.ReturnVarName);
Context.Return.Write("({1})Marshal.GetDelegateForFunctionPointer({0}, typeof({1}))",
ptrName, typedef.ToString());
return true;
}
return decl.Type.Visit(this);
}
示例11: 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);
}
示例12: VisitTypedefType
public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals)
{
var decl = typedef.Declaration;
TypeMap typeMap;
if (Context.Driver.TypeDatabase.FindTypeMap(decl, out typeMap) && typeMap.DoesMarshalling)
{
typeMap.Type = typedef;
typeMap.CLIMarshalToManaged(Context);
return typeMap.IsValueType;
}
FunctionType function;
if (decl.Type.IsPointerTo(out function))
{
Context.Return.Write("safe_cast<{0}>(", typedef);
Context.Return.Write("System::Runtime::InteropServices::Marshal::");
Context.Return.Write("GetDelegateForFunctionPointer(");
Context.Return.Write("IntPtr({0}), {1}::typeid))",Context.ReturnVarName,
typedef.ToString().TrimEnd('^'));
return true;
}
return decl.Type.Visit(this);
}
示例13: __CreateInstance
public static TypedefType __CreateInstance(TypedefType.Internal native)
{
return new TypedefType(native);
}
示例14: __CopyValue
private static TypedefType.Internal* __CopyValue(TypedefType.Internal native)
{
var ret = Marshal.AllocHGlobal(16);
CppSharp.Parser.AST.TypedefType.Internal.cctor_2(ret, new global::System.IntPtr(&native));
return (TypedefType.Internal*) ret;
}
示例15: TypedefType
private TypedefType(TypedefType.Internal native)
: this(__CopyValue(native))
{
__ownsNativeInstance = true;
}