Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef __NSDIRINDEX_H_ |
michael@0 | 7 | #define __NSDIRINDEX_H_ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsString.h" |
michael@0 | 10 | #include "nsCOMPtr.h" |
michael@0 | 11 | #include "nsIDirIndexListener.h" |
michael@0 | 12 | |
michael@0 | 13 | class nsIDirIndex; |
michael@0 | 14 | class nsITextToSubURI; |
michael@0 | 15 | |
michael@0 | 16 | /* CID: {a0d6ad32-1dd1-11b2-aa55-a40187b54036} */ |
michael@0 | 17 | |
michael@0 | 18 | class nsDirIndexParser : public nsIDirIndexParser { |
michael@0 | 19 | public: |
michael@0 | 20 | NS_DECL_ISUPPORTS |
michael@0 | 21 | NS_DECL_NSISTREAMLISTENER |
michael@0 | 22 | NS_DECL_NSIREQUESTOBSERVER |
michael@0 | 23 | NS_DECL_NSIDIRINDEXPARSER |
michael@0 | 24 | |
michael@0 | 25 | nsDirIndexParser(); |
michael@0 | 26 | virtual ~nsDirIndexParser(); |
michael@0 | 27 | nsresult Init(); |
michael@0 | 28 | |
michael@0 | 29 | enum fieldType { |
michael@0 | 30 | FIELD_UNKNOWN = 0, // MUST be 0 |
michael@0 | 31 | FIELD_FILENAME, |
michael@0 | 32 | FIELD_DESCRIPTION, |
michael@0 | 33 | FIELD_CONTENTLENGTH, |
michael@0 | 34 | FIELD_LASTMODIFIED, |
michael@0 | 35 | FIELD_CONTENTTYPE, |
michael@0 | 36 | FIELD_FILETYPE |
michael@0 | 37 | }; |
michael@0 | 38 | |
michael@0 | 39 | protected: |
michael@0 | 40 | nsCOMPtr<nsIDirIndexListener> mListener; |
michael@0 | 41 | |
michael@0 | 42 | nsCString mEncoding; |
michael@0 | 43 | nsCString mComment; |
michael@0 | 44 | nsCString mBuf; |
michael@0 | 45 | int32_t mLineStart; |
michael@0 | 46 | bool mHasDescription; |
michael@0 | 47 | int* mFormat; |
michael@0 | 48 | |
michael@0 | 49 | nsresult ProcessData(nsIRequest *aRequest, nsISupports *aCtxt); |
michael@0 | 50 | nsresult ParseFormat(const char* buf); |
michael@0 | 51 | nsresult ParseData(nsIDirIndex* aIdx, char* aDataStr); |
michael@0 | 52 | |
michael@0 | 53 | struct Field { |
michael@0 | 54 | const char *mName; |
michael@0 | 55 | fieldType mType; |
michael@0 | 56 | }; |
michael@0 | 57 | |
michael@0 | 58 | static Field gFieldTable[]; |
michael@0 | 59 | |
michael@0 | 60 | static nsrefcnt gRefCntParser; |
michael@0 | 61 | static nsITextToSubURI* gTextToSubURI; |
michael@0 | 62 | }; |
michael@0 | 63 | |
michael@0 | 64 | #endif |