libkcal

calformat.h

Go to the documentation of this file.
00001 /*
00002     This file is part of libkcal.
00003 
00004     Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License as published by the Free Software Foundation; either
00009     version 2 of the License, or (at your option) any later version.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 */
00021 #ifndef KCAL_CALFORMAT_H
00022 #define KCAL_CALFORMAT_H
00023 
00024 #include <qstring.h>
00025 #include <qdatetime.h>
00026 #include <qevent.h>
00027 
00028 #include "exceptions.h"
00029 #include "event.h"
00030 #include "libkcal_export.h"
00031 
00032 namespace KCal {
00033 
00034 class VCalDrag;
00035 class Calendar;
00036 
00043 class LIBKCAL_EXPORT CalFormat
00044 {
00045   public:
00047     CalFormat();
00049     virtual ~CalFormat();
00050 
00056     virtual bool load(Calendar *, const QString &fileName) = 0;
00061     virtual bool save(Calendar *, const QString &fileName) = 0;
00062 
00066     virtual bool fromString(Calendar *, const QString & ) = 0;
00070     virtual QString toString(Calendar *) = 0;
00071 
00073     void clearException();
00078     ErrorFormat *exception();
00079 
00083     static void setApplication(const QString& app, const QString& productID);
00085     static const QString& application()  { return mApplication; }
00087     static const QString& productId()  { return mProductId; }
00089     const QString &loadedProductId()  { return mLoadedProductId; }
00090 
00092     static QString createUniqueId();
00093 
00098     void setException(ErrorFormat *error);
00099 
00100   protected:
00101     QString mLoadedProductId;         // PRODID string loaded from calendar file
00102 
00103   private:
00104     ErrorFormat *mException;
00105 
00106     static QString mApplication;      // name of application for unique ID strings
00107     static QString mProductId;        // PRODID string to write to calendar files
00108 
00109     class Private;
00110     Private *d;
00111 };
00112 
00113 }
00114 
00115 #endif