aboutsummaryrefslogtreecommitdiffstats
path: root/tests/samplebinding/pair_conversions.h
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2009-12-07 17:58:29 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-12-07 17:58:29 -0300
commitcd830d9435ab10c7961bc4d73644c9532495ce80 (patch)
tree4e428c2d7865c8d950aae9f332c6676c27e61c2a /tests/samplebinding/pair_conversions.h
parent16ff7b614c9caf8837f72e7143984b252b71f63e (diff)
Moved container converters from test library to libshiboken's converter header.
The implementation of converters for pair, list and map containers was moved from libsample test binding to libshiboken/conversions.h. The implementation must be used with types similar to the C++ STL containers of the same name.
Diffstat (limited to 'tests/samplebinding/pair_conversions.h')
-rw-r--r--tests/samplebinding/pair_conversions.h27
1 files changed, 0 insertions, 27 deletions
diff --git a/tests/samplebinding/pair_conversions.h b/tests/samplebinding/pair_conversions.h
index aae68d061..e7e26f098 100644
--- a/tests/samplebinding/pair_conversions.h
+++ b/tests/samplebinding/pair_conversions.h
@@ -1,29 +1,2 @@
-template <typename StdPair>
-struct Converter_std_pair
-{
- static bool isConvertible(const PyObject* pyObj)
- {
- return PySequence_Check(const_cast<PyObject*>(pyObj));
- }
- static PyObject* toPython(StdPair holder)
- {
- typename StdPair::first_type first(holder.first);
- typename StdPair::second_type second(holder.second);
- PyObject* tuple = PyTuple_New(2);
- PyTuple_SET_ITEM(tuple, 0, Converter<typename StdPair::first_type>::toPython(first));
- PyTuple_SET_ITEM(tuple, 1, Converter<typename StdPair::second_type>::toPython(second));
- return tuple;
- }
- static StdPair toCpp(PyObject* pyobj)
- {
- StdPair result;
- PyObject* pyFirst = PySequence_GetItem(pyobj, 0);
- PyObject* pySecond = PySequence_GetItem(pyobj, 1);
- result.first = Converter<typename StdPair::first_type>::toCpp(pyFirst);
- result.second = Converter<typename StdPair::second_type>::toCpp(pySecond);
- return result;
- }
-};
-
template<typename FT, typename ST>
struct Converter<std::pair<FT, ST> > : Converter_std_pair<std::pair<FT, ST> > {};