• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kleopatra

  • sources
  • kde-4.12
  • kdepim
  • kleopatra
  • utils
pimpl_ptr.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2007 Klarälvdalens Datakonsult AB. All rights reserved.
3 **
4 ** This file is part of the KD Tools library.
5 **
6 ** This file may be distributed and/or modified under the terms of the
7 ** GNU General Public License version 2 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.GPL included in the
9 ** packaging of this file.
10 **
11 ** Licensees holding valid commercial KD Tools licenses may use this file in
12 ** accordance with the KD Tools Commercial License Agreement provided with
13 ** the Software.
14 **
15 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 **
18 ** Contact info@klaralvdalens-datakonsult.se if any conditions of this
19 ** licensing are not clear to you.
20 **
21 **********************************************************************/
22 
23 #ifndef __KDTOOLSCORE__PIMPL_PTR_H__
24 #define __KDTOOLSCORE__PIMPL_PTR_H__
25 
26 #include <utils/kdtoolsglobal.h>
27 
28 namespace kdtools {
29 
30  template <typename T>
31  class pimpl_ptr {
32  KDAB_DISABLE_COPY( pimpl_ptr );
33  T * d;
34  public:
35  pimpl_ptr() : d( new T ) {}
36  explicit pimpl_ptr( T * t ) : d( t ) {}
37  ~pimpl_ptr() { delete d; d = 0; }
38 
39  T * get() { return d; }
40  const T * get() const { return d; }
41 
42  T * operator->() { return get(); }
43  const T * operator->() const { return get(); }
44 
45  T & operator*() { return *get(); }
46  const T & operator*() const { return *get(); }
47 
48  KDAB_IMPLEMENT_SAFE_BOOL_OPERATOR( get() )
49  };
50 
51  // these are not implemented, so's we can catch their use at
52  // link-time. Leaving them undeclared would open up a comparison
53  // via operator unspecified-bool-type().
54  template <typename T, typename S>
55  void operator==( const pimpl_ptr<T> &, const pimpl_ptr<S> & );
56  template <typename T, typename S>
57  void operator!=( const pimpl_ptr<T> &, const pimpl_ptr<S> & );
58 
59 } // namespace kdtools
60 
61 #endif /* __KDTOOLSCORE__PIMPL_PTR_H__ */
62 
kdtools::pimpl_ptr
Definition: pimpl_ptr.h:31
kdtools::pimpl_ptr::pimpl_ptr
pimpl_ptr()
Definition: pimpl_ptr.h:35
kdtools::pimpl_ptr::~pimpl_ptr
~pimpl_ptr()
Definition: pimpl_ptr.h:37
kdtools::pimpl_ptr::operator*
T & operator*()
Definition: pimpl_ptr.h:45
kdtools::pimpl_ptr::operator->
const T * operator->() const
Definition: pimpl_ptr.h:43
kdtools::pimpl_ptr::operator*
const T & operator*() const
Definition: pimpl_ptr.h:46
kdtools::pimpl_ptr::operator->
T * operator->()
Definition: pimpl_ptr.h:42
kdtools::pimpl_ptr::pimpl_ptr
pimpl_ptr(T *t)
Definition: pimpl_ptr.h:36
kdtoolsglobal.h
kdtools::operator==
void operator==(const pimpl_ptr< T > &, const pimpl_ptr< S > &)
kdtools::operator!=
void operator!=(const pimpl_ptr< T > &, const pimpl_ptr< S > &)
KDAB_IMPLEMENT_SAFE_BOOL_OPERATOR
#define KDAB_IMPLEMENT_SAFE_BOOL_OPERATOR(func)
Definition: kdtoolsglobal.h:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:56:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kleopatra

Skip menu "kleopatra"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal