Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Unified Diff: components/sync/base/enum_set.h

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/sync/base/encryptor.h ('k') | components/sync/base/enum_set_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/base/enum_set.h
diff --git a/sync/internal_api/public/base/enum_set.h b/components/sync/base/enum_set.h
similarity index 85%
rename from sync/internal_api/public/base/enum_set.h
rename to components/sync/base/enum_set.h
index d52218c7e1caf09a817018a019bb91b07998cd51..0a28827e7b6ee4c22302a4eec71b5580a3a8e3a5 100644
--- a/sync/internal_api/public/base/enum_set.h
+++ b/components/sync/base/enum_set.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef SYNC_INTERNAL_API_PUBLIC_BASE_ENUM_SET_H_
-#define SYNC_INTERNAL_API_PUBLIC_BASE_ENUM_SET_H_
+#ifndef COMPONENTS_SYNC_BASE_ENUM_SET_H_
+#define COMPONENTS_SYNC_BASE_ENUM_SET_H_
#include <bitset>
#include <cstddef>
@@ -45,8 +45,7 @@ class EnumSet {
static const E kMinValue = MinEnumValue;
static const E kMaxValue = MaxEnumValue;
static const size_t kValueCount = kMaxValue - kMinValue + 1;
- static_assert(kMinValue < kMaxValue,
- "min value must be less than max value");
+ static_assert(kMinValue < kMaxValue, "min value must be less than max value");
private:
// Declaration needed by Iterator.
@@ -85,9 +84,7 @@ class EnumSet {
// Returns true iff the iterator points to an EnumSet and it
// hasn't yet traversed the EnumSet entirely.
- bool Good() const {
- return enums_ && i_ < kValueCount && enums_->test(i_);
- }
+ bool Good() const { return enums_ && i_ < kValueCount && enums_->test(i_); }
// Returns the value the iterator currently points to. Good()
// must hold.
@@ -124,9 +121,7 @@ class EnumSet {
EnumSet() {}
- explicit EnumSet(E value) {
- Put(value);
- }
+ explicit EnumSet(E value) { Put(value); }
EnumSet(E value1, E value2) {
Put(value1);
@@ -155,21 +150,15 @@ class EnumSet {
// (defined below).
// Adds the given value (which must be in range) to our set.
- void Put(E value) {
- enums_.set(ToIndex(value));
- }
+ void Put(E value) { enums_.set(ToIndex(value)); }
// Adds all values in the given set to our set.
- void PutAll(EnumSet other) {
- enums_ |= other.enums_;
- }
+ void PutAll(EnumSet other) { enums_ |= other.enums_; }
// There's no real need for a Retain(E) member function.
// Removes all values not in the given set from our set.
- void RetainAll(EnumSet other) {
- enums_ &= other.enums_;
- }
+ void RetainAll(EnumSet other) { enums_ &= other.enums_; }
// If the given value is in range, removes it from our set.
void Remove(E value) {
@@ -179,14 +168,10 @@ class EnumSet {
}
// Removes all values in the given set from our set.
- void RemoveAll(EnumSet other) {
- enums_ &= ~other.enums_;
- }
+ void RemoveAll(EnumSet other) { enums_ &= ~other.enums_; }
// Removes all values from our set.
- void Clear() {
- enums_.reset();
- }
+ void Clear() { enums_.reset(); }
// Returns true iff the given value is in range and a member of our set.
bool Has(E value) const {
@@ -199,19 +184,13 @@ class EnumSet {
}
// Returns true iff our set is empty.
- bool Empty() const {
- return !enums_.any();
- }
+ bool Empty() const { return !enums_.any(); }
// Returns how many values our set has.
- size_t Size() const {
- return enums_.count();
- }
+ size_t Size() const { return enums_.count(); }
// Returns an iterator pointing to the first element (if any).
- Iterator First() const {
- return Iterator(enums_);
- }
+ Iterator First() const { return Iterator(enums_); }
// Returns true iff our set and the given set contain exactly the same values.
bool operator==(const EnumSet& other) const { return enums_ == other.enums_; }
@@ -221,12 +200,12 @@ class EnumSet {
bool operator!=(const EnumSet& other) const { return enums_ != other.enums_; }
private:
- friend EnumSet Union<E, MinEnumValue, MaxEnumValue>(
- EnumSet set1, EnumSet set2);
- friend EnumSet Intersection<E, MinEnumValue, MaxEnumValue>(
- EnumSet set1, EnumSet set2);
- friend EnumSet Difference<E, MinEnumValue, MaxEnumValue>(
- EnumSet set1, EnumSet set2);
+ friend EnumSet Union<E, MinEnumValue, MaxEnumValue>(EnumSet set1,
+ EnumSet set2);
+ friend EnumSet Intersection<E, MinEnumValue, MaxEnumValue>(EnumSet set1,
+ EnumSet set2);
+ friend EnumSet Difference<E, MinEnumValue, MaxEnumValue>(EnumSet set1,
+ EnumSet set2);
explicit EnumSet(EnumBitSet enums) : enums_(enums) {}
@@ -281,4 +260,4 @@ EnumSet<E, Min, Max> Difference(EnumSet<E, Min, Max> set1,
} // namespace syncer
-#endif // SYNC_INTERNAL_API_PUBLIC_BASE_ENUM_SET_H_
+#endif // COMPONENTS_SYNC_BASE_ENUM_SET_H_
« no previous file with comments | « components/sync/base/encryptor.h ('k') | components/sync/base/enum_set_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698