michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef __NSDIRINDEX_H_ michael@0: #define __NSDIRINDEX_H_ michael@0: michael@0: #include "nsString.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsIDirIndexListener.h" michael@0: michael@0: class nsIDirIndex; michael@0: class nsITextToSubURI; michael@0: michael@0: /* CID: {a0d6ad32-1dd1-11b2-aa55-a40187b54036} */ michael@0: michael@0: class nsDirIndexParser : public nsIDirIndexParser { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSISTREAMLISTENER michael@0: NS_DECL_NSIREQUESTOBSERVER michael@0: NS_DECL_NSIDIRINDEXPARSER michael@0: michael@0: nsDirIndexParser(); michael@0: virtual ~nsDirIndexParser(); michael@0: nsresult Init(); michael@0: michael@0: enum fieldType { michael@0: FIELD_UNKNOWN = 0, // MUST be 0 michael@0: FIELD_FILENAME, michael@0: FIELD_DESCRIPTION, michael@0: FIELD_CONTENTLENGTH, michael@0: FIELD_LASTMODIFIED, michael@0: FIELD_CONTENTTYPE, michael@0: FIELD_FILETYPE michael@0: }; michael@0: michael@0: protected: michael@0: nsCOMPtr mListener; michael@0: michael@0: nsCString mEncoding; michael@0: nsCString mComment; michael@0: nsCString mBuf; michael@0: int32_t mLineStart; michael@0: bool mHasDescription; michael@0: int* mFormat; michael@0: michael@0: nsresult ProcessData(nsIRequest *aRequest, nsISupports *aCtxt); michael@0: nsresult ParseFormat(const char* buf); michael@0: nsresult ParseData(nsIDirIndex* aIdx, char* aDataStr); michael@0: michael@0: struct Field { michael@0: const char *mName; michael@0: fieldType mType; michael@0: }; michael@0: michael@0: static Field gFieldTable[]; michael@0: michael@0: static nsrefcnt gRefCntParser; michael@0: static nsITextToSubURI* gTextToSubURI; michael@0: }; michael@0: michael@0: #endif