1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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/. */
12 #ifndef __CParserContext
13 #define __CParserContext
15 #include "mozilla/UniquePtr.h"
16 #include "nsIParser.h"
18 #include "nsIRequest.h"
19 #include "nsScanner.h"
24 * Note that the parser is given FULL access to all
25 * data in a parsercontext. Hey, that what it's for!
28 class CParserContext
{
30 enum eContextType
{ eCTNone
, eCTURL
, eCTString
, eCTStream
};
32 CParserContext(CParserContext
* aPrevContext
, nsScanner
* aScanner
,
33 void* aKey
= 0, eParserCommands aCommand
= eViewNormal
,
34 nsIRequestObserver
* aListener
= 0,
35 eAutoDetectResult aStatus
= eUnknownDetect
,
36 bool aCopyUnused
= false);
40 nsresult
GetTokenizer(nsIDTD
* aDTD
, nsIContentSink
* aSink
,
41 nsITokenizer
*& aTokenizer
);
42 void SetMimeType(const nsACString
& aMimeType
);
45 mRequest
; // provided by necko to differnciate different input streams
46 // why is mRequest strongly referenced? see bug 102376.
47 nsCOMPtr
<nsIRequestObserver
> mListener
;
49 nsCOMPtr
<nsITokenizer
> mTokenizer
;
50 CParserContext
* const mPrevContext
;
51 mozilla::UniquePtr
<nsScanner
> mScanner
;
56 eParserDocType mDocType
;
57 eStreamState mStreamListenerState
;
58 eContextType mContextType
;
59 eAutoDetectResult mAutoDetectStatus
;
60 eParserCommands mParserCommand
;