1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
/**
* @file llinventoryfilter.h
* @brief Support for filtering your inventory to only display a subset of the
* available items.
*
* $LicenseInfo:firstyear=2005&license=viewergpl$
*
* Copyright (c) 2005-2009, Linden Research, Inc.
*
* Second Life Viewer Source Code
* The source code in this file ("Source Code") is provided by Linden Lab
* to you under the terms of the GNU General Public License, version 2.0
* ("GPL"), unless you have obtained a separate licensing agreement
* ("Other License"), formally executed by you and Linden Lab. Terms of
* the GPL can be found in doc/GPL-license.txt in this distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#ifndef LLINVENTORYFILTER_H
#define LLINVENTORYFILTER_H
#include "llinventorytype.h"
#include "llpermissionsflags.h"
class LLFolderViewItem;
class LLInventoryFilter
{
public:
enum EFolderShow
{
SHOW_ALL_FOLDERS,
SHOW_NON_EMPTY_FOLDERS,
SHOW_NO_FOLDERS
};
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
};
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
};
// 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;
LLInventoryFilter(const std::string& name);
virtual ~LLInventoryFilter();
// +-------------------------------------------------------------------+
// + Parameters
// +-------------------------------------------------------------------+
void setFilterObjectTypes(U64 types);
U32 getFilterObjectTypes() const;
BOOL isFilterObjectTypesWith(LLInventoryType::EType t) const;
void setFilterCategoryTypes(U64 types);
void setFilterUUID(const LLUUID &object_id);
void setFilterWearableTypes(U64 types);
void setFilterSubString(const std::string& string);
const std::string& getFilterSubString(BOOL trim = FALSE) const;
const std::string& getFilterSubStringOrig() const { return mFilterSubStringOrig; }
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 setIncludeLinks(BOOL include_links);
BOOL getIncludeLinks() const;
// +-------------------------------------------------------------------+
// + Execution And Results
// +-------------------------------------------------------------------+
BOOL check(const LLFolderViewItem* item);
BOOL checkAgainstFilterType(const LLFolderViewItem* item) const;
BOOL checkAgainstPermissions(const LLFolderViewItem* item) const;
std::string::size_type getStringMatchOffset() const;
// +-------------------------------------------------------------------+
// + Presentation
// +-------------------------------------------------------------------+
void setShowFolderState( EFolderShow state);
EFolderShow getShowFolderState() const;
void setSortOrder(U32 order);
U32 getSortOrder() const;
void setEmptyLookupMessage(const std::string& message);
const std::string& getEmptyLookupMessage() 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);
private:
struct FilterOps
{
FilterOps();
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;
BOOL mIncludeLinks;
};
U32 mOrder;
U32 mLastLogoff;
FilterOps mFilterOps;
FilterOps mDefaultFilterOps;
std::string::size_type mSubStringMatchOffset;
std::string mFilterSubString;
std::string mFilterSubStringOrig;
const std::string mName;
S32 mFilterGeneration;
S32 mMustPassGeneration;
S32 mMinRequiredGeneration;
S32 mNextFilterGeneration;
S32 mFilterCount;
EFilterBehavior mFilterBehavior;
BOOL mModified;
BOOL mNeedTextRebuild;
std::string mFilterText;
std::string mEmptyLookupMessage;
};
#endif
|