Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 final : public nsIInputStream {
18
private:
19
nsCString mBuf;
20
int32_t mOffset;
21
nsresult mStatus;
22
23
int32_t mPos; // position within mArray
24
nsCOMArray<nsIFile> mArray; // file objects within the directory
25
26
nsDirectoryIndexStream();
27
/**
28
* aDir will only be used on the calling thread.
29
*/
30
nsresult Init(nsIFile* aDir);
31
~nsDirectoryIndexStream();
32
33
public:
34
/**
35
* aDir will only be used on the calling thread.
36
*/
37
static nsresult Create(nsIFile* aDir, nsIInputStream** aStreamResult);
38
39
// nsISupportsInterface
40
NS_DECL_THREADSAFE_ISUPPORTS
41
42
// nsIInputStream interface
43
NS_DECL_NSIINPUTSTREAM
44
};
45
46
#endif // nsDirectoryIndexStream_h__