summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-01-31 14:00:05 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-01-31 14:05:11 +0100
commit7c94e01d9feff8e6c09c88a9e51c8d5a6cb61005 (patch)
treed2a7635629bdb897aaeba592a6c98dcae3450937
parent380649c1eb762f5f7a10cd15d1c5e87f36b0638c (diff)
downloadsink-7c94e01d9feff8e6c09c88a9e51c8d5a6cb61005.tar.gz
sink-7c94e01d9feff8e6c09c88a9e51c8d5a6cb61005.zip
Explicitly state visibility
This cuts the exportet symbols from 12k to 2k and the library size from 16Mb to 14Mb, which isn't great but still an improvement. About 30% of the symbols are coming from the Store:: interface. nm -C -D /work/install/lib64/libsinkcommon.so.0.1
-rw-r--r--common/CMakeLists.txt2
-rw-r--r--common/clientapi.h7
-rw-r--r--common/definitions.h5
-rw-r--r--common/domain/applicationdomaintype.h31
-rw-r--r--common/domainadaptor.h3
-rw-r--r--common/entitybuffer.h3
-rw-r--r--common/facade.h3
-rw-r--r--common/facadefactory.h3
-rw-r--r--common/index.h3
-rw-r--r--common/listener.h3
-rw-r--r--common/log.h11
-rw-r--r--common/messagequeue.h3
-rw-r--r--common/propertymapper.h9
-rw-r--r--common/resource.h2
-rw-r--r--common/resourceaccess.h5
-rw-r--r--common/resourceconfig.h3
-rw-r--r--common/threadboundary.h4
17 files changed, 59 insertions, 41 deletions
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index cb7bb35..b400993 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -25,6 +25,8 @@ install(FILES
25 COMPONENT Devel 25 COMPONENT Devel
26) 26)
27 27
28add_definitions("-fvisibility=hidden")
29
28install(EXPORT SinkCommonTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE SinkCommonTargets.cmake) 30install(EXPORT SinkCommonTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE SinkCommonTargets.cmake)
29 31
30set(storage_SRCS storage_lmdb.cpp) 32set(storage_SRCS storage_lmdb.cpp)
diff --git a/common/clientapi.h b/common/clientapi.h
index 64c4f64..bd52c3e 100644
--- a/common/clientapi.h
+++ b/common/clientapi.h
@@ -20,6 +20,7 @@
20 20
21#pragma once 21#pragma once
22 22
23#include <sinkcommon_export.h>
23#include <QString> 24#include <QString>
24#include <QSharedPointer> 25#include <QSharedPointer>
25 26
@@ -38,7 +39,7 @@ class Notification;
38/** 39/**
39 * Store interface used in the client API. 40 * Store interface used in the client API.
40 */ 41 */
41class Store { 42class SINKCOMMON_EXPORT Store {
42public: 43public:
43 static QString storageLocation(); 44 static QString storageLocation();
44 static QByteArray resourceName(const QByteArray &instanceIdentifier); 45 static QByteArray resourceName(const QByteArray &instanceIdentifier);
@@ -121,10 +122,10 @@ public:
121 122
122namespace Resources { 123namespace Resources {
123 template <class DomainType> 124 template <class DomainType>
124 KAsync::Job<void> inspect(const Inspection &inspectionCommand); 125 KAsync::Job<void> SINKCOMMON_EXPORT inspect(const Inspection &inspectionCommand);
125} 126}
126 127
127class Notifier { 128class SINKCOMMON_EXPORT Notifier {
128public: 129public:
129 Notifier(const QSharedPointer<ResourceAccess> &resourceAccess); 130 Notifier(const QSharedPointer<ResourceAccess> &resourceAccess);
130 // Notifier(const QByteArray &resource); 131 // Notifier(const QByteArray &resource);
diff --git a/common/definitions.h b/common/definitions.h
index 5834f01..99b8293 100644
--- a/common/definitions.h
+++ b/common/definitions.h
@@ -20,10 +20,11 @@
20 20
21#pragma once 21#pragma once
22 22
23#include <sinkcommon_export.h>
23#include <QString> 24#include <QString>
24#include <QByteArray> 25#include <QByteArray>
25 26
26namespace Sink { 27namespace Sink {
27 QString storageLocation(); 28 QString SINKCOMMON_EXPORT storageLocation();
28 QByteArray resourceName(const QByteArray &instanceIdentifier); 29 QByteArray SINKCOMMON_EXPORT resourceName(const QByteArray &instanceIdentifier);
29} 30}
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h
index 88f094a..330d680 100644
--- a/common/domain/applicationdomaintype.h
+++ b/common/domain/applicationdomaintype.h
@@ -19,6 +19,7 @@
19 */ 19 */
20#pragma once 20#pragma once
21 21
22#include <sinkcommon_export.h>
22#include <QSharedPointer> 23#include <QSharedPointer>
23#include <QVariant> 24#include <QVariant>
24#include <QByteArray> 25#include <QByteArray>
@@ -35,7 +36,7 @@ namespace ApplicationDomain {
35 * 36 *
36 * ApplicationDomainTypes don't adhere to any standard and are meant to be extended frequently (hence the non-typesafe interface). 37 * ApplicationDomainTypes don't adhere to any standard and are meant to be extended frequently (hence the non-typesafe interface).
37 */ 38 */
38class ApplicationDomainType { 39class SINKCOMMON_EXPORT ApplicationDomainType {
39public: 40public:
40 typedef QSharedPointer<ApplicationDomainType> Ptr; 41 typedef QSharedPointer<ApplicationDomainType> Ptr;
41 42
@@ -82,37 +83,37 @@ inline bool operator==(const ApplicationDomainType& lhs, const ApplicationDomain
82 && lhs.resourceInstanceIdentifier() == rhs.resourceInstanceIdentifier(); 83 && lhs.resourceInstanceIdentifier() == rhs.resourceInstanceIdentifier();
83} 84}
84 85
85struct Entity : public ApplicationDomainType { 86struct SINKCOMMON_EXPORT Entity : public ApplicationDomainType {
86 typedef QSharedPointer<Entity> Ptr; 87 typedef QSharedPointer<Entity> Ptr;
87 using ApplicationDomainType::ApplicationDomainType; 88 using ApplicationDomainType::ApplicationDomainType;
88 virtual ~Entity(); 89 virtual ~Entity();
89}; 90};
90 91
91struct Event : public Entity { 92struct SINKCOMMON_EXPORT Event : public Entity {
92 typedef QSharedPointer<Event> Ptr; 93 typedef QSharedPointer<Event> Ptr;
93 using Entity::Entity; 94 using Entity::Entity;
94 virtual ~Event(); 95 virtual ~Event();
95}; 96};
96 97
97struct Todo : public Entity { 98struct SINKCOMMON_EXPORT Todo : public Entity {
98 typedef QSharedPointer<Todo> Ptr; 99 typedef QSharedPointer<Todo> Ptr;
99 using Entity::Entity; 100 using Entity::Entity;
100 virtual ~Todo(); 101 virtual ~Todo();
101}; 102};
102 103
103struct Calendar : public Entity { 104struct SINKCOMMON_EXPORT Calendar : public Entity {
104 typedef QSharedPointer<Calendar> Ptr; 105 typedef QSharedPointer<Calendar> Ptr;
105 using Entity::Entity; 106 using Entity::Entity;
106 virtual ~Calendar(); 107 virtual ~Calendar();
107}; 108};
108 109
109struct Mail : public Entity { 110struct SINKCOMMON_EXPORT Mail : public Entity {
110 typedef QSharedPointer<Mail> Ptr; 111 typedef QSharedPointer<Mail> Ptr;
111 using Entity::Entity; 112 using Entity::Entity;
112 virtual ~Mail(); 113 virtual ~Mail();
113}; 114};
114 115
115struct Folder : public Entity { 116struct SINKCOMMON_EXPORT Folder : public Entity {
116 typedef QSharedPointer<Folder> Ptr; 117 typedef QSharedPointer<Folder> Ptr;
117 using Entity::Entity; 118 using Entity::Entity;
118 virtual ~Folder(); 119 virtual ~Folder();
@@ -124,7 +125,7 @@ struct Folder : public Entity {
124 * This type is used for configuration of resources, 125 * This type is used for configuration of resources,
125 * and for creating and removing resource instances. 126 * and for creating and removing resource instances.
126 */ 127 */
127struct SinkResource : public ApplicationDomainType { 128struct SINKCOMMON_EXPORT SinkResource : public ApplicationDomainType {
128 typedef QSharedPointer<SinkResource> Ptr; 129 typedef QSharedPointer<SinkResource> Ptr;
129 using ApplicationDomainType::ApplicationDomainType; 130 using ApplicationDomainType::ApplicationDomainType;
130 virtual ~SinkResource(); 131 virtual ~SinkResource();
@@ -136,22 +137,22 @@ struct SinkResource : public ApplicationDomainType {
136 * Do not store these types to disk, they may change over time. 137 * Do not store these types to disk, they may change over time.
137 */ 138 */
138template<class DomainType> 139template<class DomainType>
139QByteArray getTypeName(); 140QByteArray SINKCOMMON_EXPORT getTypeName();
140 141
141template<> 142template<>
142QByteArray getTypeName<Event>(); 143QByteArray SINKCOMMON_EXPORT getTypeName<Event>();
143 144
144template<> 145template<>
145QByteArray getTypeName<Todo>(); 146QByteArray SINKCOMMON_EXPORT getTypeName<Todo>();
146 147
147template<> 148template<>
148QByteArray getTypeName<SinkResource>(); 149QByteArray SINKCOMMON_EXPORT getTypeName<SinkResource>();
149 150
150template<> 151template<>
151QByteArray getTypeName<Mail>(); 152QByteArray SINKCOMMON_EXPORT getTypeName<Mail>();
152 153
153template<> 154template<>
154QByteArray getTypeName<Folder>(); 155QByteArray SINKCOMMON_EXPORT getTypeName<Folder>();
155 156
156/** 157/**
157 * Type implementation. 158 * Type implementation.
@@ -160,7 +161,7 @@ QByteArray getTypeName<Folder>();
160 * Contains all non-resource specific, but type-specific code. 161 * Contains all non-resource specific, but type-specific code.
161 */ 162 */
162template<typename DomainType> 163template<typename DomainType>
163class TypeImplementation; 164class SINKCOMMON_EXPORT TypeImplementation;
164 165
165} 166}
166} 167}
diff --git a/common/domainadaptor.h b/common/domainadaptor.h
index d43fad7..36a8b1c 100644
--- a/common/domainadaptor.h
+++ b/common/domainadaptor.h
@@ -19,6 +19,7 @@
19 19
20#pragma once 20#pragma once
21 21
22#include <sinkcommon_export.h>
22#include <QVariant> 23#include <QVariant>
23#include <QByteArray> 24#include <QByteArray>
24#include <functional> 25#include <functional>
@@ -121,7 +122,7 @@ public:
121 * This is required by the facade the read the value, and by the pipeline preprocessors to access the domain values in a generic way. 122 * This is required by the facade the read the value, and by the pipeline preprocessors to access the domain values in a generic way.
122 */ 123 */
123template<typename DomainType, typename ResourceBuffer, typename ResourceBuilder> 124template<typename DomainType, typename ResourceBuffer, typename ResourceBuilder>
124class DomainTypeAdaptorFactory : public DomainTypeAdaptorFactoryInterface 125class SINKCOMMON_EXPORT DomainTypeAdaptorFactory : public DomainTypeAdaptorFactoryInterface
125{ 126{
126 typedef typename Sink::ApplicationDomain::TypeImplementation<DomainType>::Buffer LocalBuffer; 127 typedef typename Sink::ApplicationDomain::TypeImplementation<DomainType>::Buffer LocalBuffer;
127 typedef typename Sink::ApplicationDomain::TypeImplementation<DomainType>::BufferBuilder LocalBuilder; 128 typedef typename Sink::ApplicationDomain::TypeImplementation<DomainType>::BufferBuilder LocalBuilder;
diff --git a/common/entitybuffer.h b/common/entitybuffer.h
index c9c2453..c23f2e8 100644
--- a/common/entitybuffer.h
+++ b/common/entitybuffer.h
@@ -1,12 +1,13 @@
1#pragma once 1#pragma once
2 2
3#include <sinkcommon_export.h>
3#include <functional> 4#include <functional>
4#include <flatbuffers/flatbuffers.h> 5#include <flatbuffers/flatbuffers.h>
5 6
6namespace Sink { 7namespace Sink {
7struct Entity; 8struct Entity;
8 9
9class EntityBuffer { 10class SINKCOMMON_EXPORT EntityBuffer {
10public: 11public:
11 EntityBuffer(const void *dataValue, int size); 12 EntityBuffer(const void *dataValue, int size);
12 const uint8_t *resourceBuffer(); 13 const uint8_t *resourceBuffer();
diff --git a/common/facade.h b/common/facade.h
index c25464f..26b9e6c 100644
--- a/common/facade.h
+++ b/common/facade.h
@@ -19,6 +19,7 @@
19 19
20#pragma once 20#pragma once
21 21
22#include <sinkcommon_export.h>
22#include "facadeinterface.h" 23#include "facadeinterface.h"
23 24
24#include <QByteArray> 25#include <QByteArray>
@@ -43,7 +44,7 @@ namespace Sink {
43 * Additionally a resource only has to provide a synchronizer plugin to execute the synchronization 44 * Additionally a resource only has to provide a synchronizer plugin to execute the synchronization
44 */ 45 */
45template <typename DomainType> 46template <typename DomainType>
46class GenericFacade: public Sink::StoreFacade<DomainType> 47class SINKCOMMON_EXPORT GenericFacade: public Sink::StoreFacade<DomainType>
47{ 48{
48public: 49public:
49 /** 50 /**
diff --git a/common/facadefactory.h b/common/facadefactory.h
index 3dca63b..ee65ac9 100644
--- a/common/facadefactory.h
+++ b/common/facadefactory.h
@@ -20,6 +20,7 @@
20 20
21#pragma once 21#pragma once
22 22
23#include <sinkcommon_export.h>
23#include <QByteArray> 24#include <QByteArray>
24#include <QDebug> 25#include <QDebug>
25#include <QMutex> 26#include <QMutex>
@@ -37,7 +38,7 @@ namespace Sink {
37 * 38 *
38 * If we were to provide default implementations for certain capabilities. Here would be the place to do so. 39 * If we were to provide default implementations for certain capabilities. Here would be the place to do so.
39 */ 40 */
40class FacadeFactory { 41class SINKCOMMON_EXPORT FacadeFactory {
41public: 42public:
42 typedef std::function<std::shared_ptr<void>(const QByteArray &)> FactoryFunction; 43 typedef std::function<std::shared_ptr<void>(const QByteArray &)> FactoryFunction;
43 44
diff --git a/common/index.h b/common/index.h
index 20213b2..672f3c2 100644
--- a/common/index.h
+++ b/common/index.h
@@ -1,5 +1,6 @@
1#pragma once 1#pragma once
2 2
3#include <sinkcommon_export.h>
3#include <string> 4#include <string>
4#include <functional> 5#include <functional>
5#include <QString> 6#include <QString>
@@ -8,7 +9,7 @@
8/** 9/**
9 * An index for value pairs. 10 * An index for value pairs.
10 */ 11 */
11class Index 12class SINKCOMMON_EXPORT Index
12{ 13{
13public: 14public:
14 enum ErrorCodes { 15 enum ErrorCodes {
diff --git a/common/listener.h b/common/listener.h
index e17f315..d4dc884 100644
--- a/common/listener.h
+++ b/common/listener.h
@@ -19,6 +19,7 @@
19 19
20#pragma once 20#pragma once
21 21
22#include <sinkcommon_export.h>
22#include <QObject> 23#include <QObject>
23 24
24#include <QPointer> 25#include <QPointer>
@@ -56,7 +57,7 @@ public:
56 qint64 currentRevision; 57 qint64 currentRevision;
57}; 58};
58 59
59class Listener : public QObject 60class SINKCOMMON_EXPORT Listener : public QObject
60{ 61{
61 Q_OBJECT 62 Q_OBJECT
62 63
diff --git a/common/log.h b/common/log.h
index 483f16f..35b628c 100644
--- a/common/log.h
+++ b/common/log.h
@@ -1,5 +1,6 @@
1#pragma once 1#pragma once
2 2
3#include <sinkcommon_export.h>
3#include <QDebug> 4#include <QDebug>
4 5
5namespace Sink { 6namespace Sink {
@@ -12,13 +13,13 @@ enum DebugLevel {
12 Error 13 Error
13}; 14};
14 15
15QByteArray debugLevelName(DebugLevel debugLevel); 16QByteArray SINKCOMMON_EXPORT debugLevelName(DebugLevel debugLevel);
16DebugLevel debugLevelFromName(const QByteArray &name); 17DebugLevel SINKCOMMON_EXPORT debugLevelFromName(const QByteArray &name);
17 18
18void setDebugOutputLevel(DebugLevel); 19void SINKCOMMON_EXPORT setDebugOutputLevel(DebugLevel);
19DebugLevel debugOutputLevel(); 20DebugLevel SINKCOMMON_EXPORT debugOutputLevel();
20 21
21QDebug debugStream(DebugLevel debugLevel, int line, const char* file, const char* function, const char* debugArea = 0); 22QDebug SINKCOMMON_EXPORT debugStream(DebugLevel debugLevel, int line, const char* file, const char* function, const char* debugArea = 0);
22 23
23} 24}
24} 25}
diff --git a/common/messagequeue.h b/common/messagequeue.h
index 3206388..9fe899e 100644
--- a/common/messagequeue.h
+++ b/common/messagequeue.h
@@ -1,5 +1,6 @@
1#pragma once 1#pragma once
2 2
3#include <sinkcommon_export.h>
3#include <QObject> 4#include <QObject>
4#include <QByteArrayList> 5#include <QByteArrayList>
5#include <string> 6#include <string>
@@ -11,7 +12,7 @@
11/** 12/**
12 * A persistent FIFO message queue. 13 * A persistent FIFO message queue.
13 */ 14 */
14class MessageQueue : public QObject 15class SINKCOMMON_EXPORT MessageQueue : public QObject
15{ 16{
16 Q_OBJECT 17 Q_OBJECT
17public: 18public:
diff --git a/common/propertymapper.h b/common/propertymapper.h
index 94c9224..940fcee 100644
--- a/common/propertymapper.h
+++ b/common/propertymapper.h
@@ -19,6 +19,7 @@
19 19
20#pragma once 20#pragma once
21 21
22#include <sinkcommon_export.h>
22#include <QVariant> 23#include <QVariant>
23#include <QByteArray> 24#include <QByteArray>
24#include <functional> 25#include <functional>
@@ -28,17 +29,17 @@
28 * Defines how to convert qt primitives to flatbuffer ones 29 * Defines how to convert qt primitives to flatbuffer ones
29 */ 30 */
30template <class T> 31template <class T>
31flatbuffers::uoffset_t variantToProperty(const QVariant &, flatbuffers::FlatBufferBuilder &fbb); 32flatbuffers::uoffset_t SINKCOMMON_EXPORT variantToProperty(const QVariant &, flatbuffers::FlatBufferBuilder &fbb);
32 33
33/** 34/**
34 * Defines how to convert flatbuffer primitives to qt ones 35 * Defines how to convert flatbuffer primitives to qt ones
35 */ 36 */
36template <typename T> 37template <typename T>
37QVariant propertyToVariant(const flatbuffers::String *); 38QVariant SINKCOMMON_EXPORT propertyToVariant(const flatbuffers::String *);
38template <typename T> 39template <typename T>
39QVariant propertyToVariant(uint8_t); 40QVariant SINKCOMMON_EXPORT propertyToVariant(uint8_t);
40template <typename T> 41template <typename T>
41QVariant propertyToVariant(const flatbuffers::Vector<uint8_t> *); 42QVariant SINKCOMMON_EXPORT propertyToVariant(const flatbuffers::Vector<uint8_t> *);
42 43
43 44
44/** 45/**
diff --git a/common/resource.h b/common/resource.h
index 30d6c46..d2dba0e 100644
--- a/common/resource.h
+++ b/common/resource.h
@@ -67,7 +67,7 @@ private:
67/** 67/**
68 * Factory interface for resource to implement. 68 * Factory interface for resource to implement.
69 */ 69 */
70class ResourceFactory : public QObject 70class SINKCOMMON_EXPORT ResourceFactory : public QObject
71{ 71{
72public: 72public:
73 static ResourceFactory *load(const QString &resourceName); 73 static ResourceFactory *load(const QString &resourceName);
diff --git a/common/resourceaccess.h b/common/resourceaccess.h
index 73b676b..8db0389 100644
--- a/common/resourceaccess.h
+++ b/common/resourceaccess.h
@@ -20,6 +20,7 @@
20 20
21#pragma once 21#pragma once
22 22
23#include <sinkcommon_export.h>
23#include <QLocalSocket> 24#include <QLocalSocket>
24#include <QObject> 25#include <QObject>
25#include <QTimer> 26#include <QTimer>
@@ -34,7 +35,7 @@ namespace Sink
34 35
35struct QueuedCommand; 36struct QueuedCommand;
36 37
37class ResourceAccessInterface : public QObject 38class SINKCOMMON_EXPORT ResourceAccessInterface : public QObject
38{ 39{
39 Q_OBJECT 40 Q_OBJECT
40public: 41public:
@@ -62,7 +63,7 @@ public Q_SLOTS:
62 virtual void close() = 0; 63 virtual void close() = 0;
63}; 64};
64 65
65class ResourceAccess : public ResourceAccessInterface 66class SINKCOMMON_EXPORT ResourceAccess : public ResourceAccessInterface
66{ 67{
67 Q_OBJECT 68 Q_OBJECT
68public: 69public:
diff --git a/common/resourceconfig.h b/common/resourceconfig.h
index cc9cb94..5a27971 100644
--- a/common/resourceconfig.h
+++ b/common/resourceconfig.h
@@ -19,12 +19,13 @@
19 19
20#pragma once 20#pragma once
21 21
22#include <sinkcommon_export.h>
22#include <QList> 23#include <QList>
23#include <QByteArray> 24#include <QByteArray>
24#include <QVariant> 25#include <QVariant>
25#include <QMap> 26#include <QMap>
26 27
27class ResourceConfig 28class SINKCOMMON_EXPORT ResourceConfig
28{ 29{
29public: 30public:
30 static QMap<QByteArray, QByteArray> getResources(); 31 static QMap<QByteArray, QByteArray> getResources();
diff --git a/common/threadboundary.h b/common/threadboundary.h
index 0d8ed3b..d1a1a3c 100644
--- a/common/threadboundary.h
+++ b/common/threadboundary.h
@@ -20,6 +20,8 @@
20 20
21#pragma once 21#pragma once
22 22
23#include <sinkcommon_export.h>
24
23#include <QObject> 25#include <QObject>
24#include <functional> 26#include <functional>
25 27
@@ -29,7 +31,7 @@ namespace async {
29* A helper class to invoke a method in a different thread using the event loop. 31* A helper class to invoke a method in a different thread using the event loop.
30* The ThreadBoundary object must live in the thread where the function should be called. 32* The ThreadBoundary object must live in the thread where the function should be called.
31*/ 33*/
32class ThreadBoundary : public QObject { 34class SINKCOMMON_EXPORT ThreadBoundary : public QObject {
33 Q_OBJECT 35 Q_OBJECT
34public: 36public:
35 ThreadBoundary(); 37 ThreadBoundary();