Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

XalanFileUtility.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(XALAN_FILEUTILITY_HEADER_GUARD_1357924680)
17 #define XALAN_FILEUTILITY_HEADER_GUARD_1357924680
18 
19 
20 
22 
23 
25 
26 
27 #if defined(XALAN_CLASSIC_IOSTREAMS)
28 #include <strstream.h>
29 #else
30 #include <strstream>
31 #endif
32 
33 
34 
36 
37 
38 
39 XALAN_CPP_NAMESPACE_BEGIN
40 
41 
42 
43 class FormatterListener;
44 class PrintWriter;
45 class StylesheetRoot;
47 class XalanDocument;
48 class XalanNode;
50 class XalanTransformer;
52 class XSLTInputSource;
53 
54 
55 XALAN_USING_XERCES(MemoryManager)
56 
57 
58 
59 // This class is exported from the Harness.dll
61 {
62 public:
63 
64 // A vector to hold directory names and file names.
65 
67 
68 
70  {
76  const char* msg;
80  int pass;
81  int fail;
82  int nogold;
83 
84  reportStruct(MemoryManager& theManager);
85 
86  void
87  reset();
88  private:
89  //Not implemented
90  reportStruct();
91  reportStruct(const reportStruct&);
92 
93  } data;
94 
96  {
97  private:
98 
99 #if defined(XALAN_NO_STD_NAMESPACE)
100  typedef ostrstream StreamType;
101 #else
102  typedef std::ostrstream StreamType;
103 #endif
104 
105  StreamType help;
106 
107  public:
108 
113  int source;
114  bool skip;
115  long iters;
116 
117 
118  cmdParams(MemoryManager& theManager);
119 
121  {
122  }
123 
124  const char*
125  getHelpMessage();
126 
127  StreamType&
128  getHelpStream()
129  {
130  return help;
131  }
132  private:
133  //Not implemented
134  cmdParams();
135  cmdParams(const cmdParams&);
136 
137  } args;
138 
140  XalanFileUtility(MemoryManager& theManager);
141 
142  ~XalanFileUtility();
143 
150  getDrive(XalanDOMString& theResult);
151 
152  bool
153  getParams(
154  int argc,
155  char* argv[],
156  const char* outDir,
157  bool fsetGold = true);
158 
159 
160  FileNameVectorType&
161  getTestFileNames(
162  const XalanDOMString& baseDir,
163  const XalanDOMString& relDir,
164  bool useDirPrefix,
165  FileNameVectorType& theFiles);
166 
171  FileNameVectorType&
172  getDirectoryNames(const XalanDOMString& rootDirectory,
173  FileNameVectorType& theFiles);
174 
178  void
179  checkAndCreateDir(const XalanDOMString& directory);
180 
184  bool
185  checkDir(const XalanDOMString& directory);
186 
192  getXSLFileName(const XalanDOMString& theXMLFileName,
193  XalanDOMString& theResult);
194 
200  generateFileName(
201  const XalanDOMString& theXMLFileName,
202  const char* suffix,
203  XalanDOMString& theResult,
204  bool* status = 0);
205 
211  generateUniqRunid(XalanDOMString& theResult);
212 
218  getXercesVersion(XalanDOMString& theResult);
219 
220 
221  void
222  checkResults(
223  const XalanDOMString& outputFile,
224  const XalanDOMString& goldFile,
225  XalanXMLFileReporter& logfile);
226 
227  void
228  checkAPIResults(
229  const XalanDOMString& actual,
230  const XalanDOMString& expected,
231  const char* msg,
232  XalanXMLFileReporter& logfile,
233  const XalanDOMString& outputFile,
234  const XalanDOMString& goldFile,
235  bool containsOnly = false);
236 
237  // This API is deprecated. Please use the following
238  // one.
239  void
240  checkAPIResults(
241  const char* actual,
242  const char* expected,
243  const char* msg,
244  XalanXMLFileReporter& logfile,
245  const XalanDOMString& outputFile,
246  const XalanDOMString& goldFile,
247  MemoryManager& /* theManager */,
248  bool containsOnly = false)
249  {
250  checkAPIResults(
251  actual,
252  expected,
253  msg,
254  logfile,
255  outputFile,
256  goldFile,
257  containsOnly);
258  }
259 
260  void
261  checkAPIResults(
262  const char* actual,
263  const char* expected,
264  const char* msg,
265  XalanXMLFileReporter& logfile,
266  const XalanDOMString& outputFile,
267  const XalanDOMString& goldFile,
268  bool containsOnly = false)
269  {
270  checkAPIResults(
271  XalanDOMString(actual, m_memoryManager),
272  XalanDOMString(expected, m_memoryManager),
273  msg,
274  logfile,
275  outputFile,
276  goldFile,
277  containsOnly);
278  }
279 
285  void
286  checkDOMResults(
287  const XalanDOMString& theOutputFile,
288  const XalanCompiledStylesheet* compiledSS,
289  const XalanSourceTreeDocument* dom,
290  const XSLTInputSource& goldInputSource,
291  XalanXMLFileReporter& logfile);
292 
293  bool
294  compareSerializedResults(
295  const XalanDOMString& transformResult,
296  const XalanDOMString& goldInputSource);
303  getXMLFormatter(
304  PrintWriter& resultWriter,
305  int indentAmount,
306  const XalanDOMString& mimeEncoding,
307  const StylesheetRoot* stylesheet);
308 
309 
310  bool
311  fileCompare(
312  const char* goldFile,
313  const char* outputFile);
314 
319  bool
320  domCompare(const XalanNode& gold, const XalanNode& doc);
321 
326  bool
327  domCompare(
328  const XalanDocument& gold,
329  const XalanDocument& doc);
330 
335  bool
336  diffElement(const XalanNode& gold, const XalanNode& doc);
337 
342  bool
343  diffNode(
344  const XalanNode& gold,
345  const XalanNode& doc);
346 
351  bool
352  diffNode(
353  const XalanNode* gold,
354  const XalanNode* doc);
355 
360  bool
361  diffElement2(
362  const XalanNode& gold,
363  const XalanNode& doc);
364 
369  bool
370  diffAttr(const XalanNode* gAttr, const XalanNode* dAttr);
371 
376  void
377  reportPassFail(XalanXMLFileReporter& logfile);
378 
379  void
380  reportPassFail(XalanXMLFileReporter& logfile, const XalanDOMString& runid);
381 
382  void
383  analyzeResults(XalanTransformer& xalan, const XalanDOMString& resultsFile);
384 
385  static const XalanDOMChar s_xmlSuffix[];
386 
387  static const XalanDOMChar s_pathSep[];
388 
389  const MemoryManager&
390  getMemoryManager() const
391  {
392  return m_memoryManager;
393  }
394 
395  MemoryManager&
396  getMemoryManager()
397  {
398  return m_memoryManager;
399  }
400 
401 private:
402 
403  static const XalanDOMString s_emptyString;
404 
406  getProgramName(const char* fullName, XalanDOMString& theBuffer);
407 
412  void
413  collectData(
414  const char* errmsg,
415  const XalanDOMString& currentnode,
416  const XalanDOMString& actdata,
417  const XalanDOMString& expdata);
418 
423  void
424  reportError();
425 
426 #if defined(NDEBUG)
427  void
428  debugNodeData(const XalanDOMString& /* value */) const
429  {
430  }
431 
432  void
433  debugNodeData(
434  const XalanDOMString& /* node */,
435  const XalanDOMString& /* value */) const
436  {
437  }
438 
439  void
440  debugAttributeData(const XalanDOMString& /* value */) const
441  {
442  }
443 
444 #else
445 
446  void
447  debugNodeData(const XalanDOMString& value) const;
448 
449  void
450  debugNodeData(
451  const XalanDOMString& node,
452  const XalanDOMString& value) const;
453 
454  void
455  debugAttributeData(const XalanDOMString& value) const;
456 
457 #endif
458 private:
459 
460  MemoryManager& m_memoryManager;
461 
462  //Not implemented
463  XalanFileUtility();
464  XalanFileUtility(const XalanFileUtility&);
465 };
466 
467 
468 
469 XALAN_CPP_NAMESPACE_END
470 
471 
472 
473 #endif // XALAN_FILEUTILITY_HEADER_GUARD_1357924680

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