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/. */
6 #ifndef ____nsindexedtohtml___h___
7 #define ____nsindexedtohtml___h___
11 #include "nsIStreamConverter.h"
12 #include "nsIDirIndexListener.h"
14 #define NS_NSINDEXEDTOHTMLCONVERTER_CID \
16 0xcf0f71fd, 0xfafd, 0x4e2b, { \
17 0x9f, 0xdc, 0x13, 0x4d, 0x97, 0x2e, 0x16, 0xe2 \
21 class nsIStringBundle
;
22 class nsITextToSubURI
;
24 class nsIndexedToHTML
: public nsIStreamConverter
, public nsIDirIndexListener
{
27 NS_DECL_NSISTREAMCONVERTER
28 NS_DECL_NSIREQUESTOBSERVER
29 NS_DECL_NSISTREAMLISTENER
30 NS_DECL_NSIDIRINDEXLISTENER
32 nsIndexedToHTML() = default;
34 nsresult
Init(nsIStreamListener
* aListener
);
36 static nsresult
Create(REFNSIID aIID
, void** aResult
);
39 void FormatSizeString(int64_t inSize
, nsCString
& outSizeString
);
40 nsresult
SendToListener(nsIRequest
* aRequest
, const nsACString
& aBuffer
);
41 // Helper to properly implement OnStartRequest
42 nsresult
DoOnStartRequest(nsIRequest
* request
, nsCString
& aBuffer
);
45 nsCOMPtr
<nsIDirIndexParser
> mParser
;
46 nsCOMPtr
<nsIStreamListener
> mListener
; // final listener (consumer)
48 nsCOMPtr
<nsIStringBundle
> mBundle
;
50 nsCOMPtr
<nsITextToSubURI
> mTextToSubURI
;
53 // Expecting absolute locations, given by 201 lines.
54 bool mExpectAbsLoc
{false};
56 virtual ~nsIndexedToHTML() = default;