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

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: std::move and reflow Created 5 years 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') | no next file with comments »
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // Creates or opens the given file. This will fail with 'access denied' if the 162 // Creates or opens the given file. This will fail with 'access denied' if the
163 // |path| contains path traversal ('..') components. 163 // |path| contains path traversal ('..') components.
164 File(const FilePath& path, uint32 flags); 164 File(const FilePath& path, uint32 flags);
165 165
166 // Takes ownership of |platform_file|. 166 // Takes ownership of |platform_file|.
167 explicit File(PlatformFile platform_file); 167 explicit File(PlatformFile platform_file);
168 168
169 // Creates an object with a specific error_details code. 169 // Creates an object with a specific error_details code.
170 explicit File(Error error_details); 170 explicit File(Error error_details);
171 171
172 // Move constructor for C++03 move emulation of this type. 172 File(File&& other);
173 File(RValue other);
174 173
175 ~File(); 174 ~File();
176 175
177 // Takes ownership of |platform_file|. 176 // Takes ownership of |platform_file|.
178 static File CreateForAsyncHandle(PlatformFile platform_file); 177 static File CreateForAsyncHandle(PlatformFile platform_file);
179 178
180 // Move operator= for C++03 move emulation of this type. 179 File& operator=(File&& other);
181 File& operator=(RValue other);
182 180
183 // Creates or opens the given file. 181 // Creates or opens the given file.
184 void Initialize(const FilePath& path, uint32 flags); 182 void Initialize(const FilePath& path, uint32 flags);
185 183
186 // Returns |true| if the handle / fd wrapped by this object is valid. This 184 // Returns |true| if the handle / fd wrapped by this object is valid. This
187 // method doesn't interact with the file system (and is safe to be called from 185 // method doesn't interact with the file system (and is safe to be called from
188 // ThreadRestrictions::SetIOAllowed(false) threads). 186 // ThreadRestrictions::SetIOAllowed(false) threads).
189 bool IsValid() const; 187 bool IsValid() const;
190 188
191 // Returns true if a new file was created (or an old one truncated to zero 189 // Returns true if a new file was created (or an old one truncated to zero
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 332
335 Error error_details_; 333 Error error_details_;
336 bool created_; 334 bool created_;
337 bool async_; 335 bool async_;
338 }; 336 };
339 337
340 } // namespace base 338 } // namespace base
341 339
342 #endif // BASE_FILES_FILE_H_ 340 #endif // BASE_FILES_FILE_H_
343 341
OLDNEW
« no previous file with comments | « no previous file | base/files/file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698