Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XalanXMLFileReporter.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #if !defined(HARNESS_HEADER_GUARD_1357924680)
17 #define HARNESS_HEADER_GUARD_1357924680
18 
19 
20 
22 
23 
24 
25 #include <cstdio>
26 
27 
28 
30 
31 
32 
35 
36 
37 
39 
40 
41 
42 XALAN_CPP_NAMESPACE_BEGIN
43 
44 
45 
46 
48 {
49 
50 public:
51 
53 
54 #if defined(XALAN_STRICT_ANSI_HEADERS)
55  typedef std::FILE FileHandleType;
56 #else
57  typedef FILE FileHandleType;
58 #endif
59 
60 public:
61 
62 
63  // Construct and initialize this reporter with specified filename, if
64  // the filename is not empty.
65  XalanXMLFileReporter(MemoryManagerType& theManager, const XalanDOMString& fileName);
66 
67  // Initialize this XalanXMLFileReporter. Must be called before attempting to log anything.
68  bool initialize(MemoryManagerType& theManager);
69 
71  getMemoryManager()
72  {
73  return m_fileName.getMemoryManager();
74  }
75 
76  // Accessor for flushing; is set from properties.
77  bool getFlushOnCaseClose();
78 
79  // Accessor methods for our properties block.
80  const XalanDOMString& getFileName() const;
81 
82  // Accessor methods for our properties block.
83  void setFileName(const XalanDOMString& fileName);
84 
85  // Accessor methods for our properties block.
86  void setFileName(const char* fileName, MemoryManagerType& theManager)
87  {
88  setFileName(XalanDOMString(fileName, theManager));
89  }
90 
91  //
92  // Is this Reporter still running OK?
93  // @returns status - true if an error has occoured, false if it's still working fine
94  bool checkError();
95 
96 
97  //
98  // Is this Reporter ready to log results?
99  // @returns status - true if it's ready to report, false otherwise
100  bool isReady();
101 
102  // Flush this reporter - ensure our File is flushed.
103  void flush();
104 
105 
106  // Close this reporter - ensure our File, etc. are closed.
107  void close();
108 
109  //-----------------------------------------------------
110  //-------- Testfile / Testcase start and stop routines --------
111  //-----------------------------------------------------
112 
117  void logTestFileInit(const XalanDOMString& msg);
118 
119  void logTestFileInit(const char* msg)
120  {
121  logTestFileInit(XalanDOMString(msg, getMemoryManager()));
122  }
123 
129  void logTestFileClose(const XalanDOMString& msg, const XalanDOMString& result);
130 
131  void logTestFileClose(const char* msg, const char* result)
132  {
133  logTestFileClose(XalanDOMString(msg, getMemoryManager()), XalanDOMString(result, getMemoryManager()));
134  }
135 
136  void logTestCaseInit(const XalanDOMString& msg);
137 
138  void logTestCaseInit(const char* msg)
139  {
140  logTestCaseInit(XalanDOMString(msg, getMemoryManager()));
141  }
142 
148  void logTestCaseClose(const XalanDOMString& msg, const XalanDOMString& result);
149 
150  void logTestCaseClose(const char* msg, const char* result)
151  {
152  logTestCaseClose(XalanDOMString(msg , getMemoryManager()), XalanDOMString(result , getMemoryManager()));
153  }
154  //-----------------------------------------------------
155  //-------- Test results reporting and logging routines --------
156  //-----------------------------------------------------
157 
158 
165  void logMessage(int level, const XalanDOMString& msg);
166 
175  void logStatistic (int level, long lVal, double dVal, const XalanDOMString& msg);
176 
177  void logStatistic (int level, long lVal, double dVal, const char* msg)
178  {
179  logStatistic(level, lVal, dVal, XalanDOMString(msg, getMemoryManager()));
180  }
181 
182  // This routine will add an attribute to the attribute list.
183  void addMetricToAttrs(char* desc, double theMetric, Hashtable& attrs);
184 
196  void logElementWAttrs(int level, const XalanDOMString& element, Hashtable& attrs, const XalanDOMString& msg);
197 
198  void logElementWAttrs(int level, const char* element, Hashtable& attrs, const char* msg)
199  {
200  logElementWAttrs(level, XalanDOMString(element, getMemoryManager()), attrs, XalanDOMString(msg, getMemoryManager()));
201  }
202 
203  void logElement(int level, const XalanDOMString& element, const XalanDOMString& msg);
204 
205  void logElement(const XalanDOMString& element, const XalanDOMString& msg);
217  void logArbitraryMessage (int level, const XalanDOMString& msg);
218 
231  /*
232  void logHashtable (int level, Hashtable hash, const XalanDOMString& msg);
233  */
234 
240  void logCheckPass(const XalanDOMString& comment);
241 
247  void logCheckAmbiguous(const XalanDOMString& comment);
248 
254  void logCheckFail(const XalanDOMString& comment);
255 
256  void logCheckFail(const XalanDOMString& test, const Hashtable& faildata, const Hashtable& actexp);
257 
258  void logCheckFail(const XalanDOMString& test, const Hashtable& actexp);
259 
260  void logErrorResult(const XalanDOMString& test, const XalanDOMString& reason);
261 
267  void logCheckErr(const XalanDOMString& comment);
268 
275  XalanDOMString& escapestring(const XalanDOMString& s, XalanDOMString& buffer);
276 
277 
278 private:
279  // not implemented
284  bool startResultsFile();
285 
289  bool closeResultsFile();
290 
294  bool printToFile(const XalanDOMString& output);
295 
296  void
297  initStrings();
298 
303  getDateTimeString(XalanDOMString& result);
304 
306  XalanDOMString OPT_FILENAME;
307 
309  XalanDOMString ELEM_RESULTSFILE;
310  XalanDOMString ELEM_TESTFILE;
311  XalanDOMString ELEM_FILERESULT;
312  XalanDOMString ELEM_TESTCASE;
313  XalanDOMString ELEM_CASERESULT;
314  XalanDOMString ELEM_CHECKRESULT;
315  XalanDOMString ELEM_STATISTIC;
316  XalanDOMString ELEM_LONGVAL;
317  XalanDOMString ELEM_DOUBLEVAL;
318  XalanDOMString ELEM_MESSAGE;
319  XalanDOMString ELEM_ARBITRARY;
320  XalanDOMString ELEM_HASHTABLE;
321  XalanDOMString ELEM_HASHITEM;
322 
324  XalanDOMString ATTR_LEVEL;
325  XalanDOMString ATTR_DESC;
326  XalanDOMString ATTR_TIME;
327  XalanDOMString ATTR_RESULT;
328  XalanDOMString ATTR_KEY;
329  XalanDOMString ATTR_FILENAME;
330  XalanDOMString LESS_THAN;
331  XalanDOMString GREATER_THAN;
332  XalanDOMString EQUALS_QUOTE;
333  XalanDOMString SPACE;
334  XalanDOMString QUOTE;
335  XalanDOMString QUOTE_SPACE;
336  XalanDOMString QUOTE_GREATER_THAN;
337  XalanDOMString QUOTE_SOLIDUS_GREATER_THAN;
338  XalanDOMString PASS;
339  XalanDOMString AMBG;
340  XalanDOMString ERRR;
341  XalanDOMString FAIL;
342  XalanDOMString LESS_THAN_SOLIDUS;
343  XalanDOMString XML_HEADER;
344  XalanDOMString REASON_EQUALS_QUOTE;
345 
350  XalanDOMString TESTCASEINIT_HDR;
351  XalanDOMString TESTCASECLOSE_HDR;
352  XalanDOMString MESSAGE_HDR;
353  XalanDOMString STATISTIC_HDR;
354  XalanDOMString ARBITRARY_HDR;
355  XalanDOMString HASHTABLE_HDR;
356  XalanDOMString HASHITEM_HDR;
357  XalanDOMString CHECKPASS_HDR;
358  XalanDOMString CHECKAMBG_HDR;
359  XalanDOMString CHECKERRR_HDR;
360  XalanDOMString CHECKFAIL_HDR;
361  XalanDOMString CHECKFAIL_FTR;
362 
364  bool m_anyOutput;
365 
367  XalanDOMString m_fileName;
368 
370  FileHandleType* m_fileHandle;
371 
373  bool m_ready;
374 
376  bool m_error;
377 
379  bool m_flushOnCaseClose;
380 
381 }; // end of class XalanXMLFileReporter
382 
383 
384 
385 XALAN_CPP_NAMESPACE_END
386 
387 
388 
389 #endif

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo