File indexing completed on 2024-04-28 11:34:15

0001 /*
0002   This file is part of the kcalcore library.
0003 
0004   SPDX-FileCopyrightText: 2001-2003 Cornelius Schumacher <schumacher@kde.org>
0005   SPDX-FileCopyrightText: 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
0006   SPDX-FileCopyrightText: 2005 Rafal Rzepecki <divide@users.sourceforge.net>
0007   SPDX-FileCopyrightText: 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
0008   SPDX-FileContributor: Alvaro Manera <alvaro.manera@nokia.com>
0009 
0010   SPDX-License-Identifier: LGPL-2.0-or-later
0011 */
0012 
0013 #ifndef KCALCORE_VISITOR_H
0014 #define KCALCORE_VISITOR_H
0015 
0016 #include "event.h"
0017 #include "freebusy.h"
0018 #include "journal.h"
0019 #include "todo.h"
0020 
0021 namespace KCalendarCore
0022 {
0023 /**
0024   This class provides the interface for a visitor of calendar components.
0025   It serves as base class for concrete visitors, which implement certain
0026   actions on calendar components. It allows to add functions, which operate
0027   on the concrete types of calendar components, without changing the
0028   calendar component classes.
0029 */
0030 class KCALENDARCORE_EXPORT Visitor // krazy:exclude=dpointer
0031 {
0032 public:
0033     /** Destruct Incidence::Visitor */
0034     virtual ~Visitor();
0035 
0036     /**
0037       Reimplement this function in your concrete subclass of
0038       IncidenceBase::Visitor to perform actions on an Event object.
0039       @param event is a pointer to a valid Event object.
0040     */
0041     virtual bool visit(const Event::Ptr &event);
0042 
0043     /**
0044       Reimplement this function in your concrete subclass of
0045       IncidenceBase::Visitor to perform actions on a Todo object.
0046       @param todo is a pointer to a valid Todo object.
0047     */
0048     virtual bool visit(const Todo::Ptr &todo);
0049 
0050     /**
0051       Reimplement this function in your concrete subclass of
0052       IncidenceBase::Visitor to perform actions on an Journal object.
0053       @param journal is a pointer to a valid Journal object.
0054     */
0055     virtual bool visit(const Journal::Ptr &journal);
0056 
0057     /**
0058       Reimplement this function in your concrete subclass of
0059       IncidenceBase::Visitor to perform actions on a FreeBusy object.
0060       @param freebusy is a pointer to a valid FreeBusy object.
0061     */
0062     virtual bool visit(const FreeBusy::Ptr &freebusy);
0063 
0064 protected:
0065     /**
0066       Constructor is protected to prevent direct creation of visitor
0067       base class.
0068     */
0069     Visitor();
0070 };
0071 
0072 } // end namespace
0073 
0074 #endif