LCOV - app.info - content/xslt/src/xslt/txXMLEventHandler.h

LCOV - code coverage report
| Current view: | directory - content/xslt/src/xslt - txXMLEventHandler.h (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 5 | 0 | 0.0 %
| Date: | 2012-04-21 | Functions: | 9 | 0 | 0.0 %

           1                 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
           2                 : /* ***** BEGIN LICENSE BLOCK *****
           3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
           4                 :  *
           5                 :  * The contents of this file are subject to the Mozilla Public License Version
           6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
           7                 :  * the License. You may obtain a copy of the License at
           8                 :  * http://www.mozilla.org/MPL/
           9                 :  *
          10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
          11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
          12                 :  * for the specific language governing rights and limitations under the
          13                 :  * License.
          14                 :  *
          15                 :  * The Original Code is TransforMiiX XSLT processor code.
          16                 :  *
          17                 :  * The Initial Developer of the Original Code is
          18                 :  * Keith Visco.
          19                 :  * Portions created by the Initial Developer are Copyright (C) 1999
          20                 :  * the Initial Developer. All Rights Reserved.
          21                 :  *
          22                 :  * Contributor(s):
          23                 :  *   Keith Visco <kvisco@ziplink.net>
          24                 :  *
          25                 :  * Alternatively, the contents of this file may be used under the terms of
          26                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
          27                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          29                 :  * of those above. If you wish to allow use of your version of this file only
          30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          31                 :  * use your version of this file under the terms of the MPL, indicate your
          32                 :  * decision by deleting the provisions above and replace them with the notice
          33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          34                 :  * the provisions above, a recipient may use your version of this file under
          35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          36                 :  *
          37                 :  * ***** END LICENSE BLOCK ***** */
          38                 :
          39                 : #ifndef TRANSFRMX_XML_EVENT_HANDLER_H
          40                 : #define TRANSFRMX_XML_EVENT_HANDLER_H
          41                 :
          42                 : #include "txCore.h"
          43                 : #include "nsIAtom.h"
          44                 :
          45                 : #define kTXNameSpaceURI "http://www.mozilla.org/TransforMiix"
          46                 : #define kTXWrapper "transformiix:result"
          47                 :
          48                 : class txOutputFormat;
          49                 : class nsIDOMDocument;
          50                 :
          51                 : /**
          52                 :  * An interface for handling XML documents, loosely modeled
          53                 :  * after Dave Megginson's SAX 1.0 API.
          54                 :  */
          55                 :
          56                 : class txAXMLEventHandler
          57               0 : {
          58                 : public:
          59               0 :     virtual ~txAXMLEventHandler() {}
          60                 :
          61                 :     /**
          62                 :      * Signals to receive the start of an attribute.
          63                 :      *
          64                 :      * @param aPrefix the prefix of the attribute
          65                 :      * @param aLocalName the localname of the attribute
          66                 :      * @param aLowercaseName the localname of the attribute in lower case
          67                 :      * @param aNsID the namespace ID of the attribute
          68                 :      * @param aValue the value of the attribute
          69                 :      */
          70                 :     virtual nsresult attribute(nsIAtom* aPrefix, nsIAtom* aLocalName,
          71                 :                                nsIAtom* aLowercaseLocalName, PRInt32 aNsID,
          72                 :                                const nsString& aValue) = 0;
          73                 :
          74                 :     /**
          75                 :      * Signals to receive the start of an attribute.
          76                 :      *
          77                 :      * @param aPrefix the prefix of the attribute
          78                 :      * @param aLocalName the localname of the attribute
          79                 :      * @param aNsID the namespace ID of the attribute
          80                 :      * @param aValue the value of the attribute
          81                 :      */
          82                 :     virtual nsresult attribute(nsIAtom* aPrefix,
          83                 :                                const nsSubstring& aLocalName,
          84                 :                                const PRInt32 aNsID,
          85                 :                                const nsString& aValue) = 0;
          86                 :
          87                 :     /**
          88                 :      * Signals to receive characters.
          89                 :      *
          90                 :      * @param aData the characters to receive
          91                 :      * @param aDOE disable output escaping for these characters
          92                 :      */
          93                 :     virtual nsresult characters(const nsSubstring& aData, bool aDOE) = 0;
          94                 :
          95                 :     /**
          96                 :      * Signals to receive data that should be treated as a comment.
          97                 :      *
          98                 :      * @param data the comment data to receive
          99                 :      */
         100                 :     virtual nsresult comment(const nsString& aData) = 0;
         101                 :
         102                 :     /**
         103                 :      * Signals the end of a document. It is an error to call
         104                 :      * this method more than once.
         105                 :      */
         106                 :     virtual nsresult endDocument(nsresult aResult) = 0;
         107                 :
         108                 :     /**
         109                 :      * Signals to receive the end of an element.
         110                 :      */
         111                 :     virtual nsresult endElement() = 0;
         112                 :
         113                 :     /**
         114                 :      * Signals to receive a processing instruction.
         115                 :      *
         116                 :      * @param aTarget the target of the processing instruction
         117                 :      * @param aData the data of the processing instruction
         118                 :      */
         119                 :     virtual nsresult processingInstruction(const nsString& aTarget,
         120                 :                                            const nsString& aData) = 0;
         121                 :
         122                 :     /**
         123                 :      * Signals the start of a document.
         124                 :      */
         125                 :     virtual nsresult startDocument() = 0;
         126                 :
         127                 :     /**
         128                 :      * Signals to receive the start of an element.
         129                 :      *
         130                 :      * @param aPrefix the prefix of the element
         131                 :      * @param aLocalName the localname of the element
         132                 :      * @param aLowercaseName the localname of the element in lower case
         133                 :      * @param aNsID the namespace ID of the element
         134                 :      */
         135                 :     virtual nsresult startElement(nsIAtom* aPrefix,
         136                 :                                   nsIAtom* aLocalName,
         137                 :                                   nsIAtom* aLowercaseLocalName,
         138                 :                                   PRInt32 aNsID) = 0;
         139                 :
         140                 :     /**
         141                 :      * Signals to receive the start of an element. Can throw
         142                 :      * NS_ERROR_XSLT_BAD_NODE_NAME if the name is invalid
         143                 :      *
         144                 :      * @param aPrefix the prefix of the element
         145                 :      * @param aLocalName the localname of the element
         146                 :      * @param aNsID the namespace ID of the element
         147                 :      */
         148                 :     virtual nsresult startElement(nsIAtom* aPrefix,
         149                 :                                   const nsSubstring& aLocalName,
         150                 :                                   const PRInt32 aNsID) = 0;
         151                 : };
         152                 :
         153                 : #define TX_DECL_TXAXMLEVENTHANDLER                                           \
         154                 :     virtual nsresult attribute(nsIAtom* aPrefix, nsIAtom* aLocalName,        \
         155                 :                                nsIAtom* aLowercaseLocalName, PRInt32 aNsID,  \
         156                 :                                const nsString& aValue);                      \
         157                 :     virtual nsresult attribute(nsIAtom* aPrefix,                             \
         158                 :                                const nsSubstring& aLocalName,                \
         159                 :                                const PRInt32 aNsID,                          \
         160                 :                                const nsString& aValue);                      \
         161                 :     virtual nsresult characters(const nsSubstring& aData, bool aDOE);      \
         162                 :     virtual nsresult comment(const nsString& aData);                         \
         163                 :     virtual nsresult endDocument(nsresult aResult = NS_OK);                  \
         164                 :     virtual nsresult endElement();                                           \
         165                 :     virtual nsresult processingInstruction(const nsString& aTarget,          \
         166                 :                                            const nsString& aData);           \
         167                 :     virtual nsresult startDocument();                                        \
         168                 :     virtual nsresult startElement(nsIAtom* aPrefix,                          \
         169                 :                                   nsIAtom* aLocalName,                       \
         170                 :                                   nsIAtom* aLowercaseLocalName,              \
         171                 :                                   PRInt32 aNsID);                            \
         172                 :     virtual nsresult startElement(nsIAtom* aPrefix,                          \
         173                 :                                   const nsSubstring& aName,                  \
         174                 :                                   const PRInt32 aNsID);
         175                 :
         176                 :
         177                 : class txAOutputXMLEventHandler : public txAXMLEventHandler
         178               0 : {
         179                 : public:
         180                 :     /**
         181                 :      * Gets the Mozilla output document
         182                 :      *
         183                 :      * @param aDocument the Mozilla output document
         184                 :      */
         185                 :     virtual void getOutputDocument(nsIDOMDocument** aDocument) = 0;
         186                 : };
         187                 :
         188                 : #define TX_DECL_TXAOUTPUTXMLEVENTHANDLER                        \
         189                 :     virtual void getOutputDocument(nsIDOMDocument** aDocument);
         190                 :
         191                 : /**
         192                 :  * Interface used to create the appropriate outputhandler
         193                 :  */
         194                 : class txAOutputHandlerFactory
         195               0 : {
         196                 : public:
         197               0 :     virtual ~txAOutputHandlerFactory() {}
         198                 :
         199                 :     /**
         200                 :      * Creates an outputhandler for the specified format.
         201                 :      * @param aFromat  format to get handler for
         202                 :      * @param aHandler outparam. The created handler
         203                 :      */
         204                 :     virtual nsresult
         205                 :     createHandlerWith(txOutputFormat* aFormat,
         206                 :                       txAXMLEventHandler** aHandler) = 0;
         207                 :
         208                 :     /**
         209                 :      * Creates an outputhandler for the specified format, with the specified
         210                 :      * name and namespace for the root element.
         211                 :      * @param aFromat  format to get handler for
         212                 :      * @param aName    name of the root element
         213                 :      * @param aNsID    namespace-id of the root element
         214                 :      * @param aHandler outparam. The created handler
         215                 :      */
         216                 :     virtual nsresult
         217                 :     createHandlerWith(txOutputFormat* aFormat,
         218                 :                       const nsSubstring& aName,
         219                 :                       PRInt32 aNsID,
         220                 :                       txAXMLEventHandler** aHandler) = 0;
         221                 : };
         222                 :
         223                 : #define TX_DECL_TXAOUTPUTHANDLERFACTORY                        \
         224                 :     nsresult createHandlerWith(txOutputFormat* aFormat,        \
         225                 :                                txAXMLEventHandler** aHandler); \
         226                 :     nsresult createHandlerWith(txOutputFormat* aFormat,        \
         227                 :                                const nsSubstring& aName,       \
         228                 :                                PRInt32 aNsID,                  \
         229                 :                                txAXMLEventHandler** aHandler);
         230                 :
         231                 : #endif

Generated by: LCOV version 1.7