1/*
2 This file is part of the kcalcore library.
3
4 Copyright (c) 2002,2003 Cornelius Schumacher <schumacher@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21/**
22 @file
23 This file is part of the API for handling calendar data and
24 defines the CalStorage abstract base class.
25
26 @author Cornelius Schumacher \<schumacher@kde.org\>
27*/
28
29#ifndef KCALCORE_CALSTORAGE_H
30#define KCALCORE_CALSTORAGE_H
31
32#include "kcalcore_export.h"
33#include "calendar.h"
34
35#include <QtCore/QObject>
36
37namespace KCalCore {
38
39/**
40 @brief
41 An abstract base class that provides a calendar storage interface.
42
43 This is the base class for calendar storage. It provides an interface for the
44 loading and saving of calendars.
45*/
46class KCALCORE_EXPORT CalStorage : public QObject
47{
48 Q_OBJECT
49
50public:
51 /**
52 Constructs a new storage object for a calendar.
53 @param calendar is a pointer to a valid Calendar object.
54 */
55 explicit CalStorage(const Calendar::Ptr &calendar);
56
57 /**
58 Destuctor.
59 */
60 virtual ~CalStorage();
61
62 /**
63 Returns the calendar for this storage object.
64 @return A pointer to the calendar whose storage is being managed.
65 */
66 Calendar::Ptr calendar() const;
67
68 /**
69 Opens the calendar for storage.
70 @return true if the open was successful; false otherwise.
71 */
72 virtual bool open() = 0;
73
74 /**
75 Loads the calendar into memory.
76 @return true if the load was successful; false otherwise.
77 */
78 virtual bool load() = 0;
79
80 /**
81 Saves the calendar.
82 @return true if the save was successful; false otherwise.
83 */
84 virtual bool save() = 0;
85
86 /**
87 Closes the calendar storage.
88 @return true if the close was successful; false otherwise.
89 */
90 virtual bool close() = 0;
91
92private:
93 //@cond PRIVATE
94 Q_DISABLE_COPY(CalStorage)
95 class Private;
96 Private *const d;
97 //@endcond
98};
99
100}
101
102#endif
103