diff --git a/src/Generator/Driver.cs b/src/Generator/Driver.cs index ccbb0b3e..b58ff582 100644 --- a/src/Generator/Driver.cs +++ b/src/Generator/Driver.cs @@ -178,6 +178,10 @@ namespace Cxxi GenerateLibraryNamespace = true; GenerateFunctionTemplates = false; WriteOnlyWhenChanged = false; + + var platform = Environment.OSVersion.Platform; + Abi = (platform == PlatformID.Unix || platform == PlatformID.MacOSX) ? + CppAbi.Itanium : CppAbi.Microsoft; } public bool Verbose = false; @@ -192,6 +196,7 @@ namespace Cxxi public string OutputNamespace; public string OutputDir; public string LibraryName; + public CppAbi Abi; public List Defines; public List IncludeDirs; public List Headers; @@ -202,5 +207,8 @@ namespace Cxxi public string WrapperSuffix; public LanguageGeneratorKind GeneratorKind; public bool WriteOnlyWhenChanged; + + public bool IsItaniumAbi { get { return Abi == CppAbi.Itanium; } } + public bool IsMicrosoftAbi { get { return Abi == CppAbi.Microsoft; } } } } \ No newline at end of file diff --git a/src/Generator/Generators/CLI/CLITextTemplate.cs b/src/Generator/Generators/CLI/CLITextTemplate.cs index 6ed5bc67..e8b62f30 100644 --- a/src/Generator/Generators/CLI/CLITextTemplate.cs +++ b/src/Generator/Generators/CLI/CLITextTemplate.cs @@ -119,43 +119,6 @@ namespace Cxxi.Generators.CLI return string.Join(", ", types); } - public static bool CheckIgnoreMethod(Class @class, Method method) - { - if (method.Ignore) return true; - - bool isEmptyCtor = method.IsConstructor && method.Parameters.Count == 0; - - if (@class.IsValueType && isEmptyCtor) - return true; - - if (method.IsCopyConstructor || method.IsMoveConstructor) - return true; - - if (method.IsDestructor) - return true; - - if (method.OperatorKind == CXXOperatorKind.Equal) - return true; - - if (method.Kind == CXXMethodKind.Conversion) - return true; - - if (method.Access != AccessSpecifier.Public) - return true; - - return false; - } - - public static bool CheckIgnoreField(Class @class, Field field) - { - if (field.Ignore) return true; - - if (field.Access != AccessSpecifier.Public) - return true; - - return false; - } - public static List GetEventParameters(Event @event) { var i = 0; diff --git a/src/Generator/Generators/Template.cs b/src/Generator/Generators/Template.cs index 3a9dd788..5ec5cc83 100644 --- a/src/Generator/Generators/Template.cs +++ b/src/Generator/Generators/Template.cs @@ -22,5 +22,42 @@ Transform = driver.Transform; TranslationUnit = unit; } + + public static bool CheckIgnoreMethod(Class @class, Method method) + { + if (method.Ignore) return true; + + bool isEmptyCtor = method.IsConstructor && method.Parameters.Count == 0; + + if (@class.IsValueType && isEmptyCtor) + return true; + + if (method.IsCopyConstructor || method.IsMoveConstructor) + return true; + + if (method.IsDestructor) + return true; + + if (method.OperatorKind == CXXOperatorKind.Equal) + return true; + + if (method.Kind == CXXMethodKind.Conversion) + return true; + + if (method.Access != AccessSpecifier.Public) + return true; + + return false; + } + + public static bool CheckIgnoreField(Class @class, Field field) + { + if (field.Ignore) return true; + + if (field.Access != AccessSpecifier.Public) + return true; + + return false; + } } } \ No newline at end of file