File indexing completed on 2024-04-21 03:52:45

0001 /*
0002   This file is part of the kcalcore library.
0003 
0004   SPDX-FileCopyrightText: 2002, 2003 Cornelius Schumacher <schumacher@kde.org>
0005 
0006   SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 /**
0009   @file
0010   This file is part of the API for handling calendar data and
0011   defines the CalStorage abstract base class.
0012 
0013   @author Cornelius Schumacher \<schumacher@kde.org\>
0014 */
0015 
0016 #ifndef KCALCORE_CALSTORAGE_H
0017 #define KCALCORE_CALSTORAGE_H
0018 
0019 #include "calendar.h"
0020 #include "kcalendarcore_export.h"
0021 
0022 #include <QObject>
0023 
0024 namespace KCalendarCore
0025 {
0026 /**
0027   @brief
0028   An abstract base class that provides a calendar storage interface.
0029 
0030   This is the base class for calendar storage. It provides an interface for the
0031   loading and saving of calendars.
0032 */
0033 class KCALENDARCORE_EXPORT CalStorage : public QObject
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038     /**
0039       Constructs a new storage object for a calendar.
0040       @param calendar is a pointer to a valid Calendar object.
0041     */
0042     explicit CalStorage(const Calendar::Ptr &calendar);
0043 
0044     /**
0045       Destuctor.
0046     */
0047     ~CalStorage() override;
0048 
0049     /**
0050       Returns the calendar for this storage object.
0051       @return A pointer to the calendar whose storage is being managed.
0052     */
0053     Calendar::Ptr calendar() const;
0054 
0055     /**
0056       Opens the calendar for storage.
0057       @return true if the open was successful; false otherwise.
0058     */
0059     virtual bool open() = 0;
0060 
0061     /**
0062       Loads the calendar into memory.
0063       @return true if the load was successful; false otherwise.
0064     */
0065     virtual bool load() = 0;
0066 
0067     /**
0068       Saves the calendar.
0069       @return true if the save was successful; false otherwise.
0070     */
0071     virtual bool save() = 0;
0072 
0073     /**
0074       Closes the calendar storage.
0075       @return true if the close was successful; false otherwise.
0076     */
0077     virtual bool close() = 0;
0078 
0079 private:
0080     //@cond PRIVATE
0081     Q_DISABLE_COPY(CalStorage)
0082     class Private;
0083     Private *const d;
0084     //@endcond
0085 };
0086 
0087 }
0088 
0089 #endif