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 11 matching lines...) Expand all Loading... | |
22 | 22 |
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); |
perkj_webrtc
2016/09/28 14:53:35
this is also ctor - Move ~File after all ctors.
| |
33 ~File(); | 33 ~File(); |
34 | 34 |
35 // The default constructor produces a closed file. | |
36 File(); | |
37 | |
35 File(File&& other); | 38 File(File&& other); |
36 File& operator=(File&& other); | 39 File& operator=(File&& other); |
37 | 40 |
38 // Open and Create give files with both reading and writing enabled. | 41 // Open and Create give files with both reading and writing enabled. |
39 static File Open(const std::string& path); | 42 static File Open(const std::string& path); |
40 // If the file already exists it will be overwritten. | 43 // If the file already exists it will be overwritten. |
41 static File Create(const std::string& path); | 44 static File Create(const std::string& path); |
42 | 45 |
43 size_t Write(const uint8_t* data, size_t length); | 46 size_t Write(const uint8_t* data, size_t length); |
44 size_t Read(uint8_t* buffer, size_t length); | 47 size_t Read(uint8_t* buffer, size_t length); |
(...skipping 16 matching lines...) Expand all Loading... | |
61 bool IsOpen(); | 64 bool IsOpen(); |
62 | 65 |
63 private: | 66 private: |
64 PlatformFile file_; | 67 PlatformFile file_; |
65 RTC_DISALLOW_COPY_AND_ASSIGN(File); | 68 RTC_DISALLOW_COPY_AND_ASSIGN(File); |
66 }; | 69 }; |
67 | 70 |
68 } // namespace rtc | 71 } // namespace rtc |
69 | 72 |
70 #endif // WEBRTC_BASE_FILE_H_ | 73 #endif // WEBRTC_BASE_FILE_H_ |
OLD | NEW |