summaryrefslogtreecommitdiffabout
path: root/libkcal/calformat.h
authorzautrix <zautrix>2004-06-26 19:01:18 (UTC)
committer zautrix <zautrix>2004-06-26 19:01:18 (UTC)
commitb9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff)
tree2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /libkcal/calformat.h
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'libkcal/calformat.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/calformat.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/libkcal/calformat.h b/libkcal/calformat.h
new file mode 100644
index 0000000..0c7ee7e
--- a/dev/null
+++ b/libkcal/calformat.h
@@ -0,0 +1,111 @@
1/*
2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20#ifndef _CALFORMAT_H
21#define _CALFORMAT_H
22
23#include <qstring.h>
24#include <qdatetime.h>
25#include <qevent.h>
26
27#include "exceptions.h"
28#include "event.h"
29
30namespace KCal {
31
32class VCalDrag;
33class Calendar;
34
35/**
36 This is the base class for calendar formats. It provides an interface for the
37 generation/interpretation of a textual representation of a calendar.
38
39 @short Class providing in interface to a calendar format
40*/
41class CalFormat {
42 public:
43 /** Constructs a new format. */
44 CalFormat();
45 /** Destruct calendar format. */
46 virtual ~CalFormat();
47
48 /**
49 loads a calendar on disk into the calendar associated with this format.
50 Returns TRUE if successful,else returns FALSE.
51 @param fileName the name of the calendar on disk.
52 */
53 virtual bool load(Calendar *, const QString &fileName) = 0;
54 /** writes out the calendar to disk. Returns true if
55 * successful and false on error.
56 * @param fileName the name of the file
57 */
58 virtual bool save(Calendar *, const QString &fileName) = 0;
59
60 /**
61 Parse string and populate calendar with that information.
62 */
63 virtual bool fromString(Calendar *, const QString & ) = 0;
64 /**
65 Return calendar information as string.
66 */
67 virtual QString toString(Calendar *) = 0;
68
69 /** Clear exception status of this format object */
70 void clearException();
71 /**
72 Return exception, if there is any, containing information about the last
73 error that occured.
74 */
75 ErrorFormat *exception();
76
77 /** Set the application name for use in unique IDs and error messages,
78 * and product ID for incidence PRODID property
79 */
80 static void setApplication(const QString& app, const QString& productID);
81 /** Return the application name used in unique IDs and error messages */
82 static const QString& application() { return mApplication; }
83 /** Return the PRODID string to write into calendar files */
84 static const QString& productId() { return mProductId; }
85 /** Return the KDE calendar format version indicated by a PRODID property */
86 static int calendarVersion(const char* prodId);
87 /** Return the PRODID string loaded from calendar file */
88 const QString &loadedProductId() { return mLoadedProductId; }
89
90 /** Create a unique id string. */
91 static QString createUniqueId();
92
93 /**
94 Set exception for this object. This is used by the functions of this
95 class to report errors.
96 */
97 void setException(ErrorFormat *error);
98
99 protected:
100 QString mLoadedProductId; // PRODID string loaded from calendar file
101
102 private:
103 ErrorFormat *mException;
104
105 static QString mApplication; // name of application for unique ID strings
106 static QString mProductId; // PRODID string to write to calendar files
107};
108
109}
110
111#endif