diff options
Diffstat (limited to 'indra/newview/llinventoryfilter.h')
-rw-r--r-- | indra/newview/llinventoryfilter.h | 145 |
1 files changed, 111 insertions, 34 deletions
diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index 6be2acfaa3..7f33be3878 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -34,7 +34,7 @@ class LLFolderViewItem; class LLFolderViewFolder; class LLInventoryItem; -class LLInventoryFilter +class LLInventoryFilter : public LLFolderViewFilter { public: enum EFolderShow @@ -53,13 +53,13 @@ public: }; enum EFilterType { - FILTERTYPE_NONE = 0, - FILTERTYPE_OBJECT = 0x1 << 0, // normal default search-by-object-type - FILTERTYPE_CATEGORY = 0x1 << 1, // search by folder type - FILTERTYPE_UUID = 0x1 << 2, // find the object with UUID and any links to it - FILTERTYPE_DATE = 0x1 << 3, // search by date range - FILTERTYPE_WEARABLE = 0x1 << 4, // search by wearable type - FILTERTYPE_EMPTYFOLDERS = 0x1 << 5 // pass if folder is not a system folder to be hidden if empty + FILTERTYPE_NONE = 0, + FILTERTYPE_OBJECT = 0x1 << 0, // normal default search-by-object-type + FILTERTYPE_CATEGORY = 0x1 << 1, // search by folder type + FILTERTYPE_UUID = 0x1 << 2, // find the object with UUID and any links to it + FILTERTYPE_DATE = 0x1 << 3, // search by date range + FILTERTYPE_WEARABLE = 0x1 << 4, // search by wearable type + FILTERTYPE_EMPTYFOLDERS = 0x1 << 5 // pass if folder is not a system folder to be hidden if }; enum EFilterLink @@ -71,13 +71,87 @@ public: enum ESortOrderType { - SO_NAME = 0, // Sort inventory by name - SO_DATE = 0x1, // Sort inventory by date - SO_FOLDERS_BY_NAME = 0x1 << 1, // Force folder sort by name - SO_SYSTEM_FOLDERS_TO_TOP = 0x1 << 2 // Force system folders to be on top + SO_NAME = 0, // Sort inventory by name + SO_DATE = 0x1, // Sort inventory by date + SO_FOLDERS_BY_NAME = 0x1 << 1, // Force folder sort by name + SO_SYSTEM_FOLDERS_TO_TOP = 0x1 << 2 // Force system folders to be on top }; - LLInventoryFilter(const std::string& name); + struct FilterOps + { + struct DateRange : public LLInitParam::Block<DateRange> + { + Optional<time_t> min_date; + Optional<time_t> max_date; + + DateRange() + : min_date("min_date", time_min()), + max_date("max_date", time_max()) + {} + + bool validateBlock(bool emit_errors = true); + }; + + struct Params : public LLInitParam::Block<Params> + { + Optional<U32> types; + Optional<U64> object_types, + wearable_types, + category_types; + Optional<EFilterLink> links; + Optional<LLUUID> uuid; + Optional<DateRange> date_range; + Optional<S32> hours_ago; + Optional<EFolderShow> show_folder_state; + Optional<PermissionMask> permissions; + + Params() + : types("filter_types", FILTERTYPE_OBJECT), + object_types("object_types", 0xffffFFFFffffFFFFULL), + wearable_types("wearable_types", 0xffffFFFFffffFFFFULL), + category_types("category_types", 0xffffFFFFffffFFFFULL), + links("links", FILTERLINK_INCLUDE_LINKS), + uuid("uuid"), + date_range("date_range"), + hours_ago("hours_ago", 0), + show_folder_state("show_folder_state", SHOW_NON_EMPTY_FOLDERS), + permissions("permissions", PERM_NONE) + {} + }; + + FilterOps(const Params& = Params()); + + U32 mFilterTypes; + + U64 mFilterObjectTypes; // For _OBJECT + U64 mFilterWearableTypes; + U64 mFilterCategoryTypes; // For _CATEGORY + LLUUID mFilterUUID; // for UUID + + time_t mMinDate; + time_t mMaxDate; + U32 mHoursAgo; + EFolderShow mShowFolderState; + PermissionMask mPermissions; + U64 mFilterLinks; + }; + + struct Params : public LLInitParam::Block<Params> + { + Optional<FilterOps::Params> filter_ops; + Optional<std::string> substring; + Optional<U32> sort_order; + Optional<bool> since_logoff; + + Params() + : filter_ops(""), + substring("substring"), + sort_order("sort_order"), + since_logoff("since_logoff") + {} + }; + + LLInventoryFilter(const std::string& name, const Params& p); virtual ~LLInventoryFilter(); // +-------------------------------------------------------------------+ @@ -86,7 +160,7 @@ public: void setFilterObjectTypes(U64 types); U64 getFilterObjectTypes() const; U64 getFilterCategoryTypes() const; - BOOL isFilterObjectTypesWith(LLInventoryType::EType t) const; + bool isFilterObjectTypesWith(LLInventoryType::EType t) const; void setFilterCategoryTypes(U64 types); void setFilterUUID(const LLUUID &object_id); void setFilterWearableTypes(U64 types); @@ -96,7 +170,7 @@ public: void setFilterSubString(const std::string& string); const std::string& getFilterSubString(BOOL trim = FALSE) const; const std::string& getFilterSubStringOrig() const { return mFilterSubStringOrig; } - BOOL hasFilterString() const; + bool hasFilterString() const; void setFilterPermissions(PermissionMask perms); PermissionMask getFilterPermissions() const; @@ -115,18 +189,17 @@ public: // +-------------------------------------------------------------------+ // + Execution And Results // +-------------------------------------------------------------------+ - BOOL check(const LLFolderViewItem* item); + bool check(const LLFolderViewItem* item); bool check(const LLInventoryItem* item); bool checkFolder(const LLFolderViewFolder* folder) const; bool checkFolder(const LLUUID& folder_id) const; - BOOL checkAgainstFilterType(const LLFolderViewItem* item) const; + bool checkAgainstFilterType(const LLFolderViewItem* item) const; bool checkAgainstFilterType(const LLInventoryItem* item) const; - BOOL checkAgainstPermissions(const LLFolderViewItem* item) const; + bool checkAgainstPermissions(const LLFolderViewItem* item) const; bool checkAgainstPermissions(const LLInventoryItem* item) const; - BOOL checkAgainstFilterLinks(const LLFolderViewItem* item) const; - - std::string::size_type getStringMatchOffset() const; + bool checkAgainstFilterLinks(const LLFolderViewItem* item) const; + std::string::size_type getStringMatchOffset(LLFolderViewItem* item) const; // +-------------------------------------------------------------------+ // + Presentation // +-------------------------------------------------------------------+ @@ -142,10 +215,10 @@ public: // +-------------------------------------------------------------------+ // + Status // +-------------------------------------------------------------------+ - BOOL isActive() const; - BOOL isModified() const; - BOOL isModifiedAndClear(); - BOOL isSinceLogoff() const; + bool isActive() const; + bool isModified() const; + bool isModifiedAndClear(); + bool isSinceLogoff() const; void clearModified(); const std::string& getName() const; const std::string& getFilterText(); @@ -162,7 +235,7 @@ public: // +-------------------------------------------------------------------+ // + Default // +-------------------------------------------------------------------+ - BOOL isNotDefault() const; + bool isNotDefault() const; void markDefault(); void resetDefault(); @@ -170,14 +243,17 @@ public: // + Generation // +-------------------------------------------------------------------+ S32 getCurrentGeneration() const; - S32 getMinRequiredGeneration() const; - S32 getMustPassGeneration() const; + S32 getFirstSuccessGeneration() const; + S32 getFirstRequiredGeneration() const; + // +-------------------------------------------------------------------+ // + Conversion // +-------------------------------------------------------------------+ - void toLLSD(LLSD& data) const; - void fromLLSD(LLSD& data); + void toParams(Params& params) const; + void fromParams(const Params& p); + + LLInventoryFilter& operator =(const LLInventoryFilter& other); private: bool areDateLimitsSet(); @@ -203,7 +279,8 @@ private: U32 mOrder; U32 mLastLogoff; - FilterOps mFilterOps; + std::string::size_type mSubStringMatchOffset; + FilterOps mFilterOps; FilterOps mDefaultFilterOps; std::string::size_type mSubStringMatchOffset; @@ -211,9 +288,9 @@ private: std::string mFilterSubStringOrig; const std::string mName; - S32 mFilterGeneration; - S32 mMustPassGeneration; - S32 mMinRequiredGeneration; + S32 mLastSuccessGeneration; + S32 mLastFailGeneration; + S32 mFirstSuccessGeneration; S32 mNextFilterGeneration; S32 mFilterCount; |