Browse Source

Disabled the type map for std::vector in the C# generator.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/661/head
Dimitar Dobrev 9 years ago
parent
commit
f1860c679d
  1. 4
      src/Generator/Generator.cs
  2. 2
      src/Generator/Types/Std/Stdlib.cs
  3. 6
      src/Generator/Types/TypeMap.cs
  4. 4
      tests/CSharp/CSharp.cpp
  5. 2
      tests/CSharp/CSharp.h

4
src/Generator/Generator.cs

@ -11,8 +11,8 @@ namespace CppSharp.Generators
/// </summary> /// </summary>
public enum GeneratorKind public enum GeneratorKind
{ {
CLI, CLI = 1,
CSharp, CSharp = 2
} }
/// <summary> /// <summary>

2
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 class Vector : TypeMap
{ {
public override bool IsIgnored public override bool IsIgnored

6
src/Generator/Types/TypeMap.cs

@ -15,9 +15,9 @@ namespace CppSharp.Types
public class TypeMapAttribute : Attribute public class TypeMapAttribute : Attribute
{ {
public string Type { get; private set; } 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; Type = type;
} }
@ -152,7 +152,7 @@ namespace CppSharp.Types
var attrs = typeMap.GetCustomAttributes(typeof(TypeMapAttribute), true); var attrs = typeMap.GetCustomAttributes(typeof(TypeMapAttribute), true);
foreach (TypeMapAttribute attr in attrs) foreach (TypeMapAttribute attr in attrs)
{ {
if (attr.GeneratorKind == null || attr.GeneratorKind == generatorKind) if (attr.GeneratorKind == 0 || attr.GeneratorKind == generatorKind)
{ {
TypeMaps[attr.Type] = typeMap; TypeMaps[attr.Type] = typeMap;
} }

4
tests/CSharp/CSharp.cpp

@ -45,6 +45,10 @@ void Foo::foo(int i)
{ {
} }
void Foo::takesStdVector(const std::vector<int>& vector)
{
}
const int Foo::rename; const int Foo::rename;
int Foo::makeFunctionCall() int Foo::makeFunctionCall()

2
tests/CSharp/CSharp.h

@ -1,5 +1,6 @@
#include "../Tests.h" #include "../Tests.h"
#include <cstdint> #include <cstdint>
#include <vector>
#include "AnotherUnit.h" #include "AnotherUnit.h"
class DLL_API Foo class DLL_API Foo
@ -17,6 +18,7 @@ public:
bool isNoParams(); bool isNoParams();
void setNoParams(); void setNoParams();
void foo(int i); void foo(int i);
void takesStdVector(const std::vector<int>& vector);
static const int rename = 5; static const int rename = 5;
static int makeFunctionCall(); static int makeFunctionCall();

Loading…
Cancel
Save