add swig::PyItem and all the helper code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7787 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c655b7d1be
commit
04113db0e7
7 changed files with 206 additions and 6 deletions
|
|
@ -29,8 +29,8 @@ namespace std
|
|||
%template(pairiiAc) pair<int,const pair<int, A*> >;
|
||||
|
||||
|
||||
%template() pair<PyObject *, PyObject *>;
|
||||
%template(pymap) map<PyObject *, PyObject*>;
|
||||
%template() pair<swig::PyItem, swig::PyItem>;
|
||||
%template(pymap) map<swig::PyItem, swig::PyItem>;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,10 +32,17 @@ for k in m:
|
|||
|
||||
|
||||
|
||||
|
||||
m = {}
|
||||
m[1] = (1,2)
|
||||
m["foo"] = "hello"
|
||||
|
||||
pm = li_std_map.pymap()
|
||||
|
||||
pm[1] = (1,2)
|
||||
pm["foo"] = "hello"
|
||||
for k in m:
|
||||
pm[k] = m[k]
|
||||
|
||||
for k in pm:
|
||||
print pm[k]
|
||||
if (pm[k] != m[k]):
|
||||
raise RuntimeError
|
||||
|
||||
|
|
|
|||
|
|
@ -13,3 +13,5 @@
|
|||
|
||||
|
||||
|
||||
|
||||
%template(pyset) std::set<swig::PyItem>;
|
||||
|
|
|
|||
|
|
@ -82,3 +82,15 @@ if m.value() != "c":
|
|||
|
||||
|
||||
|
||||
s = pyset()
|
||||
s.insert((1,2))
|
||||
s.insert(1)
|
||||
s.insert("hello")
|
||||
|
||||
|
||||
sum = ()
|
||||
for i in s:
|
||||
sum += (i,)
|
||||
|
||||
if sum != (1, 'hello', (1, 2)):
|
||||
raise RuntimeError
|
||||
|
|
|
|||
|
|
@ -123,4 +123,4 @@ std::vector<std::string> vecStr(std::vector<std::string> v) {
|
|||
%array_functions(int,ArrInt)
|
||||
|
||||
|
||||
%template(pyvector) std::vector<PyObject*>;
|
||||
%template(pyvector) std::vector<swig::PyItem>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue