1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/streamconv/converters/nsDirIndexParser.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,64 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef __NSDIRINDEX_H_ 1.10 +#define __NSDIRINDEX_H_ 1.11 + 1.12 +#include "nsString.h" 1.13 +#include "nsCOMPtr.h" 1.14 +#include "nsIDirIndexListener.h" 1.15 + 1.16 +class nsIDirIndex; 1.17 +class nsITextToSubURI; 1.18 + 1.19 +/* CID: {a0d6ad32-1dd1-11b2-aa55-a40187b54036} */ 1.20 + 1.21 +class nsDirIndexParser : public nsIDirIndexParser { 1.22 +public: 1.23 + NS_DECL_ISUPPORTS 1.24 + NS_DECL_NSISTREAMLISTENER 1.25 + NS_DECL_NSIREQUESTOBSERVER 1.26 + NS_DECL_NSIDIRINDEXPARSER 1.27 + 1.28 + nsDirIndexParser(); 1.29 + virtual ~nsDirIndexParser(); 1.30 + nsresult Init(); 1.31 + 1.32 + enum fieldType { 1.33 + FIELD_UNKNOWN = 0, // MUST be 0 1.34 + FIELD_FILENAME, 1.35 + FIELD_DESCRIPTION, 1.36 + FIELD_CONTENTLENGTH, 1.37 + FIELD_LASTMODIFIED, 1.38 + FIELD_CONTENTTYPE, 1.39 + FIELD_FILETYPE 1.40 + }; 1.41 + 1.42 +protected: 1.43 + nsCOMPtr<nsIDirIndexListener> mListener; 1.44 + 1.45 + nsCString mEncoding; 1.46 + nsCString mComment; 1.47 + nsCString mBuf; 1.48 + int32_t mLineStart; 1.49 + bool mHasDescription; 1.50 + int* mFormat; 1.51 + 1.52 + nsresult ProcessData(nsIRequest *aRequest, nsISupports *aCtxt); 1.53 + nsresult ParseFormat(const char* buf); 1.54 + nsresult ParseData(nsIDirIndex* aIdx, char* aDataStr); 1.55 + 1.56 + struct Field { 1.57 + const char *mName; 1.58 + fieldType mType; 1.59 + }; 1.60 + 1.61 + static Field gFieldTable[]; 1.62 + 1.63 + static nsrefcnt gRefCntParser; 1.64 + static nsITextToSubURI* gTextToSubURI; 1.65 +}; 1.66 + 1.67 +#endif