2 * The contents of this file are subject to the Mozilla Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/MPL/
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
12 * The Original Code is the Sablotron XSLT Processor.
14 * The Initial Developer of the Original Code is Ginger Alliance Ltd.
15 * Portions created by Ginger Alliance are Copyright (C) 2000-2002
16 * Ginger Alliance Ltd. All Rights Reserved.
20 * Alternatively, the contents of this file may be used under the
21 * terms of the GNU General Public License Version 2 or later (the
22 * "GPL"), in which case the provisions of the GPL are applicable
23 * instead of those above. If you wish to allow use of your
24 * version of this file only under the terms of the GPL and not to
25 * allow others to use your version of this file under the MPL,
26 * indicate your decision by deleting the provisions above and
27 * replace them with the notice and other provisions required by
28 * the GPL. If you do not delete the provisions above, a recipient
29 * may use your version of this file under either the MPL or the
45 Mode constants for the situation object.
63 The following class keeps track of the current situation: which vertex
64 is currently being parsed/processed etc. This is used solely for error reporting.
73 class DOMProviderStandard;
74 class DOMProviderUniversal;
85 int SDOMExceptionCode;
91 SDOMExceptionCode = 0;
93 SituaInfo& operator= (const SituaInfo& other);
105 Recoder& recoder() const;
107 void setFlag(SablotFlag f);
108 Bool hasFlag(SablotFlag f);
109 void resetFlag(SablotFlag f);
110 void setFlags(int f);
113 // set vertex information for the current message
114 void setCurrV(Vertex *v);
116 // same, including the document identification
117 void setCurrVDoc(Vertex *v);
119 // set file (URI) information for the current message
120 void setCurrFile(const Str &);
122 // set line number information for the current message
123 void setCurrLine(int);
125 // set line number information while SAX parsing is in progress
126 void setCurrSAXLine(int);
127 int getCurrSAXLine();
129 // set pointer to associated Processor (will be NULL if not processing)
130 void setProcessor(Processor *P) {proc = P;}
132 // get pointer to associated Processor
133 Processor* getProcessor() const {return proc;}
135 // common messaging routine for reporting errors, warnings and log messages
136 // (distinguished by 'type')
137 void message(MsgType type, MsgCode code, const Str &arg1, const Str &arg2);
139 // reset the situation's state
142 // clear the error-related information
145 // detect pending error
148 // get pending error code
149 int getError() const;
151 // set output files for errors and for log messages
152 eFlag msgOutputFile(char *_errwfn, char *_logfn);
155 eFlag eraseLog(char *newLogFile);
157 // return current time
160 // open the default output files
161 eFlag openDefaultFiles();
163 // close files in use
166 // return the pending error message (with all substitutions)
167 const Str& getMessage();
169 void setSXPOptions(unsigned long options);
170 unsigned long getSXPOptions();
171 void setSXPMaskBit(int mask);
174 void setSDOMExceptionCode(int code);
176 int getSDOMExceptionCode() const;
178 void getSDOMExceptionExtra(MsgCode& theCode,
179 Str& theMessage, Str& theDocument,
182 void swapProcessor(void *&proc_);
184 const Str& findBaseURI(const Str& unmappedBase);
186 void setDOMProvider(DOMHandler *domh, void* udata);
188 DOMProvider& dom() {return *(DOMProvider*)theProvider; }
190 Bool domExternal(NodeHandle n) {return (unsigned long)n & 1;}
193 SituaInfo info, infoDOM;
195 void generateMessage(MsgType, MsgCode, const Str &arg1, const Str &arg2,
198 // report error (in this case to self)
199 void report(Situation *S, MsgType, MsgCode, const Str &, const Str &);
200 FILE *logfile, *errwfile;
202 unsigned long sxpOptions;
204 DOMProviderUniversal *theProvider;
207 typedef Situation & Sit;