webrtc/rtc_base/file.cc
Yves Gerey 2e00abc98e Reland "[cleanup] Remove useless includes."
Reason for reland: Downstream project fixed.

Original change's description:

> [cleanup] Remove useless includes.
>
> Manual cleanup guided by include-what-you-use diagnostic.
>
> Bug: webrtc:8311
> Change-Id: I00be03392cc7ee005101427ea7dc701621ccea68
> Reviewed-on: https://webrtc-review.googlesource.com/c/103320
> Commit-Queue: Yves Gerey <yvesg@webrtc.org>
> Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25013}

Bug: webrtc:8311
Change-Id: Id6ec4aeb798886a90ace640a190eaf16497ba31b
Reviewed-on: https://webrtc-review.googlesource.com/c/104120
Commit-Queue: Yves Gerey <yvesg@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25034}
2018-10-08 07:44:19 +00:00

53 lines
1.2 KiB
C++

/*
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/file.h"
namespace rtc {
File::File(PlatformFile file) : file_(file) {}
File::File() : file_(kInvalidPlatformFileValue) {}
File::~File() {
Close();
}
// static
File File::Open(const std::string& path) {
return File(OpenPlatformFile(path));
}
// static
File File::Create(const std::string& path) {
return File(CreatePlatformFile(path));
}
// static
bool File::Remove(const std::string& path) {
return RemoveFile(path);
}
File::File(File&& other) : file_(other.file_) {
other.file_ = kInvalidPlatformFileValue;
}
File& File::operator=(File&& other) {
Close();
file_ = other.file_;
other.file_ = kInvalidPlatformFileValue;
return *this;
}
bool File::IsOpen() {
return file_ != kInvalidPlatformFileValue;
}
} // namespace rtc