nsDirectoryIndexStream.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef nsDirectoryIndexStream_h__
  6. #define nsDirectoryIndexStream_h__
  7. #include "mozilla/Attributes.h"
  8. #include "nsString.h"
  9. #include "nsIInputStream.h"
  10. #include "nsCOMArray.h"
  11. class nsIFile;
  12. class nsDirectoryIndexStream final : public nsIInputStream
  13. {
  14. private:
  15. nsCString mBuf;
  16. int32_t mOffset;
  17. nsresult mStatus;
  18. int32_t mPos; // position within mArray
  19. nsCOMArray<nsIFile> mArray; // file objects within the directory
  20. nsDirectoryIndexStream();
  21. /**
  22. * aDir will only be used on the calling thread.
  23. */
  24. nsresult Init(nsIFile* aDir);
  25. ~nsDirectoryIndexStream();
  26. public:
  27. /**
  28. * aDir will only be used on the calling thread.
  29. */
  30. static nsresult
  31. Create(nsIFile* aDir, nsIInputStream** aStreamResult);
  32. // nsISupportsInterface
  33. NS_DECL_THREADSAFE_ISUPPORTS
  34. // nsIInputStream interface
  35. NS_DECL_NSIINPUTSTREAM
  36. };
  37. #endif // nsDirectoryIndexStream_h__