00001 /* 00002 * Copyright 1999-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #if !defined(XALAN_FILEUTILITY_HEADER_GUARD_1357924680) 00017 #define XALAN_FILEUTILITY_HEADER_GUARD_1357924680 00018 00019 00020 00021 #include "xalanc/Harness/XalanHarnessDefinitions.hpp" 00022 00023 00024 #include "xalanc/Include/XalanVector.hpp" 00025 00026 00027 #if defined(XALAN_CLASSIC_IOSTREAMS) 00028 #include <strstream.h> 00029 #else 00030 #include <strstream> 00031 #endif 00032 00033 00034 00035 #include "xalanc/XalanDOM/XalanDOMString.hpp" 00036 00037 00038 00039 XALAN_CPP_NAMESPACE_BEGIN 00040 00041 00042 00043 class FormatterListener; 00044 class PrintWriter; 00045 class StylesheetRoot; 00046 class XalanCompiledStylesheet; 00047 class XalanDocument; 00048 class XalanNode; 00049 class XalanSourceTreeDocument; 00050 class XalanTransformer; 00051 class XalanXMLFileReporter; 00052 class XSLTInputSource; 00053 00054 00055 00056 // This class is exported from the Harness.dll 00057 class XALAN_HARNESS_EXPORT XalanFileUtility 00058 { 00059 public: 00060 00061 // A vector to hold directory names and file names. 00062 00063 typedef XalanVector<XalanDOMString> FileNameVectorType; 00064 00065 00066 struct XALAN_HARNESS_EXPORT reportStruct 00067 { 00068 XalanDOMString theDrive; 00069 XalanDOMString testOrFile; 00070 XalanDOMString xmlFileURL; 00071 XalanDOMString xslFileURL; 00072 XalanDOMString xmlFormat; 00073 const char* msg; 00074 XalanDOMString currentNode; 00075 XalanDOMString actual; 00076 XalanDOMString expected; 00077 int pass; 00078 int fail; 00079 int nogold; 00080 00081 reportStruct(MemoryManagerType& theManager); 00082 00083 void 00084 reset(); 00085 private: 00086 //Not implemented 00087 reportStruct(); 00088 reportStruct(const reportStruct&); 00089 00090 } data; 00091 00092 struct XALAN_HARNESS_EXPORT cmdParams 00093 { 00094 private: 00095 00096 #if defined(XALAN_NO_STD_NAMESPACE) 00097 typedef ostrstream StreamType; 00098 #else 00099 typedef std::ostrstream StreamType; 00100 #endif 00101 00102 StreamType help; 00103 00104 public: 00105 00106 XalanDOMString base; 00107 XalanDOMString output; 00108 XalanDOMString gold; 00109 XalanDOMString sub; 00110 int source; 00111 bool skip; 00112 long iters; 00113 00114 00115 cmdParams(MemoryManagerType& theManager); 00116 00117 ~cmdParams() 00118 { 00119 } 00120 00121 const char* 00122 getHelpMessage(); 00123 00124 StreamType& 00125 getHelpStream() 00126 { 00127 return help; 00128 } 00129 private: 00130 //Not implemented 00131 cmdParams(); 00132 cmdParams(const cmdParams&); 00133 00134 } args; 00135 00137 XalanFileUtility(MemoryManagerType& theManager); 00138 00139 ~XalanFileUtility(); 00140 00146 XalanDOMString& 00147 getDrive(XalanDOMString& theResult); 00148 00149 bool 00150 getParams( 00151 int argc, 00152 char* argv[], 00153 const char* outDir, 00154 bool fsetGold = true); 00155 00156 00157 FileNameVectorType& 00158 getTestFileNames( 00159 const XalanDOMString& baseDir, 00160 const XalanDOMString& relDir, 00161 bool useDirPrefix, 00162 FileNameVectorType& theFiles); 00163 00168 FileNameVectorType& 00169 getDirectoryNames(const XalanDOMString& rootDirectory, 00170 FileNameVectorType& theFiles); 00171 00175 void 00176 checkAndCreateDir(const XalanDOMString& directory); 00177 00181 bool 00182 checkDir(const XalanDOMString& directory); 00183 00188 XalanDOMString& 00189 getXSLFileName(const XalanDOMString& theXMLFileName, 00190 XalanDOMString& theResult); 00191 00196 XalanDOMString& 00197 generateFileName( 00198 const XalanDOMString& theXMLFileName, 00199 const char* suffix, 00200 XalanDOMString& theResult, 00201 bool* status = 0); 00202 00207 XalanDOMString& 00208 generateUniqRunid(XalanDOMString& theResult); 00209 00214 XalanDOMString& 00215 getXercesVersion(XalanDOMString& theResult); 00216 00217 00218 void 00219 checkResults( 00220 const XalanDOMString& outputFile, 00221 const XalanDOMString& goldFile, 00222 XalanXMLFileReporter& logfile); 00223 00224 void 00225 checkAPIResults( 00226 const XalanDOMString& actual, 00227 const XalanDOMString& expected, 00228 const char* msg, 00229 XalanXMLFileReporter& logfile, 00230 const XalanDOMString& outputFile, 00231 const XalanDOMString& goldFile, 00232 bool containsOnly = false); 00233 00234 void 00235 checkAPIResults( 00236 const char* actual, 00237 const char* expected, 00238 const char* msg, 00239 XalanXMLFileReporter& logfile, 00240 const XalanDOMString& outputFile, 00241 const XalanDOMString& goldFile, 00242 MemoryManagerType& theManager, 00243 bool containsOnly = false) 00244 { 00245 checkAPIResults( 00246 XalanDOMString(actual, theManager), 00247 XalanDOMString(expected, theManager), 00248 msg, 00249 logfile, 00250 outputFile, 00251 goldFile, 00252 containsOnly); 00253 } 00254 00260 void 00261 checkDOMResults( 00262 const XalanDOMString& theOutputFile, 00263 const XalanCompiledStylesheet* compiledSS, 00264 const XalanSourceTreeDocument* dom, 00265 const XSLTInputSource& goldInputSource, 00266 XalanXMLFileReporter& logfile); 00267 00268 bool 00269 compareSerializedResults( 00270 const XalanDOMString& transformResult, 00271 const XalanDOMString& goldInputSource); 00277 FormatterListener* 00278 getXMLFormatter( 00279 PrintWriter& resultWriter, 00280 int indentAmount, 00281 const XalanDOMString& mimeEncoding, 00282 const StylesheetRoot* stylesheet); 00283 00284 00285 bool 00286 fileCompare( 00287 const char* goldFile, 00288 const char* outputFile); 00289 00294 bool 00295 domCompare(const XalanNode& gold, const XalanNode& doc); 00296 00301 bool 00302 domCompare( 00303 const XalanDocument& gold, 00304 const XalanDocument& doc); 00305 00310 bool 00311 diffElement(const XalanNode& gold, const XalanNode& doc); 00312 00317 bool 00318 diffNode( 00319 const XalanNode& gold, 00320 const XalanNode& doc); 00321 00326 bool 00327 diffNode( 00328 const XalanNode* gold, 00329 const XalanNode* doc); 00330 00335 bool 00336 diffElement2( 00337 const XalanNode& gold, 00338 const XalanNode& doc); 00339 00344 bool 00345 diffAttr(const XalanNode* gAttr, const XalanNode* dAttr); 00346 00351 void 00352 reportPassFail(XalanXMLFileReporter& logfile); 00353 00354 void 00355 reportPassFail(XalanXMLFileReporter& logfile, const XalanDOMString& runid); 00356 00357 void 00358 analyzeResults(XalanTransformer& xalan, const XalanDOMString& resultsFile); 00359 00360 static const XalanDOMChar s_xmlSuffix[]; 00361 00362 static const XalanDOMChar s_pathSep[]; 00363 00364 private: 00365 00366 static const XalanDOMString s_emptyString; 00367 00368 XalanDOMString& 00369 getProgramName(const char* fullName, XalanDOMString& theBuffer); 00370 00375 void 00376 collectData( 00377 const char* errmsg, 00378 const XalanDOMString& currentnode, 00379 const XalanDOMString& actdata, 00380 const XalanDOMString& expdata); 00381 00386 void 00387 reportError(); 00388 00389 #if defined(NDEBUG) 00390 void 00391 debugNodeData(const XalanDOMString& /* value */) const 00392 { 00393 } 00394 00395 void 00396 debugNodeData( 00397 const XalanDOMString& /* node */, 00398 const XalanDOMString& /* value */) const 00399 { 00400 } 00401 00402 void 00403 debugAttributeData(const XalanDOMString& /* value */) const 00404 { 00405 } 00406 00407 #else 00408 00409 void 00410 debugNodeData(const XalanDOMString& value) const; 00411 00412 void 00413 debugNodeData( 00414 const XalanDOMString& node, 00415 const XalanDOMString& value) const; 00416 00417 void 00418 debugAttributeData(const XalanDOMString& value) const; 00419 00420 #endif 00421 private: 00422 //Not implemented 00423 XalanFileUtility(); 00424 XalanFileUtility(const XalanFileUtility&); 00425 00426 }; // end of class FileUtility 00427 00428 00429 00430 XALAN_CPP_NAMESPACE_END 00431 00432 00433 00434 #endif // XALAN_FILEUTILITY_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
![]() |
Xalan-C++ XSLT Processor Version 1.9 |
|