| 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> | |
| 15 #include <string> | |
| 16 | 14 |
| 17 #if defined(WEBRTC_WIN) | 15 // This header is deprecated and is just left here temporarily during |
| 18 #include "webrtc/base/win32.h" | 16 // refactoring. See https://bugs.webrtc.org/7634 for more details. |
| 19 #endif | 17 #include "webrtc/rtc_base/platform_file.h" |
| 20 | |
| 21 namespace rtc { | |
| 22 | |
| 23 #if defined(WEBRTC_WIN) | |
| 24 typedef HANDLE PlatformFile; | |
| 25 #elif defined(WEBRTC_POSIX) | |
| 26 typedef int PlatformFile; | |
| 27 #else | |
| 28 #error Unsupported platform | |
| 29 #endif | |
| 30 | |
| 31 extern const PlatformFile kInvalidPlatformFileValue; | |
| 32 | |
| 33 // Associates a standard FILE stream with an existing PlatformFile. | |
| 34 // Note that after this function has returned a valid FILE stream, | |
| 35 // the PlatformFile should no longer be used. | |
| 36 FILE* FdopenPlatformFileForWriting(PlatformFile file); | |
| 37 | |
| 38 // Closes a PlatformFile. | |
| 39 // Don't use ClosePlatformFile to close a file opened with FdopenPlatformFile. | |
| 40 // Use fclose instead. | |
| 41 bool ClosePlatformFile(PlatformFile file); | |
| 42 | |
| 43 // Removes a file in the filesystem. | |
| 44 bool RemoveFile(const std::string& path); | |
| 45 | |
| 46 // Opens a file for reading and writing. You might want to use base/file.h | |
| 47 // instead. | |
| 48 PlatformFile OpenPlatformFile(const std::string& path); | |
| 49 | |
| 50 // Creates a new file for reading and writing. If the file already exists it | |
| 51 // will be overwritten. You might want to use base/file.h instead. | |
| 52 PlatformFile CreatePlatformFile(const std::string& path); | |
| 53 | |
| 54 } // namespace rtc | |
| 55 | 18 |
| 56 #endif // WEBRTC_BASE_PLATFORM_FILE_H_ | 19 #endif // WEBRTC_BASE_PLATFORM_FILE_H_ |
| OLD | NEW |