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

Side by Side Diff: base/files/file.h

Issue 1407443002: Remove old C++03 move emulation code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/files/file.cc » ('j') | base/files/file.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 BASE_FILES_FILE_H_ 5 #ifndef BASE_FILES_FILE_H_
6 #define BASE_FILES_FILE_H_ 6 #define BASE_FILES_FILE_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // Note that this class does not provide any support for asynchronous IO, other 46 // Note that this class does not provide any support for asynchronous IO, other
47 // than the ability to create asynchronous handles on Windows. 47 // than the ability to create asynchronous handles on Windows.
48 // 48 //
49 // Note about const: this class does not attempt to determine if the underlying 49 // Note about const: this class does not attempt to determine if the underlying
50 // file system object is affected by a particular method in order to consider 50 // file system object is affected by a particular method in order to consider
51 // that method const or not. Only methods that deal with member variables in an 51 // that method const or not. Only methods that deal with member variables in an
52 // obvious non-modifying way are marked as const. Any method that forward calls 52 // obvious non-modifying way are marked as const. Any method that forward calls
53 // to the OS is not considered const, even if there is no apparent change to 53 // to the OS is not considered const, even if there is no apparent change to
54 // member variables. 54 // member variables.
55 class BASE_EXPORT File { 55 class BASE_EXPORT File {
56 MOVE_ONLY_TYPE_FOR_CPP_03(File, RValue) 56 MOVE_ONLY_TYPE_FOR_CPP_03(File)
57 57
58 public: 58 public:
59 // FLAG_(OPEN|CREATE).* are mutually exclusive. You should specify exactly one 59 // FLAG_(OPEN|CREATE).* are mutually exclusive. You should specify exactly one
60 // of the five (possibly combining with other flags) when opening or creating 60 // of the five (possibly combining with other flags) when opening or creating
61 // a file. 61 // a file.
62 // FLAG_(WRITE|APPEND) are mutually exclusive. This is so that APPEND behavior 62 // FLAG_(WRITE|APPEND) are mutually exclusive. This is so that APPEND behavior
63 // will be consistent with O_APPEND on POSIX. 63 // will be consistent with O_APPEND on POSIX.
64 // FLAG_EXCLUSIVE_(READ|WRITE) only grant exclusive access to the file on 64 // FLAG_EXCLUSIVE_(READ|WRITE) only grant exclusive access to the file on
65 // creation on POSIX; for existing files, consider using Lock(). 65 // creation on POSIX; for existing files, consider using Lock().
66 enum Flags { 66 enum Flags {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Creates or opens the given file. This will fail with 'access denied' if the 161 // Creates or opens the given file. This will fail with 'access denied' if the
162 // |path| contains path traversal ('..') components. 162 // |path| contains path traversal ('..') components.
163 File(const FilePath& path, uint32 flags); 163 File(const FilePath& path, uint32 flags);
164 164
165 // Takes ownership of |platform_file|. 165 // Takes ownership of |platform_file|.
166 explicit File(PlatformFile platform_file); 166 explicit File(PlatformFile platform_file);
167 167
168 // Creates an object with a specific error_details code. 168 // Creates an object with a specific error_details code.
169 explicit File(Error error_details); 169 explicit File(Error error_details);
170 170
171 // Move constructor for C++03 move emulation of this type. 171 File(File&& other);
dcheng 2015/10/13 21:03:09 I opted to remove the comments of this form, since
danakj 2015/10/15 23:35:06 sgtm
172 File(RValue other);
173 172
174 ~File(); 173 ~File();
175 174
176 // Takes ownership of |platform_file|. 175 // Takes ownership of |platform_file|.
177 static File CreateForAsyncHandle(PlatformFile platform_file); 176 static File CreateForAsyncHandle(PlatformFile platform_file);
178 177
179 // Move operator= for C++03 move emulation of this type. 178 File& operator=(File&& other);
180 File& operator=(RValue other);
181 179
182 // Creates or opens the given file. 180 // Creates or opens the given file.
183 void Initialize(const FilePath& path, uint32 flags); 181 void Initialize(const FilePath& path, uint32 flags);
184 182
185 bool IsValid() const; 183 bool IsValid() const;
186 184
187 // Returns true if a new file was created (or an old one truncated to zero 185 // Returns true if a new file was created (or an old one truncated to zero
188 // length to simulate a new file, which can happen with 186 // length to simulate a new file, which can happen with
189 // FLAG_CREATE_ALWAYS), and false otherwise. 187 // FLAG_CREATE_ALWAYS), and false otherwise.
190 bool created() const { return created_; } 188 bool created() const { return created_; }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 328
331 Error error_details_; 329 Error error_details_;
332 bool created_; 330 bool created_;
333 bool async_; 331 bool async_;
334 }; 332 };
335 333
336 } // namespace base 334 } // namespace base
337 335
338 #endif // BASE_FILES_FILE_H_ 336 #endif // BASE_FILES_FILE_H_
339 337
OLDNEW
« no previous file with comments | « no previous file | base/files/file.cc » ('j') | base/files/file.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698