Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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/. */
6 #ifndef nsDirectoryIndexStream_h__
7 #define nsDirectoryIndexStream_h__
9 #include "mozilla/Attributes.h"
11 #include "nsString.h"
12 #include "nsIInputStream.h"
13 #include "nsCOMArray.h"
15 class nsIFile;
17 class nsDirectoryIndexStream MOZ_FINAL : public nsIInputStream
18 {
19 private:
20 nsCString mBuf;
21 int32_t mOffset;
22 nsresult mStatus;
24 int32_t mPos; // position within mArray
25 nsCOMArray<nsIFile> mArray; // file objects within the directory
27 nsDirectoryIndexStream();
28 /**
29 * aDir will only be used on the calling thread.
30 */
31 nsresult Init(nsIFile* aDir);
32 ~nsDirectoryIndexStream();
34 public:
35 /**
36 * aDir will only be used on the calling thread.
37 */
38 static nsresult
39 Create(nsIFile* aDir, nsIInputStream** aStreamResult);
41 // nsISupportsInterface
42 NS_DECL_THREADSAFE_ISUPPORTS
44 // nsIInputStream interface
45 NS_DECL_NSIINPUTSTREAM
46 };
48 #endif // nsDirectoryIndexStream_h__