Tools and libraries to glue C/C++ APIs to high-level languages
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

48 lines
1.4 KiB

using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using System.CodeDom;
namespace Mono.VisualC.Code {
public abstract class CodeAtom {
internal protected virtual void Visit (object obj)
{
object result = obj;
while (result != null) {
if (result is CodeCompileUnit) { result = InsideCodeCompileUnit (result as CodeCompileUnit); continue; }
if (result is CodeNamespace) { result = InsideCodeNamespace (result as CodeNamespace); continue; }
if (result is CodeTypeDeclaration) { result = InsideCodeTypeDeclaration (result as CodeTypeDeclaration); continue; }
if (result is CodeMemberMethod) { result = InsideCodeStatementCollection (((CodeMemberMethod)result).Statements); continue; }
if (result is CodeStatementCollection) { result = InsideCodeStatementCollection (result as CodeStatementCollection); continue; }
break;
}
}
internal protected virtual object InsideCodeCompileUnit (CodeCompileUnit ccu)
{
return null;
}
internal protected virtual object InsideCodeNamespace (CodeNamespace ns)
{
return null;
}
internal protected virtual object InsideCodeTypeDeclaration (CodeTypeDeclaration decl)
{
return null;
}
internal protected virtual object InsideCodeStatementCollection (CodeStatementCollection stmts)
{
return null;
}
public abstract void Write (TextWriter writer);
}
}