summaryrefslogtreecommitdiffstats
path: root/tests/libsample/list.h
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-10-18 16:59:55 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2011-12-09 20:28:07 -0300
commit3a89431b24352c28fc62b669a0b153498b9e254d (patch)
tree49a060b7cae6124bb0838d32656b53ac8119852c /tests/libsample/list.h
parent0f162af40a414ed4ffcca4123d572d1a8a3e4280 (diff)
downloadshiboken-3a89431b24352c28fc62b669a0b153498b9e254d.tar.gz
shiboken-3a89431b24352c28fc62b669a0b153498b9e254d.tar.xz
shiboken-3a89431b24352c28fc62b669a0b153498b9e254d.zip
Updates std::list methods writer to use the new converters.
Also added a couple of related unit tests.
Diffstat (limited to 'tests/libsample/list.h')
-rw-r--r--tests/libsample/list.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/libsample/list.h b/tests/libsample/list.h
index 9eb03452..6b8d14ce 100644
--- a/tests/libsample/list.h
+++ b/tests/libsample/list.h
@@ -25,6 +25,9 @@
#include <list>
#include "libsamplemacros.h"
+#include "point.h"
+
+class ObjectType;
template<class T>
class List : public std::list<T>
@@ -52,4 +55,46 @@ private:
CtorEnum m_ctorUsed;
};
+class PointValueList : public List<Point>
+{
+public:
+ enum CtorEnum {
+ NoParamsCtor,
+ PointCtor,
+ CopyCtor,
+ ListOfPointValuesCtor
+ };
+
+ inline PointValueList() : m_ctorUsed(NoParamsCtor) {}
+ inline explicit PointValueList(Point val) : m_ctorUsed(PointCtor) { push_back(val); }
+ inline PointValueList(const PointValueList& lst) : List<Point>(lst), m_ctorUsed(CopyCtor) {}
+ inline PointValueList(const List<Point>& lst) : List<Point>(lst), m_ctorUsed(ListOfPointValuesCtor) {}
+
+ inline void append(Point v) { insert(end(), v); }
+ CtorEnum constructorUsed() { return m_ctorUsed; }
+private:
+ CtorEnum m_ctorUsed;
+};
+
+class ObjectTypePtrList : public List<ObjectType*>
+{
+public:
+ enum CtorEnum {
+ NoParamsCtor,
+ ObjectTypeCtor,
+ CopyCtor,
+ ListOfObjectTypePtrCtor
+ };
+
+ inline ObjectTypePtrList() : m_ctorUsed(NoParamsCtor) {}
+ inline explicit ObjectTypePtrList(ObjectType* val) : m_ctorUsed(ObjectTypeCtor) { push_back(val); }
+ inline ObjectTypePtrList(const ObjectTypePtrList& lst) : List<ObjectType*>(lst), m_ctorUsed(CopyCtor) {}
+ inline ObjectTypePtrList(const List<ObjectType*>& lst) : List<ObjectType*>(lst), m_ctorUsed(ListOfObjectTypePtrCtor) {}
+
+ inline void append(ObjectType* v) { insert(end(), v); }
+ CtorEnum constructorUsed() { return m_ctorUsed; }
+private:
+ CtorEnum m_ctorUsed;
+};
+
#endif // LIST_H