LCOV - code coverage report
Current view: top level - dom/xslt/xslt - txXMLEventHandler.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 5 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       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/. */
       5             : 
       6             : #ifndef TRANSFRMX_XML_EVENT_HANDLER_H
       7             : #define TRANSFRMX_XML_EVENT_HANDLER_H
       8             : 
       9             : #include "txCore.h"
      10             : #include "nsIAtom.h"
      11             : 
      12             : #define kTXNameSpaceURI "http://www.mozilla.org/TransforMiix"
      13             : #define kTXWrapper "transformiix:result"
      14             : 
      15             : class txOutputFormat;
      16             : class nsIDOMDocument;
      17             : 
      18             : /**
      19             :  * An interface for handling XML documents, loosely modeled
      20             :  * after Dave Megginson's SAX 1.0 API.
      21             :  */
      22             : 
      23           0 : class txAXMLEventHandler
      24             : {
      25             : public:
      26           0 :     virtual ~txAXMLEventHandler() {}
      27             : 
      28             :     /**
      29             :      * Signals to receive the start of an attribute.
      30             :      *
      31             :      * @param aPrefix the prefix of the attribute
      32             :      * @param aLocalName the localname of the attribute
      33             :      * @param aLowercaseName the localname of the attribute in lower case
      34             :      * @param aNsID the namespace ID of the attribute
      35             :      * @param aValue the value of the attribute
      36             :      */
      37             :     virtual nsresult attribute(nsIAtom* aPrefix, nsIAtom* aLocalName,
      38             :                                nsIAtom* aLowercaseLocalName, int32_t aNsID,
      39             :                                const nsString& aValue) = 0;
      40             : 
      41             :     /**
      42             :      * Signals to receive the start of an attribute.
      43             :      *
      44             :      * @param aPrefix the prefix of the attribute
      45             :      * @param aLocalName the localname of the attribute
      46             :      * @param aNsID the namespace ID of the attribute
      47             :      * @param aValue the value of the attribute
      48             :      */
      49             :     virtual nsresult attribute(nsIAtom* aPrefix,
      50             :                                const nsAString& aLocalName,
      51             :                                const int32_t aNsID,
      52             :                                const nsString& aValue) = 0;
      53             : 
      54             :     /**
      55             :      * Signals to receive characters.
      56             :      *
      57             :      * @param aData the characters to receive
      58             :      * @param aDOE disable output escaping for these characters
      59             :      */
      60             :     virtual nsresult characters(const nsAString& aData, bool aDOE) = 0;
      61             : 
      62             :     /**
      63             :      * Signals to receive data that should be treated as a comment.
      64             :      *
      65             :      * @param data the comment data to receive
      66             :      */
      67             :     virtual nsresult comment(const nsString& aData) = 0;
      68             : 
      69             :     /**
      70             :      * Signals the end of a document. It is an error to call
      71             :      * this method more than once.
      72             :      */
      73             :     virtual nsresult endDocument(nsresult aResult) = 0;
      74             : 
      75             :     /**
      76             :      * Signals to receive the end of an element.
      77             :      */
      78             :     virtual nsresult endElement() = 0;
      79             : 
      80             :     /**
      81             :      * Signals to receive a processing instruction.
      82             :      *
      83             :      * @param aTarget the target of the processing instruction
      84             :      * @param aData the data of the processing instruction
      85             :      */
      86             :     virtual nsresult processingInstruction(const nsString& aTarget,
      87             :                                            const nsString& aData) = 0;
      88             : 
      89             :     /**
      90             :      * Signals the start of a document.
      91             :      */
      92             :     virtual nsresult startDocument() = 0;
      93             : 
      94             :     /**
      95             :      * Signals to receive the start of an element.
      96             :      *
      97             :      * @param aPrefix the prefix of the element
      98             :      * @param aLocalName the localname of the element
      99             :      * @param aLowercaseName the localname of the element in lower case
     100             :      * @param aNsID the namespace ID of the element
     101             :      */
     102             :     virtual nsresult startElement(nsIAtom* aPrefix,
     103             :                                   nsIAtom* aLocalName,
     104             :                                   nsIAtom* aLowercaseLocalName,
     105             :                                   int32_t aNsID) = 0;
     106             : 
     107             :     /**
     108             :      * Signals to receive the start of an element. Can throw
     109             :      * NS_ERROR_XSLT_BAD_NODE_NAME if the name is invalid
     110             :      *
     111             :      * @param aPrefix the prefix of the element
     112             :      * @param aLocalName the localname of the element
     113             :      * @param aNsID the namespace ID of the element
     114             :      */
     115             :     virtual nsresult startElement(nsIAtom* aPrefix,
     116             :                                   const nsAString& aLocalName,
     117             :                                   const int32_t aNsID) = 0;
     118             : };
     119             : 
     120             : #define TX_DECL_TXAXMLEVENTHANDLER                                           \
     121             :     virtual nsresult attribute(nsIAtom* aPrefix, nsIAtom* aLocalName,        \
     122             :                                nsIAtom* aLowercaseLocalName, int32_t aNsID,  \
     123             :                                const nsString& aValue);                      \
     124             :     virtual nsresult attribute(nsIAtom* aPrefix,                             \
     125             :                                const nsAString& aLocalName,                  \
     126             :                                const int32_t aNsID,                          \
     127             :                                const nsString& aValue);                      \
     128             :     virtual nsresult characters(const nsAString& aData, bool aDOE);          \
     129             :     virtual nsresult comment(const nsString& aData);                         \
     130             :     virtual nsresult endDocument(nsresult aResult = NS_OK);                  \
     131             :     virtual nsresult endElement();                                           \
     132             :     virtual nsresult processingInstruction(const nsString& aTarget,          \
     133             :                                            const nsString& aData);           \
     134             :     virtual nsresult startDocument();                                        \
     135             :     virtual nsresult startElement(nsIAtom* aPrefix,                          \
     136             :                                   nsIAtom* aLocalName,                       \
     137             :                                   nsIAtom* aLowercaseLocalName,              \
     138             :                                   int32_t aNsID);                            \
     139             :     virtual nsresult startElement(nsIAtom* aPrefix,                          \
     140             :                                   const nsAString& aName,                    \
     141             :                                   const int32_t aNsID);
     142             : 
     143             : 
     144           0 : class txAOutputXMLEventHandler : public txAXMLEventHandler
     145             : {
     146             : public:
     147             :     /**
     148             :      * Gets the Mozilla output document
     149             :      *
     150             :      * @param aDocument the Mozilla output document
     151             :      */
     152             :     virtual void getOutputDocument(nsIDOMDocument** aDocument) = 0;
     153             : };
     154             : 
     155             : #define TX_DECL_TXAOUTPUTXMLEVENTHANDLER                        \
     156             :     virtual void getOutputDocument(nsIDOMDocument** aDocument);
     157             : 
     158             : /**
     159             :  * Interface used to create the appropriate outputhandler
     160             :  */
     161           0 : class txAOutputHandlerFactory
     162             : {
     163             : public:
     164           0 :     virtual ~txAOutputHandlerFactory() {}
     165             : 
     166             :     /**
     167             :      * Creates an outputhandler for the specified format.
     168             :      * @param aFromat  format to get handler for
     169             :      * @param aHandler outparam. The created handler
     170             :      */
     171             :     virtual nsresult
     172             :     createHandlerWith(txOutputFormat* aFormat,
     173             :                       txAXMLEventHandler** aHandler) = 0;
     174             : 
     175             :     /**
     176             :      * Creates an outputhandler for the specified format, with the specified
     177             :      * name and namespace for the root element.
     178             :      * @param aFromat  format to get handler for
     179             :      * @param aName    name of the root element
     180             :      * @param aNsID    namespace-id of the root element
     181             :      * @param aHandler outparam. The created handler
     182             :      */
     183             :     virtual nsresult
     184             :     createHandlerWith(txOutputFormat* aFormat,
     185             :                       const nsAString& aName,
     186             :                       int32_t aNsID,
     187             :                       txAXMLEventHandler** aHandler) = 0;
     188             : };
     189             : 
     190             : #define TX_DECL_TXAOUTPUTHANDLERFACTORY                        \
     191             :     nsresult createHandlerWith(txOutputFormat* aFormat,        \
     192             :                                txAXMLEventHandler** aHandler); \
     193             :     nsresult createHandlerWith(txOutputFormat* aFormat,        \
     194             :                                const nsAString& aName,         \
     195             :                                int32_t aNsID,                  \
     196             :                                txAXMLEventHandler** aHandler);
     197             : 
     198             : #endif

Generated by: LCOV version 1.13