• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KParts

historyprovider.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 Carsten Pfeiffer <pfeiffer@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include <qdict.h>
00021 
00022 #include <kapplication.h>
00023 
00024 #include "historyprovider.h"
00025 
00026 using namespace KParts;
00027 template class QDict<void>;
00028 
00029 HistoryProvider * HistoryProvider::s_self = 0L;
00030 
00031 class HistoryProvider::HistoryProviderPrivate
00032 {
00033 public:
00034     HistoryProviderPrivate()
00035     : dict( 1009 ) {}
00036 
00037     QDict<void> dict;
00038 };
00039 
00040 HistoryProvider * HistoryProvider::self()
00041 {
00042     if ( !s_self )
00043     s_self = new HistoryProvider( kapp, "history provider" );
00044     return s_self;
00045 }
00046 
00047 HistoryProvider::HistoryProvider( QObject *parent, const char *name )
00048     : QObject( parent, name )
00049 {
00050     if ( !s_self )
00051     s_self = this;
00052 
00053     d = new HistoryProviderPrivate;
00054 }
00055 
00056 HistoryProvider::~HistoryProvider()
00057 {
00058     delete d;
00059 
00060     if ( s_self == this )
00061     s_self = 0;
00062 }
00063 
00064 bool HistoryProvider::contains( const QString& item ) const
00065 {
00066     return (bool) d->dict.find( item );
00067 }
00068 
00069 void HistoryProvider::insert( const QString& item )
00070 {
00071     // no need to allocate memory, we only want to have fast lookup, no mapping
00072     d->dict.replace( item, (void*) 1 );
00073     emit inserted( item );
00074 }
00075 
00076 void HistoryProvider::remove( const QString& item )
00077 {
00078     (void) d->dict.remove( item );
00079 }
00080 
00081 void HistoryProvider::clear()
00082 {
00083     d->dict.clear();
00084     emit cleared();
00085 }   
00086 
00087 void HistoryProvider::virtual_hook( int, void* )
00088 { /*BASE::virtual_hook( id, data );*/ }
00089 
00090 #include "historyprovider.moc"

KParts

Skip menu "KParts"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal