Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Attributes
txXMLOutput Class Reference

#include <txXMLOutput.h>

Inheritance diagram for txXMLOutput:
Inheritance graph
[legend]
Collaboration diagram for txXMLOutput:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 txXMLOutput (txOutputFormat *aFormat, ostream *aOut)
virtual ~txXMLOutput ()
virtual void getOutputDocument (nsIDOMDocument **aDocument)=0
 Gets the Mozilla output document.
virtual void attribute (const nsAString &aName, const PRInt32 aNsID, const nsAString &aValue)=0
 Signals to receive the start of an attribute.
virtual void characters (const nsAString &aData, PRBool aDOE)=0
 Signals to receive characters.
virtual void comment (const nsAString &aData)=0
 Signals to receive data that should be treated as a comment.
virtual void endDocument (nsresult aResult)=0
 Signals the end of a document.
virtual void endElement (const nsAString &aName, const PRInt32 aNsID)=0
 Signals to receive the end of an element.
virtual void processingInstruction (const nsAString &aTarget, const nsAString &aData)=0
 Signals to receive a processing instruction.
virtual void startDocument ()=0
 Signals the start of a document.
virtual void startElement (const nsAString &aName, const PRInt32 aNsID)=0
 Signals to receive the start of an element.

Static Public Attributes

static const int DEFAULT_INDENT = 2

Protected Member Functions

virtual void closeStartTag (MBool aUseEmptyElementShorthand)
void printUTF8Char (PRUnichar &ch)
void printUTF8Chars (const nsAString &aData)
void printWithXMLEntities (const nsAString &aData, MBool aAttribute=MB_FALSE)

Protected Attributes

ostream * mOut
txOutputFormat mOutputFormat
MBool mUseEmptyElementShorthand
MBool mHaveDocumentElement
MBool mStartTagOpen
MBool mAfterEndTag
MBool mInCDATASection
PRUint32 mIndentLevel
txList mAttributes
txStack mCDATASections

Private Attributes

PRUnichar mBuffer [4]

Detailed Description

Definition at line 93 of file txXMLOutput.h.


Constructor & Destructor Documentation

txXMLOutput::txXMLOutput ( txOutputFormat aFormat,
ostream *  aOut 
)

Definition at line 64 of file txXMLOutput.cpp.

{
}

Member Function Documentation

virtual void txAXMLEventHandler::attribute ( const nsAString &  aName,
const PRInt32  aNsID,
const nsAString &  aValue 
) [pure virtual, inherited]

Signals to receive the start of an attribute.

Parameters:
aNamethe name of the attribute
aNsIDthe namespace ID of the attribute
aValuethe value of the attribute

Implemented in txHTMLOutput, and txUnknownHandler.

Here is the caller graph for this function:

virtual void txAXMLEventHandler::characters ( const nsAString &  aData,
PRBool  aDOE 
) [pure virtual, inherited]

Signals to receive characters.

Parameters:
aDatathe characters to receive
aDOEdisable output escaping for these characters

Implemented in txHTMLOutput.

Here is the caller graph for this function:

void txXMLOutput::closeStartTag ( MBool  aUseEmptyElementShorthand) [protected, virtual]

Reimplemented in txHTMLOutput.

Definition at line 258 of file txXMLOutput.cpp.

{
    mAfterEndTag = aUseEmptyElementShorthand;
    if (mStartTagOpen) {
        txListIterator iter(&mAttributes);
        txOutAttr* att;
        while ((att = (txOutAttr*)iter.next())) {
            *mOut << SPACE;
            const char* attrVal;
            att->mName.mLocalName->GetUTF8String(&attrVal);
            *mOut << attrVal;
            if (!att->mShorthand) {
                *mOut << EQUALS << DOUBLE_QUOTE;
                printWithXMLEntities(att->mValue, MB_TRUE);
                *mOut << DOUBLE_QUOTE;
            }
            delete (txOutAttr*)iter.remove();
        }

        if (aUseEmptyElementShorthand)
            *mOut << FORWARD_SLASH;
        *mOut << R_ANGLE_BRACKET;
        mStartTagOpen = MB_FALSE;
    }
}

Here is the call graph for this function:

virtual void txAXMLEventHandler::comment ( const nsAString &  aData) [pure virtual, inherited]

Signals to receive data that should be treated as a comment.

Parameters:
datathe comment data to receive

Here is the caller graph for this function:

virtual void txAXMLEventHandler::endDocument ( nsresult  aResult) [pure virtual, inherited]

Signals the end of a document.

It is an error to call this method more than once.

Implemented in txRtfHandler, and txUnknownHandler.

Here is the caller graph for this function:

virtual void txAXMLEventHandler::endElement ( const nsAString &  aName,
const PRInt32  aNsID 
) [pure virtual, inherited]

Signals to receive the end of an element.

Parameters:
aNamethe name of the element
aNsIDthe namespace ID of the element

Implemented in txHTMLOutput.

Here is the caller graph for this function:

virtual void txAOutputXMLEventHandler::getOutputDocument ( nsIDOMDocument **  aDocument) [pure virtual, inherited]

Gets the Mozilla output document.

Parameters:
aDocumentthe Mozilla output document

Here is the caller graph for this function:

void txXMLOutput::printUTF8Char ( PRUnichar ch) [protected]

Definition at line 284 of file txXMLOutput.cpp.

{
    // PRUnichar is 16-bits so we only need to cover up to 0xFFFF

    // 0x0000-0x007F
    if (ch < 128) {
        *mOut << (char)ch;
    }
    // 0x0080-0x07FF
    else if (ch < 2048) {
        *mOut << (char) (192+(ch/64));        // 0xC0 + x/64
        *mOut << (char) (128+(ch%64));        // 0x80 + x%64
    }
    // 0x800-0xFFFF
    else {
        *mOut << (char) (224+(ch/4096));      // 0xE0 + x/64^2
        *mOut << (char) (128+((ch/64)%64));   // 0x80 + (x/64)%64
        *mOut << (char) (128+(ch%64));        // 0x80 + x%64
    }
}

Here is the caller graph for this function:

void txXMLOutput::printUTF8Chars ( const nsAString &  aData) [protected]

Definition at line 305 of file txXMLOutput.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void txXMLOutput::printWithXMLEntities ( const nsAString &  aData,
MBool  aAttribute = MB_FALSE 
) [protected]

Definition at line 310 of file txXMLOutput.cpp.

{
    nsAString::const_iterator iter, end;
    aData.EndReading(end);

    for (aData.BeginReading(iter); iter != end; ++iter) {
        PRUnichar currChar = *iter;
        switch (currChar) {
            case AMPERSAND:
                *mOut << AMP_ENTITY;
                break;
            case APOSTROPHE:
                if (aAttribute)
                    *mOut << APOS_ENTITY;
                else
                    printUTF8Char(currChar);
                break;
            case GT:
                *mOut << GT_ENTITY;
                break;
            case LT:
                *mOut << LT_ENTITY;
                break;
            case QUOTE:
                if (aAttribute)
                    *mOut << QUOT_ENTITY;
                else
                    printUTF8Char(currChar);
                break;
            default:
                printUTF8Char(currChar);
                break;
        }
    }
    *mOut << flush;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void txAXMLEventHandler::processingInstruction ( const nsAString &  aTarget,
const nsAString &  aData 
) [pure virtual, inherited]

Signals to receive a processing instruction.

Parameters:
aTargetthe target of the processing instruction
aDatathe data of the processing instruction

Implemented in txHTMLOutput.

Here is the caller graph for this function:

virtual void txAXMLEventHandler::startDocument ( ) [pure virtual, inherited]

Signals the start of a document.

Implemented in txRtfHandler, and txHTMLOutput.

Here is the caller graph for this function:

virtual void txAXMLEventHandler::startElement ( const nsAString &  aName,
const PRInt32  aNsID 
) [pure virtual, inherited]

Signals to receive the start of an element.

Parameters:
aNamethe name of the element
aNsIDthe namespace ID of the element

Implemented in txHTMLOutput, and txUnknownHandler.

Here is the caller graph for this function:


Member Data Documentation

Definition at line 99 of file txXMLOutput.h.

Definition at line 116 of file txXMLOutput.h.

Definition at line 119 of file txXMLOutput.h.

Definition at line 123 of file txXMLOutput.h.

Definition at line 120 of file txXMLOutput.h.

Definition at line 114 of file txXMLOutput.h.

Definition at line 117 of file txXMLOutput.h.

Definition at line 118 of file txXMLOutput.h.

ostream* txXMLOutput::mOut [protected]

Definition at line 111 of file txXMLOutput.h.

Definition at line 112 of file txXMLOutput.h.

Definition at line 115 of file txXMLOutput.h.

Definition at line 113 of file txXMLOutput.h.


The documentation for this class was generated from the following files: