diff --git a/src/Generator/Generator.cs b/src/Generator/Generator.cs index 0f090d65..bf0421e2 100644 --- a/src/Generator/Generator.cs +++ b/src/Generator/Generator.cs @@ -11,8 +11,8 @@ namespace CppSharp.Generators /// public enum GeneratorKind { - CLI, - CSharp, + CLI = 1, + CSharp = 2 } /// diff --git a/src/Generator/Types/Std/Stdlib.cs b/src/Generator/Types/Std/Stdlib.cs index 370ab432..ed886249 100644 --- a/src/Generator/Types/Std/Stdlib.cs +++ b/src/Generator/Types/Std/Stdlib.cs @@ -98,7 +98,7 @@ namespace CppSharp.Types.Std } } - [TypeMap("std::vector")] + [TypeMap("std::vector", GeneratorKind = GeneratorKind.CLI)] public class Vector : TypeMap { public override bool IsIgnored diff --git a/src/Generator/Types/TypeMap.cs b/src/Generator/Types/TypeMap.cs index 84b97f7a..c001194a 100644 --- a/src/Generator/Types/TypeMap.cs +++ b/src/Generator/Types/TypeMap.cs @@ -15,9 +15,9 @@ namespace CppSharp.Types public class TypeMapAttribute : Attribute { public string Type { get; private set; } - public GeneratorKind? GeneratorKind { get; set; } + public GeneratorKind GeneratorKind { get; set; } - public TypeMapAttribute(string type) + public TypeMapAttribute(string type) : this(type, 0) { Type = type; } @@ -152,7 +152,7 @@ namespace CppSharp.Types var attrs = typeMap.GetCustomAttributes(typeof(TypeMapAttribute), true); foreach (TypeMapAttribute attr in attrs) { - if (attr.GeneratorKind == null || attr.GeneratorKind == generatorKind) + if (attr.GeneratorKind == 0 || attr.GeneratorKind == generatorKind) { TypeMaps[attr.Type] = typeMap; } diff --git a/tests/CSharp/CSharp.cpp b/tests/CSharp/CSharp.cpp index 9296d3a4..7c993ec1 100644 --- a/tests/CSharp/CSharp.cpp +++ b/tests/CSharp/CSharp.cpp @@ -45,6 +45,10 @@ void Foo::foo(int i) { } +void Foo::takesStdVector(const std::vector& vector) +{ +} + const int Foo::rename; int Foo::makeFunctionCall() diff --git a/tests/CSharp/CSharp.h b/tests/CSharp/CSharp.h index 6d415de5..5b66fa65 100644 --- a/tests/CSharp/CSharp.h +++ b/tests/CSharp/CSharp.h @@ -1,5 +1,6 @@ #include "../Tests.h" #include +#include #include "AnotherUnit.h" class DLL_API Foo @@ -17,6 +18,7 @@ public: bool isNoParams(); void setNoParams(); void foo(int i); + void takesStdVector(const std::vector& vector); static const int rename = 5; static int makeFunctionCall();