File indexing completed on 2024-12-29 05:05:44

0001 /*
0002     SPDX-FileCopyrightText: 2012-2016 Ivan Cukic <ivan.cukic@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include <memory>
0010 
0011 namespace kamd
0012 {
0013 namespace utils
0014 {
0015 template<typename T>
0016 class d_ptr
0017 {
0018 private:
0019     std::unique_ptr<T> d;
0020 
0021 public:
0022     d_ptr();
0023 
0024     template<typename... Args>
0025     d_ptr(Args &&...);
0026 
0027     ~d_ptr();
0028 
0029     T *operator->() const;
0030 };
0031 
0032 #define D_PTR                                                                                                                                                  \
0033     class Private;                                                                                                                                             \
0034     friend class Private;                                                                                                                                      \
0035     const ::kamd::utils::d_ptr<Private> d
0036 
0037 } // namespace utils
0038 } // namespace kamd