Commit f227b179 authored by Jesse McKenna's avatar Jesse McKenna Committed by Commit Bot

Remove DISALLOW_COPY_AND_ASSIGN from IllegalCharacters class

This change removes DISALLOW_COPY_AND_ASSIGN from the
IllegalCharacters class, and makes member functions that don't modify
the class instance `const`.

Change-Id: I3b49140c4fb52aa6ae4982ed0bc6563dad6bd3a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2459637Reviewed-by: default avatarAlbert J. Wong <ajwong@chromium.org>
Commit-Queue: Jesse McKenna <jessemckenna@google.com>
Cr-Commit-Position: refs/heads/master@{#828287}
parent 1f328c4f
......@@ -14,7 +14,6 @@
#include "base/files/file_path.h"
#include "base/i18n/icu_string_conversions.h"
#include "base/i18n/string_compare.h"
#include "base/macros.h"
#include "base/memory/singleton.h"
#include "base/strings/string_util.h"
#include "base/strings/sys_string_conversions.h"
......@@ -30,19 +29,22 @@ namespace {
class IllegalCharacters {
public:
IllegalCharacters(const IllegalCharacters&) = delete;
IllegalCharacters& operator=(const IllegalCharacters&) = delete;
static IllegalCharacters* GetInstance() {
return Singleton<IllegalCharacters>::get();
}
bool DisallowedEverywhere(UChar32 ucs4) {
bool DisallowedEverywhere(UChar32 ucs4) const {
return !!illegal_anywhere_->contains(ucs4);
}
bool DisallowedLeadingOrTrailing(UChar32 ucs4) {
bool DisallowedLeadingOrTrailing(UChar32 ucs4) const {
return !!illegal_at_ends_->contains(ucs4);
}
bool IsAllowedName(const string16& s) {
bool IsAllowedName(const string16& s) const {
return s.empty() || (!!illegal_anywhere_->containsNone(
icu::UnicodeString(s.c_str(), s.size())) &&
!illegal_at_ends_->contains(*s.begin()) &&
......@@ -61,8 +63,6 @@ class IllegalCharacters {
// set of characters considered invalid at either end of a filename.
std::unique_ptr<icu::UnicodeSet> illegal_at_ends_;
DISALLOW_COPY_AND_ASSIGN(IllegalCharacters);
};
IllegalCharacters::IllegalCharacters() {
......
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