author | drw <drw> | 2003-02-06 01:19:25 (UTC) |
---|---|---|
committer | drw <drw> | 2003-02-06 01:19:25 (UTC) |
commit | 79588befde53765db0a92977c6890a4d226096e7 (patch) (unidiff) | |
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) (show 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() | |||
39 | availableCategories = "#"; | 39 | availableCategories = "#"; |
40 | |||
41 | serverList.setAutoDelete( TRUE ); | ||
42 | destList.setAutoDelete( TRUE ); | ||
40 | } | 43 | } |
@@ -45,10 +48,7 @@ DataManager::~DataManager() | |||
45 | 48 | ||
46 | vector<Server>::iterator DataManager :: getServer( const char *name ) | 49 | Server *DataManager :: getServer( const char *name ) |
47 | { | 50 | { |
48 | vector<Server>::iterator it = serverList.begin(); | 51 | QListIterator<Server> it( serverList ); |
49 | while ( it != serverList.end() ) | 52 | while ( it.current() && it.current()->getServerName() != name ) |
50 | { | 53 | { |
51 | if ( it->getServerName() == name ) | ||
52 | return it; | ||
53 | |||
54 | ++it; | 54 | ++it; |
@@ -56,13 +56,10 @@ vector<Server>::iterator DataManager :: getServer( const char *name ) | |||
56 | 56 | ||
57 | return serverList.end(); | 57 | return it.current(); |
58 | } | 58 | } |
59 | 59 | ||
60 | vector<Destination>::iterator DataManager :: getDestination( const char *name ) | 60 | Destination *DataManager :: getDestination( const char *name ) |
61 | { | 61 | { |
62 | vector<Destination>::iterator it = destList.begin(); | 62 | QListIterator<Destination> it( destList ); |
63 | while ( it != destList.end() ) | 63 | while ( it.current() && it.current()->getDestinationName() != name ) |
64 | { | 64 | { |
65 | if ( it->getDestinationName() == name ) | ||
66 | return it; | ||
67 | |||
68 | ++it; | 65 | ++it; |
@@ -70,3 +67,3 @@ vector<Destination>::iterator DataManager :: getDestination( const char *name ) | |||
70 | 67 | ||
71 | return destList.end(); | 68 | return it.current(); |
72 | } | 69 | } |
@@ -77,4 +74,4 @@ void DataManager :: loadServers() | |||
77 | // the local config (which packages are installed) | 74 | // the local config (which packages are installed) |
78 | serverList.push_back( Server( LOCAL_SERVER, "" ) ); | 75 | serverList.append( new Server( LOCAL_SERVER, "" ) ); |
79 | serverList.push_back( Server( LOCAL_IPKGS, "" ) ); | 76 | serverList.append( new Server( LOCAL_IPKGS, "" ) ); |
80 | 77 | ||
@@ -111,9 +108,9 @@ void DataManager :: loadServers() | |||
111 | sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); | 108 | sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); |
112 | Server s( alias, url ); | 109 | Server *s = new Server( alias, url ); |
113 | if ( lineStr.startsWith( "src" ) ) | 110 | if ( lineStr.startsWith( "src" ) ) |
114 | s.setActive( true ); | 111 | s->setActive( true ); |
115 | else | 112 | else |
116 | s.setActive( false ); | 113 | s->setActive( false ); |
117 | 114 | ||
118 | serverList.push_back( s ); | 115 | serverList.append( s ); |
119 | 116 | ||
@@ -125,3 +122,3 @@ void DataManager :: loadServers() | |||
125 | sscanf( lineStr, "%*[^ ] %s %s", alias, path ); | 122 | sscanf( lineStr, "%*[^ ] %s %s", alias, path ); |
126 | Destination d( alias, path ); | 123 | Destination *d = new Destination( alias, path ); |
127 | bool linkToRoot = true; | 124 | bool linkToRoot = true; |
@@ -132,5 +129,5 @@ void DataManager :: loadServers() | |||
132 | #endif | 129 | #endif |
133 | d.linkToRoot( linkToRoot ); | 130 | d->linkToRoot( linkToRoot ); |
134 | 131 | ||
135 | destList.push_back( d ); | 132 | destList.append( d ); |
136 | } | 133 | } |
@@ -171,11 +168,14 @@ void DataManager :: reloadServerData( ) | |||
171 | { | 168 | { |
172 | emit progressSetSteps( serverList.size() ); | 169 | emit progressSetSteps( serverList.count() ); |
173 | emit progressSetMessage( tr( "Reading configuration..." ) ); | 170 | emit progressSetMessage( tr( "Reading configuration..." ) ); |
174 | 171 | ||
175 | vector<Server>::iterator it = serverList.begin(); | ||
176 | QString serverName; | 172 | QString serverName; |
177 | int i = 0; | 173 | int i = 0; |
178 | for ( it = serverList.begin() ; it != serverList.end() ; ++it ) | 174 | |
175 | Server *server; | ||
176 | QListIterator<Server> it( serverList ); | ||
177 | for ( ; it.current(); ++it ) | ||
179 | { | 178 | { |
180 | serverName = it->getServerName(); | 179 | server = it.current(); |
180 | serverName = server->getServerName(); | ||
181 | i++; | 181 | i++; |
@@ -190,7 +190,7 @@ void DataManager :: reloadServerData( ) | |||
190 | if ( serverName == LOCAL_SERVER ) | 190 | if ( serverName == LOCAL_SERVER ) |
191 | it->readStatusFile( destList ); | 191 | server->readStatusFile( destList ); |
192 | else if ( serverName == LOCAL_IPKGS ) | 192 | else if ( serverName == LOCAL_IPKGS ) |
193 | it->readLocalIpks( &( *getServer( LOCAL_SERVER ) ) ); | 193 | server->readLocalIpks( getServer( LOCAL_SERVER ) ); |
194 | else | 194 | else |
195 | it->readPackageFile( &( *getServer( LOCAL_SERVER ) ) ); | 195 | server->readPackageFile( getServer( LOCAL_SERVER ) ); |
196 | } | 196 | } |
@@ -219,6 +219,8 @@ void DataManager :: writeOutIpkgConf() | |||
219 | // Write out servers | 219 | // Write out servers |
220 | vector<Server>::iterator it = serverList.begin(); | 220 | Server *server; |
221 | while ( it != serverList.end() ) | 221 | QListIterator<Server> it( serverList ); |
222 | while ( it.current() ) | ||
222 | { | 223 | { |
223 | QString alias = it->getServerName(); | 224 | server = it.current(); |
225 | QString alias = server->getServerName(); | ||
224 | // Don't write out local as its a dummy | 226 | // Don't write out local as its a dummy |
@@ -226,5 +228,5 @@ void DataManager :: writeOutIpkgConf() | |||
226 | { | 228 | { |
227 | QString url = it->getServerUrl();; | 229 | QString url = server->getServerUrl();; |
228 | 230 | ||
229 | if ( !it->isServerActive() ) | 231 | if ( !server->isServerActive() ) |
230 | out << "#"; | 232 | out << "#"; |
@@ -233,3 +235,3 @@ void DataManager :: writeOutIpkgConf() | |||
233 | 235 | ||
234 | it++; | 236 | ++it; |
235 | } | 237 | } |
@@ -239,7 +241,7 @@ void DataManager :: writeOutIpkgConf() | |||
239 | // Write out destinations | 241 | // Write out destinations |
240 | vector<Destination>::iterator it2 = destList.begin(); | 242 | QListIterator<Destination> it2( destList ); |
241 | while ( it2 != destList.end() ) | 243 | while ( it2.current() ) |
242 | { | 244 | { |
243 | out << "dest " << it2->getDestinationName() << " " << it2->getDestinationPath() << endl; | 245 | out << "dest " << it2.current()->getDestinationName() << " " << it2.current()->getDestinationPath() << endl; |
244 | it2++; | 246 | ++it2; |
245 | } | 247 | } |