Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef nsForwardReference_h__
7 : #define nsForwardReference_h__
8 :
9 : class nsForwardReference
10 : {
11 : protected:
12 47 : nsForwardReference() {}
13 :
14 : public:
15 47 : virtual ~nsForwardReference() {}
16 :
17 : /**
18 : * Priority codes returned from GetPhase()
19 : */
20 : enum Phase {
21 : /** A dummy marker, used to indicate unstarted resolution */
22 : eStart,
23 :
24 : /** The initial pass, after which the content model will be
25 : fully built */
26 : eConstruction,
27 :
28 : /** A second pass, after which all 'magic attribute' hookup
29 : will have been performed */
30 : eHookup,
31 :
32 : /** A dummy marker, used in kPasses to indicate termination */
33 : eDone
34 : };
35 :
36 : /**
37 : * Forward references are categorized by 'priority', and all
38 : * forward references in a higher priority are resolved before any
39 : * reference in a lower priority. This variable specifies this
40 : * ordering. The last Priority is guaranteed to be eDone.
41 : */
42 : static const Phase kPasses[];
43 :
44 : /**
45 : * Get the state in which the forward reference should be resolved.
46 : * 'eConstruction' references are all resolved before 'eHookup' references
47 : * are resolved.
48 : *
49 : * @return the Phase in which the reference needs to be resolved
50 : */
51 : virtual Phase GetPhase() = 0;
52 :
53 : /**
54 : * Result codes returned from Resolve()
55 : */
56 : enum Result {
57 : /** Resolution succeeded, I'm done. */
58 : eResolve_Succeeded,
59 :
60 : /** Couldn't resolve, but try me later. */
61 : eResolve_Later,
62 :
63 : /** Something bad happened, don't try again. */
64 : eResolve_Error
65 : };
66 :
67 : /**
68 : * Attempt to resolve the forward reference.
69 : *
70 : * @return a Result that tells the resolver how to treat
71 : * the reference.
72 : */
73 : virtual Result Resolve() = 0;
74 : };
75 :
76 : #endif // nsForwardReference_h__
|