diff options
Diffstat (limited to 'libkcal/incidence.h')
-rw-r--r-- | libkcal/incidence.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index 477b758c6..89d45b085 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h @@ -66,6 +66,36 @@ class LIBKCAL_EXPORT Incidence : public IncidenceBase, public Recurrence::Observ }; /** + This class implements a visitor for adding an Incidence to a resource + plus subresource supporting addEvent(), addTodo() and addJournal() calls. + */ + template<class T> + class AddSubResourceVisitor : public IncidenceBase::Visitor + { + public: + AddSubResourceVisitor( T *r, const TQString &subResource ) + : mResource( r ), mSubResource( subResource ) {} + + protected: + bool visit( Event *e ) + { + return mResource->addEvent( e, mSubResource ); + } + bool visit( Todo *t ) + { + return mResource->addTodo( t, mSubResource ); + } + bool visit( Journal *j ) + { + return mResource->addJournal( j, mSubResource ); + } + + private: + T *mResource; + TQString mSubResource; + }; + + /** This class implements a visitor for deleting an Incidence from a resource supporting deleteEvent(), deleteTodo() and deleteJournal() calls. */ |