gecko-dev/parser/xml/nsSAXXMLReader.h
Birunthan Mohanathas 898d0c9efb Bug 1057923 - Flatten parser/xml/{public,src}/ into parent directory. r=peterv
--HG--
rename : parser/xml/public/nsIMozSAXXMLDeclarationHandler.idl => parser/xml/nsIMozSAXXMLDeclarationHandler.idl
rename : parser/xml/public/nsISAXAttributes.idl => parser/xml/nsISAXAttributes.idl
rename : parser/xml/public/nsISAXContentHandler.idl => parser/xml/nsISAXContentHandler.idl
rename : parser/xml/public/nsISAXDTDHandler.idl => parser/xml/nsISAXDTDHandler.idl
rename : parser/xml/public/nsISAXErrorHandler.idl => parser/xml/nsISAXErrorHandler.idl
rename : parser/xml/public/nsISAXLexicalHandler.idl => parser/xml/nsISAXLexicalHandler.idl
rename : parser/xml/public/nsISAXLocator.idl => parser/xml/nsISAXLocator.idl
rename : parser/xml/public/nsISAXMutableAttributes.idl => parser/xml/nsISAXMutableAttributes.idl
rename : parser/xml/public/nsISAXXMLFilter.idl => parser/xml/nsISAXXMLFilter.idl
rename : parser/xml/public/nsISAXXMLReader.idl => parser/xml/nsISAXXMLReader.idl
rename : parser/xml/src/nsSAXAttributes.cpp => parser/xml/nsSAXAttributes.cpp
rename : parser/xml/src/nsSAXAttributes.h => parser/xml/nsSAXAttributes.h
rename : parser/xml/src/nsSAXLocator.cpp => parser/xml/nsSAXLocator.cpp
rename : parser/xml/src/nsSAXLocator.h => parser/xml/nsSAXLocator.h
rename : parser/xml/src/nsSAXXMLReader.cpp => parser/xml/nsSAXXMLReader.cpp
rename : parser/xml/src/nsSAXXMLReader.h => parser/xml/nsSAXXMLReader.h
2014-08-26 07:10:58 -07:00

106 lines
2.9 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsSAXXMLReader_h__
#define nsSAXXMLReader_h__
#include "nsCOMPtr.h"
#include "nsIContentSink.h"
#include "nsIExtendedExpatSink.h"
#include "nsIParser.h"
#include "nsIURI.h"
#include "nsISAXXMLReader.h"
#include "nsISAXContentHandler.h"
#include "nsISAXDTDHandler.h"
#include "nsISAXErrorHandler.h"
#include "nsISAXLexicalHandler.h"
#include "nsIMozSAXXMLDeclarationHandler.h"
#include "nsCycleCollectionParticipant.h"
#include "mozilla/Attributes.h"
#define NS_SAXXMLREADER_CONTRACTID "@mozilla.org/saxparser/xmlreader;1"
#define NS_SAXXMLREADER_CID \
{ 0xab1da296, 0x6125, 0x40ba, \
{ 0x96, 0xd0, 0x47, 0xa8, 0x28, 0x2a, 0xe3, 0xdb} }
class nsSAXXMLReader MOZ_FINAL : public nsISAXXMLReader,
public nsIExtendedExpatSink,
public nsIContentSink
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsSAXXMLReader, nsISAXXMLReader)
NS_DECL_NSIEXPATSINK
NS_DECL_NSIEXTENDEDEXPATSINK
NS_DECL_NSISAXXMLREADER
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER
nsSAXXMLReader();
//nsIContentSink
NS_IMETHOD WillParse()
{
return NS_OK;
}
NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode);
NS_IMETHOD DidBuildModel(bool aTerminated);
NS_IMETHOD SetParser(nsParserBase* aParser);
NS_IMETHOD WillInterrupt()
{
return NS_OK;
}
NS_IMETHOD WillResume()
{
return NS_OK;
}
virtual void FlushPendingNotifications(mozFlushType aType)
{
}
NS_IMETHOD SetDocumentCharset(nsACString& aCharset)
{
return NS_OK;
}
virtual nsISupports *GetTarget()
{
return nullptr;
}
private:
~nsSAXXMLReader() {}
nsCOMPtr<nsISAXContentHandler> mContentHandler;
nsCOMPtr<nsISAXDTDHandler> mDTDHandler;
nsCOMPtr<nsISAXErrorHandler> mErrorHandler;
nsCOMPtr<nsISAXLexicalHandler> mLexicalHandler;
nsCOMPtr<nsIMozSAXXMLDeclarationHandler> mDeclarationHandler;
nsCOMPtr<nsIURI> mBaseURI;
nsCOMPtr<nsIStreamListener> mListener;
nsCOMPtr<nsIRequestObserver> mParserObserver;
bool mIsAsyncParse;
static bool TryChannelCharset(nsIChannel *aChannel,
int32_t& aCharsetSource,
nsACString& aCharset);
nsresult EnsureBaseURI();
nsresult InitParser(nsIRequestObserver *aListener, nsIChannel *aChannel);
nsresult SplitExpatName(const char16_t *aExpatName,
nsString &aURI,
nsString &aLocalName,
nsString &aQName);
nsString mPublicId;
nsString mSystemId;
// Feature flags
bool mEnableNamespacePrefixes;
};
#endif // nsSAXXMLReader_h__