OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 // This class wraps the platform specific APIs for simple file interactions. | 23 // This class wraps the platform specific APIs for simple file interactions. |
24 // | 24 // |
25 // The various read and write methods are best effort, i.e. if an underlying | 25 // The various read and write methods are best effort, i.e. if an underlying |
26 // call does not manage to read/write all the data more calls will be performed, | 26 // call does not manage to read/write all the data more calls will be performed, |
27 // until an error is detected or all data is read/written. | 27 // until an error is detected or all data is read/written. |
28 class File { | 28 class File { |
29 public: | 29 public: |
30 // Wraps the given PlatformFile. This class is then responsible for closing | 30 // Wraps the given PlatformFile. This class is then responsible for closing |
31 // the file, which will be done in the destructor if Close is never called. | 31 // the file, which will be done in the destructor if Close is never called. |
32 explicit File(PlatformFile); | 32 explicit File(PlatformFile); |
| 33 // The default constructor produces a closed file. |
| 34 File(); |
33 ~File(); | 35 ~File(); |
34 | 36 |
35 File(File&& other); | 37 File(File&& other); |
36 File& operator=(File&& other); | 38 File& operator=(File&& other); |
37 | 39 |
38 // Open and Create give files with both reading and writing enabled. | 40 // Open and Create give files with both reading and writing enabled. |
39 static File Open(const std::string& path); | 41 static File Open(const std::string& path); |
40 // If the file already exists it will be overwritten. | 42 // If the file already exists it will be overwritten. |
41 static File Create(const std::string& path); | 43 static File Create(const std::string& path); |
42 | 44 |
(...skipping 18 matching lines...) Expand all Loading... |
61 bool IsOpen(); | 63 bool IsOpen(); |
62 | 64 |
63 private: | 65 private: |
64 PlatformFile file_; | 66 PlatformFile file_; |
65 RTC_DISALLOW_COPY_AND_ASSIGN(File); | 67 RTC_DISALLOW_COPY_AND_ASSIGN(File); |
66 }; | 68 }; |
67 | 69 |
68 } // namespace rtc | 70 } // namespace rtc |
69 | 71 |
70 #endif // WEBRTC_BASE_FILE_H_ | 72 #endif // WEBRTC_BASE_FILE_H_ |
OLD | NEW |