|
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 |
|
6 #ifndef nsDirectoryIndexStream_h__ |
|
7 #define nsDirectoryIndexStream_h__ |
|
8 |
|
9 #include "mozilla/Attributes.h" |
|
10 |
|
11 #include "nsString.h" |
|
12 #include "nsIInputStream.h" |
|
13 #include "nsCOMArray.h" |
|
14 |
|
15 class nsIFile; |
|
16 |
|
17 class nsDirectoryIndexStream MOZ_FINAL : public nsIInputStream |
|
18 { |
|
19 private: |
|
20 nsCString mBuf; |
|
21 int32_t mOffset; |
|
22 nsresult mStatus; |
|
23 |
|
24 int32_t mPos; // position within mArray |
|
25 nsCOMArray<nsIFile> mArray; // file objects within the directory |
|
26 |
|
27 nsDirectoryIndexStream(); |
|
28 /** |
|
29 * aDir will only be used on the calling thread. |
|
30 */ |
|
31 nsresult Init(nsIFile* aDir); |
|
32 ~nsDirectoryIndexStream(); |
|
33 |
|
34 public: |
|
35 /** |
|
36 * aDir will only be used on the calling thread. |
|
37 */ |
|
38 static nsresult |
|
39 Create(nsIFile* aDir, nsIInputStream** aStreamResult); |
|
40 |
|
41 // nsISupportsInterface |
|
42 NS_DECL_THREADSAFE_ISUPPORTS |
|
43 |
|
44 // nsIInputStream interface |
|
45 NS_DECL_NSIINPUTSTREAM |
|
46 }; |
|
47 |
|
48 #endif // nsDirectoryIndexStream_h__ |
|
49 |