本文整理汇总了C#中Cursor.VisitChildren方法的典型用法代码示例。如果您正苦于以下问题:C# Cursor.VisitChildren方法的具体用法?C# Cursor.VisitChildren怎么用?C# Cursor.VisitChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cursor
的用法示例。
在下文中一共展示了Cursor.VisitChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public void Parse(Cursor cursor)
{
if (String.IsNullOrEmpty(cursor.Name))
return;
String enumName = cursor.Name.Substring(2).Replace("_", "");
if (enumName == "ChildVisitResult")
enumName = "CursorVisitResult";
if (enumName == "CallingConv")
enumName = "CallingConvention";
String filename = Path.Combine(_di.FullName, enumName + ".h");
var contents = new StringBuilder();
contents.AppendLine(Template.Template.Header);
if (enumName.EndsWith("Flags"))
contents.AppendLine(" [System::Flags]");
contents.Append(" public enum class ");
contents.Append(enumName);
contents.AppendLine(" {");
// add values
_sb = contents;
cursor.VisitChildren(EnumVisitor);
contents.AppendLine(" };");
contents.AppendLine(Template.Template.Footer);
File.WriteAllText(filename, contents.ToString());
}
示例2: CursorVisitor
private static CursorVisitResult CursorVisitor(Cursor cursor, Cursor parent)
{
if (cursor.Location.SpellingPosition.File.Path == FILENAME)
{
//_last.Push(parent);
switch (cursor.Kind)
{
case CursorKind.FunctionDeclaration:
FunctionVisitor.Parse(cursor);
break;
case CursorKind.VariableDeclaration:
Console.WriteLine ("variable {0} -> recurse", cursor.Name);
break;
case CursorKind.EnumerationDeclaration:
Console.WriteLine ("enum {0} -> recurse", cursor.Name);
break;
case CursorKind.ClassDeclaration:
Console.WriteLine ("class {0} -> recurse", cursor.Name);
cursor.VisitChildren(ClassVisitor.Visitor);
break;
case CursorKind.MacroDefinition:
Console.WriteLine ("macro {0} -> recurse", cursor.Name);
break;
//case CursorKind.EnumerationConstantDeclaration:
// Console.WriteLine (" {0}", cursor.Name);
// break;
//case CursorKind.CxxAccessSpecifier:
// break;
//case CursorKind.UnexposedExpression:
// break;
//case CursorKind.CharacterLiteral:
// Console.Write ("char: {0}", cursor.Spelling);
// break;
//case CursorKind.StringLiteral:
// Console.Write ("string: {0}", cursor.Spelling);
// break;
//case CursorKind.IntegerLiteral:
// //Console.Write ("intval={0}", cursor.Spelling);
// break;
//case CursorKind.CompoundStatement:
// Console.WriteLine ("{");
// break;
//case CursorKind.DeclarationReferenceExpression:
// Console.Write (" {0}, ", cursor.Name);
// break;
//case CursorKind.CallExpression:
// Console.WriteLine ("{0} ();", cursor.Name);
// break;
default:
Console.WriteLine ("{0} (name:{1}) [spelling:{2}] L{3}C{4}",
cursor.Kind, cursor.Name, cursor.Spelling,
cursor.Location.SpellingPosition.Line,
cursor.Location.SpellingPosition.Column);
break;
}
}
return CursorVisitResult.Continue;
}