2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsDirectoryIndexStream_h__
|
|
|
|
#define nsDirectoryIndexStream_h__
|
|
|
|
|
2011-12-17 19:47:45 -08:00
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIFile.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsIInputStream.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsCOMArray.h"
|
|
|
|
#include "nsITextToSubURI.h"
|
|
|
|
|
2011-12-17 19:47:45 -08:00
|
|
|
class nsDirectoryIndexStream MOZ_FINAL : public nsIInputStream
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
private:
|
2008-06-30 11:46:47 -07:00
|
|
|
nsCString mBuf;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mOffset;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult mStatus;
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mPos; // position within mArray
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMArray<nsIFile> mArray; // file objects within the directory
|
|
|
|
|
|
|
|
nsDirectoryIndexStream();
|
|
|
|
/**
|
|
|
|
* aDir will only be used on the calling thread.
|
|
|
|
*/
|
|
|
|
nsresult Init(nsIFile* aDir);
|
|
|
|
~nsDirectoryIndexStream();
|
|
|
|
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* aDir will only be used on the calling thread.
|
|
|
|
*/
|
|
|
|
static nsresult
|
|
|
|
Create(nsIFile* aDir, nsIInputStream** aStreamResult);
|
|
|
|
|
|
|
|
// nsISupportsInterface
|
2013-07-18 19:24:13 -07:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIInputStream interface
|
|
|
|
NS_DECL_NSIINPUTSTREAM
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsDirectoryIndexStream_h__
|
|
|
|
|