Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
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/. */
6 #ifndef __NSDIRINDEX_H_
7 #define __NSDIRINDEX_H_
9 #include "nsString.h"
10 #include "nsCOMPtr.h"
11 #include "nsIDirIndexListener.h"
13 class nsIDirIndex;
14 class nsITextToSubURI;
16 /* CID: {a0d6ad32-1dd1-11b2-aa55-a40187b54036} */
18 class nsDirIndexParser : public nsIDirIndexParser {
19 public:
20 NS_DECL_ISUPPORTS
21 NS_DECL_NSISTREAMLISTENER
22 NS_DECL_NSIREQUESTOBSERVER
23 NS_DECL_NSIDIRINDEXPARSER
25 nsDirIndexParser();
26 virtual ~nsDirIndexParser();
27 nsresult Init();
29 enum fieldType {
30 FIELD_UNKNOWN = 0, // MUST be 0
31 FIELD_FILENAME,
32 FIELD_DESCRIPTION,
33 FIELD_CONTENTLENGTH,
34 FIELD_LASTMODIFIED,
35 FIELD_CONTENTTYPE,
36 FIELD_FILETYPE
37 };
39 protected:
40 nsCOMPtr<nsIDirIndexListener> mListener;
42 nsCString mEncoding;
43 nsCString mComment;
44 nsCString mBuf;
45 int32_t mLineStart;
46 bool mHasDescription;
47 int* mFormat;
49 nsresult ProcessData(nsIRequest *aRequest, nsISupports *aCtxt);
50 nsresult ParseFormat(const char* buf);
51 nsresult ParseData(nsIDirIndex* aIdx, char* aDataStr);
53 struct Field {
54 const char *mName;
55 fieldType mType;
56 };
58 static Field gFieldTable[];
60 static nsrefcnt gRefCntParser;
61 static nsITextToSubURI* gTextToSubURI;
62 };
64 #endif