KCalendarCore

filestorage.h
Go to the documentation of this file.
1/*
2 This file is part of the kcalcore library.
3
4 SPDX-FileCopyrightText: 2002, 2003 Cornelius Schumacher <schumacher@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8/**
9 @file
10 This file is part of the API for handling calendar data and
11 defines the FileStorage class.
12
13 @author Cornelius Schumacher <schumacher@kde.org>
14*/
15
16#ifndef KCALCORE_FILESTORAGE_H
17#define KCALCORE_FILESTORAGE_H
18
19#include "calstorage.h"
20#include "kcalendarcore_export.h"
21
22namespace KCalendarCore
23{
24class CalFormat;
25class Calendar;
26
27/**
28 @brief
29 This class provides a calendar storage as a local file.
30*/
31class KCALENDARCORE_EXPORT FileStorage : public CalStorage
32{
33 Q_OBJECT
34public:
35 /**
36 A shared pointer to a FileStorage.
37 */
39
40 /**
41 Constructs a new FileStorage object for Calendar @p calendar with format
42 @p format, and storage to file @p fileName.
43
44 @param calendar is a pointer to a valid Calendar object.
45 @param fileName is the name of the disk file containing the calendar data.
46 @param format is a pointer to a valid CalFormat object that specifies
47 the calendar format to be used. FileStorage takes ownership; i.e., the
48 memory for @p format is deleted by this destructor. If no format is
49 specified, then iCalendar format is assumed.
50 */
51 explicit FileStorage(const Calendar::Ptr &calendar, const QString &fileName = QString(), KCalendarCore::CalFormat *format = nullptr);
52
53 /**
54 Destructor.
55 */
56 ~FileStorage() override;
57
58 /**
59 Sets the name of the file that contains the calendar data.
60
61 @param fileName is the name of the disk file containing the calendar data.
62 @see fileName().
63 */
64 void setFileName(const QString &fileName);
65
66 /**
67 Returns the calendar file name.
68 @return A QString with the name of the calendar file for this storge.
69 @see setFileName().
70 */
71 Q_REQUIRED_RESULT QString fileName() const;
72
73 /**
74 Sets the CalFormat object to use for this storage.
75
76 @param format is a pointer to a valid CalFormat object that specifies
77 the calendar format to be used. FileStorage takes ownership.
78 @see saveFormat().
79 */
80 void setSaveFormat(KCalendarCore::CalFormat *format);
81
82 /**
83 Returns the CalFormat object used by this storage.
84 @return A pointer to the CalFormat object used by this storage.
85 @see setSaveFormat().
86 */
87 CalFormat *saveFormat() const;
88
89 /**
90 @copydoc CalStorage::open()
91 */
92 Q_REQUIRED_RESULT bool open() override;
93
94 /**
95 @copydoc CalStorage::load()
96 */
97 Q_REQUIRED_RESULT bool load() override;
98
99 /**
100 @copydoc CalStorage::save()
101 */
102 Q_REQUIRED_RESULT bool save() override;
103
104 /**
105 @copydoc CalStorage::close()
106 */
107 Q_REQUIRED_RESULT bool close() override;
108
109private:
110 //@cond PRIVATE
111 Q_DISABLE_COPY(FileStorage)
112 class Private;
113 Private *const d;
114 //@endcond
115};
116
117}
118
119#endif
This file is part of the API for handling calendar data and defines the CalStorage abstract base clas...
An abstract base class that provides an interface to various calendar formats.
Definition calformat.h:39
An abstract base class that provides a calendar storage interface.
Definition calstorage.h:34
This class provides a calendar storage as a local file.
Definition filestorage.h:32
QSharedPointer< FileStorage > Ptr
A shared pointer to a FileStorage.
Definition filestorage.h:38
Namespace for all KCalendarCore types.
Definition alarm.h:37
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:59:19 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.