Kaydet (Commit) 42eb843b authored tarafından Noel Grandin's avatar Noel Grandin

convert SearchBehavior to scoped enum

Change-Id: I57f03fc43aff838c7066556319a3a5a187e46ad3
Reviewed-on: https://gerrit.libreoffice.org/35831Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 5f2d57fb
......@@ -124,14 +124,14 @@ public:
std::vector<unsigned>
FindPositionsByName(const rtl::OUString& name) const;
enum SearchBehavior { RETURN_ALL, RETURN_FIRST };
enum class SearchBehavior { ReturnAll, ReturnFirst };
/** Obtain the positions of all styles which have a certain name and fulfill a certain condition.
*
* This method is fast because it can use the name-based index
*/
std::vector<unsigned>
FindPositionsByNameAndPredicate(const rtl::OUString& name, StyleSheetPredicate& predicate,
SearchBehavior behavior = RETURN_ALL) const;
SearchBehavior behavior = SearchBehavior::ReturnAll) const;
/** Obtain the positions of all styles which fulfill a certain condition.
*
......
......@@ -203,7 +203,7 @@ void IndexedStyleSheetsTest::OnlyOneStyleSheetIsReturnedWhenReturnFirstIsUsed()
DummyPredicate predicate; // returns always true, i.e., all style sheets match the predicate.
std::vector<unsigned> v = iss.FindPositionsByNameAndPredicate(name, predicate,
IndexedStyleSheets::RETURN_FIRST);
IndexedStyleSheets::SearchBehavior::ReturnFirst);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Only one style sheet is returned.", static_cast<size_t>(1), v.size());
std::vector<unsigned> w = iss.FindPositionsByNameAndPredicate(name, predicate);
......
......@@ -142,7 +142,7 @@ IndexedStyleSheets::FindPositionsByNameAndPredicate(const rtl::OUString& name,
SfxStyleSheetBase *ssheet = mStyleSheets.at(pos).get();
if (predicate.Check(*ssheet)) {
r.push_back(pos);
if (behavior == RETURN_FIRST) {
if (behavior == SearchBehavior::ReturnFirst) {
break;
}
}
......
......@@ -541,7 +541,7 @@ SfxStyleSheetBase* SfxStyleSheetIterator::Find(const OUString& rStr)
std::vector<unsigned> positions =
pBasePool->pImpl->mxIndexedStyleSheets->FindPositionsByNameAndPredicate(rStr, predicate,
svl::IndexedStyleSheets::RETURN_FIRST);
svl::IndexedStyleSheets::SearchBehavior::ReturnFirst);
if (positions.empty()) {
return nullptr;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment