|
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 /* |
|
7 |
|
8 Interfaces for the RDF/XML sink, which parses RDF/XML into |
|
9 a graph representation. |
|
10 |
|
11 */ |
|
12 |
|
13 #include "nsISupports.idl" |
|
14 |
|
15 // XXX Until these get scriptable. See nsIRDFXMLSink::AddNameSpace() |
|
16 [ptr] native nsIAtomPtr(nsIAtom); |
|
17 [ref] native nsStringRef(nsString); |
|
18 %{C++ |
|
19 class nsIAtom; |
|
20 class nsString; |
|
21 %} |
|
22 |
|
23 interface nsIRDFXMLSink; |
|
24 |
|
25 /** |
|
26 * An observer that is notified as progress is made on the load |
|
27 * of an RDF/XML document in an <code>nsIRDFXMLSink</code>. |
|
28 */ |
|
29 [scriptable, uuid(EB1A5D30-AB33-11D2-8EC6-00805F29F370)] |
|
30 interface nsIRDFXMLSinkObserver : nsISupports |
|
31 { |
|
32 /** |
|
33 * Called when the load begins. |
|
34 * @param aSink the RDF/XML sink on which the load is beginning. |
|
35 */ |
|
36 void onBeginLoad(in nsIRDFXMLSink aSink); |
|
37 |
|
38 /** |
|
39 * Called when the load is suspended (e.g., for network quantization). |
|
40 * @param aSink the RDF/XML sink that is being interrupted. |
|
41 */ |
|
42 void onInterrupt(in nsIRDFXMLSink aSink); |
|
43 |
|
44 /** |
|
45 * Called when a suspended load is resuming. |
|
46 * @param aSink the RDF/XML sink that is resuming. |
|
47 */ |
|
48 void onResume(in nsIRDFXMLSink aSink); |
|
49 |
|
50 /** |
|
51 * Called when an RDF/XML load completes successfully. |
|
52 * @param aSink the RDF/XML sink that has finished loading. |
|
53 */ |
|
54 void onEndLoad(in nsIRDFXMLSink aSink); |
|
55 |
|
56 /** |
|
57 * Called when an error occurs during the load |
|
58 * @param aSink the RDF/XML sink in which the error occurred |
|
59 * @param aStatus the networking result code |
|
60 * @param aErrorMsg an error message, if applicable |
|
61 */ |
|
62 void onError(in nsIRDFXMLSink aSink, in nsresult aStatus, in wstring aErrorMsg); |
|
63 }; |
|
64 |
|
65 |
|
66 |
|
67 /** |
|
68 * A "sink" that receives and processes RDF/XML. This interface is used |
|
69 * by the RDF/XML parser. |
|
70 */ |
|
71 [scriptable, uuid(EB1A5D31-AB33-11D2-8EC6-00805F29F370)] |
|
72 interface nsIRDFXMLSink : nsISupports |
|
73 { |
|
74 /** |
|
75 * Set to <code>true</code> if the sink is read-only and cannot |
|
76 * be modified |
|
77 */ |
|
78 attribute boolean readOnly; |
|
79 |
|
80 /** |
|
81 * Initiate the RDF/XML load. |
|
82 */ |
|
83 void beginLoad(); |
|
84 |
|
85 /** |
|
86 * Suspend the RDF/XML load. |
|
87 */ |
|
88 void interrupt(); |
|
89 |
|
90 /** |
|
91 * Resume the RDF/XML load. |
|
92 */ |
|
93 void resume(); |
|
94 |
|
95 /** |
|
96 * Complete the RDF/XML load. |
|
97 */ |
|
98 void endLoad(); |
|
99 |
|
100 /** |
|
101 * Add namespace information to the RDF/XML sink. |
|
102 * @param aPrefix the namespace prefix |
|
103 * @param aURI the namespace URI |
|
104 */ |
|
105 [noscript] void addNameSpace(in nsIAtomPtr aPrefix, |
|
106 [const] in nsStringRef aURI); |
|
107 |
|
108 /** |
|
109 * Add an observer that will be notified as the RDF/XML load |
|
110 * progresses. |
|
111 * <p> |
|
112 * |
|
113 * Note that the sink will acquire a strong reference to the |
|
114 * observer, so care should be taken to avoid cyclical references |
|
115 * that cannot be released (i.e., if the observer holds a |
|
116 * reference to the sink, it should be sure that it eventually |
|
117 * clears the reference). |
|
118 * |
|
119 * @param aObserver the observer to add to the sink's set of |
|
120 * load observers. |
|
121 */ |
|
122 void addXMLSinkObserver(in nsIRDFXMLSinkObserver aObserver); |
|
123 |
|
124 /** |
|
125 * Remove an observer from the sink's set of observers. |
|
126 * @param aObserver the observer to remove. |
|
127 */ |
|
128 void removeXMLSinkObserver(in nsIRDFXMLSinkObserver aObserver); |
|
129 }; |
|
130 |