diff options
| author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-04-30 10:31:34 -0700 |
|---|---|---|
| committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-04-30 10:31:34 -0700 |
| commit | 5d80f70a9cbcf5cb923c34ea4a2619e3d3df1aa9 (patch) | |
| tree | 346afdb3be5459bb2b3a6eda10d451dbb79a7ad4 /indra/newview/llpersonmodelcommon.cpp | |
| parent | 6691d99eb01edfd02d122ae2c9d1761014142414 (diff) | |
| parent | 44ba579bb8897bab3ddeaa279587068abdb10c0d (diff) | |
merge
Diffstat (limited to 'indra/newview/llpersonmodelcommon.cpp')
| -rw-r--r-- | indra/newview/llpersonmodelcommon.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/indra/newview/llpersonmodelcommon.cpp b/indra/newview/llpersonmodelcommon.cpp index bea7f3d45e..4e54562f18 100644 --- a/indra/newview/llpersonmodelcommon.cpp +++ b/indra/newview/llpersonmodelcommon.cpp @@ -157,3 +157,65 @@ LLPersonModel::LLPersonModel(LLFolderViewModelInterface& root_view_model) : LLPersonModelCommon(root_view_model) { } + +// +// LLPersonViewFilter +// + +LLPersonViewFilter::LLPersonViewFilter() : + mEmpty(""), + mFilterSubString(""), + mFilterModified(FILTER_NONE) +{ +} + +void LLPersonViewFilter::setFilterSubString(const std::string& string) +{ + std::string filter_sub_string_new = string; + LLStringUtil::trimHead(filter_sub_string_new); + LLStringUtil::toUpper(filter_sub_string_new); + + if (mFilterSubString != filter_sub_string_new) + { + mFilterSubString = filter_sub_string_new; + } +} + +std::string::size_type LLPersonViewFilter::getFilterStringSize() const +{ + return mFilterSubString.size(); +} + +bool LLPersonViewFilter::check(const LLFolderViewModelItem* item) +{ + //const LLPersonModelCommon* person = dynamic_cast<const LLPersonModelCommon*>(item); + std::string::size_type string_offset = mFilterSubString.size() ? item->getSearchableName().find(mFilterSubString) : std::string::npos; + + return (mFilterSubString.size() == 0 || string_offset != std::string::npos); +} + +bool LLPersonViewFilter::showAllResults() const +{ + return mFilterSubString.size() > 0; +} + +std::string::size_type LLPersonViewFilter::getStringMatchOffset(LLFolderViewModelItem* item) const +{ + return mFilterSubString.size() ? item->getSearchableName().find(mFilterSubString) : std::string::npos; +} + +bool LLPersonViewFilter::isActive() const +{ + return mFilterSubString.size(); +} + +bool LLPersonViewFilter::isModified() const +{ + return isActive(); +} + +void LLPersonViewFilter::clearModified() +{ + mFilterModified = FILTER_NONE; + setFilterSubString(""); +} |
