LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/base - file.cc (source / functions) Hit Total Coverage
Test: output.info Lines: 0 36 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 16 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       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             : 
      13             : #include <utility>
      14             : 
      15             : namespace rtc {
      16             : 
      17             : namespace {
      18             : 
      19           0 : std::string NormalizePathname(Pathname&& path) {
      20           0 :   path.Normalize();
      21           0 :   return path.pathname();
      22             : }
      23             : 
      24             : }  // namespace
      25             : 
      26           0 : File::File(PlatformFile file) : file_(file) {}
      27             : 
      28           0 : File::File() : file_(kInvalidPlatformFileValue) {}
      29             : 
      30           0 : File::~File() {
      31           0 :   Close();
      32           0 : }
      33             : 
      34             : // static
      35           0 : File File::Open(const std::string& path) {
      36           0 :   return File(OpenPlatformFile(path));
      37             : }
      38             : 
      39             : // static
      40           0 : File File::Open(Pathname&& path) {
      41           0 :   return Open(NormalizePathname(std::move(path)));
      42             : }
      43             : 
      44             : // static
      45           0 : File File::Open(const Pathname& path) {
      46           0 :   return Open(Pathname(path));
      47             : }
      48             : 
      49             : // static
      50           0 : File File::Create(const std::string& path) {
      51           0 :   return File(CreatePlatformFile(path));
      52             : }
      53             : 
      54             : // static
      55           0 : File File::Create(Pathname&& path) {
      56           0 :   return Create(NormalizePathname(std::move(path)));
      57             : }
      58             : 
      59             : // static
      60           0 : File File::Create(const Pathname& path) {
      61           0 :   return Create(Pathname(path));
      62             : }
      63             : 
      64             : // static
      65           0 : bool File::Remove(const std::string& path) {
      66           0 :   return RemoveFile(path);
      67             : }
      68             : 
      69             : // static
      70           0 : bool File::Remove(Pathname&& path) {
      71           0 :   return Remove(NormalizePathname(std::move(path)));
      72             : }
      73             : 
      74             : // static
      75           0 : bool File::Remove(const Pathname& path) {
      76           0 :   return Remove(Pathname(path));
      77             : }
      78             : 
      79           0 : File::File(File&& other) : file_(other.file_) {
      80           0 :   other.file_ = kInvalidPlatformFileValue;
      81           0 : }
      82             : 
      83           0 : File& File::operator=(File&& other) {
      84           0 :   Close();
      85           0 :   file_ = other.file_;
      86           0 :   other.file_ = kInvalidPlatformFileValue;
      87           0 :   return *this;
      88             : }
      89             : 
      90           0 : bool File::IsOpen() {
      91           0 :   return file_ != kInvalidPlatformFileValue;
      92             : }
      93             : 
      94             : }  // namespace rtc

Generated by: LCOV version 1.13