From 0f2f846a12936991f0434d5aac50c850d76ce2a4 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Thu, 3 Dec 2009 20:50:21 -0500 Subject: EXT-3125 : INFRASTRUCTURE : Cleanup LLInventoryFilter to disambiguate various filter options EXT-3124 : Add lookup for finding all linked items to an item LLInventoryFilter cleanup, including adding ability to lookup item by UUID. --HG-- branch : avatar-pipeline --- indra/newview/llinventoryfilter.h | 195 +++++++++++++++++++++++--------------- 1 file changed, 116 insertions(+), 79 deletions(-) (limited to 'indra/newview/llinventoryfilter.h') diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index b803df110b..20a4a15028 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -33,30 +33,38 @@ #ifndef LLINVENTORYFILTER_H #define LLINVENTORYFILTER_H -// lots of includes here #include "llinventorytype.h" -#include "llpermissionsflags.h" // PermissionsMask +#include "llpermissionsflags.h" class LLFolderViewItem; class LLInventoryFilter { public: - typedef enum e_folder_show + enum EFolderShow { SHOW_ALL_FOLDERS, SHOW_NON_EMPTY_FOLDERS, SHOW_NO_FOLDERS - } EFolderShow; + }; - typedef enum e_filter_behavior + enum EFilterBehavior { FILTER_NONE, // nothing to do, already filtered FILTER_RESTART, // restart filtering from scratch FILTER_LESS_RESTRICTIVE, // existing filtered items will certainly pass this filter FILTER_MORE_RESTRICTIVE // if you didn't pass the previous filter, you definitely won't pass this one - } EFilterBehavior; + }; + + enum EFilterType + { + FILTERTYPE_NONE, + FILTERTYPE_ITEM, // normal default search-by-item-type + FILTERTYPE_CATEGORY, // search by folder type + FILTERTYPE_UUID // find the object with UUID and any links to it + }; + // REFACTOR: Change this to an enum. static const U32 SO_DATE = 1; static const U32 SO_FOLDERS_BY_NAME = 2; static const U32 SO_SYSTEM_FOLDERS_TO_TOP = 4; @@ -64,89 +72,118 @@ public: LLInventoryFilter(const std::string& name); virtual ~LLInventoryFilter(); - void setFilterTypes(U64 types, BOOL filter_for_categories = FALSE); // if filter_for_categories is true, operate on folder preferred asset type - U32 getFilterTypes() const { return mFilterOps.mFilterTypes; } - - void setFilterSubString(const std::string& string); - const std::string getFilterSubString(BOOL trim = FALSE); - - void setFilterPermissions(PermissionMask perms); - PermissionMask getFilterPermissions() const { return mFilterOps.mPermissions; } - - void setDateRange(time_t min_date, time_t max_date); - void setDateRangeLastLogoff(BOOL sl); - time_t getMinDate() const { return mFilterOps.mMinDate; } - time_t getMaxDate() const { return mFilterOps.mMaxDate; } - - void setHoursAgo(U32 hours); - U32 getHoursAgo() const { return mFilterOps.mHoursAgo; } - - void setShowFolderState( EFolderShow state); - EFolderShow getShowFolderState() { return mFilterOps.mShowFolderState; } - - void setSortOrder(U32 order); - U32 getSortOrder() { return mOrder; } - - BOOL check(LLFolderViewItem* item); + // +-------------------------------------------------------------------+ + // + Execution And Results + // +-------------------------------------------------------------------+ + BOOL check(const LLFolderViewItem* item); + BOOL checkAgainstFilterType(const LLFolderViewItem* item); std::string::size_type getStringMatchOffset() const; - BOOL isActive(); - BOOL isNotDefault(); - BOOL isModified(); - BOOL isModifiedAndClear(); - BOOL isSinceLogoff(); - bool hasFilterString() { return mFilterSubString.size() > 0; } - void clearModified() { mModified = FALSE; mFilterBehavior = FILTER_NONE; } - const std::string getName() const { return mName; } - std::string getFilterText(); - void setFilterCount(S32 count) { mFilterCount = count; } - S32 getFilterCount() { return mFilterCount; } - void decrementFilterCount() { mFilterCount--; } + // +-------------------------------------------------------------------+ + // + Parameters + // +-------------------------------------------------------------------+ + void setFilterTypes(U64 types, EFilterType filter_type = FILTERTYPE_ITEM); + U32 getFilterTypes() const; + BOOL isFilterWith(LLInventoryType::EType t) const; + + void setFilterSubString(const std::string& string); + const std::string& getFilterSubString(BOOL trim = FALSE) const; + BOOL hasFilterString() const; + + void setFilterPermissions(PermissionMask perms); + PermissionMask getFilterPermissions() const; + + void setDateRange(time_t min_date, time_t max_date); + void setDateRangeLastLogoff(BOOL sl); + time_t getMinDate() const; + time_t getMaxDate() const; + + void setHoursAgo(U32 hours); + U32 getHoursAgo() const; + + void setShowFolderState( EFolderShow state); + EFolderShow getShowFolderState() const; + + void setSortOrder(U32 order); + U32 getSortOrder() const; + + // +-------------------------------------------------------------------+ + // + Status + // +-------------------------------------------------------------------+ + BOOL isActive() const; + BOOL isModified() const; + BOOL isModifiedAndClear(); + BOOL isSinceLogoff() const; + void clearModified(); + const std::string& getName() const; + const std::string& getFilterText(); + //RN: this is public to allow system to externally force a global refilter + void setModified(EFilterBehavior behavior = FILTER_RESTART); + + // +-------------------------------------------------------------------+ + // + Count + // +-------------------------------------------------------------------+ + void setFilterCount(S32 count); + S32 getFilterCount() const; + void decrementFilterCount(); + + // +-------------------------------------------------------------------+ + // + Default + // +-------------------------------------------------------------------+ + BOOL isNotDefault() const; + void markDefault(); + void resetDefault(); + + // +-------------------------------------------------------------------+ + // + Generation + // +-------------------------------------------------------------------+ + S32 getCurrentGeneration() const; + S32 getMinRequiredGeneration() const; + S32 getMustPassGeneration() const; + + // +-------------------------------------------------------------------+ + // + Conversion + // +-------------------------------------------------------------------+ + void toLLSD(LLSD& data) const; + void fromLLSD(LLSD& data); - void markDefault(); - void resetDefault(); +private: + struct FilterOps + { + FilterOps(); + EFilterType mFilterType; - BOOL isFilterWith(LLInventoryType::EType t); + U64 mFilterObjectTypes; // For _ITEM or _CATEGORY + LLUUID mFilterUUID; // for UUID - S32 getCurrentGeneration() const { return mFilterGeneration; } - S32 getMinRequiredGeneration() const { return mMinRequiredGeneration; } - S32 getMustPassGeneration() const { return mMustPassGeneration; } + time_t mMinDate; + time_t mMaxDate; + U32 mHoursAgo; + EFolderShow mShowFolderState; + PermissionMask mPermissions; + }; - //RN: this is public to allow system to externally force a global refilter - void setModified(EFilterBehavior behavior = FILTER_RESTART); + U32 mOrder; + U32 mLastLogoff; - void toLLSD(LLSD& data); - void fromLLSD(LLSD& data); + FilterOps mFilterOps; + FilterOps mDefaultFilterOps; -protected: - struct filter_ops - { - U64 mFilterTypes; - BOOL mFilterForCategories; - time_t mMinDate; - time_t mMaxDate; - U32 mHoursAgo; - EFolderShow mShowFolderState; - PermissionMask mPermissions; - }; - filter_ops mFilterOps; - filter_ops mDefaultFilterOps; std::string::size_type mSubStringMatchOffset; - std::string mFilterSubString; - U32 mOrder; - const std::string mName; - S32 mFilterGeneration; - S32 mMustPassGeneration; - S32 mMinRequiredGeneration; - S32 mFilterCount; - S32 mNextFilterGeneration; - EFilterBehavior mFilterBehavior; + std::string mFilterSubString; + const std::string mName; -private: - U32 mLastLogoff; - BOOL mModified; - BOOL mNeedTextRebuild; - std::string mFilterText; + S32 mFilterGeneration; + S32 mMustPassGeneration; + S32 mMinRequiredGeneration; + S32 mNextFilterGeneration; + + S32 mFilterCount; + EFilterBehavior mFilterBehavior; + + BOOL mModified; + BOOL mNeedTextRebuild; + std::string mFilterText; }; #endif -- cgit v1.2.3 From 71cd24b4799f8bc0bed2665cca103c39fec3a965 Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Thu, 3 Dec 2009 21:32:03 -0500 Subject: EXT-3124 : Add lookup for finding all linked items to an item Added ability to filter by UUID. Work in progress. --HG-- branch : avatar-pipeline --- indra/newview/llinventoryfilter.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llinventoryfilter.h') diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index 20a4a15028..47407eb86c 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -86,6 +86,8 @@ public: U32 getFilterTypes() const; BOOL isFilterWith(LLInventoryType::EType t) const; + void setFilterUUID(const LLUUID &object_id); + void setFilterSubString(const std::string& string); const std::string& getFilterSubString(BOOL trim = FALSE) const; BOOL hasFilterString() const; -- cgit v1.2.3 From 9b89325cc9a02c3305eb32148cc8de7dccf8808b Mon Sep 17 00:00:00 2001 From: Loren Shih Date: Fri, 4 Dec 2009 11:42:17 -0500 Subject: EXT-3124 : Add lookup for finding all linked items to an item Filter now works correctly. Made some naming changes (e.g. setFilterType -> setFilterObjectType) so that what you choose to filter by is more explicit. --HG-- branch : avatar-pipeline --- indra/newview/llinventoryfilter.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'indra/newview/llinventoryfilter.h') diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index 47407eb86c..d65fb8f27c 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -58,10 +58,10 @@ public: enum EFilterType { - FILTERTYPE_NONE, - FILTERTYPE_ITEM, // normal default search-by-item-type - FILTERTYPE_CATEGORY, // search by folder type - FILTERTYPE_UUID // find the object with UUID and any links to it + FILTERTYPE_NONE = 0, + FILTERTYPE_OBJECT = 1, // normal default search-by-object-type + FILTERTYPE_CATEGORY = 2, // search by folder type + FILTERTYPE_UUID = 4 // find the object with UUID and any links to it }; // REFACTOR: Change this to an enum. @@ -82,10 +82,10 @@ public: // +-------------------------------------------------------------------+ // + Parameters // +-------------------------------------------------------------------+ - void setFilterTypes(U64 types, EFilterType filter_type = FILTERTYPE_ITEM); - U32 getFilterTypes() const; - BOOL isFilterWith(LLInventoryType::EType t) const; - + void setFilterObjectTypes(U64 types); + U32 getFilterObjectTypes() const; + BOOL isFilterObjectTypesWith(LLInventoryType::EType t) const; + void setFilterCategoryTypes(U64 types); void setFilterUUID(const LLUUID &object_id); void setFilterSubString(const std::string& string); @@ -153,9 +153,10 @@ private: struct FilterOps { FilterOps(); - EFilterType mFilterType; + U32 mFilterTypes; - U64 mFilterObjectTypes; // For _ITEM or _CATEGORY + U64 mFilterObjectTypes; // For _ITEM + U64 mFilterCategoryTypes; // For _ITEM LLUUID mFilterUUID; // for UUID time_t mMinDate; -- cgit v1.2.3