nsIndexedToHTML.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #ifndef ____nsindexedtohtml___h___
  6. #define ____nsindexedtohtml___h___
  7. #include "nsCOMPtr.h"
  8. #include "nsString.h"
  9. #include "nsIStreamConverter.h"
  10. #include "nsIDirIndexListener.h"
  11. #define NS_NSINDEXEDTOHTMLCONVERTER_CID \
  12. { 0xcf0f71fd, 0xfafd, 0x4e2b, {0x9f, 0xdc, 0x13, 0x4d, 0x97, 0x2e, 0x16, 0xe2} }
  13. class nsIDateTimeFormat;
  14. class nsIStringBundle;
  15. class nsITextToSubURI;
  16. class nsIndexedToHTML : public nsIStreamConverter,
  17. public nsIDirIndexListener
  18. {
  19. public:
  20. NS_DECL_ISUPPORTS
  21. NS_DECL_NSISTREAMCONVERTER
  22. NS_DECL_NSIREQUESTOBSERVER
  23. NS_DECL_NSISTREAMLISTENER
  24. NS_DECL_NSIDIRINDEXLISTENER
  25. nsIndexedToHTML();
  26. nsresult Init(nsIStreamListener *aListener);
  27. static nsresult
  28. Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
  29. protected:
  30. void FormatSizeString(int64_t inSize, nsCString& outSizeString);
  31. nsresult SendToListener(nsIRequest* aRequest, nsISupports *aContext, const nsACString &aBuffer);
  32. // Helper to properly implement OnStartRequest
  33. nsresult DoOnStartRequest(nsIRequest* request, nsISupports *aContext,
  34. nsCString& aBuffer);
  35. protected:
  36. nsCOMPtr<nsIDirIndexParser> mParser;
  37. nsCOMPtr<nsIStreamListener> mListener; // final listener (consumer)
  38. nsCOMPtr<nsIDateTimeFormat> mDateTime;
  39. nsCOMPtr<nsIStringBundle> mBundle;
  40. nsCOMPtr<nsITextToSubURI> mTextToSubURI;
  41. private:
  42. // Expecting absolute locations, given by 201 lines.
  43. bool mExpectAbsLoc;
  44. virtual ~nsIndexedToHTML();
  45. };
  46. #endif