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