本文整理汇总了C#中ClangSharp.CXCursor.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# CXCursor.ToString方法的具体用法?C# CXCursor.ToString怎么用?C# CXCursor.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClangSharp.CXCursor
的用法示例。
在下文中一共展示了CXCursor.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PortParameter
public ParameterSyntax PortParameter(CXCursor paramDecl)
{
string paramName = paramDecl.ToString ();
CXType type = clang.getCursorType (paramDecl);
// We can't pass void as function parameter
if (type.kind == CXTypeKind.CXType_Void)
throw new ArgumentException ();
var paramId = SF.Identifier (paramName);
ParameterSyntax paramSyntax = SF.Parameter (paramId);
if (type.kind == CXTypeKind.CXType_ObjCObjectPointer) {
type = type.GetPointee ();
TypeSyntax typeSyntax = PortType (type);
return paramSyntax.WithType (typeSyntax);
}
if (type.kind == CXTypeKind.CXType_Pointer) {
type = type.GetPointee ();
if(type.kind == CXTypeKind.CXType_Void) // original type was void*
return paramSyntax.WithType(CommonTypes.IntPtrTypeSyntax);
TypeSyntax typeSyntax = PortType (type);
return paramSyntax.WithType (typeSyntax).WithModifiers (SF.TokenList (SF.Token (SyntaxKind.OutKeyword)));
}
TypeSyntax ts = PortType (type);
return paramSyntax.WithType (ts);
}
示例2: Dump
static void Dump(CXCursor cursor, StringBuilder sb, int level, int mask)
{
for (int i = 1; i <= level; i++) {
if (IsSet (mask, level - i)) {
if (i == level)
sb.Append ("|-");
else
sb.Append ("| ");
} else {
if (i == level)
sb.Append ("`-");
else
sb.Append (" ");
}
}
sb.AppendFormat ("{0} {1}\n", cursor.kind, cursor.ToString ());
CXCursor[] children = cursor.GetChildren ().ToArray();
for (int i = 0; i < children.Length; i++)
Dump (children[i], sb, level + 1, (mask << 1) | (i == children.Length - 1 ? 0 : 1));
}
示例3: CreatePropertyFromPropertyDecl
PropertyDeclarationSyntax CreatePropertyFromPropertyDecl(CXCursor propDecl)
{
CXType propType = clang.getCursorType (propDecl);
TypeSyntax propTypeSyntax = TypePorter.PortType (propType);
PropertyDeclarationSyntax propSyntax = SF.PropertyDeclaration (propTypeSyntax, propDecl.ToString())
.AddModifiers (SF.Token (SyntaxKind.PublicKeyword));
propSyntax = propSyntax.AddAccessorListAccessors (
SF.AccessorDeclaration (SyntaxKind.GetAccessorDeclaration)
.WithSemicolonToken (SF.Token (SyntaxKind.SemicolonToken)),
SF.AccessorDeclaration (SyntaxKind.SetAccessorDeclaration)
.WithSemicolonToken (SF.Token (SyntaxKind.SemicolonToken))
);
return propSyntax;
}