diff options
Diffstat (limited to 'indra/newview/llinventoryobserver.h')
-rw-r--r-- | indra/newview/llinventoryobserver.h | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index c48ffaa55d..036e6ca40d 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -148,7 +148,6 @@ public: virtual void done() = 0; protected: - BOOL mDone; LLInventoryFetchItemsObserver *mFetchItems; LLInventoryFetchDescendentsObserver *mFetchDescendents; }; @@ -262,5 +261,49 @@ protected: uuid_vec_t mIncomplete; }; -#endif // LL_LLINVENTORYOBSERVERS_H +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLInventoryCategoriesObserver +// +// This class is used for monitoring a list of inventory categories +// and firing a callback when there are changes in any of them. +// Categories are identified by their UUIDs. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLInventoryCategoriesObserver : public LLInventoryObserver +{ +public: + typedef boost::function<void()> callback_t; + + LLInventoryCategoriesObserver() {}; + virtual void changed(U32 mask); + + /** + * Add cat_id to the list of observed categories with a + * callback fired on category being changed. + * + * @return "true" if category was added, "false" if it could + * not be found. + */ + bool addCategory(const LLUUID& cat_id, callback_t cb); + void removeCategory(const LLUUID& cat_id); +protected: + struct LLCategoryData + { + LLCategoryData(callback_t cb, S32 version, S32 num_descendents) + : mCallback(cb) + , mVersion(version) + , mDescendentsCount(num_descendents) + {} + + callback_t mCallback; + S32 mVersion; + S32 mDescendentsCount; + }; + + typedef std::map<LLUUID, LLCategoryData> category_map_t; + typedef category_map_t::value_type category_map_value_t; + + category_map_t mCategoryMap; +}; + +#endif // LL_LLINVENTORYOBSERVERS_H |