1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/xul/document/src/nsForwardReference.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,76 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsForwardReference_h__ 1.10 +#define nsForwardReference_h__ 1.11 + 1.12 +class nsForwardReference 1.13 +{ 1.14 +protected: 1.15 + nsForwardReference() {} 1.16 + 1.17 +public: 1.18 + virtual ~nsForwardReference() {} 1.19 + 1.20 + /** 1.21 + * Priority codes returned from GetPhase() 1.22 + */ 1.23 + enum Phase { 1.24 + /** A dummy marker, used to indicate unstarted resolution */ 1.25 + eStart, 1.26 + 1.27 + /** The initial pass, after which the content model will be 1.28 + fully built */ 1.29 + eConstruction, 1.30 + 1.31 + /** A second pass, after which all 'magic attribute' hookup 1.32 + will have been performed */ 1.33 + eHookup, 1.34 + 1.35 + /** A dummy marker, used in kPasses to indicate termination */ 1.36 + eDone 1.37 + }; 1.38 + 1.39 + /** 1.40 + * Forward references are categorized by 'priority', and all 1.41 + * forward references in a higher priority are resolved before any 1.42 + * reference in a lower priority. This variable specifies this 1.43 + * ordering. The last Priority is guaranteed to be eDone. 1.44 + */ 1.45 + static const Phase kPasses[]; 1.46 + 1.47 + /** 1.48 + * Get the state in which the forward reference should be resolved. 1.49 + * 'eConstruction' references are all resolved before 'eHookup' references 1.50 + * are resolved. 1.51 + * 1.52 + * @return the Phase in which the reference needs to be resolved 1.53 + */ 1.54 + virtual Phase GetPhase() = 0; 1.55 + 1.56 + /** 1.57 + * Result codes returned from Resolve() 1.58 + */ 1.59 + enum Result { 1.60 + /** Resolution succeeded, I'm done. */ 1.61 + eResolve_Succeeded, 1.62 + 1.63 + /** Couldn't resolve, but try me later. */ 1.64 + eResolve_Later, 1.65 + 1.66 + /** Something bad happened, don't try again. */ 1.67 + eResolve_Error 1.68 + }; 1.69 + 1.70 + /** 1.71 + * Attempt to resolve the forward reference. 1.72 + * 1.73 + * @return a Result that tells the resolver how to treat 1.74 + * the reference. 1.75 + */ 1.76 + virtual Result Resolve() = 0; 1.77 +}; 1.78 + 1.79 +#endif // nsForwardReference_h__