author | drw <drw> | 2003-02-06 01:19:25 (UTC) |
---|---|---|
committer | drw <drw> | 2003-02-06 01:19:25 (UTC) |
commit | 79588befde53765db0a92977c6890a4d226096e7 (patch) (side-by-side diff) | |
tree | 83b6dd14c49733b9759fad04147bf0bee50793fe /noncore/settings/aqpkg/datamgr.cpp | |
parent | bbb3690f12191763a407e6a0edd521113b3c25ac (diff) | |
download | opie-79588befde53765db0a92977c6890a4d226096e7.zip opie-79588befde53765db0a92977c6890a4d226096e7.tar.gz opie-79588befde53765db0a92977c6890a4d226096e7.tar.bz2 |
Change all vector<> to QList<>. First step in removing dependency on libstdc++.
Diffstat (limited to 'noncore/settings/aqpkg/datamgr.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/datamgr.cpp | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp index 2c83e28..79f36e1 100644 --- a/noncore/settings/aqpkg/datamgr.cpp +++ b/noncore/settings/aqpkg/datamgr.cpp @@ -39,2 +39,5 @@ DataManager::DataManager() availableCategories = "#"; + + serverList.setAutoDelete( TRUE ); + destList.setAutoDelete( TRUE ); } @@ -45,10 +48,7 @@ DataManager::~DataManager() -vector<Server>::iterator DataManager :: getServer( const char *name ) +Server *DataManager :: getServer( const char *name ) { - vector<Server>::iterator it = serverList.begin(); - while ( it != serverList.end() ) + QListIterator<Server> it( serverList ); + while ( it.current() && it.current()->getServerName() != name ) { - if ( it->getServerName() == name ) - return it; - ++it; @@ -56,13 +56,10 @@ vector<Server>::iterator DataManager :: getServer( const char *name ) - return serverList.end(); + return it.current(); } -vector<Destination>::iterator DataManager :: getDestination( const char *name ) +Destination *DataManager :: getDestination( const char *name ) { - vector<Destination>::iterator it = destList.begin(); - while ( it != destList.end() ) + QListIterator<Destination> it( destList ); + while ( it.current() && it.current()->getDestinationName() != name ) { - if ( it->getDestinationName() == name ) - return it; - ++it; @@ -70,3 +67,3 @@ vector<Destination>::iterator DataManager :: getDestination( const char *name ) - return destList.end(); + return it.current(); } @@ -77,4 +74,4 @@ void DataManager :: loadServers() // the local config (which packages are installed) - serverList.push_back( Server( LOCAL_SERVER, "" ) ); - serverList.push_back( Server( LOCAL_IPKGS, "" ) ); + serverList.append( new Server( LOCAL_SERVER, "" ) ); + serverList.append( new Server( LOCAL_IPKGS, "" ) ); @@ -111,9 +108,9 @@ void DataManager :: loadServers() sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); - Server s( alias, url ); + Server *s = new Server( alias, url ); if ( lineStr.startsWith( "src" ) ) - s.setActive( true ); + s->setActive( true ); else - s.setActive( false ); + s->setActive( false ); - serverList.push_back( s ); + serverList.append( s ); @@ -125,3 +122,3 @@ void DataManager :: loadServers() sscanf( lineStr, "%*[^ ] %s %s", alias, path ); - Destination d( alias, path ); + Destination *d = new Destination( alias, path ); bool linkToRoot = true; @@ -132,5 +129,5 @@ void DataManager :: loadServers() #endif - d.linkToRoot( linkToRoot ); + d->linkToRoot( linkToRoot ); - destList.push_back( d ); + destList.append( d ); } @@ -171,11 +168,14 @@ void DataManager :: reloadServerData( ) { - emit progressSetSteps( serverList.size() ); + emit progressSetSteps( serverList.count() ); emit progressSetMessage( tr( "Reading configuration..." ) ); - vector<Server>::iterator it = serverList.begin(); QString serverName; int i = 0; - for ( it = serverList.begin() ; it != serverList.end() ; ++it ) + + Server *server; + QListIterator<Server> it( serverList ); + for ( ; it.current(); ++it ) { - serverName = it->getServerName(); + server = it.current(); + serverName = server->getServerName(); i++; @@ -190,7 +190,7 @@ void DataManager :: reloadServerData( ) if ( serverName == LOCAL_SERVER ) - it->readStatusFile( destList ); + server->readStatusFile( destList ); else if ( serverName == LOCAL_IPKGS ) - it->readLocalIpks( &( *getServer( LOCAL_SERVER ) ) ); + server->readLocalIpks( getServer( LOCAL_SERVER ) ); else - it->readPackageFile( &( *getServer( LOCAL_SERVER ) ) ); + server->readPackageFile( getServer( LOCAL_SERVER ) ); } @@ -219,6 +219,8 @@ void DataManager :: writeOutIpkgConf() // Write out servers - vector<Server>::iterator it = serverList.begin(); - while ( it != serverList.end() ) + Server *server; + QListIterator<Server> it( serverList ); + while ( it.current() ) { - QString alias = it->getServerName(); + server = it.current(); + QString alias = server->getServerName(); // Don't write out local as its a dummy @@ -226,5 +228,5 @@ void DataManager :: writeOutIpkgConf() { - QString url = it->getServerUrl();; + QString url = server->getServerUrl();; - if ( !it->isServerActive() ) + if ( !server->isServerActive() ) out << "#"; @@ -233,3 +235,3 @@ void DataManager :: writeOutIpkgConf() - it++; + ++it; } @@ -239,7 +241,7 @@ void DataManager :: writeOutIpkgConf() // Write out destinations - vector<Destination>::iterator it2 = destList.begin(); - while ( it2 != destList.end() ) + QListIterator<Destination> it2( destList ); + while ( it2.current() ) { - out << "dest " << it2->getDestinationName() << " " << it2->getDestinationPath() << endl; - it2++; + out << "dest " << it2.current()->getDestinationName() << " " << it2.current()->getDestinationPath() << endl; + ++it2; } |