equal
deleted
inserted
replaced
18 |
18 |
19 #include <list> |
19 #include <list> |
20 #include <memory> |
20 #include <memory> |
21 #include <string> |
21 #include <string> |
22 #include <time.h> |
22 #include <time.h> |
|
23 #include <algorithm> |
23 |
24 |
24 #include "pushregistryhandler.h" |
25 #include "pushregistryhandler.h" |
25 #include "coreinterface.h" |
26 #include "coreinterface.h" |
26 #include "rtcinterface.h" |
27 #include "rtcinterface.h" |
27 #include "commsendpoint.h" |
28 #include "commsendpoint.h" |
1053 /** |
1054 /** |
1054 * |
1055 * |
1055 */ |
1056 */ |
1056 void PushRegistryHandler::removeDriveFromContainer(const driveInfo& aDriveInfo) |
1057 void PushRegistryHandler::removeDriveFromContainer(const driveInfo& aDriveInfo) |
1057 { |
1058 { |
1058 for (driveInfos::iterator iter = mDriveInfo.begin(); iter != mDriveInfo.end();) |
1059 //Root path is unique for every drive and it is always available |
1059 { |
1060 //in the driveInfo so it is safe to compare equality of two driveInfo objects |
1060 //Root path is unique for every drive and it is always available |
1061 //with this value. |
1061 //in the driveInfo so it is safe to compare equality of two driveInfo objects |
1062 //In theory, there might be duplicate driveInfo objects with same root path |
1062 //with this value. |
1063 //in the vector, so it is better to loop through a whole vector. |
1063 //On the safe side, a whole list is looped through. |
1064 //Multiple objects can be removed from vector by stl's remove_if method. |
1064 if (aDriveInfo.iRootPath == iter->iRootPath) |
1065 DriveInfoComparisonUtil searchObj(aDriveInfo); |
1065 { |
1066 mDriveInfo.erase( remove_if(mDriveInfo.begin(),mDriveInfo.end(),searchObj) , |
1066 mDriveInfo.erase(iter); |
1067 mDriveInfo.end() ); |
1067 continue; |
|
1068 } |
|
1069 else |
|
1070 ++iter; |
|
1071 }//end for |
|
1072 } |
1068 } |
1073 |
1069 |
1074 /** |
1070 /** |
1075 * |
1071 * |
1076 */ |
1072 */ |