Skip to content

Commit

Permalink
Bug 1627131 - Part 3: Move nsTString<T>::Contains implementation. r=x…
Browse files Browse the repository at this point in the history
…pcom-reviewers,sg

`kNotFound` isn't actually defined in `nsTStringRepr.h`.

Differential Revision: https://phabricator.services.mozilla.com/D69468
  • Loading branch information
EricRahm committed Apr 8, 2020
1 parent 872b9cd commit cb7f66d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 1 addition & 3 deletions xpcom/string/nsTStringRepr.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,7 @@ class nsTStringRepr {
size_type NS_FASTCALL CountChar(char_type) const;
int32_t NS_FASTCALL FindChar(char_type, index_type aOffset = 0) const;

inline bool Contains(char_type aChar) const {
return FindChar(aChar) != kNotFound;
}
bool Contains(char_type aChar) const;

// Equality.
bool NS_FASTCALL Equals(const self_type&) const;
Expand Down
5 changes: 5 additions & 0 deletions xpcom/string/nsTSubstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,11 @@ int32_t nsTStringRepr<T>::FindChar(char_type aChar, index_type aOffset) const {
return -1;
}

template <typename T>
bool nsTStringRepr<T>::Contains(char_type aChar) const {
return FindChar(aChar) != kNotFound;
}

} // namespace detail
} // namespace mozilla

Expand Down

0 comments on commit cb7f66d

Please sign in to comment.