Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_FILEAPI_SYNCABLE_FILE_CHANGE_H_ | 5 #ifndef WEBKIT_FILEAPI_SYNCABLE_FILE_CHANGE_H_ |
| 6 #define WEBKIT_FILEAPI_SYNCABLE_FILE_CHANGE_H_ | 6 #define WEBKIT_FILEAPI_SYNCABLE_FILE_CHANGE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 | 25 |
| 26 FileChange(ChangeType change, SyncFileType file_type); | 26 FileChange(ChangeType change, SyncFileType file_type); |
| 27 | 27 |
| 28 bool IsAddOrUpdate() const { return change_ == FILE_CHANGE_ADD_OR_UPDATE; } | 28 bool IsAddOrUpdate() const { return change_ == FILE_CHANGE_ADD_OR_UPDATE; } |
| 29 bool IsDelete() const { return change_ == FILE_CHANGE_DELETE; } | 29 bool IsDelete() const { return change_ == FILE_CHANGE_DELETE; } |
| 30 | 30 |
| 31 bool IsFile() const { return file_type_ == SYNC_FILE_TYPE_FILE; } | 31 bool IsFile() const { return file_type_ == SYNC_FILE_TYPE_FILE; } |
| 32 bool IsDirectory() const { return file_type_ == SYNC_FILE_TYPE_DIRECTORY; } | 32 bool IsDirectory() const { return file_type_ == SYNC_FILE_TYPE_DIRECTORY; } |
| 33 bool IsTypeUnknown() const { return !IsFile() && !IsDirectory(); } | 33 bool IsTypeUnknown() const { return !IsFile() && !IsDirectory(); } |
| 34 | 34 |
| 35 bool IsAddOrUpdateFile() const { return IsAddOrUpdate() && IsFile(); } | |
| 36 bool IsDeleteFile() const { return IsDelete() && IsFile(); } | |
| 37 bool IsAddDirectory() const { return IsAddOrUpdate() && IsDirectory(); } | |
| 38 bool IsDeleteDirectory() const { return IsDelete() && IsDirectory(); } | |
|
kinuko
2013/04/24 02:32:32
These methods are good for DCHECKs but I'm worried
nhiroki
2013/04/24 13:29:05
hmm... I think this seems straightforward and usef
kinuko
2013/04/24 14:07:59
If it's really useful that's fine of course, I mea
| |
| 39 | |
| 35 ChangeType change() const { return change_; } | 40 ChangeType change() const { return change_; } |
| 36 SyncFileType file_type() const { return file_type_; } | 41 SyncFileType file_type() const { return file_type_; } |
| 37 | 42 |
| 38 std::string DebugString() const; | 43 std::string DebugString() const; |
| 39 | 44 |
| 40 bool operator==(const FileChange& that) const { | 45 bool operator==(const FileChange& that) const { |
| 41 return change() == that.change() && | 46 return change() == that.change() && |
| 42 file_type() == that.file_type(); | 47 file_type() == that.file_type(); |
| 43 } | 48 } |
| 44 | 49 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 67 | 72 |
| 68 std::string DebugString() const; | 73 std::string DebugString() const; |
| 69 | 74 |
| 70 private: | 75 private: |
| 71 List list_; | 76 List list_; |
| 72 }; | 77 }; |
| 73 | 78 |
| 74 } // namespace sync_file_system | 79 } // namespace sync_file_system |
| 75 | 80 |
| 76 #endif // WEBKIT_FILEAPI_SYNCABLE_FILE_CHANGE_H_ | 81 #endif // WEBKIT_FILEAPI_SYNCABLE_FILE_CHANGE_H_ |
| OLD | NEW |