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

2
src/Generator/Types/Std/Stdlib.cs

@ -98,7 +98,7 @@ namespace CppSharp.Types.Std @@ -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

6
src/Generator/Types/TypeMap.cs

@ -15,9 +15,9 @@ namespace CppSharp.Types @@ -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 @@ -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;
}

4
tests/CSharp/CSharp.cpp

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

2
tests/CSharp/CSharp.h

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

Loading…
Cancel
Save