Back to index

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

#include <dom.h>

List of all members.

Static Public Member Functions

static PRInt32 getNamespaceID (const nsAString &aURI)
static nsresult getNamespaceURI (const PRInt32 aID, nsAString &aNSURI)
static MBool init ()
static void shutdown ()

Static Private Attributes

static nsStringArray * mNamespaces

Detailed Description

Definition at line 551 of file dom.h.


Member Function Documentation

static PRInt32 txStandaloneNamespaceManager::getNamespaceID ( const nsAString &  aURI) [inline, static]

Definition at line 554 of file dom.h.

    {
        if (!mNamespaces && !init())
            return kNameSpaceID_Unknown;

        PRInt32 id = mNamespaces->IndexOf(aURI);
        if (id != -1) {
            return id + 1;
        }

        if (!mNamespaces->AppendString(aURI)) {
            NS_ASSERTION(0, "Out of memory, namespaces are getting lost");
            return kNameSpaceID_Unknown;
        }

        return mNamespaces->Count();
    }

Here is the call graph for this function:

static nsresult txStandaloneNamespaceManager::getNamespaceURI ( const PRInt32  aID,
nsAString &  aNSURI 
) [inline, static]

Definition at line 572 of file dom.h.

    {
        // empty namespace, and errors
        aNSURI.Truncate();
        if (aID <= 0 || (!mNamespaces && !init()) ||
            aID > mNamespaces->Count()) {
            return NS_OK;
        }

        aNSURI = *mNamespaces->StringAt(aID - 1);
        return NS_OK;
    }

Here is the call graph for this function:

static MBool txStandaloneNamespaceManager::init ( ) [inline, static]

Definition at line 585 of file dom.h.

    {
        NS_ASSERTION(!mNamespaces,
                     "called without matching shutdown()");
        if (mNamespaces)
            return MB_TRUE;
        mNamespaces = new nsStringArray();
        if (!mNamespaces)
            return MB_FALSE;
        /*
         * Hardwiring some Namespace IDs.
         * no Namespace is 0
         * xmlns prefix is 1, mapped to http://www.w3.org/2000/xmlns/
         * xml prefix is 2, mapped to http://www.w3.org/XML/1998/namespace
         */
        if (!mNamespaces->AppendString(NS_LITERAL_STRING("http://www.w3.org/2000/xmlns/")) ||
            !mNamespaces->AppendString(NS_LITERAL_STRING("http://www.w3.org/XML/1998/namespace")) ||
            !mNamespaces->AppendString(NS_LITERAL_STRING("http://www.w3.org/1999/XSL/Transform"))) {
            delete mNamespaces;
            mNamespaces = 0;
            return MB_FALSE;
        }

        return MB_TRUE;
    }

Here is the caller graph for this function:

static void txStandaloneNamespaceManager::shutdown ( ) [inline, static]

Definition at line 611 of file dom.h.

    {
        NS_ASSERTION(mNamespaces, "called without matching init()");
        if (!mNamespaces)
            return;
        delete mNamespaces;
        mNamespaces = nsnull;
    }

Member Data Documentation

nsStringArray* txStandaloneNamespaceManager::mNamespaces [static, private]

Definition at line 621 of file dom.h.


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