dir_reader_fallback.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_FILES_DIR_READER_FALLBACK_H_
  5. #define BASE_FILES_DIR_READER_FALLBACK_H_
  6. namespace base {
  7. class DirReaderFallback {
  8. public:
  9. // Open a directory. If |IsValid| is true, then |Next| can be called to start
  10. // the iteration at the beginning of the directory.
  11. explicit DirReaderFallback(const char* directory_path) {}
  12. // After construction, IsValid returns true iff the directory was
  13. // successfully opened.
  14. bool IsValid() const { return false; }
  15. // Move to the next entry returning false if the iteration is complete.
  16. bool Next() { return false; }
  17. // Return the name of the current directory entry.
  18. const char* name() { return nullptr;}
  19. // Return the file descriptor which is being used.
  20. int fd() const { return -1; }
  21. // Returns true if this is a no-op fallback class (for testing).
  22. static bool IsFallback() { return true; }
  23. };
  24. } // namespace base
  25. #endif // BASE_FILES_DIR_READER_FALLBACK_H_