2023-08-16 00:20:26 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2008-04-30 15:41:54 +00:00
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
#pragma once
|
2008-04-30 15:41:54 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup freestyle
|
|
|
|
|
* \brief Cast function
|
2012-12-28 20:21:05 +00:00
|
|
|
*/
|
2008-04-30 15:41:54 +00:00
|
|
|
|
2013-04-09 00:46:49 +00:00
|
|
|
namespace Freestyle {
|
|
|
|
|
|
2012-12-28 20:21:05 +00:00
|
|
|
namespace Cast {
|
|
|
|
|
template<class T, class U> U *cast(T *in)
|
|
|
|
|
{
|
2019-05-31 23:21:16 +10:00
|
|
|
if (!in) {
|
2023-08-01 21:15:52 +10:00
|
|
|
return nullptr;
|
2019-05-31 23:21:16 +10:00
|
|
|
}
|
2012-12-28 20:21:05 +00:00
|
|
|
return dynamic_cast<U *>(in);
|
|
|
|
|
}
|
2008-04-30 15:41:54 +00:00
|
|
|
} // end of namespace Cast
|
|
|
|
|
|
2013-04-09 00:46:49 +00:00
|
|
|
} /* namespace Freestyle */
|