aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLuciano Wolf <luciano.wolf@openbossa.org>2009-11-26 19:39:51 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-11-27 16:02:17 -0300
commit82d9090fa5d60fbe29caea2f0097e9ed6d649de3 (patch)
tree3d792d8a76ff149cb8a38308044a01ccd2929f66 /tests
parentacad8ceeef196c725eeabe7cf2a042a91eecbee3 (diff)
Renaming -> KinderGarten to BlackBox
Diffstat (limited to 'tests')
-rw-r--r--tests/libsample/CMakeLists.txt2
-rw-r--r--tests/libsample/blackbox.cpp (renamed from tests/libsample/kindergarten.cpp)63
-rw-r--r--tests/libsample/blackbox.h (renamed from tests/libsample/kindergarten.h)32
-rw-r--r--tests/samplebinding/CMakeLists.txt2
-rw-r--r--tests/samplebinding/global.h2
-rw-r--r--tests/samplebinding/typesystem_sample.xml16
6 files changed, 86 insertions, 31 deletions
diff --git a/tests/libsample/CMakeLists.txt b/tests/libsample/CMakeLists.txt
index 71b8a6da3..84a3061a1 100644
--- a/tests/libsample/CMakeLists.txt
+++ b/tests/libsample/CMakeLists.txt
@@ -2,6 +2,7 @@ project(libsample)
set(libsample_SRC
abstract.cpp
+blackbox.cpp
collector.cpp
complex.cpp
derived.cpp
@@ -9,7 +10,6 @@ echo.cpp
functions.cpp
implicitconv.cpp
injectcode.cpp
-kindergarten.cpp
listuser.cpp
modifications.cpp
mapuser.cpp
diff --git a/tests/libsample/kindergarten.cpp b/tests/libsample/blackbox.cpp
index d8c908937..e29c76873 100644
--- a/tests/libsample/kindergarten.cpp
+++ b/tests/libsample/blackbox.cpp
@@ -32,35 +32,70 @@
* 02110-1301 USA
*/
-#include "kindergarten.h"
+#include "blackbox.h"
using namespace std;
-KinderGarten::~KinderGarten()
+BlackBox::~BlackBox()
{
- // Free children objects.
- while (!m_children.empty()) {
- delete m_children.back();
- m_children.pop_back();
+ // Free all lists.
+ while (!m_objects.empty()) {
+ delete m_objects.back();
+ m_objects.pop_back();
+ }
+ while (!m_points.empty()) {
+ delete m_points.back();
+ m_points.pop_back();
}
}
void
-KinderGarten::addChild(ObjectType* child)
+BlackBox::keepObjectType(ObjectType* object)
{
- m_children.push_back(child);
+ m_objects.push_back(object);
}
ObjectType*
-KinderGarten::releaseChild(ObjectType* child)
+BlackBox::retrieveObjectType(ObjectType* object)
{
- for(ChildList::iterator child_iter = m_children.begin();
- child_iter != m_children.end(); child_iter++) {
- if (child == *child_iter) {
- m_children.erase(child_iter);
- return child;
+ for(ObjectTypeList::iterator objecttype_iter = m_objects.begin();
+ objecttype_iter != m_objects.end(); objecttype_iter++) {
+ if (object == *objecttype_iter) {
+ m_objects.erase(objecttype_iter);
+ return object;
}
}
return 0;
}
+void
+BlackBox::disposeObjectType(ObjectType* object)
+{
+//TODO: implement + describe inside typesystem file.
+}
+
+void
+BlackBox::keepPoint(Point* point)
+{
+ m_points.push_back(point);
+}
+
+Point*
+BlackBox::retrievePoint(Point* point)
+{
+ for(PointList::iterator point_iter = m_points.begin();
+ point_iter != m_points.end(); point_iter++) {
+ if (point == *point_iter) {
+ m_points.erase(point_iter);
+ return point;
+ }
+ }
+ return 0;
+}
+
+void
+BlackBox::disposePoint(Point* point)
+{
+//TODO: implement + describe inside typesystem file.
+}
+
diff --git a/tests/libsample/kindergarten.h b/tests/libsample/blackbox.h
index e01eb1503..136be3008 100644
--- a/tests/libsample/kindergarten.h
+++ b/tests/libsample/blackbox.h
@@ -32,28 +32,38 @@
* 02110-1301 USA
*/
-#ifndef KINDERGARTEN_H
-#define KINDERGARTEN_H
+#ifndef BLACKBOX_H
+#define BLACKBOX_H
#include "libsamplemacros.h"
#include <list>
#include "objecttype.h"
+#include "point.h"
-class LIBSAMPLE_API KinderGarten
+class LIBSAMPLE_API BlackBox
{
public:
- typedef std::list<ObjectType*> ChildList;
+ typedef std::list<ObjectType*> ObjectTypeList;
+ typedef std::list<Point*> PointList;
- KinderGarten() {}
- ~KinderGarten();
+ BlackBox() {}
+ ~BlackBox();
- void addChild(ObjectType* child);
- ObjectType* releaseChild(ObjectType* child);
- ChildList children() { return m_children; }
+ void keepObjectType(ObjectType* object);
+ ObjectType* retrieveObjectType(ObjectType* object);
+ void disposeObjectType(ObjectType* object);
+
+ void keepPoint(Point* point);
+ Point* retrievePoint(Point* point);
+ void disposePoint(Point* point);
+
+ ObjectTypeList objects() { return m_objects; }
+ PointList points() { return m_points; }
private:
- ChildList m_children;
+ ObjectTypeList m_objects;
+ PointList m_points;
};
-#endif // KINDERGARTEN_H
+#endif // BLACKBOX_H
diff --git a/tests/samplebinding/CMakeLists.txt b/tests/samplebinding/CMakeLists.txt
index eab8da906..4529056ed 100644
--- a/tests/samplebinding/CMakeLists.txt
+++ b/tests/samplebinding/CMakeLists.txt
@@ -13,6 +13,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/sample/base3_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/base4_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/base5_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/base6_wrapper.cpp
+${CMAKE_CURRENT_BINARY_DIR}/sample/blackbox_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/collector_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/derived_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/echo_wrapper.cpp
@@ -23,7 +24,6 @@ ${CMAKE_CURRENT_BINARY_DIR}/sample/implicittarget_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/sortedoverload_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/intwrapper_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/injectcode_wrapper.cpp
-${CMAKE_CURRENT_BINARY_DIR}/sample/kindergarten_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/listuser_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/mapuser_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/sample/mderived1_wrapper.cpp
diff --git a/tests/samplebinding/global.h b/tests/samplebinding/global.h
index 806a9f979..d08f0f6f0 100644
--- a/tests/samplebinding/global.h
+++ b/tests/samplebinding/global.h
@@ -1,4 +1,5 @@
#include "abstract.h"
+#include "blackbox.h"
#include "collector.h"
#include "complex.h"
#include "derived.h"
@@ -7,7 +8,6 @@
#include "implicitconv.h"
#include "overloadsort.h"
#include "injectcode.h"
-#include "kindergarten.h"
#include "listuser.h"
#include "mapuser.h"
#include "modifications.h"
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index bd955151c..13a9a7303 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -67,13 +67,23 @@
</object-type>
<value-type name="Event"/>
- <value-type name="KinderGarten">
- <modify-function signature="addChild(ObjectType*)">
+ <value-type name="BlackBox">
+ <modify-function signature="keepObjectType(ObjectType*)">
<modify-argument index="1">
<define-ownership owner="c++"/>
</modify-argument>
</modify-function>
- <modify-function signature="releaseChild(ObjectType*)">
+ <modify-function signature="retrieveObjectType(ObjectType*)">
+ <modify-argument index="return">
+ <define-ownership owner="target"/>
+ </modify-argument>
+ </modify-function>
+ <modify-function signature="keepPoint(Point*)">
+ <modify-argument index="1">
+ <define-ownership owner="c++"/>
+ </modify-argument>
+ </modify-function>
+ <modify-function signature="retrievePoint(Point*)">
<modify-argument index="return">
<define-ownership owner="target"/>
</modify-argument>