Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Static Public Attributes | Protected Attributes
nsXULDocument::BroadcasterHookup Class Reference

Used to resolve broadcaster references. More...

#include <nsXULDocument.h>

Inheritance diagram for nsXULDocument::BroadcasterHookup:
Inheritance graph
[legend]
Collaboration diagram for nsXULDocument::BroadcasterHookup:
Collaboration graph
[legend]

List of all members.

Public Types

enum  Phase { eStart, eConstruction, eHookup, eDone }
 Priority codes returned from GetPhase() More...
enum  Result { eResolve_Succeeded, eResolve_Later, eResolve_Error }
 Result codes returned from Resolve() More...

Public Member Functions

 BroadcasterHookup (nsXULDocument *aDocument, nsIContent *aObservesElement)
virtual ~BroadcasterHookup ()
virtual Phase GetPhase ()
 Get the state in which the forward reference should be resolved.
virtual Result Resolve ()
 Attempt to resolve the forward reference.

Static Public Attributes

static const Phase kPasses []
 Forward references are categorized by 'priority', and all forward references in a higher priority are resolved before any reference in a lower priority.

Protected Attributes

nsXULDocumentmDocument
nsCOMPtr< nsIContentmObservesElement
PRBool mResolved

Detailed Description

Used to resolve broadcaster references.

Definition at line 420 of file nsXULDocument.h.


Member Enumeration Documentation

enum nsForwardReference::Phase [inherited]

Priority codes returned from GetPhase()

Enumerator:
eStart 

A dummy marker, used to indicate unstarted resolution.

eConstruction 

The initial pass, after which the content model will be fully built.

eHookup 

A second pass, after which all 'magic attribute' hookup will have been performed.

eDone 

A dummy marker, used in kPasses to indicate termination.

Definition at line 53 of file nsForwardReference.h.

enum nsForwardReference::Result [inherited]

Result codes returned from Resolve()

Enumerator:
eResolve_Succeeded 

Resolution succeeded, I'm done.

eResolve_Later 

Couldn't resolve, but try me later.

eResolve_Error 

Something bad happened, don't try again.

Definition at line 89 of file nsForwardReference.h.


Constructor & Destructor Documentation

nsXULDocument::BroadcasterHookup::BroadcasterHookup ( nsXULDocument aDocument,
nsIContent aObservesElement 
) [inline]

Definition at line 428 of file nsXULDocument.h.

            : mDocument(aDocument),
              mObservesElement(aObservesElement),
              mResolved(PR_FALSE)
        {
        }

Definition at line 4246 of file nsXULDocument.cpp.

{
#ifdef PR_LOGGING
    if (PR_LOG_TEST(gXULLog, PR_LOG_WARNING) && !mResolved) {
        // Tell the world we failed
        nsresult rv;

        nsIAtom *tag = mObservesElement->Tag();

        nsAutoString broadcasterID;
        nsAutoString attribute;

        if (tag == nsXULAtoms::observes) {
            rv = mObservesElement->GetAttr(kNameSpaceID_None, nsXULAtoms::element, broadcasterID);
            if (NS_FAILED(rv)) return;

            rv = mObservesElement->GetAttr(kNameSpaceID_None, nsXULAtoms::attribute, attribute);
            if (NS_FAILED(rv)) return;
        }
        else {
            rv = mObservesElement->GetAttr(kNameSpaceID_None, nsXULAtoms::observes, broadcasterID);
            if (NS_FAILED(rv)) return;

            attribute.AssignLiteral("*");
        }

        nsAutoString tagStr;
        rv = tag->ToString(tagStr);
        if (NS_FAILED(rv)) return;

        nsCAutoString tagstrC, attributeC,broadcasteridC;
        tagstrC.AssignWithConversion(tagStr);
        attributeC.AssignWithConversion(attribute);
        broadcasteridC.AssignWithConversion(broadcasterID);
        PR_LOG(gXULLog, PR_LOG_WARNING,
               ("xul: broadcaster hookup failed <%s attribute='%s'> to %s",
                tagstrC.get(),
                attributeC.get(),
                broadcasteridC.get()));
    }
#endif
}

Here is the call graph for this function:


Member Function Documentation

virtual Phase nsXULDocument::BroadcasterHookup::GetPhase ( ) [inline, virtual]

Get the state in which the forward reference should be resolved.

'eConstruction' references are all resolved before 'eHookup' references are resolved.

Returns:
the Phase in which the reference needs to be resolved

Implements nsForwardReference.

Definition at line 438 of file nsXULDocument.h.

{ return eHookup; }

Attempt to resolve the forward reference.

Returns:
a Result that tells the resolver how to treat the reference.

Implements nsForwardReference.

Definition at line 4234 of file nsXULDocument.cpp.


Member Data Documentation

Initial value:

Forward references are categorized by 'priority', and all forward references in a higher priority are resolved before any reference in a lower priority.

This variable specifies this ordering. The last Priority is guaranteed to be eDone.

Definition at line 75 of file nsForwardReference.h.

Definition at line 423 of file nsXULDocument.h.

Definition at line 424 of file nsXULDocument.h.

Definition at line 425 of file nsXULDocument.h.


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