tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

dir_reader_fallback.h (1214B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
      4 // Use of this source code is governed by a BSD-style license that can be
      5 // found in the LICENSE file.
      6 
      7 #ifndef BASE_DIR_READER_FALLBACK_H_
      8 #define BASE_DIR_READER_FALLBACK_H_
      9 #pragma once
     10 
     11 namespace base {
     12 
     13 class DirReaderFallback {
     14 public:
     15  // Open a directory. If |IsValid| is true, then |Next| can be called to start
     16  // the iteration at the beginning of the directory.
     17  explicit DirReaderFallback(const char* directory_path) {}
     18  // After construction, IsValid returns true iff the directory was
     19  // successfully opened.
     20  bool IsValid() const { return false; }
     21  // Move to the next entry returning false if the iteration is complete.
     22  bool Next() { return false; }
     23  // Return the name of the current directory entry.
     24  const char* name() { return 0; }
     25  // Return the file descriptor which is being used.
     26  int fd() const { return -1; }
     27  // Returns true if this is a no-op fallback class (for testing).
     28  static bool IsFallback() { return true; }
     29 };
     30 
     31 }  // namespace base
     32 
     33 #endif  // BASE_DIR_READER_FALLBACK_H_