blob: 9a865884ea07ca6f956c36318193ecb4bfa9293d [file] [log] [blame]
Viktor Palmkvist4ec6a0c2016-09-02 13:38:32 +02001/*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "webrtc/base/file.h"
12
13namespace rtc {
14
15File::File(PlatformFile file) : file_(file) {}
16
17File::~File() {
18 Close();
19}
20
21File::File(File&& other) : file_(other.file_) {
22 other.file_ = kInvalidPlatformFileValue;
23}
24
25File& File::operator=(File&& other) {
26 Close();
27 file_ = other.file_;
28 other.file_ = kInvalidPlatformFileValue;
29 return *this;
30}
31
32bool File::IsOpen() {
33 return file_ != kInvalidPlatformFileValue;
34}
35
36} // namespace rtc