summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryobserver.cpp
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-04-21 16:58:28 +0300
committerVadim Savchuk <vsavchuk@productengine.com>2010-04-21 16:58:28 +0300
commit85e47b0cf058c3999bdcc3ae3cc7585fdefaa581 (patch)
tree628c64e1992df6fa57248c03385284d30f61a867 /indra/newview/llinventoryobserver.cpp
parent74df84be94b93f6068acd2619859a574343be41d (diff)
parent2ce7556e53544e50a4d4d28705976655cafa6992 (diff)
merge
--HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llinventoryobserver.cpp')
-rw-r--r--indra/newview/llinventoryobserver.cpp32
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));
+}