kabc Library API Documentation

bigwrite.cpp

00001 #include <sys/times.h> 00002 00003 #include <kaboutdata.h> 00004 #include <kapplication.h> 00005 #include <kdebug.h> 00006 #include <klocale.h> 00007 #include <kcmdlineargs.h> 00008 00009 #include "addressbook.h" 00010 #include "vcardformat.h" 00011 #include "plugins/file/resourcefile.h" 00012 00013 using namespace KABC; 00014 00015 int main(int argc,char **argv) 00016 { 00017 KAboutData aboutData("bigwrite","BigWriteKabc","0.1"); 00018 KCmdLineArgs::init(argc,argv,&aboutData); 00019 00020 KApplication app( false, false ); 00021 00022 AddressBook ab; 00023 ResourceFile r( "my.kabc", "vcard" ); 00024 ab.addResource( &r ); 00025 00026 for( int i = 0; i < 5000; ++i ) { 00027 Addressee a; 00028 a.setGivenName( "number" + QString::number( i ) ); 00029 a.setFamilyName( "Name" ); 00030 a.insertEmail( QString::number( i ) + "@domain" ); 00031 00032 ab.insertAddressee( a ); 00033 } 00034 printf( "\n" ); 00035 00036 Ticket *t = ab.requestSaveTicket( &r ); 00037 if ( t ) { 00038 struct tms start; 00039 00040 times( &start ); 00041 00042 #if 0 00043 kdDebug() << "utime : " << int( start.tms_utime ) << endl; 00044 kdDebug() << "stime : " << int( start.tms_stime ) << endl; 00045 kdDebug() << "cutime: " << int( start.tms_cutime ) << endl; 00046 kdDebug() << "cstime: " << int( start.tms_cstime ) << endl; 00047 #endif 00048 00049 if ( !ab.save( t ) ) { 00050 kdDebug() << "Can't save." << endl; 00051 } 00052 00053 struct tms end; 00054 00055 times( &end ); 00056 00057 #if 0 00058 kdDebug() << "utime : " << int( end.tms_utime ) << endl; 00059 kdDebug() << "stime : " << int( end.tms_stime ) << endl; 00060 kdDebug() << "cutime: " << int( end.tms_cutime ) << endl; 00061 kdDebug() << "cstime: " << int( end.tms_cstime ) << endl; 00062 #endif 00063 00064 kdDebug() << "UTime: " << int( end.tms_utime ) - int( start.tms_utime ) << endl; 00065 kdDebug() << "STime: " << int( end.tms_stime ) - int( start.tms_stime ) << endl; 00066 00067 } else { 00068 kdDebug() << "No ticket for save." << endl; 00069 } 00070 }
KDE Logo
This file is part of the documentation for kabc Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Aug 30 22:56:00 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003