diff options
author | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2010-04-27 10:20:30 +0300 |
---|---|---|
committer | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2010-04-27 10:20:30 +0300 |
commit | ca07973e3ebd0ed1b18325a077ba4553d051c662 (patch) | |
tree | a0f9de9cab2b374195301cb6b783af7750d603f4 /indra/newview/lloutfitslist.cpp | |
parent | 17f2234a96d11a78726a77285b77dd25721ab8ce (diff) |
Making use of LLCommonUtils::computeDifference.
Replaced duplicating code with generic function LLCommonUtils::computeDifference()
Reviewed by Vadim Savchuk - https://codereview.productengine.com/secondlife/r/313/
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/lloutfitslist.cpp')
-rw-r--r-- | indra/newview/lloutfitslist.cpp | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 1c627d452f..1215272685 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -36,6 +36,9 @@ // llcommon #include "llcommonutils.h" +// llcommon +#include "llcommonutils.h" + #include "llaccordionctrl.h" #include "llaccordionctrltab.h" #include "llinventoryfunctions.h" @@ -119,31 +122,11 @@ void LLOutfitsList::refreshList(const LLUUID& category_id) LLInventoryModel::EXCLUDE_TRASH, is_category); - uuid_vec_t vnew; - - // Creating a vector of newly collected sub-categories UUIDs. - for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin(); - iter != cat_array.end(); - ++iter) - { - vnew.push_back((*iter)->getUUID()); - } - - uuid_vec_t vcur; - - // Creating a vector of currently displayed sub-categories UUIDs. - for (outfits_map_t::const_iterator iter = mOutfitsMap.begin(); - iter != mOutfitsMap.end(); - ++iter) - { - vcur.push_back((*iter).first); - } - uuid_vec_t vadded; uuid_vec_t vremoved; // Create added and removed items vectors. - LLCommonUtils::computeDifference(vnew, vcur, vadded, vremoved); + computeDifference(cat_array, vadded, vremoved); // Handle added tabs. for (uuid_vec_t::const_iterator iter = vadded.begin(); @@ -274,4 +257,30 @@ LLXMLNodePtr LLOutfitsList::getAccordionTabXMLNode() return xmlNode; } +void LLOutfitsList::computeDifference( + const LLInventoryModel::cat_array_t& vcats, + uuid_vec_t& vadded, + uuid_vec_t& vremoved) +{ + uuid_vec_t vnew; + // Creating a vector of newly collected sub-categories UUIDs. + for (LLInventoryModel::cat_array_t::const_iterator iter = vcats.begin(); + iter != vcats.end(); + iter++) + { + vnew.push_back((*iter)->getUUID()); + } + + uuid_vec_t vcur; + // Creating a vector of currently displayed sub-categories UUIDs. + for (outfits_map_t::const_iterator iter = mOutfitsMap.begin(); + iter != mOutfitsMap.end(); + iter++) + { + vcur.push_back((*iter).first); + } + + LLCommonUtils::computeDifference(vnew, vcur, vadded, vremoved); +} + // EOF |