parser/xml/src/nsSAXXMLReader.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/parser/xml/src/nsSAXXMLReader.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,103 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     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 nsSAXXMLReader_h__
    1.10 +#define nsSAXXMLReader_h__
    1.11 +
    1.12 +#include "nsCOMPtr.h"
    1.13 +#include "nsIContentSink.h"
    1.14 +#include "nsIExtendedExpatSink.h"
    1.15 +#include "nsIParser.h"
    1.16 +#include "nsIURI.h"
    1.17 +#include "nsISAXXMLReader.h"
    1.18 +#include "nsISAXContentHandler.h"
    1.19 +#include "nsISAXDTDHandler.h"
    1.20 +#include "nsISAXErrorHandler.h"
    1.21 +#include "nsISAXLexicalHandler.h"
    1.22 +#include "nsIMozSAXXMLDeclarationHandler.h"
    1.23 +#include "nsCycleCollectionParticipant.h"
    1.24 +#include "mozilla/Attributes.h"
    1.25 +
    1.26 +#define NS_SAXXMLREADER_CONTRACTID "@mozilla.org/saxparser/xmlreader;1"
    1.27 +#define NS_SAXXMLREADER_CID  \
    1.28 +{ 0xab1da296, 0x6125, 0x40ba, \
    1.29 +{ 0x96, 0xd0, 0x47, 0xa8, 0x28, 0x2a, 0xe3, 0xdb} }
    1.30 +
    1.31 +class nsSAXXMLReader MOZ_FINAL : public nsISAXXMLReader,
    1.32 +                                 public nsIExtendedExpatSink,
    1.33 +                                 public nsIContentSink
    1.34 +{
    1.35 +public:
    1.36 +  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    1.37 +  NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsSAXXMLReader, nsISAXXMLReader)
    1.38 +  NS_DECL_NSIEXPATSINK
    1.39 +  NS_DECL_NSIEXTENDEDEXPATSINK
    1.40 +  NS_DECL_NSISAXXMLREADER
    1.41 +  NS_DECL_NSIREQUESTOBSERVER
    1.42 +  NS_DECL_NSISTREAMLISTENER
    1.43 +
    1.44 +  nsSAXXMLReader();
    1.45 +
    1.46 +  //nsIContentSink
    1.47 +  NS_IMETHOD WillParse()
    1.48 +  {
    1.49 +    return NS_OK;
    1.50 +  }
    1.51 +
    1.52 +  NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode);
    1.53 +  NS_IMETHOD DidBuildModel(bool aTerminated);
    1.54 +  NS_IMETHOD SetParser(nsParserBase* aParser);
    1.55 +  
    1.56 +  NS_IMETHOD WillInterrupt()
    1.57 +  {
    1.58 +    return NS_OK;
    1.59 +  }
    1.60 +
    1.61 +  NS_IMETHOD WillResume()
    1.62 +  {
    1.63 +    return NS_OK;
    1.64 +  }
    1.65 +  
    1.66 +  virtual void FlushPendingNotifications(mozFlushType aType)
    1.67 +  {
    1.68 +  }
    1.69 +  
    1.70 +  NS_IMETHOD SetDocumentCharset(nsACString& aCharset)
    1.71 +  {
    1.72 +    return NS_OK;
    1.73 +  }
    1.74 +  
    1.75 +  virtual nsISupports *GetTarget()
    1.76 +  {
    1.77 +    return nullptr;
    1.78 +  }
    1.79 +
    1.80 +private:
    1.81 +  nsCOMPtr<nsISAXContentHandler> mContentHandler;
    1.82 +  nsCOMPtr<nsISAXDTDHandler> mDTDHandler;
    1.83 +  nsCOMPtr<nsISAXErrorHandler> mErrorHandler;
    1.84 +  nsCOMPtr<nsISAXLexicalHandler> mLexicalHandler;
    1.85 +  nsCOMPtr<nsIMozSAXXMLDeclarationHandler> mDeclarationHandler;
    1.86 +  nsCOMPtr<nsIURI> mBaseURI;
    1.87 +  nsCOMPtr<nsIStreamListener> mListener;
    1.88 +  nsCOMPtr<nsIRequestObserver> mParserObserver;
    1.89 +  bool mIsAsyncParse;
    1.90 +  static bool TryChannelCharset(nsIChannel *aChannel,
    1.91 +                                  int32_t& aCharsetSource,
    1.92 +                                  nsACString& aCharset);
    1.93 +  nsresult EnsureBaseURI();
    1.94 +  nsresult InitParser(nsIRequestObserver *aListener, nsIChannel *aChannel);
    1.95 +  nsresult SplitExpatName(const char16_t *aExpatName,
    1.96 +                          nsString &aURI,
    1.97 +                          nsString &aLocalName,
    1.98 +                          nsString &aQName);
    1.99 +  nsString mPublicId;
   1.100 +  nsString mSystemId;
   1.101 +
   1.102 +  // Feature flags
   1.103 +  bool mEnableNamespacePrefixes;
   1.104 +};
   1.105 +
   1.106 +#endif // nsSAXXMLReader_h__

mercurial