Warning, file /office/calligra/libs/widgets/KoResourceServerPolicies.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*  This file is part of the KDE project
0002 
0003     Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
0004 
0005     This library is free software; you can redistribute it and/or
0006     modify it under the terms of the GNU Lesser General Public
0007     License as published by the Free Software Foundation; either
0008     version 2.1 of the License, or (at your option) any later version.
0009 
0010     This library is distributed in the hope that it will be useful,
0011     but WITHOUT ANY WARRANTY; without even the implied warranty of
0012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013     Lesser General Public License for more details.
0014 
0015     You should have received a copy of the GNU Lesser General Public
0016     License along with this library; if not, write to the Free Software
0017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0018  */
0019 
0020 #ifndef KORESOURCESERVERPOLICIES_H
0021 #define KORESOURCESERVERPOLICIES_H
0022 
0023 #include "kowidgets_export.h"
0024 
0025 class KoResource;
0026 
0027 template <class T> struct PointerStoragePolicy
0028 {
0029     typedef T* PointerType;
0030     static inline void deleteResource(PointerType resource) {
0031         delete resource;
0032     }
0033     static inline KoResource* toResourcePointer(PointerType resource) {
0034         return resource;
0035     }
0036 };
0037 
0038 template <class SharedPointer> struct SharedPointerStoragePolicy
0039 {
0040     typedef SharedPointer PointerType;
0041     static inline void deleteResource(PointerType resource) {
0042         Q_UNUSED(resource);
0043     }
0044     static inline KoResource* toResourcePointer(PointerType resource) {
0045         return resource.data();
0046     }
0047 };
0048 
0049 #endif // KORESOURCESERVERPOLICIES_H