Browse Source

Fixed the generated C# when using std::map.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1015/head
Dimitar Dobrev 8 years ago
parent
commit
a913a74138
  1. 3
      src/Generator/Passes/IgnoreSystemDeclarationsPass.cs
  2. 5
      tests/CSharp/CSharpTemplates.cpp
  3. 9
      tests/CSharp/CSharpTemplates.h

3
src/Generator/Passes/IgnoreSystemDeclarationsPass.cs

@ -48,6 +48,9 @@ namespace CppSharp.Passes
if (!@class.IsDependent || @class.Specializations.Count == 0) if (!@class.IsDependent || @class.Specializations.Count == 0)
return false; return false;
foreach (var specialization in @class.Specializations)
specialization.ExplicitlyIgnore();
// we only need a few members for marshalling so strip the rest // we only need a few members for marshalling so strip the rest
switch (@class.Name) switch (@class.Name)
{ {

5
tests/CSharp/CSharpTemplates.cpp

@ -135,6 +135,11 @@ void hasIgnoredParam(DependentValueFields<IndependentFields<Ignored>> ii)
{ {
} }
std::map<int, int> usesValidSpecialisationOfIgnoredTemplate()
{
return std::map<int, int>();
}
DependentValueFields<double> specialiseReturnOnly() DependentValueFields<double> specialiseReturnOnly()
{ {
return DependentValueFields<double>(); return DependentValueFields<double>();

9
tests/CSharp/CSharpTemplates.h

@ -2,6 +2,7 @@
#include "AnotherUnit.h" #include "AnotherUnit.h"
#include <string> #include <string>
#include <map>
class DLL_API T1 class DLL_API T1
{ {
@ -31,6 +32,7 @@ public:
IndependentFields(const T& t); IndependentFields(const T& t);
IndependentFields(int i); IndependentFields(int i);
~IndependentFields(); ~IndependentFields();
explicit IndependentFields(const std::map<T, T> &other);
int getIndependent(); int getIndependent();
const T* returnTakeDependentPointer(const T* p); const T* returnTakeDependentPointer(const T* p);
T getDependent(const T& t); T getDependent(const T& t);
@ -67,6 +69,11 @@ IndependentFields<T>::IndependentFields(int i)
independent = i; independent = i;
} }
template <typename T>
IndependentFields<T>::IndependentFields(const std::map<T, T> &v)
{
}
template <typename T> template <typename T>
IndependentFields<T>::~IndependentFields() IndependentFields<T>::~IndependentFields()
{ {
@ -513,6 +520,8 @@ void forceUseSpecializations(IndependentFields<int> _1, IndependentFields<bool>
void hasIgnoredParam(DependentValueFields<IndependentFields<Ignored>> ii); void hasIgnoredParam(DependentValueFields<IndependentFields<Ignored>> ii);
std::map<int, int> usesValidSpecialisationOfIgnoredTemplate();
DLL_API DependentValueFields<double> specialiseReturnOnly(); DLL_API DependentValueFields<double> specialiseReturnOnly();
// force the symbols for the template instantiations because we do not have the auto-compilation for the generated C++ source // force the symbols for the template instantiations because we do not have the auto-compilation for the generated C++ source

Loading…
Cancel
Save