aboutsummaryrefslogtreecommitdiffstats
path: root/tests/libsample
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-10-18 16:59:55 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:18:30 -0300
commit01acb23113d4a22eae474bcb9be30e4d661b505e (patch)
treed57b0b8d79349725de1a49387156234d947176b3 /tests/libsample
parent7dc999dab8eccfbee983206d70f7925fb1f629df (diff)
Updates std::list methods writer to use the new converters.
Also added a couple of related unit tests.
Diffstat (limited to 'tests/libsample')
-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 9eb03452f..6b8d14ce3 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