15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef BASE_FILES_DIR_READER_FALLBACK_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define BASE_FILES_DIR_READER_FALLBACK_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace base {
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class DirReaderFallback {
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Open a directory. If |IsValid| is true, then |Next| can be called to start
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the iteration at the beginning of the directory.
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  explicit DirReaderFallback(const char* directory_path) {}
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // After construction, IsValid returns true iff the directory was
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // successfully opened.
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool IsValid() const { return false; }
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Move to the next entry returning false if the iteration is complete.
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool Next() { return false; }
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Return the name of the current directory entry.
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const char* name() { return 0;}
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Return the file descriptor which is being used.
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int fd() const { return -1; }
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if this is a no-op fallback class (for testing).
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static bool IsFallback() { return true; }
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace base
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // BASE_FILES_DIR_READER_FALLBACK_H_
36