diff options
author | Loren Shih <seraph@lindenlab.com> | 2010-04-06 18:58:26 -0400 |
---|---|---|
committer | Loren Shih <seraph@lindenlab.com> | 2010-04-06 18:58:26 -0400 |
commit | f096f02278f3b8c8fdd962c85b237492defa93ec (patch) | |
tree | a1016d9087ba0bad73895dee4280a195a0c01f0e /indra/newview/llinventoryobserver.h | |
parent | c3d9316dff568d5265d856a708e3909deae09f18 (diff) |
EXT-6728 : Have LLInventoryFetchItems/DescendentsObserver inherit from a base abstract LLInventoryFetchObserver class
Added a new abstract class LLInventoryFetchObserver from which LLInventoryFetchItems and LLInventoryFetchDescendents inherit.
Also changed isEverythingComplete to isFinished and made some other minor superficial changes.
Diffstat (limited to 'indra/newview/llinventoryobserver.h')
-rw-r--r-- | indra/newview/llinventoryobserver.h | 69 |
1 files changed, 41 insertions, 28 deletions
diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h index 420afdfadc..7480b7e7af 100644 --- a/indra/newview/llinventoryobserver.h +++ b/indra/newview/llinventoryobserver.h @@ -73,57 +73,70 @@ public: }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Class LLInventoryFetchItemsObserver +// Class LLInventoryFetchObserver // -// Fetches inventory items, calls done() when all inventory has arrived. +// Abstract class to handle fetching items, folders, etc. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -class LLInventoryFetchItemsObserver : public LLInventoryObserver +class LLInventoryFetchObserver : public LLInventoryObserver { public: - LLInventoryFetchItemsObserver(bool retry_if_missing = false); // deprecated - LLInventoryFetchItemsObserver(const LLUUID& item_id, bool retry_if_missing = false); // single item - LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids, bool retry_if_missing = false); // multiple items - virtual void changed(U32 mask); + LLInventoryFetchObserver(const LLUUID& id = LLUUID::null); // single item + LLInventoryFetchObserver(const uuid_vec_t& ids); // multiple items + void setFetchID(const LLUUID& id); + void setFetchIDs(const uuid_vec_t& ids); - bool isEverythingComplete() const; - void setItems(const uuid_vec_t& ids) { mIDs = ids; } - void startFetch(); + BOOL isFinished() const; - virtual void done() {}; + virtual void startFetch() = 0; + virtual void done() = 0; + virtual void changed(U32 mask) = 0; protected: - bool mRetryIfMissing; uuid_vec_t mComplete; uuid_vec_t mIncomplete; uuid_vec_t mIDs; }; + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Class LLInventoryFetchItemsObserver +// +// Fetches inventory items, calls done() when all inventory has arrived. +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLInventoryFetchItemsObserver : public LLInventoryFetchObserver +{ +public: + // LLInventoryFetchItemsObserver(BOOL retry_if_missing = FALSE); + LLInventoryFetchItemsObserver(const LLUUID& item_id = LLUUID::null, + BOOL retry_if_missing = FALSE); + LLInventoryFetchItemsObserver(const uuid_vec_t& item_ids, + BOOL retry_if_missing = FALSE); + + /*virtual*/ void startFetch(); + /*virtual*/ void changed(U32 mask); + /*virtual*/ void done(); + +protected: + BOOL mRetryIfMissing; +}; + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLInventoryFetchDescendentsObserver // // Fetches children of a category/folder, calls done() when all // inventory has arrived. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLInventoryFetchDescendentsObserver : public LLInventoryObserver +class LLInventoryFetchDescendentsObserver : public LLInventoryFetchObserver { public: - LLInventoryFetchDescendentsObserver(); - LLInventoryFetchDescendentsObserver(const LLUUID& cat_id); + // LLInventoryFetchDescendentsObserver(); + LLInventoryFetchDescendentsObserver(const LLUUID& cat_id = LLUUID::null); LLInventoryFetchDescendentsObserver(const uuid_vec_t& cat_ids); - virtual void changed(U32 mask); - - void setFolders(const uuid_vec_t& cat_ids) { mIDs = cat_ids; } - void setFolders(const LLUUID& cat_id) { mIDs.clear(); mIDs.push_back(cat_id); } - void startFetch(); - bool isEverythingComplete() const; - virtual void done() = 0; + /*virtual*/ void startFetch(); + /*virtual*/ void changed(U32 mask); protected: - bool isComplete(LLViewerInventoryCategory* cat); - uuid_vec_t mIncomplete; - uuid_vec_t mComplete; - uuid_vec_t mIDs; + BOOL isCategoryComplete(const LLViewerInventoryCategory* cat) const; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -137,7 +150,7 @@ protected: class LLInventoryFetchComboObserver : public LLInventoryObserver { public: - LLInventoryFetchComboObserver() : mDone(false) {} + LLInventoryFetchComboObserver() : mDone(FALSE) {} virtual void changed(U32 mask); void startFetch(const uuid_vec_t& folder_ids, const uuid_vec_t& item_ids); |