OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2014 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 |
11 #ifndef WEBRTC_BASE_PLATFORM_FILE_H_ | 11 #ifndef WEBRTC_BASE_PLATFORM_FILE_H_ |
12 #define WEBRTC_BASE_PLATFORM_FILE_H_ | 12 #define WEBRTC_BASE_PLATFORM_FILE_H_ |
13 | 13 |
14 #include <stdio.h> | 14 #include <stdio.h> |
15 | 15 |
perkj_webrtc
2016/09/15 13:35:30
nit: remove extra line after stdio.h
| |
16 #include <string> | |
17 | |
16 #if defined(WEBRTC_WIN) | 18 #if defined(WEBRTC_WIN) |
17 #include <windows.h> | 19 #include "webrtc/base/win32.h" |
18 #endif | 20 #endif |
19 | 21 |
20 namespace rtc { | 22 namespace rtc { |
21 | 23 |
22 #if defined(WEBRTC_WIN) | 24 #if defined(WEBRTC_WIN) |
23 typedef HANDLE PlatformFile; | 25 typedef HANDLE PlatformFile; |
24 #elif defined(WEBRTC_POSIX) | 26 #elif defined(WEBRTC_POSIX) |
25 typedef int PlatformFile; | 27 typedef int PlatformFile; |
26 #else | 28 #else |
27 #error Unsupported platform | 29 #error Unsupported platform |
28 #endif | 30 #endif |
29 | 31 |
30 extern const PlatformFile kInvalidPlatformFileValue; | 32 extern const PlatformFile kInvalidPlatformFileValue; |
31 | 33 |
32 // Associates a standard FILE stream with an existing PlatformFile. | 34 // Associates a standard FILE stream with an existing PlatformFile. |
33 // Note that after this function has returned a valid FILE stream, | 35 // Note that after this function has returned a valid FILE stream, |
34 // the PlatformFile should no longer be used. | 36 // the PlatformFile should no longer be used. |
35 FILE* FdopenPlatformFileForWriting(PlatformFile file); | 37 FILE* FdopenPlatformFileForWriting(PlatformFile file); |
36 | 38 |
37 // Closes a PlatformFile. | 39 // Closes a PlatformFile. |
38 // Don't use ClosePlatformFile to close a file opened with FdopenPlatformFile. | 40 // Don't use ClosePlatformFile to close a file opened with FdopenPlatformFile. |
39 // Use fclose instead. | 41 // Use fclose instead. |
40 bool ClosePlatformFile(PlatformFile file); | 42 bool ClosePlatformFile(PlatformFile file); |
41 | 43 |
44 // Removes a file in the filesystem. | |
45 bool RemoveFile(const std::string& path); | |
46 | |
47 // Opens a file for reading and writing. You might want to use base/file.h | |
48 // instead, this function is largely used for tests that require exactly a | |
perkj_webrtc
2016/09/15 13:35:30
dito as comment below.
| |
49 // PlatformFile. | |
50 PlatformFile OpenPlatformFile(const std::string& path); | |
51 | |
52 // Creates a new file for reading and writing. If the file already exists it | |
53 // will be overwritten. You might want to use base/file.h instead, this | |
perkj_webrtc
2016/09/15 13:35:30
instead.
Suggest you remove the sentence about ho
| |
54 // function is largely used for tests that require exactly a PlatformFile. | |
55 PlatformFile CreatePlatformFile(const std::string& path); | |
56 | |
42 } // namespace rtc | 57 } // namespace rtc |
43 | 58 |
44 #endif // WEBRTC_BASE_PLATFORM_FILE_H_ | 59 #endif // WEBRTC_BASE_PLATFORM_FILE_H_ |
OLD | NEW |