From 0161b8ab46495a99bebaea62e229f66edd88d547 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Thu, 14 Jan 2021 00:19:02 +0000 Subject: [PATCH] include/osg/Callback: nullptr -> NULL Fixes travis, which explictly requires c++98 --- include/osg/Callback | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/osg/Callback b/include/osg/Callback index 35480a39c..02a517168 100644 --- a/include/osg/Callback +++ b/include/osg/Callback @@ -121,6 +121,32 @@ class OSG_EXPORT Callback : public virtual Object { } } + /** Convenience method to find a nested callback by type. */ + template + static T* findNestedCallback(osg::Callback* callback) + { + if (!callback) + return NULL; + + if (T* cb = dynamic_cast(callback)) + return cb; + + return findNestedCallback(callback->getNestedCallback()); + } + + /** Convenience method to find a nested callback by type. */ + template + static const T* findNestedCallback(const osg::Callback* callback) + { + if (!callback) + return NULL; + + if (const T* cb = dynamic_cast(callback)) + return cb; + + return findNestedCallback(callback->getNestedCallback()); + } + protected: virtual ~Callback() {}