aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-05-18 21:48:04 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-05-20 07:48:38 +0900
commite3d2edbea279da8c3ed19b9faa77a287b6a65faf (patch)
treecafc6a2b959122335c03a22508e8552f76f7f2e6
parent97cec65105cab43b95d76b73ebdab74f2e222d81 (diff)
downloadlibquotient-e3d2edbea279da8c3ed19b9faa77a287b6a65faf.tar.gz
libquotient-e3d2edbea279da8c3ed19b9faa77a287b6a65faf.zip
event.h: add doc-comments; deprecate ptrCast()
-rw-r--r--lib/events/event.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/events/event.h b/lib/events/event.h
index d7ac4292..b7bbd83e 100644
--- a/lib/events/event.h
+++ b/lib/events/event.h
@@ -32,19 +32,23 @@ namespace QMatrixClient
template <typename EventT>
using event_ptr_tt = std::unique_ptr<EventT>;
+ /// Unwrap a plain pointer from a smart pointer
template <typename EventT>
- inline EventT* rawPtr(const event_ptr_tt<EventT>& ptr) // unwrap
+ inline EventT* rawPtr(const event_ptr_tt<EventT>& ptr)
{
return ptr.get();
}
+ /// Unwrap a plain pointer and downcast it to the specified type
template <typename TargetEventT, typename EventT>
inline TargetEventT* weakPtrCast(const event_ptr_tt<EventT>& ptr)
{
return static_cast<TargetEventT*>(rawPtr(ptr));
}
+ /// Re-wrap a smart pointer to base into a smart pointer to derived
template <typename TargetT, typename SourceT>
+ [[deprecated("Consider using eventCast() or visit() instead")]]
inline event_ptr_tt<TargetT> ptrCast(event_ptr_tt<SourceT>&& ptr)
{
return unique_ptr_cast<TargetT>(ptr);