/usr/include/qwtplot3d-qt4/qwt3d_autoptr.h is in libqwtplot3d-qt4-dev 0.2.7+svn191-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | #ifndef qwt3d_autoptr_h__2004_05_14_18_57_begin_guarded_code
#define qwt3d_autoptr_h__2004_05_14_18_57_begin_guarded_code
namespace Qwt3D
{
//! Simple Auto pointer providing deep copies for raw pointer
/*!
Requirements: \n
virtual T* T::clone() const;\n
T::destroy() const;
virtual ~T() private/protected\n\n
clone() is necessary for the pointer to preserve polymorphic behaviour.
The pointer requires also heap based objects with regard to the template
argument in order to be able to get ownership and control over destruction.
*/
template <typename T>
class qwt3d_ptr
{
public:
//! Standard ctor
explicit qwt3d_ptr(T* ptr = 0)
:rawptr_(ptr)
{
}
//! Dtor (calls T::destroy)
~qwt3d_ptr()
{
destroyRawPtr();
}
//! Copy ctor (calls (virtual) clone())
qwt3d_ptr(qwt3d_ptr const& val)
{
rawptr_ = val.rawptr_->clone();
}
//! Assignment in the same spirit as copy ctor
qwt3d_ptr<T>& operator=(qwt3d_ptr const& val)
{
if (this == &val)
return *this;
destroyRawPtr();
rawptr_ = val.rawptr_->clone();
return *this;
}
//! It's a pointerlike object, isn't it ?
T* operator->() const
{
return rawptr_;
}
//! Dereferencing
T& operator*() const
{
return *rawptr_;
}
private:
T* rawptr_;
void destroyRawPtr()
{
if (rawptr_)
rawptr_->destroy();
rawptr_ = 0;
}
};
} // ns
#endif /* include guarded */
|