Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / sync_file_system / drive_backend / tracker_id_set.h
blob15f4470f146dcec43afb5fb424af5140909924bf
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_TRACKER_ID_SET_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_TRACKER_ID_SET_H_
8 #include <set>
10 #include "base/basictypes.h"
12 namespace sync_file_system {
13 namespace drive_backend {
15 class FileTracker;
17 class TrackerIDSet {
18 public:
19 typedef std::set<int64> RawTrackerIDSet;
20 typedef RawTrackerIDSet::iterator iterator;
21 typedef RawTrackerIDSet::const_iterator const_iterator;
23 TrackerIDSet();
24 ~TrackerIDSet();
26 bool has_active() const { return !!active_tracker_; }
27 void Insert(const FileTracker& tracker);
28 void InsertActiveTracker(int64 tracker_id);
29 void InsertInactiveTracker(int64 tracker_id);
30 void Erase(int64 tracker_id);
31 void Activate(int64 tracker_id);
32 void Deactivate(int64 tracker_id);
34 int64 active_tracker() const { return active_tracker_; }
35 const RawTrackerIDSet& tracker_set() const { return tracker_ids_; }
37 iterator begin() { return tracker_ids_.begin(); }
38 iterator end() { return tracker_ids_.end(); }
39 const_iterator begin() const { return tracker_ids_.begin(); }
40 const_iterator end() const { return tracker_ids_.end(); }
41 bool empty() const { return tracker_ids_.empty(); }
42 size_t size() const { return tracker_ids_.size(); }
44 private:
45 int64 active_tracker_;
46 RawTrackerIDSet tracker_ids_;
49 } // namespace drive_backend
50 } // namespace sync_file_system
52 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_TRACKER_ID_SET_H_