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

kalarm/lib

  • sources
  • kde-4.14
  • kdepim
  • kalarm
  • lib
autodeletelist.h
Go to the documentation of this file.
1 /*
2  * autodeletelist.h - pointer list with auto-delete on destruction
3  * Program: kalarm
4  * Copyright © 2008,2009 by David Jarvie <djarvie@kde.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef AUTODELETELIST_H
22 #define AUTODELETELIST_H
23 
24 #include <QList>
25 
26 
32 template <class T>
33 class AutoDeleteList : public QList<T*>
34 {
35  public:
36  AutoDeleteList() : QList<T*>() {}
37  ~AutoDeleteList()
38  {
39  // Remove from list first before deleting the pointer, in
40  // case the pointer's destructor removes it from the list.
41  while (!this->isEmpty())
42  delete this->takeFirst();
43  }
44  private:
45  // Prevent copying since that would create two owners of the pointers
46  AutoDeleteList(const AutoDeleteList&);
47  AutoDeleteList& operator=(const AutoDeleteList&);
48 };
49 
50 #endif // AUTODELETELIST_H
51 
52 // vim: et sw=4:
AutoDeleteList::~AutoDeleteList
~AutoDeleteList()
Definition: autodeletelist.h:37
AutoDeleteList::AutoDeleteList
AutoDeleteList()
Definition: autodeletelist.h:36
QList< T * >::isEmpty
bool isEmpty() const
QList
T
QList< T * >::takeFirst
T takeFirst()
AutoDeleteList
A list of pointers which are auto-deleted when the list is deleted.
Definition: autodeletelist.h:33
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:35:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalarm/lib

Skip menu "kalarm/lib"
  • 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
  • pimprint

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