summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/libsample/CMakeLists.txt2
-rw-r--r--tests/libsample/abstract.h4
-rw-r--r--tests/libsample/collector.h7
-rw-r--r--tests/libsample/complex.h4
-rw-r--r--tests/libsample/derived.h5
-rw-r--r--tests/libsample/echo.h4
-rw-r--r--tests/libsample/functions.h33
-rw-r--r--tests/libsample/implicitconv.h4
-rw-r--r--tests/libsample/injectcode.h3
-rw-r--r--tests/libsample/kindergarten.h3
-rw-r--r--tests/libsample/libsamplemacros.h52
-rw-r--r--tests/libsample/listuser.h4
-rw-r--r--tests/libsample/mapuser.h4
-rw-r--r--tests/libsample/modifications.h5
-rw-r--r--tests/libsample/multiple_derived.h8
-rw-r--r--tests/libsample/nondefaultctor.h4
-rw-r--r--tests/libsample/objecttype.h6
-rw-r--r--tests/libsample/oddbool.h6
-rw-r--r--tests/libsample/overload.h4
-rw-r--r--tests/libsample/pairuser.h4
-rw-r--r--tests/libsample/point.h34
-rw-r--r--tests/libsample/reference.h4
-rw-r--r--tests/libsample/samplenamespace.h14
-rw-r--r--tests/libsample/simplefile.h3
-rw-r--r--tests/libsample/size.h4
-rw-r--r--tests/libsample/sometime.h3
-rw-r--r--tests/libsample/str.h8
-rw-r--r--tests/libsample/virtualmethods.h4
28 files changed, 168 insertions, 72 deletions
diff --git a/tests/libsample/CMakeLists.txt b/tests/libsample/CMakeLists.txt
index 5633a4c8..534931aa 100644
--- a/tests/libsample/CMakeLists.txt
+++ b/tests/libsample/CMakeLists.txt
@@ -27,8 +27,8 @@ str.cpp
virtualmethods.cpp
)
-add_definitions("-fvisibility=default")
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+add_definitions("-DLIBSAMPLE_BUILD")
add_library(libsample SHARED ${libsample_SRC})
set_property(TARGET libsample PROPERTY PREFIX "")
diff --git a/tests/libsample/abstract.h b/tests/libsample/abstract.h
index 27c13268..63ac5944 100644
--- a/tests/libsample/abstract.h
+++ b/tests/libsample/abstract.h
@@ -35,7 +35,9 @@
#ifndef ABSTRACT_H
#define ABSTRACT_H
-class Abstract
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Abstract
{
public:
enum PrintFormat {
diff --git a/tests/libsample/collector.h b/tests/libsample/collector.h
index 1b47c5b8..68d7f536 100644
--- a/tests/libsample/collector.h
+++ b/tests/libsample/collector.h
@@ -36,8 +36,9 @@
#define COLLECTOR_H
#include <list>
+#include "libsamplemacros.h"
-class Collector
+class LIBSAMPLE_API Collector
{
public:
Collector() {}
@@ -59,7 +60,7 @@ private:
};
/* Helper for testing external operators */
-class IntWrapper
+class LIBSAMPLE_API IntWrapper
{
public:
IntWrapper(int x=0):value(x){}
@@ -67,7 +68,7 @@ public:
int value;
};
-Collector &operator<<(Collector&, const IntWrapper&);
+LIBSAMPLE_API Collector &operator<<(Collector&, const IntWrapper&);
#endif // COLLECTOR_H
diff --git a/tests/libsample/complex.h b/tests/libsample/complex.h
index 6ef0ebc5..9ee2a4ee 100644
--- a/tests/libsample/complex.h
+++ b/tests/libsample/complex.h
@@ -35,7 +35,9 @@
#ifndef COMPLEX_H
#define COMPLEX_H
-class Complex
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Complex
{
public:
Complex(double real = 0.0, double imag = 0.0);
diff --git a/tests/libsample/derived.h b/tests/libsample/derived.h
index e12042f9..9e0e33a8 100644
--- a/tests/libsample/derived.h
+++ b/tests/libsample/derived.h
@@ -35,14 +35,15 @@
#ifndef DERIVED_H
#define DERIVED_H
+#include "libsamplemacros.h"
#include "abstract.h"
-enum OverloadedFuncEnum {
+enum LIBSAMPLE_API OverloadedFuncEnum {
OverloadedFunc_ii,
OverloadedFunc_d
};
-class Derived : public Abstract
+class LIBSAMPLE_API Derived : public Abstract
{
public:
enum OtherOverloadedFuncEnum {
diff --git a/tests/libsample/echo.h b/tests/libsample/echo.h
index fcb6e67c..962e1949 100644
--- a/tests/libsample/echo.h
+++ b/tests/libsample/echo.h
@@ -35,7 +35,9 @@
#ifndef ECHO_H
#define ECHO_H
-class Echo
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Echo
{
public:
Echo(){}
diff --git a/tests/libsample/functions.h b/tests/libsample/functions.h
index 81d87298..f6cf81b1 100644
--- a/tests/libsample/functions.h
+++ b/tests/libsample/functions.h
@@ -35,41 +35,42 @@
#ifndef FUNCTIONS_H
#define FUNCTIONS_H
+#include "libsamplemacros.h"
#include <list>
#include <utility>
#include "complex.h"
#include "objecttype.h"
-enum GlobalEnum {
+enum LIBSAMPLE_API GlobalEnum {
NoThing,
FirstThing,
SecondThing,
ThirdThing
};
-enum GlobalOverloadFuncEnum {
+enum LIBSAMPLE_API GlobalOverloadFuncEnum {
GlobalOverloadFunc_i,
GlobalOverloadFunc_d
};
-void printSomething();
-int gimmeInt();
-double gimmeDouble();
-double multiplyPair(std::pair<double, double> pair);
-std::list<Complex> gimmeComplexList();
-Complex sumComplexPair(std::pair<Complex, Complex> cpx_pair);
+LIBSAMPLE_API void printSomething();
+LIBSAMPLE_API int gimmeInt();
+LIBSAMPLE_API double gimmeDouble();
+LIBSAMPLE_API double multiplyPair(std::pair<double, double> pair);
+LIBSAMPLE_API std::list<Complex> gimmeComplexList();
+LIBSAMPLE_API Complex sumComplexPair(std::pair<Complex, Complex> cpx_pair);
-int countCharacters(const char* text);
-char* makeCString();
-const char* returnCString();
+LIBSAMPLE_API int countCharacters(const char* text);
+LIBSAMPLE_API char* makeCString();
+LIBSAMPLE_API const char* returnCString();
-char* returnNullPrimitivePointer();
-ObjectType* returnNullObjectTypePointer();
-Event* returnNullValueTypePointer();
+LIBSAMPLE_API char* returnNullPrimitivePointer();
+LIBSAMPLE_API ObjectType* returnNullObjectTypePointer();
+LIBSAMPLE_API Event* returnNullValueTypePointer();
// Tests overloading on functions (!methods)
-GlobalOverloadFuncEnum overloadedFunc(int val);
-GlobalOverloadFuncEnum overloadedFunc(double val);
+LIBSAMPLE_API GlobalOverloadFuncEnum overloadedFunc(int val);
+LIBSAMPLE_API GlobalOverloadFuncEnum overloadedFunc(double val);
#endif // FUNCTIONS_H
diff --git a/tests/libsample/implicitconv.h b/tests/libsample/implicitconv.h
index 7d537fb1..36c78b9c 100644
--- a/tests/libsample/implicitconv.h
+++ b/tests/libsample/implicitconv.h
@@ -35,7 +35,9 @@
#ifndef IMPLICITCONV_H
#define IMPLICITCONV_H
-class ImplicitConv
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API ImplicitConv
{
public:
enum CtorEnum {
diff --git a/tests/libsample/injectcode.h b/tests/libsample/injectcode.h
index 52d41719..73c4f37e 100644
--- a/tests/libsample/injectcode.h
+++ b/tests/libsample/injectcode.h
@@ -35,10 +35,11 @@
#ifndef INJECTCODE_H
#define INJECTCODE_H
+#include "libsamplemacros.h"
#include <utility>
#include <string>
-class InjectCode
+class LIBSAMPLE_API InjectCode
{
public:
InjectCode();
diff --git a/tests/libsample/kindergarten.h b/tests/libsample/kindergarten.h
index e074b7e1..e01eb150 100644
--- a/tests/libsample/kindergarten.h
+++ b/tests/libsample/kindergarten.h
@@ -35,10 +35,11 @@
#ifndef KINDERGARTEN_H
#define KINDERGARTEN_H
+#include "libsamplemacros.h"
#include <list>
#include "objecttype.h"
-class KinderGarten
+class LIBSAMPLE_API KinderGarten
{
public:
typedef std::list<ObjectType*> ChildList;
diff --git a/tests/libsample/libsamplemacros.h b/tests/libsample/libsamplemacros.h
new file mode 100644
index 00000000..4a845ab7
--- /dev/null
+++ b/tests/libsample/libsamplemacros.h
@@ -0,0 +1,52 @@
+/*
+* This file is part of the Shiboken Python Bindings Generator project.
+*
+* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+*
+* Contact: PySide team <contact@pyside.org>
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public License
+* version 2.1 as published by the Free Software Foundation. Please
+* review the following information to ensure the GNU Lesser General
+* Public License version 2.1 requirements will be met:
+* http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+*
+* As a special exception to the GNU Lesser General Public License
+* version 2.1, the object code form of a "work that uses the Library"
+* may incorporate material from a header file that is part of the
+* Library. You may distribute such object code under terms of your
+* choice, provided that the incorporated material (i) does not exceed
+* more than 5% of the total size of the Library; and (ii) is limited to
+* numerical parameters, data structure layouts, accessors, macros,
+* inline functions and templates.
+*
+* This program 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 program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA
+*/
+
+#ifndef LIBSAMPLEMACROS_H
+#define LIBSAMPLEMACROS_H
+
+#if defined _WIN32 || defined __CYGWIN__
+ #if LIBSAMPLE_BUILD
+ #define LIBSAMPLE_API __declspec(dllexport)
+ #else
+ #define LIBSAMPLE_API __declspec(dllimport)
+ #endif
+#else
+#if __GNUC__ >= 4
+ #define LIBSAMPLE_API __attribute__ ((visibility("default")))
+#else
+ #define LIBSAMPLE_API
+#endif
+#endif
+
+#endif
diff --git a/tests/libsample/listuser.h b/tests/libsample/listuser.h
index b57ce76b..52dea8bd 100644
--- a/tests/libsample/listuser.h
+++ b/tests/libsample/listuser.h
@@ -39,7 +39,9 @@
#include "complex.h"
#include "point.h"
-class ListUser
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API ListUser
{
public:
typedef std::list<Point*> PointList;
diff --git a/tests/libsample/mapuser.h b/tests/libsample/mapuser.h
index 8165ec98..743a7e53 100644
--- a/tests/libsample/mapuser.h
+++ b/tests/libsample/mapuser.h
@@ -40,7 +40,9 @@
#include <utility>
#include "complex.h"
-class MapUser
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API MapUser
{
public:
MapUser() {}
diff --git a/tests/libsample/modifications.h b/tests/libsample/modifications.h
index 5061c120..2014b7ec 100644
--- a/tests/libsample/modifications.h
+++ b/tests/libsample/modifications.h
@@ -35,10 +35,11 @@
#ifndef MODIFICATIONS_H
#define MODIFICATIONS_H
+#include "libsamplemacros.h"
#include <utility>
#include "point.h"
-class Modifications
+class LIBSAMPLE_API Modifications
{
public:
Modifications() {}
@@ -106,7 +107,7 @@ public:
virtual const char* className();
};
-class AbstractModifications : public Modifications
+class LIBSAMPLE_API AbstractModifications : public Modifications
{
public:
AbstractModifications() {}
diff --git a/tests/libsample/multiple_derived.h b/tests/libsample/multiple_derived.h
index 531cdb28..5ddfd112 100644
--- a/tests/libsample/multiple_derived.h
+++ b/tests/libsample/multiple_derived.h
@@ -35,21 +35,23 @@
#ifndef MDERIVED_H
#define MDERIVED_H
-class MBase1
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API MBase1
{
public:
~MBase1() {}
virtual const char* name() { return "MBase"; }
};
-class MBase2
+class LIBSAMPLE_API MBase2
{
public:
~MBase2() {}
virtual const char* funcName() { return "MBase2.funcName"; }
};
-class MDerived : public MBase1, public MBase2
+class LIBSAMPLE_API MDerived : public MBase1, public MBase2
{
public:
MDerived();
diff --git a/tests/libsample/nondefaultctor.h b/tests/libsample/nondefaultctor.h
index 7f0e0942..9a0a98f7 100644
--- a/tests/libsample/nondefaultctor.h
+++ b/tests/libsample/nondefaultctor.h
@@ -35,7 +35,9 @@
#ifndef NONDEFAULTCTOR_H
#define NONDEFAULTCTOR_H
-class NonDefaultCtor
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API NonDefaultCtor
{
int m_value;
public:
diff --git a/tests/libsample/objecttype.h b/tests/libsample/objecttype.h
index f75bbeb3..eac12fd7 100644
--- a/tests/libsample/objecttype.h
+++ b/tests/libsample/objecttype.h
@@ -38,7 +38,9 @@
#include <list>
#include "str.h"
-struct Event
+#include "libsamplemacros.h"
+
+struct LIBSAMPLE_API Event
{
enum EventType {
NO_EVENT,
@@ -52,7 +54,7 @@ private:
EventType m_eventType;
};
-class ObjectType
+class LIBSAMPLE_API ObjectType
{
public:
typedef std::list<ObjectType*> ObjectTypeList;
diff --git a/tests/libsample/oddbool.h b/tests/libsample/oddbool.h
index fb7d9ff2..0d256576 100644
--- a/tests/libsample/oddbool.h
+++ b/tests/libsample/oddbool.h
@@ -35,7 +35,9 @@
#ifndef ODDBOOL_H
#define ODDBOOL_H
-class OddBool
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API OddBool
{
public:
@@ -55,7 +57,7 @@ inline bool operator!=(OddBool b1, bool b2) { return !b1 != !b2; }
inline bool operator!=(bool b1, OddBool b2) { return !b1 != !b2; }
inline bool operator!=(OddBool b1, OddBool b2) { return !b1 != !b2; }
-class OddBoolUser
+class LIBSAMPLE_API OddBoolUser
{
public:
OddBoolUser() : m_oddbool(OddBool(false)) {};
diff --git a/tests/libsample/overload.h b/tests/libsample/overload.h
index 51fbae71..370fe468 100644
--- a/tests/libsample/overload.h
+++ b/tests/libsample/overload.h
@@ -38,7 +38,9 @@
#include "size.h"
#include "point.h"
-class Overload
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Overload
{
public:
enum FunctionEnum {
diff --git a/tests/libsample/pairuser.h b/tests/libsample/pairuser.h
index 162d7753..b3b95846 100644
--- a/tests/libsample/pairuser.h
+++ b/tests/libsample/pairuser.h
@@ -38,7 +38,9 @@
#include <utility>
#include "complex.h"
-class PairUser
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API PairUser
{
public:
PairUser() {}
diff --git a/tests/libsample/point.h b/tests/libsample/point.h
index 01570cff..a8175039 100644
--- a/tests/libsample/point.h
+++ b/tests/libsample/point.h
@@ -38,7 +38,9 @@
#include "complex.h"
#include <utility>
-class Point
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Point
{
public:
Point(int x = 0, int y = 0);
@@ -63,12 +65,12 @@ public:
Point operator+(const Point& other);
Point operator-(const Point& other);
- friend Point operator*(const Point& pt, double mult);
- friend Point operator*(const Point& pt, int mult);
- friend Point operator*(double mult, const Point& pt);
- friend Point operator*(int mult, const Point& pt);
- friend Point operator-(const Point& pt);
- friend bool operator!(const Point& pt);
+ friend LIBSAMPLE_API Point operator*(const Point& pt, double mult);
+ friend LIBSAMPLE_API Point operator*(const Point& pt, int mult);
+ friend LIBSAMPLE_API Point operator*(double mult, const Point& pt);
+ friend LIBSAMPLE_API Point operator*(int mult, const Point& pt);
+ friend LIBSAMPLE_API Point operator-(const Point& pt);
+ friend LIBSAMPLE_API bool operator!(const Point& pt);
Point& operator+=(Point &other);
Point& operator-=(Point &other);
@@ -80,17 +82,17 @@ private:
double m_y;
};
-Point operator*(const Point& pt, double mult);
-Point operator*(const Point& pt, int mult);
-Point operator*(double mult, const Point& pt);
-Point operator*(int mult, const Point& pt);
-Point operator-(const Point& pt);
-bool operator!(const Point& pt);
+LIBSAMPLE_API Point operator*(const Point& pt, double mult);
+LIBSAMPLE_API Point operator*(const Point& pt, int mult);
+LIBSAMPLE_API Point operator*(double mult, const Point& pt);
+LIBSAMPLE_API Point operator*(int mult, const Point& pt);
+LIBSAMPLE_API Point operator-(const Point& pt);
+LIBSAMPLE_API bool operator!(const Point& pt);
-Complex transmutePointIntoComplex(const Point& point);
-Point transmuteComplexIntoPoint(const Complex& cpx);
+LIBSAMPLE_API Complex transmutePointIntoComplex(const Point& point);
+LIBSAMPLE_API Point transmuteComplexIntoPoint(const Complex& cpx);
-Point operator*(const Point& pt, double multiplier);
+LIBSAMPLE_API Point operator*(const Point& pt, double multiplier);
#endif // POINT_H
diff --git a/tests/libsample/reference.h b/tests/libsample/reference.h
index 1da27cc9..5c9e8c99 100644
--- a/tests/libsample/reference.h
+++ b/tests/libsample/reference.h
@@ -35,7 +35,9 @@
#ifndef REFERENCE_H
#define REFERENCE_H
-class Reference
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Reference
{
public:
explicit Reference(int objId = -1)
diff --git a/tests/libsample/samplenamespace.h b/tests/libsample/samplenamespace.h
index 420b7a77..5d58ac27 100644
--- a/tests/libsample/samplenamespace.h
+++ b/tests/libsample/samplenamespace.h
@@ -35,32 +35,34 @@
#ifndef SAMPLENAMESPACE_H
#define SAMPLENAMESPACE_H
+#include "libsamplemacros.h"
+
namespace SampleNamespace
{
-enum Option {
+enum LIBSAMPLE_API Option {
None,
RandomNumber,
UnixTime
};
-enum InValue {
+enum LIBSAMPLE_API InValue {
ZeroIn,
OneIn,
TwoIn
};
-enum OutValue {
+enum LIBSAMPLE_API OutValue {
ZeroOut,
OneOut,
TwoOut
};
-OutValue enumInEnumOut(InValue in);
+LIBSAMPLE_API OutValue enumInEnumOut(InValue in);
-int getNumber(Option opt);
+LIBSAMPLE_API int getNumber(Option opt);
-inline double powerOfTwo(double num) {
+LIBSAMPLE_API inline double powerOfTwo(double num) {
return num * num;
}
diff --git a/tests/libsample/simplefile.h b/tests/libsample/simplefile.h
index 18114466..aad82c21 100644
--- a/tests/libsample/simplefile.h
+++ b/tests/libsample/simplefile.h
@@ -35,9 +35,10 @@
#ifndef SIMPLEFILE_H
#define SIMPLEFILE_H
+#include "libsamplemacros.h"
#include <stdio.h>
-class SimpleFile
+class LIBSAMPLE_API SimpleFile
{
public:
explicit SimpleFile(const char* filename)
diff --git a/tests/libsample/size.h b/tests/libsample/size.h
index 504d711c..cc9da4f2 100644
--- a/tests/libsample/size.h
+++ b/tests/libsample/size.h
@@ -35,7 +35,9 @@
#ifndef SIZE_H
#define SIZE_H
-class Size
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Size
{
public:
Size(double width = 0.0, double height = 0.0) : m_width(width), m_height(height) {}
diff --git a/tests/libsample/sometime.h b/tests/libsample/sometime.h
index 12fd4e09..1db8af86 100644
--- a/tests/libsample/sometime.h
+++ b/tests/libsample/sometime.h
@@ -35,11 +35,12 @@
#ifndef SOMETIME_H
#define SOMETIME_H
+#include "libsamplemacros.h"
#include "str.h"
#include "implicitconv.h"
#include "objecttype.h"
-class Time
+class LIBSAMPLE_API Time
{
public:
enum NumArgs {
diff --git a/tests/libsample/str.h b/tests/libsample/str.h
index 31266753..52f46e6b 100644
--- a/tests/libsample/str.h
+++ b/tests/libsample/str.h
@@ -36,7 +36,9 @@
#define STR_H
#include <string>
-class Str
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API Str
{
public:
Str(const Str& s);
@@ -64,10 +66,10 @@ private:
void init(const char* cstr);
std::string m_str;
- friend Str operator+(int number, const Str& str);
+ friend LIBSAMPLE_API Str operator+(int number, const Str& str);
};
-Str operator+(int number, const Str& str);
+LIBSAMPLE_API Str operator+(int number, const Str& str);
#endif // STR_H
diff --git a/tests/libsample/virtualmethods.h b/tests/libsample/virtualmethods.h
index 8bd4b93f..45d8ae71 100644
--- a/tests/libsample/virtualmethods.h
+++ b/tests/libsample/virtualmethods.h
@@ -39,7 +39,9 @@
#include "complex.h"
#include "str.h"
-class VirtualMethods
+#include "libsamplemacros.h"
+
+class LIBSAMPLE_API VirtualMethods
{
public:
VirtualMethods() {}