Move CIL-specific type printing to type printing file.
This commit is contained in:
Родитель
4a9933b550
Коммит
da1a9a0a0b
|
@ -58,21 +58,12 @@ namespace MonoManagedToNative.Generators
|
|||
return CGenerator.GenId(id);
|
||||
}
|
||||
|
||||
string PrintCILType(CILType type, TypeQualifiers quals)
|
||||
{
|
||||
if (type.Type == typeof(string))
|
||||
return "const char*";
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public CppTypePrinter CTypePrinter
|
||||
{
|
||||
get
|
||||
{
|
||||
var cTypePrinter = new CppTypePrinter { PrintScopeKind = CppTypePrintScopeKind.Qualified };
|
||||
cTypePrinter.CILTypePrinter += PrintCILType;
|
||||
return cTypePrinter;
|
||||
var typePrinter = new CppTypePrinter { PrintScopeKind = CppTypePrintScopeKind.Qualified };
|
||||
return typePrinter;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,17 @@ namespace CppSharp.Types
|
|||
Cpp,
|
||||
}
|
||||
|
||||
static class CLITypePrinter
|
||||
{
|
||||
public static string Visit(CILType type, TypeQualifiers quals)
|
||||
{
|
||||
if (type.Type == typeof(string))
|
||||
return "char*";
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public class CppTypePrinter : ITypePrinter<string>, IDeclVisitor<string>
|
||||
{
|
||||
public CppTypePrintFlavorKind PrintFlavorKind;
|
||||
|
@ -268,14 +279,9 @@ namespace CppSharp.Types
|
|||
return string.Empty;
|
||||
}
|
||||
|
||||
public Func<CILType , TypeQualifiers, string> CILTypePrinter;
|
||||
|
||||
public string VisitCILType(CILType type, TypeQualifiers quals)
|
||||
{
|
||||
if (CILTypePrinter != null)
|
||||
return CILTypePrinter(type, quals);
|
||||
|
||||
return string.Empty;
|
||||
return CLITypePrinter.Visit(type, quals);
|
||||
}
|
||||
|
||||
public string VisitPrimitiveType(PrimitiveType type, TypeQualifiers quals)
|
||||
|
|
Загрузка…
Ссылка в новой задаче