aboutsummaryrefslogtreecommitdiffstats
path: root/tests/libminimal
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2011-05-16 12:57:58 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:15:23 -0300
commit973a5389ac0f2a5d899025843b9af9e587eff7d3 (patch)
tree7c2988fd044ef091c56d92683a15f145ce99cd0e /tests/libminimal
parent510e7af9a0e9a8b8c0b90ad76453d9ccdf55aedb (diff)
Added a new test binding called 'minimal'.
The purpose is to have the smallest possible binding to help when doing complex changes that require a good deal of debugging and tracking, and the many operations performed in too many wrapped classes will clutter any output used for those purposes. In other words: don't add anything here except with a good reason for it, prefer to use 'sample' or 'other' binding for that. Reviewed by Hugo Parente <hugo.lima@openbossa.org> Reviewed by Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests/libminimal')
-rw-r--r--tests/libminimal/CMakeLists.txt11
-rw-r--r--tests/libminimal/libminimalmacros.h40
-rw-r--r--tests/libminimal/obj.cpp38
-rw-r--r--tests/libminimal/obj.h46
-rw-r--r--tests/libminimal/val.h39
5 files changed, 174 insertions, 0 deletions
diff --git a/tests/libminimal/CMakeLists.txt b/tests/libminimal/CMakeLists.txt
new file mode 100644
index 000000000..7fa87dc39
--- /dev/null
+++ b/tests/libminimal/CMakeLists.txt
@@ -0,0 +1,11 @@
+project(libminimal)
+
+set(libminimal_SRC
+obj.cpp
+)
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+add_definitions("-DLIBMINIMAL_BUILD")
+add_library(libminimal SHARED ${libminimal_SRC})
+set_property(TARGET libminimal PROPERTY PREFIX "")
+
diff --git a/tests/libminimal/libminimalmacros.h b/tests/libminimal/libminimalmacros.h
new file mode 100644
index 000000000..7996035ec
--- /dev/null
+++ b/tests/libminimal/libminimalmacros.h
@@ -0,0 +1,40 @@
+/*
+* This file is part of the Shiboken Python Bindings Generator project.
+*
+* Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+*
+* Contact: PySide team <contact@pyside.org>
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef LIBMINIMALMACROS_H
+#define LIBMINIMALMACROS_H
+
+#if defined _WIN32 || defined __CYGWIN__
+ #if LIBMINIMAL_BUILD
+ #define LIBMINIMAL_API __declspec(dllexport)
+ #else
+ #define LIBMINIMAL_API __declspec(dllimport)
+ #endif
+#else
+#if __GNUC__ >= 4
+ #define LIBMINIMAL_API __attribute__ ((visibility("default")))
+#else
+ #define LIBMINIMAL_API
+#endif
+#endif
+
+#endif
diff --git a/tests/libminimal/obj.cpp b/tests/libminimal/obj.cpp
new file mode 100644
index 000000000..cb115b72f
--- /dev/null
+++ b/tests/libminimal/obj.cpp
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the Shiboken Python Binding Generator project.
+ *
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: PySide team <contact@pyside.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "obj.h"
+
+Obj::Obj(int objId) : m_objId(objId)
+{
+}
+
+Obj::~Obj()
+{
+}
+
+bool
+Obj::virtualMethod(int val)
+{
+ return !bool(val%2);
+}
+
diff --git a/tests/libminimal/obj.h b/tests/libminimal/obj.h
new file mode 100644
index 000000000..384d8e74b
--- /dev/null
+++ b/tests/libminimal/obj.h
@@ -0,0 +1,46 @@
+/*
+ * This file is part of the Shiboken Python Binding Generator project.
+ *
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: PySide team <contact@pyside.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef OBJ_H
+#define OBJ_H
+
+#include "libminimalmacros.h"
+
+class LIBMINIMAL_API Obj
+{
+public:
+ explicit Obj(int objId);
+ virtual ~Obj();
+
+ int objId() { return m_objId; }
+ void setObjId(int objId) { m_objId = objId; }
+
+ virtual bool virtualMethod(int val);
+ bool callVirtualMethod(int val) { return virtualMethod(val); }
+private:
+ Obj(const Obj&);
+ Obj& operator=(const Obj&);
+ int m_objId;
+};
+
+#endif // OBJ_H
+
diff --git a/tests/libminimal/val.h b/tests/libminimal/val.h
new file mode 100644
index 000000000..3cdf64c4b
--- /dev/null
+++ b/tests/libminimal/val.h
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the Shiboken Python Binding Generator project.
+ *
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Contact: PySide team <contact@pyside.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef VAL_H
+#define VAL_H
+
+#include "libminimalmacros.h"
+
+class LIBMINIMAL_API Val
+{
+public:
+ explicit Val(int valId) : m_valId(valId) {}
+ int valId() { return m_valId; }
+ void setValId(int valId) { m_valId = valId; }
+private:
+ int m_valId;
+};
+
+#endif // VAL_H
+