plasma-framework/src/utils/d_ptr_implementation.h
Ivan Čukić b78db9acd6 Properly initialize kded dbus object
- kded module uses underscore instead of a dash
- dbus interface is based on the generated adapter
- added the d_ptr template class
2013-06-24 09:01:16 +02:00

60 lines
1.3 KiB
C++

/*
* Copyright (C) 2012 Ivan Cukic <ivan.cukic(at)kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2,
* or (at your option) any later version, as published by the Free
* Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef D_PTR_IMPLEMENTATION_H
#define D_PTR_IMPLEMENTATION_H
#include <utility>
namespace utils {
template <typename T>
d_ptr<T>::d_ptr() : d(new T())
{
}
template <typename T>
template <typename ...Args>
d_ptr<T>::d_ptr(Args && ... args)
: d(new T(std::forward<Args>(args)... ))
{
}
template <typename T>
d_ptr<T>::~d_ptr()
{
}
template<typename T>
T * d_ptr<T>::operator->() const
{
return d.get();
}
template<typename T>
T * d_ptr<T>::get() const
{
return d.get();
}
} // namespace utils
#endif