merge revisions 11243-11872 from trunk to gsoc2009-matevz
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@12162 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
ab1cd03979
387 changed files with 12383 additions and 4412 deletions
|
|
@ -1,7 +1,9 @@
|
|||
%include <shared_ptr.i>
|
||||
|
||||
// Language specific macro implementing all the customisations for handling the smart pointer
|
||||
%define SWIG_SHARED_PTR_TYPEMAPS(PROXYCLASS, CONST, TYPE...)
|
||||
|
||||
// %naturalvar is as documented for member variables
|
||||
%naturalvar TYPE;
|
||||
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
|
||||
|
|
@ -10,6 +12,7 @@
|
|||
//"if (debug_shared) { cout << \"deleting use_count: \" << (*smartarg1).use_count() << \" [\" << (boost::get_deleter<SWIG_null_deleter>(*smartarg1) ? std::string(\"CANNOT BE DETERMINED SAFELY\") : ( (*smartarg1).get() ? (*smartarg1)->getValue() : std::string(\"NULL PTR\") )) << \"]\" << endl << flush; }\n"
|
||||
"(void)arg1; delete smartarg1;"
|
||||
|
||||
// Typemap customisations...
|
||||
|
||||
// plain value
|
||||
%typemap(in, canthrow=1) CONST TYPE ($&1_type argp = 0) %{
|
||||
|
|
|
|||
|
|
@ -1,25 +1,14 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* std_map.i
|
||||
*
|
||||
* SWIG typemaps for std::map
|
||||
* SWIG typemaps for std::map< K, T >
|
||||
*
|
||||
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.IDictionary<>.
|
||||
*
|
||||
* Using this wrapper is fairly simple. For example, to create a map from integers to doubles use:
|
||||
*
|
||||
* %include <std_map.i>
|
||||
* %template(Map_Int_Double) std::map<int, double>
|
||||
*
|
||||
* Very often the C# generated code will not compile as the C++ template type is not the same as the C#
|
||||
* proxy type, so use the SWIG_STD_MAP_SPECIALIZED or SWIG_STD_MAP_SPECIALIZED_SIMPLE macros. For example:
|
||||
*
|
||||
* SWIG_STD_MAP_SPECIALIZED(MyCppKeyClass, MyCppValueClass, MyCsKeyClass, MyCsValueClass)
|
||||
* %template(Map_MyCppKeyClass_MyCppValueClass) std::map<MyCppKeyClass, MyCppValueClass >;
|
||||
*
|
||||
* Or if the C# class names are the same as the C++ class names, you can use:
|
||||
*
|
||||
* SWIG_STD_MAP_SPECIALIZED_SIMPLE(MyKeyClass, MyValueClass)
|
||||
* %template(Map_MyCppKeyClass_MyCppValueClass) std::map<MyKeyClass, MyValueClass >;
|
||||
* %template(MapIntDouble) std::map<int, double>
|
||||
*
|
||||
* Notes:
|
||||
* 1) For .NET 1 compatibility, define SWIG_DOTNET_1 when compiling the C# code. In this case
|
||||
|
|
@ -36,69 +25,13 @@
|
|||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
// A minimal implementation to be used when no specialization exists.
|
||||
%define SWIG_STD_MAP_MINIMAL_INTERNAL(K, T)
|
||||
public:
|
||||
map();
|
||||
map(const map<K, T > &other);
|
||||
/* K is the C++ key type, T is the C++ value type */
|
||||
%define SWIG_STD_MAP_INTERNAL(K, T)
|
||||
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
typedef size_t size_type;
|
||||
size_type size() const;
|
||||
bool empty() const;
|
||||
%rename(Clear) clear;
|
||||
void clear();
|
||||
%extend {
|
||||
const mapped_type& getitem(const key_type& key) throw (std::out_of_range) {
|
||||
std::map<K,T >::iterator iter = $self->find(key);
|
||||
if (iter != $self->end())
|
||||
return iter->second;
|
||||
else
|
||||
throw std::out_of_range("key not found");
|
||||
}
|
||||
|
||||
void setitem(const key_type& key, const mapped_type& x) {
|
||||
(*$self)[key] = x;
|
||||
}
|
||||
|
||||
bool ContainsKey(const key_type& key) {
|
||||
std::map<K, T >::iterator iter = $self->find(key);
|
||||
return iter != $self->end();
|
||||
}
|
||||
|
||||
void Add(const key_type& key, const mapped_type& val) throw (std::out_of_range) {
|
||||
std::map<K, T >::iterator iter = $self->find(key);
|
||||
if (iter != $self->end())
|
||||
throw std::out_of_range("key already exists");
|
||||
$self->insert(std::pair<K, T >(key, val));
|
||||
}
|
||||
|
||||
bool Remove(const key_type& key) {
|
||||
std::map<K, T >::iterator iter = $self->find(key);
|
||||
if (iter != $self->end()) {
|
||||
$self->erase(iter);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
%enddef
|
||||
|
||||
/* The specialized std::map implementation
|
||||
* K is the C++ key type
|
||||
* T is the C++ value type
|
||||
* CSKEYTYPE is the C# key type
|
||||
* CSVALUETYPE is the C# value type
|
||||
*/
|
||||
%define SWIG_STD_MAP_SPECIALIZED_INTERNAL(K, T, CSKEYTYPE, CSVALUETYPE)
|
||||
// add typemaps here
|
||||
%typemap(csinterfaces) std::map<K, T > "IDisposable \n#if !SWIG_DOTNET_1\n , System.Collections.Generic.IDictionary<CSKEYTYPE, CSVALUETYPE>\n#endif\n";
|
||||
%typemap(csinterfaces) std::map< K, T > "IDisposable \n#if !SWIG_DOTNET_1\n , System.Collections.Generic.IDictionary<$typemap(cstype, K), $typemap(cstype, T)>\n#endif\n";
|
||||
%typemap(cscode) std::map<K, T > %{
|
||||
|
||||
public CSVALUETYPE this[CSKEYTYPE key] {
|
||||
public $typemap(cstype, T) this[$typemap(cstype, K) key] {
|
||||
get {
|
||||
return getitem(key);
|
||||
}
|
||||
|
|
@ -108,12 +41,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
public bool TryGetValue(CSKEYTYPE key, out CSVALUETYPE value) {
|
||||
public bool TryGetValue($typemap(cstype, K) key, out $typemap(cstype, T) value) {
|
||||
if (this.ContainsKey(key)) {
|
||||
value = this[key];
|
||||
return true;
|
||||
}
|
||||
value = default(CSVALUETYPE);
|
||||
value = default($typemap(cstype, T));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -131,9 +64,9 @@
|
|||
|
||||
#if !SWIG_DOTNET_1
|
||||
|
||||
public System.Collections.Generic.ICollection<CSKEYTYPE> Keys {
|
||||
public System.Collections.Generic.ICollection<$typemap(cstype, K)> Keys {
|
||||
get {
|
||||
System.Collections.Generic.ICollection<CSKEYTYPE> keys = new System.Collections.Generic.List<CSKEYTYPE>();
|
||||
System.Collections.Generic.ICollection<$typemap(cstype, K)> keys = new System.Collections.Generic.List<$typemap(cstype, K)>();
|
||||
IntPtr iter = create_iterator_begin();
|
||||
try {
|
||||
while (true) {
|
||||
|
|
@ -145,21 +78,21 @@
|
|||
}
|
||||
}
|
||||
|
||||
public System.Collections.Generic.ICollection<CSVALUETYPE> Values {
|
||||
public System.Collections.Generic.ICollection<$typemap(cstype, T)> Values {
|
||||
get {
|
||||
System.Collections.Generic.ICollection<CSVALUETYPE> vals = new System.Collections.Generic.List<CSVALUETYPE>();
|
||||
foreach (System.Collections.Generic.KeyValuePair<CSKEYTYPE, CSVALUETYPE> pair in this) {
|
||||
System.Collections.Generic.ICollection<$typemap(cstype, T)> vals = new System.Collections.Generic.List<$typemap(cstype, T)>();
|
||||
foreach (System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> pair in this) {
|
||||
vals.Add(pair.Value);
|
||||
}
|
||||
return vals;
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(System.Collections.Generic.KeyValuePair<CSKEYTYPE, CSVALUETYPE> item) {
|
||||
public void Add(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
|
||||
Add(item.Key, item.Value);
|
||||
}
|
||||
|
||||
public bool Remove(System.Collections.Generic.KeyValuePair<CSKEYTYPE, CSVALUETYPE> item) {
|
||||
public bool Remove(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
|
||||
if (Contains(item)) {
|
||||
return Remove(item.Key);
|
||||
} else {
|
||||
|
|
@ -167,7 +100,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
public bool Contains(System.Collections.Generic.KeyValuePair<CSKEYTYPE, CSVALUETYPE> item) {
|
||||
public bool Contains(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> item) {
|
||||
if (this[item.Key] == item.Value) {
|
||||
return true;
|
||||
} else {
|
||||
|
|
@ -175,11 +108,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
public void CopyTo(System.Collections.Generic.KeyValuePair<CSKEYTYPE, CSVALUETYPE>[] array) {
|
||||
public void CopyTo(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array) {
|
||||
CopyTo(array, 0);
|
||||
}
|
||||
|
||||
public void CopyTo(System.Collections.Generic.KeyValuePair<CSKEYTYPE, CSVALUETYPE>[] array, int arrayIndex) {
|
||||
public void CopyTo(System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>[] array, int arrayIndex) {
|
||||
if (array == null)
|
||||
throw new ArgumentNullException("array");
|
||||
if (arrayIndex < 0)
|
||||
|
|
@ -189,14 +122,14 @@
|
|||
if (arrayIndex+this.Count > array.Length)
|
||||
throw new ArgumentException("Number of elements to copy is too large.");
|
||||
|
||||
System.Collections.Generic.IList<CSKEYTYPE> keyList = new System.Collections.Generic.List<CSKEYTYPE>(this.Keys);
|
||||
System.Collections.Generic.IList<$typemap(cstype, K)> keyList = new System.Collections.Generic.List<$typemap(cstype, K)>(this.Keys);
|
||||
for (int i = 0; i < keyList.Count; i++) {
|
||||
CSKEYTYPE currentKey = keyList[i];
|
||||
array.SetValue(new System.Collections.Generic.KeyValuePair<CSKEYTYPE, CSVALUETYPE>(currentKey, this[currentKey]), arrayIndex+i);
|
||||
$typemap(cstype, K) currentKey = keyList[i];
|
||||
array.SetValue(new System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, this[currentKey]), arrayIndex+i);
|
||||
}
|
||||
}
|
||||
|
||||
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<CSKEYTYPE, CSVALUETYPE>> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<CSKEYTYPE, CSVALUETYPE>>.GetEnumerator() {
|
||||
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>.GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
|
||||
|
|
@ -214,24 +147,24 @@
|
|||
/// collection but not when one of the elements of the collection is modified as it is a bit
|
||||
/// tricky to detect unmanaged code that modifies the collection under our feet.
|
||||
public sealed class $csclassnameEnumerator : System.Collections.IEnumerator,
|
||||
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<CSKEYTYPE, CSVALUETYPE>>
|
||||
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>>
|
||||
{
|
||||
private $csclassname collectionRef;
|
||||
private System.Collections.Generic.IList<CSKEYTYPE> keyCollection;
|
||||
private System.Collections.Generic.IList<$typemap(cstype, K)> keyCollection;
|
||||
private int currentIndex;
|
||||
private object currentObject;
|
||||
private int currentSize;
|
||||
|
||||
public $csclassnameEnumerator($csclassname collection) {
|
||||
collectionRef = collection;
|
||||
keyCollection = new System.Collections.Generic.List<CSKEYTYPE>(collection.Keys);
|
||||
keyCollection = new System.Collections.Generic.List<$typemap(cstype, K)>(collection.Keys);
|
||||
currentIndex = -1;
|
||||
currentObject = null;
|
||||
currentSize = collectionRef.Count;
|
||||
}
|
||||
|
||||
// Type-safe iterator Current
|
||||
public System.Collections.Generic.KeyValuePair<CSKEYTYPE, CSVALUETYPE> Current {
|
||||
public System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)> Current {
|
||||
get {
|
||||
if (currentIndex == -1)
|
||||
throw new InvalidOperationException("Enumeration not started.");
|
||||
|
|
@ -239,7 +172,7 @@
|
|||
throw new InvalidOperationException("Enumeration finished.");
|
||||
if (currentObject == null)
|
||||
throw new InvalidOperationException("Collection modified.");
|
||||
return (System.Collections.Generic.KeyValuePair<CSKEYTYPE, CSVALUETYPE>)currentObject;
|
||||
return (System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>)currentObject;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -255,8 +188,8 @@
|
|||
bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
|
||||
if (moveOkay) {
|
||||
currentIndex++;
|
||||
CSKEYTYPE currentKey = keyCollection[currentIndex];
|
||||
currentObject = new System.Collections.Generic.KeyValuePair<CSKEYTYPE, CSVALUETYPE>(currentKey, collectionRef[currentKey]);
|
||||
$typemap(cstype, K) currentKey = keyCollection[currentIndex];
|
||||
currentObject = new System.Collections.Generic.KeyValuePair<$typemap(cstype, K), $typemap(cstype, T)>(currentKey, collectionRef[currentKey]);
|
||||
} else {
|
||||
currentObject = null;
|
||||
}
|
||||
|
|
@ -282,7 +215,7 @@
|
|||
|
||||
public:
|
||||
map();
|
||||
map(const map<K, T > &other);
|
||||
map(const map< K, T > &other);
|
||||
|
||||
typedef K key_type;
|
||||
typedef T mapped_type;
|
||||
|
|
@ -293,7 +226,7 @@
|
|||
void clear();
|
||||
%extend {
|
||||
const mapped_type& getitem(const key_type& key) throw (std::out_of_range) {
|
||||
std::map<K,T >::iterator iter = $self->find(key);
|
||||
std::map< K,T >::iterator iter = $self->find(key);
|
||||
if (iter != $self->end())
|
||||
return iter->second;
|
||||
else
|
||||
|
|
@ -305,19 +238,19 @@
|
|||
}
|
||||
|
||||
bool ContainsKey(const key_type& key) {
|
||||
std::map<K, T >::iterator iter = $self->find(key);
|
||||
std::map< K, T >::iterator iter = $self->find(key);
|
||||
return iter != $self->end();
|
||||
}
|
||||
|
||||
void Add(const key_type& key, const mapped_type& val) throw (std::out_of_range) {
|
||||
std::map<K, T >::iterator iter = $self->find(key);
|
||||
std::map< K, T >::iterator iter = $self->find(key);
|
||||
if (iter != $self->end())
|
||||
throw std::out_of_range("key already exists");
|
||||
$self->insert(std::pair<K, T >(key, val));
|
||||
$self->insert(std::pair< K, T >(key, val));
|
||||
}
|
||||
|
||||
bool Remove(const key_type& key) {
|
||||
std::map<K, T >::iterator iter = $self->find(key);
|
||||
std::map< K, T >::iterator iter = $self->find(key);
|
||||
if (iter != $self->end()) {
|
||||
$self->erase(iter);
|
||||
return true;
|
||||
|
|
@ -326,15 +259,15 @@
|
|||
}
|
||||
|
||||
// create_iterator_begin() and get_next_key() work together to provide a collection of keys to C#
|
||||
%apply void *VOID_INT_PTR { std::map<K, T >::iterator *std::map<K, T >::create_iterator_begin }
|
||||
%apply void *VOID_INT_PTR { std::map<K, T >::iterator *swigiterator }
|
||||
%apply void *VOID_INT_PTR { std::map< K, T >::iterator *create_iterator_begin }
|
||||
%apply void *VOID_INT_PTR { std::map< K, T >::iterator *swigiterator }
|
||||
|
||||
std::map<K, T >::iterator *create_iterator_begin() {
|
||||
return new std::map<K, T >::iterator($self->begin());
|
||||
std::map< K, T >::iterator *create_iterator_begin() {
|
||||
return new std::map< K, T >::iterator($self->begin());
|
||||
}
|
||||
|
||||
const key_type& get_next_key(std::map<K, T >::iterator *swigiterator) throw (std::out_of_range) {
|
||||
std::map<K, T >::iterator iter = *swigiterator;
|
||||
const key_type& get_next_key(std::map< K, T >::iterator *swigiterator) throw (std::out_of_range) {
|
||||
std::map< K, T >::iterator iter = *swigiterator;
|
||||
if (iter == $self->end()) {
|
||||
delete swigiterator;
|
||||
throw std::out_of_range("no more map elements");
|
||||
|
|
@ -345,275 +278,32 @@
|
|||
}
|
||||
|
||||
|
||||
%csmethodmodifiers std::map<K, T >::size "private"
|
||||
%csmethodmodifiers std::map<K, T >::getitem "private"
|
||||
%csmethodmodifiers std::map<K, T >::setitem "private"
|
||||
%csmethodmodifiers std::map<K, T >::create_iterator_begin "private"
|
||||
%csmethodmodifiers std::map<K, T >::get_next_key "private"
|
||||
|
||||
%enddef
|
||||
|
||||
|
||||
// Main specialization macros
|
||||
%define SWIG_STD_MAP_SPECIALIZED(K, T, CSKEY, CSVAL)
|
||||
namespace std {
|
||||
template<> class map<K, T > {
|
||||
SWIG_STD_MAP_SPECIALIZED_INTERNAL(K, T, CSKEY, CSVAL)
|
||||
};
|
||||
}
|
||||
%enddef
|
||||
|
||||
%define SWIG_STD_MAP_SPECIALIZED_SIMPLE(K, T)
|
||||
SWIG_STD_MAP_SPECIALIZED(K, T, K, T)
|
||||
%enddef
|
||||
|
||||
// Old macros (deprecated)
|
||||
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
#warning specialize_std_map_on_key ignored - macro is deprecated, please use SWIG_STD_MAP_MINIMAL_INTERNAL in Lib/csharp/std_map.i
|
||||
%enddef
|
||||
|
||||
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
#warning specialize_std_map_on_value ignored - macro is deprecated, please use SWIG_STD_MAP_MINIMAL_INTERNAL in Lib/csharp/std_map.i
|
||||
%enddef
|
||||
|
||||
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
|
||||
#warning specialize_std_map_on_both ignored - macro is deprecated, please use SWIG_STD_MAP_MINIMAL_INTERNAL in Lib/csharp/std_map.i
|
||||
%enddef
|
||||
%csmethodmodifiers std::map::size "private"
|
||||
%csmethodmodifiers std::map::getitem "private"
|
||||
%csmethodmodifiers std::map::setitem "private"
|
||||
%csmethodmodifiers std::map::create_iterator_begin "private"
|
||||
%csmethodmodifiers std::map::get_next_key "private"
|
||||
|
||||
// Default implementation
|
||||
namespace std {
|
||||
template<class K, class T> class map {
|
||||
SWIG_STD_MAP_MINIMAL_INTERNAL(K, T)
|
||||
SWIG_STD_MAP_INTERNAL(K, T)
|
||||
};
|
||||
}
|
||||
|
||||
// specializations for built-ins
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, std::string, string, string)
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, bool, string, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, int, string, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, unsigned long long, string, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, unsigned long, string, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, unsigned short, string, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, long long, string, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, unsigned int, string, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, unsigned char, string, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, signed char, string, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, double, string, double)
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, short, string, short)
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, float, string, float)
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, char, string, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(std::string, long, string, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(bool, std::string, bool, string)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(bool, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(bool, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(bool, unsigned long long, bool, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(bool, unsigned long, bool, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(bool, unsigned short, bool, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(bool, long long, bool, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(bool, unsigned int, bool, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(bool, unsigned char, bool, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(bool, signed char, bool, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(bool, double)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(bool, short)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(bool, float)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(bool, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(bool, long, bool, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(int, std::string, int, string)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(int, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(int, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(int, unsigned long long, int, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(int, unsigned long, int, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(int, unsigned short, int, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(int, long long, int, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(int, unsigned int, int, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(int, unsigned char, int, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(int, signed char, int, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(int, double)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(int, short)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(int, float)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(int, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(int, long, int, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, std::string, ulong, string)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, bool, ulong, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, int, ulong, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, unsigned long long, ulong, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, unsigned long, ulong, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, unsigned short, ulong, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, long long, ulong, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, unsigned int, ulong, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, unsigned char, ulong, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, signed char, ulong, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, double, ulong, double)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, short, ulong, short)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, float, ulong, float)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, char, ulong, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long long, long, ulong, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, std::string, uint, string)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, bool, uint, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, int, uint, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, unsigned long long, uint, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, unsigned long, uint, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, unsigned short, uint, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, long long, uint, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, unsigned int, uint, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, unsigned char, uint, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, signed char, uint, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, double, uint, double)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, short, uint, short)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, float, uint, float)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, char, uint, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned long, long, uint, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, std::string, ushort, string)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, bool, ushort, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, int, ushort, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, unsigned long long, ushort, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, unsigned long, ushort, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, unsigned short, ushort, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, long long, ushort, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, unsigned int, ushort, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, unsigned char, ushort, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, signed char, ushort, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, double, ushort, double)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, short, ushort, short)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, float, ushort, float)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, char, ushort, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned short, long, ushort, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, std::string, long, string)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, bool, long, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, int, long, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, unsigned long long, long, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, unsigned long, long, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, unsigned short, long, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, long long, long, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, unsigned int, long, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, unsigned char, long, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, signed char, long, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, double, long, double)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, short, long, short)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, float, long, float)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, char, long, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(long long, long, long, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, std::string, uint, string)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, bool, uint, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, int, uint, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, unsigned long long, uint, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, unsigned long, uint, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, unsigned short, uint, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, long long, uint, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, unsigned int, uint, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, unsigned char, uint, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, signed char, uint, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, double, uint, double)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, short, uint, short)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, float, uint, float)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, char, uint, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned int, long, uint, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, std::string, byte, string)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, bool, byte, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, int, byte, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, unsigned long long, byte, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, unsigned long, byte, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, unsigned short, byte, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, long long, byte, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, unsigned int, byte, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, unsigned char, byte, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, signed char, byte, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, double, byte, double)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, short, byte, short)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, float, byte, float)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, char, byte, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(unsigned char, long, byte, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, std::string, sbyte, string)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, bool, sbyte, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, int, sbyte, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, unsigned long long, sbyte, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, unsigned long, sbyte, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, unsigned short, sbyte, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, long long, sbyte, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, unsigned int, sbyte, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, unsigned char, sbyte, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, signed char, sbyte, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, double, sbyte, double)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, short, sbyte, short)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, float, sbyte, float)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, char, sbyte, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(signed char, long, sbyte, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(double, std::string, double, string)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(double, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(double, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(double, unsigned long long, double, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(double, unsigned long, double, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(double, unsigned short, double, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(double, long long, double, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(double, unsigned int, double, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(double, unsigned char, double, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(double, signed char, double, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(double, double)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(double, short)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(double, float)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(double, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(double, long, double, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(short, std::string, short, string)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(short, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(short, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(short, unsigned long long, short, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(short, unsigned long, short, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(short, unsigned short, short, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(short, long long, short, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(short, unsigned int, short, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(short, unsigned char, short, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(short, signed char, short, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(short, double)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(short, short)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(short, float)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(short, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(short, long, short, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(float, std::string, float, string)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(float, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(float, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(float, unsigned long long, float, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(float, unsigned long, float, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(float, unsigned short, float, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(float, long long, float, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(float, unsigned int, float, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(float, unsigned char, float, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(float, signed char, float, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(float, double)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(float, short)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(float, float)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(float, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(float, long, float, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(char, std::string, char, string)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(char, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(char, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(char, unsigned long long, char, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(char, unsigned long, char, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(char, unsigned short, char, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(char, long long, char, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(char, unsigned int, char, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(char, unsigned char, char, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(char, signed char, char, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(char, double)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(char, short)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(char, float)
|
||||
SWIG_STD_MAP_SPECIALIZED_SIMPLE(char, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(char, long, char, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, std::string, int, string)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, bool, int, bool)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, int, int, int)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, unsigned long long, int, ulong)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, unsigned long, int, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, unsigned short, int, ushort)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, long long, int, long)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, unsigned int, int, uint)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, unsigned char, int, byte)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, signed char, int, sbyte)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, double, int, double)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, short, int, short)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, float, int, float)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, char, int, char)
|
||||
SWIG_STD_MAP_SPECIALIZED(long, long, int, int)
|
||||
|
||||
// add specializations here
|
||||
// Legacy macros (deprecated)
|
||||
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
#warning specialize_std_map_on_key ignored - macro is deprecated and no longer necessary
|
||||
%enddef
|
||||
|
||||
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
|
||||
#warning specialize_std_map_on_value ignored - macro is deprecated and no longer necessary
|
||||
%enddef
|
||||
|
||||
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
|
||||
#warning specialize_std_map_on_both ignored - macro is deprecated and no longer necessary
|
||||
%enddef
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,20 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* std_vector.i
|
||||
*
|
||||
* SWIG typemaps for std::vector
|
||||
* SWIG typemaps for std::vector<T>
|
||||
* C# implementation
|
||||
* The C# wrapper is made to look and feel like a C# System.Collections.Generic.List<> collection.
|
||||
* For .NET 1 compatibility, define SWIG_DOTNET_1 when compiling the C# code; then the C# wrapper is
|
||||
* made to look and feel like a typesafe C# System.Collections.ArrayList. All the methods in IList
|
||||
* are defined, but we don't derive from IList as this is a typesafe collection and the C++ operator==
|
||||
* must always be defined for the collection type (which it isn't).
|
||||
*
|
||||
* Very often the C# generated code will not compile as the C++ template type is not the same as the C#
|
||||
* proxy type, so use the SWIG_STD_VECTOR_SPECIALIZE or SWIG_STD_VECTOR_SPECIALIZE_MINIMUM macro, eg
|
||||
*
|
||||
* SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(Klass, SomeNamespace::Klass)
|
||||
* %template(VectKlass) std::vector<SomeNamespace::Klass>;
|
||||
* made to look and feel like a typesafe C# System.Collections.ArrayList.
|
||||
*
|
||||
* Note that IEnumerable<> is implemented in the proxy class which is useful for using LINQ with
|
||||
* C++ std::vector wrappers. IEnumerable<> is replaced by IList<> wherever we are confident that the
|
||||
* required C++ operator== is available for correct compilation.
|
||||
* C++ std::vector wrappers. The IList<> interface is also implemented to provide enhanced functionality
|
||||
* whenever we are confident that the required C++ operator== is available. This is the case for when
|
||||
* T is a primitive type or a pointer. If T does define an operator==, then use the SWIG_STD_VECTOR_ENHANCED
|
||||
* macro to obtain this enhanced functionality, for example:
|
||||
*
|
||||
* SWIG_STD_VECTOR_ENHANCED(SomeNamespace::Klass)
|
||||
* %template(VectKlass) std::vector<SomeNamespace::Klass>;
|
||||
*
|
||||
* Warning: heavy macro usage in this file. Use swig -E to get a sane view on the real file contents!
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
|
@ -28,14 +25,13 @@
|
|||
%include <std_common.i>
|
||||
|
||||
// MACRO for use within the std::vector class body
|
||||
// CSTYPE and CTYPE respectively correspond to the types in the cstype and ctype typemaps
|
||||
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE_TYPE, CSTYPE, CTYPE...)
|
||||
%typemap(csinterfaces) std::vector<CTYPE > "IDisposable, System.Collections.IEnumerable\n#if !SWIG_DOTNET_1\n , System.Collections.Generic.CSINTERFACE<CSTYPE>\n#endif\n";
|
||||
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CSINTERFACE, CONST_REFERENCE_TYPE, CTYPE...)
|
||||
%typemap(csinterfaces) std::vector<CTYPE > "IDisposable, System.Collections.IEnumerable\n#if !SWIG_DOTNET_1\n , System.Collections.Generic.CSINTERFACE<$typemap(cstype, CTYPE)>\n#endif\n";
|
||||
%typemap(cscode) std::vector<CTYPE > %{
|
||||
public $csclassname(System.Collections.ICollection c) : this() {
|
||||
if (c == null)
|
||||
throw new ArgumentNullException("c");
|
||||
foreach (CSTYPE element in c) {
|
||||
foreach ($typemap(cstype, CTYPE) element in c) {
|
||||
this.Add(element);
|
||||
}
|
||||
}
|
||||
|
|
@ -52,7 +48,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
public CSTYPE this[int index] {
|
||||
public $typemap(cstype, CTYPE) this[int index] {
|
||||
get {
|
||||
return getitem(index);
|
||||
}
|
||||
|
|
@ -87,7 +83,7 @@
|
|||
#if SWIG_DOTNET_1
|
||||
public void CopyTo(System.Array array)
|
||||
#else
|
||||
public void CopyTo(CSTYPE[] array)
|
||||
public void CopyTo($typemap(cstype, CTYPE)[] array)
|
||||
#endif
|
||||
{
|
||||
CopyTo(0, array, 0, this.Count);
|
||||
|
|
@ -96,7 +92,7 @@
|
|||
#if SWIG_DOTNET_1
|
||||
public void CopyTo(System.Array array, int arrayIndex)
|
||||
#else
|
||||
public void CopyTo(CSTYPE[] array, int arrayIndex)
|
||||
public void CopyTo($typemap(cstype, CTYPE)[] array, int arrayIndex)
|
||||
#endif
|
||||
{
|
||||
CopyTo(0, array, arrayIndex, this.Count);
|
||||
|
|
@ -105,7 +101,7 @@
|
|||
#if SWIG_DOTNET_1
|
||||
public void CopyTo(int index, System.Array array, int arrayIndex, int count)
|
||||
#else
|
||||
public void CopyTo(int index, CSTYPE[] array, int arrayIndex, int count)
|
||||
public void CopyTo(int index, $typemap(cstype, CTYPE)[] array, int arrayIndex, int count)
|
||||
#endif
|
||||
{
|
||||
if (array == null)
|
||||
|
|
@ -125,7 +121,7 @@
|
|||
}
|
||||
|
||||
#if !SWIG_DOTNET_1
|
||||
System.Collections.Generic.IEnumerator<CSTYPE> System.Collections.Generic.IEnumerable<CSTYPE>.GetEnumerator() {
|
||||
System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)> System.Collections.Generic.IEnumerable<$typemap(cstype, CTYPE)>.GetEnumerator() {
|
||||
return new $csclassnameEnumerator(this);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -145,7 +141,7 @@
|
|||
/// tricky to detect unmanaged code that modifies the collection under our feet.
|
||||
public sealed class $csclassnameEnumerator : System.Collections.IEnumerator
|
||||
#if !SWIG_DOTNET_1
|
||||
, System.Collections.Generic.IEnumerator<CSTYPE>
|
||||
, System.Collections.Generic.IEnumerator<$typemap(cstype, CTYPE)>
|
||||
#endif
|
||||
{
|
||||
private $csclassname collectionRef;
|
||||
|
|
@ -161,7 +157,7 @@
|
|||
}
|
||||
|
||||
// Type-safe iterator Current
|
||||
public CSTYPE Current {
|
||||
public $typemap(cstype, CTYPE) Current {
|
||||
get {
|
||||
if (currentIndex == -1)
|
||||
throw new InvalidOperationException("Enumeration not started.");
|
||||
|
|
@ -169,7 +165,7 @@
|
|||
throw new InvalidOperationException("Enumeration finished.");
|
||||
if (currentObject == null)
|
||||
throw new InvalidOperationException("Collection modified.");
|
||||
return (CSTYPE)currentObject;
|
||||
return ($typemap(cstype, CTYPE))currentObject;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -323,14 +319,13 @@
|
|||
}
|
||||
%enddef
|
||||
|
||||
%define SWIG_STD_VECTOR_MINIMUM(CSTYPE, CTYPE...)
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, const value_type&, CSTYPE, CTYPE)
|
||||
%define SWIG_STD_VECTOR_MINIMUM(CTYPE...)
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, const value_type&, CTYPE)
|
||||
%enddef
|
||||
|
||||
// Extra methods added to the collection class if operator== is defined for the class being wrapped
|
||||
// CSTYPE and CTYPE respectively correspond to the types in the cstype and ctype typemaps
|
||||
// The class will then implement IList<>, which adds extra functionality
|
||||
%define SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CSTYPE, CTYPE...)
|
||||
%define SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE...)
|
||||
%extend {
|
||||
bool Contains(const value_type& value) {
|
||||
return std::find($self->begin(), $self->end(), value) != $self->end();
|
||||
|
|
@ -360,23 +355,24 @@ SWIG_STD_VECTOR_MINIMUM_INTERNAL(IEnumerable, const value_type&, CSTYPE, CTYPE)
|
|||
}
|
||||
%enddef
|
||||
|
||||
// Macros for std::vector class specializations
|
||||
// CSTYPE and CTYPE respectively correspond to the types in the cstype and ctype typemaps
|
||||
%define SWIG_STD_VECTOR_SPECIALIZE(CSTYPE, CTYPE...)
|
||||
// Macros for std::vector class specializations/enhancements
|
||||
%define SWIG_STD_VECTOR_ENHANCED(CTYPE...)
|
||||
namespace std {
|
||||
template<> class vector<CTYPE > {
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, CSTYPE, CTYPE)
|
||||
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CSTYPE, CTYPE)
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, CTYPE)
|
||||
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE)
|
||||
};
|
||||
}
|
||||
%enddef
|
||||
|
||||
// Legacy macros
|
||||
%define SWIG_STD_VECTOR_SPECIALIZE(CSTYPE, CTYPE...)
|
||||
#warning SWIG_STD_VECTOR_SPECIALIZE macro deprecated, please see csharp/std_vector.i and switch to SWIG_STD_VECTOR_ENHANCED
|
||||
SWIG_STD_VECTOR_ENHANCED(CTYPE)
|
||||
%enddef
|
||||
|
||||
%define SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(CSTYPE, CTYPE...)
|
||||
namespace std {
|
||||
template<> class vector<CTYPE > {
|
||||
SWIG_STD_VECTOR_MINIMUM(CSTYPE, CTYPE)
|
||||
};
|
||||
}
|
||||
#warning SWIG_STD_VECTOR_SPECIALIZE_MINIMUM macro deprecated, it is no longer required
|
||||
%enddef
|
||||
|
||||
%{
|
||||
|
|
@ -396,36 +392,38 @@ namespace std {
|
|||
// primary (unspecialized) class template for std::vector
|
||||
// does not require operator== to be defined
|
||||
template<class T> class vector {
|
||||
SWIG_STD_VECTOR_MINIMUM(T, T)
|
||||
SWIG_STD_VECTOR_MINIMUM(T)
|
||||
};
|
||||
// specializations for pointers
|
||||
template<class T> class vector<T*> {
|
||||
SWIG_STD_VECTOR_MINIMUM(T, T*)
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, T*)
|
||||
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(T*)
|
||||
};
|
||||
template<class T> class vector<const T*> {
|
||||
SWIG_STD_VECTOR_MINIMUM(T, const T*)
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, const value_type&, const T*)
|
||||
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(const T*)
|
||||
};
|
||||
// bool is a bit different in the C++ standard
|
||||
template<> class vector<bool> {
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, bool, bool, bool)
|
||||
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(bool, bool)
|
||||
SWIG_STD_VECTOR_MINIMUM_INTERNAL(IList, bool, bool)
|
||||
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(bool)
|
||||
};
|
||||
}
|
||||
|
||||
// template specializations for std::vector
|
||||
// these provide extra collections methods as operator== is defined
|
||||
SWIG_STD_VECTOR_SPECIALIZE(char, char)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(sbyte, signed char)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(byte, unsigned char)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(short, short)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(ushort, unsigned short)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(int, int)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(uint, unsigned int)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(int, long)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(uint, unsigned long)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(long, long long)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(ulong, unsigned long long)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(float, float)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(double, double)
|
||||
SWIG_STD_VECTOR_SPECIALIZE(string, std::string) // also requires a %include <std_string.i>
|
||||
SWIG_STD_VECTOR_ENHANCED(char)
|
||||
SWIG_STD_VECTOR_ENHANCED(signed char)
|
||||
SWIG_STD_VECTOR_ENHANCED(unsigned char)
|
||||
SWIG_STD_VECTOR_ENHANCED(short)
|
||||
SWIG_STD_VECTOR_ENHANCED(unsigned short)
|
||||
SWIG_STD_VECTOR_ENHANCED(int)
|
||||
SWIG_STD_VECTOR_ENHANCED(unsigned int)
|
||||
SWIG_STD_VECTOR_ENHANCED(long)
|
||||
SWIG_STD_VECTOR_ENHANCED(unsigned long)
|
||||
SWIG_STD_VECTOR_ENHANCED(long long)
|
||||
SWIG_STD_VECTOR_ENHANCED(unsigned long long)
|
||||
SWIG_STD_VECTOR_ENHANCED(float)
|
||||
SWIG_STD_VECTOR_ENHANCED(double)
|
||||
SWIG_STD_VECTOR_ENHANCED(std::string) // also requires a %include <std_string.i>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue