diff options
| author | Roxie Linden <roxie@lindenlab.com> | 2010-04-23 13:24:09 -0700 |
|---|---|---|
| committer | Roxie Linden <roxie@lindenlab.com> | 2010-04-23 13:24:09 -0700 |
| commit | a42dcc3f5e8dbddbc83500371bcb3d0ca8d91a3b (patch) | |
| tree | 3eafe790e4b51122d6d56c025856a8eb3ca36880 /indra/newview/llinventoryobserver.cpp | |
| parent | e1b3919a4fec68f57be6d6de2839dc31b654609f (diff) | |
| parent | e82ed4e8761be902cf3a4d80c337e0cd44d41b17 (diff) | |
automated merge
Diffstat (limited to 'indra/newview/llinventoryobserver.cpp')
| -rw-r--r-- | indra/newview/llinventoryobserver.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp index 29d99d328a..03006243f9 100644 --- a/indra/newview/llinventoryobserver.cpp +++ b/indra/newview/llinventoryobserver.cpp @@ -650,3 +650,35 @@ void LLInventoryTransactionObserver::changed(U32 mask) } } } + +void LLInventoryCategoriesObserver::changed(U32 mask) +{ + if (!mCategoryMap.size()) + return; + + for (category_map_t::iterator iter = mCategoryMap.begin(); + iter != mCategoryMap.end(); + iter++) + { + // Inventory category version is used to find out if some changes + // to a category have been made. + S32 version = gInventory.getCategory((*iter).first)->getVersion(); + if (version != (*iter).second.mVersion) + { + // Update category version in map. + (*iter).second.mVersion = version; + (*iter).second.mCallback(); + } + } +} + +void LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t cb) +{ + S32 version = gInventory.getCategory(cat_id)->getVersion(); + mCategoryMap.insert(category_map_value_t(cat_id, LLCategoryData(cb, version))); +} + +void LLInventoryCategoriesObserver::removeCategory(const LLUUID& cat_id) +{ + mCategoryMap.erase(mCategoryMap.find(cat_id)); +} |
