historyprovider.cpp
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
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     
00072     d->dict.replace( item, (void*) 1 );
00073 }
00074 
00075 void HistoryProvider::remove( const QString& item )
00076 {
00077     (void) d->dict.remove( item );
00078 }
00079 
00080 void HistoryProvider::clear()
00081 {
00082     d->dict.clear();
00083     emit cleared();
00084 }   
00085 
00086 void HistoryProvider::virtual_hook( int, void* )
00087 {  }
00088 
00089 #include "historyprovider.moc"
 
This file is part of the documentation for kparts Library Version 3.2.0.