本文整理汇总了C#中PointerType.Visit方法的典型用法代码示例。如果您正苦于以下问题:C# PointerType.Visit方法的具体用法?C# PointerType.Visit怎么用?C# PointerType.Visit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointerType
的用法示例。
在下文中一共展示了PointerType.Visit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitPointerType
public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals)
{
if (!VisitType(pointer, quals))
return false;
var pointee = pointer.Pointee.Desugar();
if ((pointee.IsPrimitiveType(PrimitiveType.Char) ||
pointee.IsPrimitiveType(PrimitiveType.WideChar)) &&
pointer.QualifiedPointee.Qualifiers.IsConst)
{
Context.SupportBefore.WriteLine(
"auto _{0} = clix::marshalString<clix::E_UTF8>({1});",
Context.ArgName, Context.Parameter.Name);
Context.Return.Write("_{0}.c_str()", Context.ArgName);
return true;
}
if (pointee is FunctionType)
{
var function = pointee as FunctionType;
var cppTypePrinter = new CppTypePrinter(Context.Driver.TypeDatabase);
var cppTypeName = pointer.Visit(cppTypePrinter, quals);
return VisitDelegateType(function, cppTypeName);
}
Enumeration @enum;
if (pointee.TryGetEnum(out @enum))
{
var isRef = Context.Parameter.Usage == ParameterUsage.Out ||
Context.Parameter.Usage == ParameterUsage.InOut;
ArgumentPrefix.Write("&");
Context.Return.Write("(::{0}){1}{2}", @enum.QualifiedOriginalName,
isRef ? string.Empty : "*", Context.Parameter.Name);
return true;
}
Class @class;
if (pointee.TryGetClass(out @class) && @class.IsValueType)
{
if (Context.Function == null)
Context.Return.Write("&");
return pointee.Visit(this, quals);
}
var finalPointee = pointer.GetFinalPointee();
if (finalPointee.IsPrimitiveType())
{
var cppTypePrinter = new CppTypePrinter(Context.Driver.TypeDatabase);
var cppTypeName = pointer.Visit(cppTypePrinter, quals);
Context.Return.Write("({0})", cppTypeName);
Context.Return.Write(Context.Parameter.Name);
return true;
}
return pointer.Pointee.Visit(this, quals);
}
示例2: VisitPointerType
public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals)
{
if (!VisitType(pointer, quals))
return false;
var pointee = pointer.Pointee.Desugar();
if ((pointee.IsPrimitiveType(PrimitiveType.Char) ||
pointee.IsPrimitiveType(PrimitiveType.WideChar)) &&
pointer.QualifiedPointee.Qualifiers.IsConst)
{
Context.SupportBefore.WriteLine(
"auto _{0} = clix::marshalString<clix::E_UTF8>({1});",
Context.ArgName, Context.Parameter.Name);
Context.Return.Write("_{0}.c_str()", Context.ArgName);
return true;
}
if (pointee is FunctionType)
{
var function = pointee as FunctionType;
var cppTypePrinter = new CppTypePrinter(Context.Driver.TypeDatabase);
var cppTypeName = pointer.Visit(cppTypePrinter, quals);
return VisitDelegateType(function, cppTypeName);
}
Class @class;
if (pointee.IsTagDecl(out @class) && @class.IsValueType)
{
if (Context.Function == null)
Context.Return.Write("&");
return pointee.Visit(this, quals);
}
PrimitiveType primitive;
if (pointee.IsPrimitiveType(out primitive))
{
var cppTypePrinter = new CppTypePrinter(Context.Driver.TypeDatabase);
var cppTypeName = pointer.Visit(cppTypePrinter, quals);
Context.Return.Write("({0})", cppTypeName);
Context.Return.Write(Context.Parameter.Name);
return true;
}
return pointer.Pointee.Visit(this, quals);
}