1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
/*
This file is part of libkcal.
Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KCAL_CALFORMAT_H
#define KCAL_CALFORMAT_H
#include <tqstring.h>
#include <tqdatetime.h>
#include <tqevent.h>
#include "exceptions.h"
#include "event.h"
#include "libkcal_export.h"
namespace KCal {
class VCalDrag;
class Calendar;
/**
This is the base class for calendar formats. It provides an interface for the
generation/interpretation of a textual representation of a calendar.
@short Class providing in interface to a calendar format
*/
class LIBKCAL_EXPORT CalFormat
{
public:
/** Constructs a new format. */
CalFormat();
/** Destruct calendar format. */
virtual ~CalFormat();
/**
loads a calendar on disk into the calendar associated with this format.
Returns TRUE if successful,else returns FALSE.
@param fileName the name of the calendar on disk.
*/
virtual bool load(Calendar *, const TQString &fileName) = 0;
/** writes out the calendar to disk. Returns true if
* successful and false on error.
* @param fileName the name of the file
*/
virtual bool save(Calendar *, const TQString &fileName) = 0;
/**
Parse string and populate calendar with that information.
*/
virtual bool fromString(Calendar *, const TQString & ) = 0;
/**
Return calendar information as string.
*/
virtual TQString toString(Calendar *) = 0;
/** Clear exception status of this format object */
void clearException();
/**
Return exception, if there is any, containing information about the last
error that occurred.
*/
ErrorFormat *exception();
/** Set the application name for use in unique IDs and error messages,
* and product ID for incidence PRODID property
*/
static void setApplication(const TQString& app, const TQString& productID);
/** Return the application name used in unique IDs and error messages */
static const TQString& application() { return mApplication; }
/** Return the PRODID string to write into calendar files */
static const TQString& productId() { return mProductId; }
/** Return the PRODID string loaded from calendar file */
const TQString &loadedProductId() { return mLoadedProductId; }
/** Create a unique id string. */
static TQString createUniqueId();
/**
Set exception for this object. This is used by the functions of this
class to report errors.
*/
void setException( ErrorFormat *error );
protected:
TQString mLoadedProductId; // PRODID string loaded from calendar file
private:
ErrorFormat *mException;
static TQString mApplication; // name of application for unique ID strings
static TQString mProductId; // PRODID string to write to calendar files
class Private;
Private *d;
};
}
#endif
|