michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsForwardReference_h__ michael@0: #define nsForwardReference_h__ michael@0: michael@0: class nsForwardReference michael@0: { michael@0: protected: michael@0: nsForwardReference() {} michael@0: michael@0: public: michael@0: virtual ~nsForwardReference() {} michael@0: michael@0: /** michael@0: * Priority codes returned from GetPhase() michael@0: */ michael@0: enum Phase { michael@0: /** A dummy marker, used to indicate unstarted resolution */ michael@0: eStart, michael@0: michael@0: /** The initial pass, after which the content model will be michael@0: fully built */ michael@0: eConstruction, michael@0: michael@0: /** A second pass, after which all 'magic attribute' hookup michael@0: will have been performed */ michael@0: eHookup, michael@0: michael@0: /** A dummy marker, used in kPasses to indicate termination */ michael@0: eDone michael@0: }; michael@0: michael@0: /** michael@0: * Forward references are categorized by 'priority', and all michael@0: * forward references in a higher priority are resolved before any michael@0: * reference in a lower priority. This variable specifies this michael@0: * ordering. The last Priority is guaranteed to be eDone. michael@0: */ michael@0: static const Phase kPasses[]; michael@0: michael@0: /** michael@0: * Get the state in which the forward reference should be resolved. michael@0: * 'eConstruction' references are all resolved before 'eHookup' references michael@0: * are resolved. michael@0: * michael@0: * @return the Phase in which the reference needs to be resolved michael@0: */ michael@0: virtual Phase GetPhase() = 0; michael@0: michael@0: /** michael@0: * Result codes returned from Resolve() michael@0: */ michael@0: enum Result { michael@0: /** Resolution succeeded, I'm done. */ michael@0: eResolve_Succeeded, michael@0: michael@0: /** Couldn't resolve, but try me later. */ michael@0: eResolve_Later, michael@0: michael@0: /** Something bad happened, don't try again. */ michael@0: eResolve_Error michael@0: }; michael@0: michael@0: /** michael@0: * Attempt to resolve the forward reference. michael@0: * michael@0: * @return a Result that tells the resolver how to treat michael@0: * the reference. michael@0: */ michael@0: virtual Result Resolve() = 0; michael@0: }; michael@0: michael@0: #endif // nsForwardReference_h__