KCalendarCore

calformat.cpp
Go to the documentation of this file.
1/*
2 This file is part of the kcalcore library.
3
4 SPDX-FileCopyrightText: 2001 Cornelius Schumacher <schumacher@kde.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8/**
9 @file
10 This file is part of the API for handling calendar data and
11 defines the CalFormat base class.
12
13 @brief
14 Base class providing an interface to various calendar formats.
15
16 @author Cornelius Schumacher <schumacher@kde.org>
17*/
18
19#include "calformat.h"
20#include "calformat_p.h"
21#include "exceptions.h"
22
23#include <QUuid>
24
25using namespace KCalendarCore;
26
27CalFormatPrivate::~CalFormatPrivate() = default;
28
29QString CalFormatPrivate::mApplication = QStringLiteral("libkcal");
30QString CalFormatPrivate::mProductId = QStringLiteral("-//K Desktop Environment//NONSGML libkcal 4.3//EN");
31
32CalFormat::CalFormat(CalFormatPrivate *dd)
33 : d_ptr(dd)
34{
35}
36
41
42bool CalFormat::fromString(const Calendar::Ptr &calendar, const QString &string)
43{
44 return fromRawString(calendar, string.toUtf8());
45}
46
48{
49 d_ptr->mException.reset();
50}
51
53{
54 d_ptr->mException.reset(exception);
55}
56
58{
59 return d_ptr->mException.get();
60}
61
62void CalFormat::setApplication(const QString &application, const QString &productID)
63{
64 CalFormatPrivate::mApplication = application;
65 CalFormatPrivate::mProductId = productID;
66}
67
69{
70 return CalFormatPrivate::mApplication;
71}
72
74{
75 return CalFormatPrivate::mProductId;
76}
79{
80 return d_ptr->mLoadedProductId;
81}
82
84{
85 d_ptr->mLoadedProductId = id;
86}
87
This file is part of the API for handling calendar data and defines the CalFormat abstract base class...
static QString createUniqueId()
Creates a unique id string.
Definition calformat.cpp:88
void setLoadedProductId(const QString &id)
Sets the PRODID string loaded from calendar file.
Definition calformat.cpp:83
void clearException()
Clears the exception status.
Definition calformat.cpp:47
virtual ~CalFormat()
Destructor.
Definition calformat.cpp:37
QString loadedProductId()
Returns the PRODID string loaded from calendar file.
Definition calformat.cpp:78
static void setApplication(const QString &application, const QString &productID)
Sets the application name for use in unique IDs and error messages, and product ID for incidence PROD...
Definition calformat.cpp:62
static const QString & application()
Returns the application name used in unique IDs and error messages.
Definition calformat.cpp:68
Exception * exception() const
Returns an exception, if there is any, containing information about the last error that occurred.
Definition calformat.cpp:57
static const QString & productId()
Returns the our library's PRODID string to write into calendar files.
Definition calformat.cpp:73
void setException(Exception *error)
Sets an exception that is to be used by the functions of this class to report errors.
Definition calformat.cpp:52
bool fromString(const Calendar::Ptr &calendar, const QString &string)
Loads a calendar from a string.
Definition calformat.cpp:42
virtual bool fromRawString(const Calendar::Ptr &calendar, const QByteArray &string)=0
Parses a utf8 encoded string, returning the first iCal component encountered in that string.
Exception base class, currently used as a fancy kind of error code and not as an C++ exception.
Definition exceptions.h:42
This file is part of the API for handling calendar data and defines the Exception class.
Namespace for all KCalendarCore types.
Definition alarm.h:37
QUuid createUuid()
QString toString(StringFormat mode) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:47 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.