Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /* |
---|---|
2 | Copyright (c) 2008 Volker Krause <vkrause@kde.org> |
3 | |
4 | This library is free software; you can redistribute it and/or modify it |
5 | under the terms of the GNU Library General Public License as published by |
6 | the Free Software Foundation; either version 2 of the License, or (at your |
7 | option) any later version. |
8 | |
9 | This library is distributed in the hope that it will be useful, but WITHOUT |
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public |
12 | License for more details. |
13 | |
14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to the |
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
17 | 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef SINKBASE_H |
21 | #define SINKBASE_H |
22 | |
23 | #include <QObject> |
24 | |
25 | #include <opensync/opensync.h> |
26 | #include <opensync/opensync-plugin.h> |
27 | #include <opensync/opensync-context.h> |
28 | #include <opensync/opensync-error.h> |
29 | #include <opensync/opensync-helper.h> |
30 | |
31 | /** |
32 | * Base class providing wraping of OSyncObjTypeSink. |
33 | */ |
34 | class SinkBase : public QObject |
35 | { |
36 | Q_OBJECT |
37 | public: |
38 | enum Feature { |
39 | Connect = 1, |
40 | Disconnect = 2, |
41 | GetChanges = 4, |
42 | Commit = 8, |
43 | Write = 16, |
44 | CommittedAll = 32, |
45 | Read = 64, |
46 | BatchCommit = 128, |
47 | SyncDone = 256 |
48 | }; |
49 | |
50 | SinkBase( int features ); |
51 | virtual ~SinkBase(); |
52 | |
53 | virtual void connect(); |
54 | virtual void disconnect(); |
55 | virtual void getChanges(); |
56 | virtual void commit( OSyncChange *chg ); |
57 | virtual void syncDone(); |
58 | |
59 | OSyncContext* context() const { return mContext; } |
60 | void setContext( OSyncContext *context ); |
61 | |
62 | OSyncPluginInfo *pluginInfo() const { return mPluginInfo; } |
63 | void setPluginInfo( OSyncPluginInfo *info ); |
64 | |
65 | protected: |
66 | void success() const; |
67 | void error( OSyncErrorType type, const QString &msg ) const; |
68 | void warning( OSyncError *error ) const; |
69 | void wrapSink( OSyncObjTypeSink *sink ); |
70 | |
71 | OSyncObjTypeSink* sink() const { return mSink; } |
72 | |
73 | private: |
74 | OSyncObjTypeSinkFunctions mWrapedFunctions; |
75 | mutable OSyncContext *mContext; |
76 | OSyncObjTypeSink *mSink; |
77 | OSyncPluginInfo *mPluginInfo; |
78 | }; |
79 | |
80 | #endif |
81 |
Warning: That file was not part of the compilation database. It may have many parsing errors.