aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2009-12-04 04:33:58 +0000
committerOlly Betts <olly@survex.com>2009-12-04 04:33:58 +0000
commit0633acd24f607a57d2dce65c9a5596df36ad9308 (patch)
treebe8f5f84622f0ffb3209d8aadbe3cdf5f87dc1c2
parent8461ba43ffb3b0bd7d6aa2a6cab68ce6b1cff5aa (diff)
downloadswig-0633acd24f607a57d2dce65c9a5596df36ad9308.tar.gz
[PHP] "empty" is a reserved word in PHP, so rename empty() method
on STL classes to "is_empty()" (previously this was automatically renamed to "c_empty()"). *** POTENTIAL INCOMPATIBILITY *** git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11772 626c5289-ae23-0410-ae9c-e8d60b6d4f22
-rw-r--r--CHANGES.current6
-rw-r--r--Lib/php/std_map.i20
-rw-r--r--Lib/std/_std_deque.i23
3 files changed, 34 insertions, 15 deletions
diff --git a/CHANGES.current b/CHANGES.current
index 1c39df098..26c135d9a 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -1,6 +1,12 @@
Version 1.3.41 (in progress)
============================
+2009-12-04: olly
+ [PHP] "empty" is a reserved word in PHP, so rename empty() method
+ on STL classes to "is_empty()" (previously this was automatically
+ renamed to "c_empty()").
+ *** POTENTIAL INCOMPATIBILITY ***
+
2009-12-03: olly
[PHP] Add typemaps for long long and unsigned long long, and for
pointer to method.
diff --git a/Lib/php/std_map.i b/Lib/php/std_map.i
index c6721806b..2c9e1fd9a 100644
--- a/Lib/php/std_map.i
+++ b/Lib/php/std_map.i
@@ -30,8 +30,6 @@ namespace std {
map(const map<K,T> &);
unsigned int size() const;
- %rename(is_empty) empty;
- bool empty() const;
void clear();
%extend {
T& get(const K& key) throw (std::out_of_range) {
@@ -55,6 +53,9 @@ namespace std {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
+ bool is_empty() const {
+ return self->empty();
+ }
}
};
@@ -70,8 +71,6 @@ namespace std {
map(const map<K,T> &);
unsigned int size() const;
- %rename(is_empty) empty;
- bool empty() const;
void clear();
%extend {
T& get(K key) throw (std::out_of_range) {
@@ -95,6 +94,9 @@ namespace std {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
+ bool is_empty() const {
+ return self->empty();
+ }
}
};
%enddef
@@ -107,8 +109,6 @@ namespace std {
map(const map<K,T> &);
unsigned int size() const;
- %rename(is_empty) empty;
- bool empty() const;
void clear();
%extend {
T get(const K& key) throw (std::out_of_range) {
@@ -132,6 +132,9 @@ namespace std {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
+ bool is_empty() const {
+ return self->empty();
+ }
}
};
%enddef
@@ -145,8 +148,6 @@ namespace std {
map(const map<K,T> &);
unsigned int size() const;
- %rename(is_empty) empty;
- bool empty() const;
void clear();
%extend {
T get(K key) throw (std::out_of_range) {
@@ -170,6 +171,9 @@ namespace std {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
+ bool is_empty() const {
+ return self->empty();
+ }
}
};
%enddef
diff --git a/Lib/std/_std_deque.i b/Lib/std/_std_deque.i
index 026f373d6..9b2908cec 100644
--- a/Lib/std/_std_deque.i
+++ b/Lib/std/_std_deque.i
@@ -27,7 +27,7 @@
};
*/
-%define %std_deque_methods(T)
+%define %std_deque_methods_noempty(T)
typedef T &reference;
typedef const T& const_reference;
@@ -41,7 +41,6 @@
unsigned int size() const;
unsigned int max_size() const;
void resize(unsigned int n, T c = T());
- bool empty() const;
const_reference front();
const_reference back();
void push_front(const T& x);
@@ -69,7 +68,7 @@
throw std::out_of_range("deque index out of range");
}
void delitem(int i) throw (std::out_of_range) {
- int size = int(self->size());
+ int size = int(self->size());
if (i<0) i+= size;
if (i>=0 && i<size) {
self->erase(self->begin()+i);
@@ -77,7 +76,7 @@
throw std::out_of_range("deque index out of range");
}
}
- std::deque<T> getslice(int i, int j) {
+ std::deque<T> getslice(int i, int j) {
int size = int(self->size());
if (i<0) i = size+i;
if (j<0) j = size+j;
@@ -112,8 +111,21 @@
self->erase(self->begin()+i,self->begin()+j);
}
};
+%enddef
+#ifdef SWIGPHP
+%define %std_deque_methods(T)
+ %extend {
+ bool is_empty() const {
+ return self->empty();
+ }
+ };
+%enddef
+#else
+%define %std_deque_methods(T)
+ bool empty() const;
%enddef
+#endif
namespace std {
template<class T> class deque {
@@ -121,6 +133,3 @@ namespace std {
%std_deque_methods(T);
};
}
-
-
-