Diffstat (limited to 'libopie2/opiepim/core/opimevent.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/core/opimevent.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libopie2/opiepim/core/opimevent.cpp b/libopie2/opiepim/core/opimevent.cpp index 7bc6c32..1b553d8 100644 --- a/libopie2/opiepim/core/opimevent.cpp +++ b/libopie2/opiepim/core/opimevent.cpp @@ -488,8 +488,27 @@ int OPimEvent::rtti() const { return OPimResolver::DateBook; } +/** + * \brief Cast safely to OPimEvent from OPimRecord + * + * Safely cast from OPimRecord to OPimEvent. If the + * OPimRecord is not of type OPimEvent Null will be + * returned. + * + * @param rec The OPimRecord to be casted to OPimEvent + * + * @see OPimTodo::safeCast + * @return OPimEvent or Null Pointer + */ +OPimEvent* OPimEvent::safeCast( const OPimRecord* rec) { + return ( rec && rec->rtti() == OPimResolver::DateBook ) ? + static_cast<OPimEvent*>( const_cast<OPimRecord*>(rec) ) : + 0l; +} + + bool OPimEvent::loadFromStream( QDataStream& ) { return true; |