libkcal

calformat.h
1 /*
2  This file is part of libkcal.
3 
4  Copyright (c) 2001-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 #ifndef KCAL_CALFORMAT_H
22 #define KCAL_CALFORMAT_H
23 
24 #include <tqstring.h>
25 #include <tqdatetime.h>
26 #include <tqevent.h>
27 
28 #include "exceptions.h"
29 #include "event.h"
30 #include "libkcal_export.h"
31 
32 namespace KCal {
33 
34 class VCalDrag;
35 class Calendar;
36 
43 class LIBKCAL_EXPORT CalFormat
44 {
45  public:
47  CalFormat();
49  virtual ~CalFormat();
50 
56  virtual bool load(Calendar *, const TQString &fileName) = 0;
61  virtual bool save(Calendar *, const TQString &fileName) = 0;
62 
66  virtual bool fromString(Calendar *, const TQString & ) = 0;
70  virtual TQString toString(Calendar *) = 0;
71 
73  void clearException();
78  ErrorFormat *exception();
79 
83  static void setApplication(const TQString& app, const TQString& productID);
85  static const TQString& application() { return mApplication; }
87  static const TQString& productId() { return mProductId; }
89  const TQString &loadedProductId() { return mLoadedProductId; }
90 
92  static TQString createUniqueId();
93 
98  void setException( ErrorFormat *error );
99 
100  protected:
101  TQString mLoadedProductId; // PRODID string loaded from calendar file
102 
103  private:
104  ErrorFormat *mException;
105 
106  static TQString mApplication; // name of application for unique ID strings
107  static TQString mProductId; // PRODID string to write to calendar files
108 
109  class Private;
110  Private *d;
111 };
112 
113 }
114 
115 #endif
This is the base class for calendar formats.
Definition: calformat.h:44
virtual bool fromString(Calendar *, const TQString &)=0
Parse string and populate calendar with that information.
static const TQString & application()
Return the application name used in unique IDs and error messages.
Definition: calformat.h:85
virtual bool load(Calendar *, const TQString &fileName)=0
loads a calendar on disk into the calendar associated with this format.
virtual bool save(Calendar *, const TQString &fileName)=0
writes out the calendar to disk.
const TQString & loadedProductId()
Return the PRODID string loaded from calendar file.
Definition: calformat.h:89
static const TQString & productId()
Return the PRODID string to write into calendar files.
Definition: calformat.h:87
virtual TQString toString(Calendar *)=0
Return calendar information as string.
This is the main "calendar" object class.
Definition: calendar.h:171
Calendar format related error class.
Definition: exceptions.h:65
Namespace KCal is for global classes, objects and/or functions in libkcal.
Definition: alarm.h:38