diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-11-03 05:21:04 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2009-11-03 05:21:04 -0300 |
commit | 048498d28bf7a0451bfc490b9f1799d3d3751b40 (patch) | |
tree | 90102429b533478bda47213c8ad5b8d531d6204d /tests/libsample/listuser.cpp | |
parent | 22ae136011c64b3da8f272e6f55574413064efae (diff) |
* added the ObjectType example which adds some cases similar to
those on Qt's QObject (object name, parent and children list),
although no ownership test was added yet.
* added method Abstract::getObjectId(Abstract*) as a case of
an argument that should be converted to an abstract type.
* added ListUser::multiplyPointList(std::list<Point*>&, double),
which tests the conversion from a Python list of Point wrappers
to a C++ list whose items will be altered.
Diffstat (limited to 'tests/libsample/listuser.cpp')
-rw-r--r-- | tests/libsample/listuser.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/libsample/listuser.cpp b/tests/libsample/listuser.cpp index 3312e4110..8dc76f8ae 100644 --- a/tests/libsample/listuser.cpp +++ b/tests/libsample/listuser.cpp @@ -32,7 +32,6 @@ * 02110-1301 USA */ -#include <iostream> #include <numeric> #include <cstdlib> #include "listuser.h" @@ -42,14 +41,12 @@ using namespace std; std::list<int> ListUser::callCreateList() { - //cout << __PRETTY_FUNCTION__ << endl; return createList(); } std::list<int> ListUser::createList() { - //cout << __PRETTY_FUNCTION__ << endl; std::list<int> retval; for (int i = 0; i < 4; i++) retval.push_front(rand()); @@ -59,7 +56,6 @@ ListUser::createList() std::list<Complex> ListUser::createComplexList(Complex cpx0, Complex cpx1) { - //cout << __PRETTY_FUNCTION__ << endl; std::list<Complex> retval; retval.push_back(cpx0); retval.push_back(cpx1); @@ -78,3 +74,12 @@ ListUser::sumList(std::list<double> vallist) return std::accumulate(vallist.begin(), vallist.end(), 0.0); } +void +ListUser::multiplyPointList(PointList& points, double multiplier) +{ + for(PointList::iterator piter = points.begin(); piter != points.end(); piter++) { + (*piter)->setX((*piter)->x() * multiplier); + (*piter)->setY((*piter)->y() * multiplier); + } +} + |