## Xalan-C++ API Documentation

### The Xalan C++ XSLT Processor Version 1.10

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# XalanFileUtility.hpp

Go to the documentation of this file.

    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 XALAN_USING_XERCES(MemoryManager)
    00056
    00057
    00058
    00059 // This class is exported from the Harness.dll
    00060 class XALAN_HARNESS_EXPORT XalanFileUtility
    00061 {
    00062 public:
    00063
    00064 // A vector to hold directory names and file names.
    00065
    00066     typedef XalanVector<XalanDOMString>     FileNameVectorType;
    00067
    00068
    00069     struct XALAN_HARNESS_EXPORT reportStruct
    00070     {
    00071         XalanDOMString  theDrive;
    00072         XalanDOMString  testOrFile;
    00073         XalanDOMString  xmlFileURL;
    00074         XalanDOMString  xslFileURL;
    00075         XalanDOMString  xmlFormat;
    00076         const char*     msg;
    00077         XalanDOMString  currentNode;
    00078         XalanDOMString  actual;
    00079         XalanDOMString  expected;
    00080         int             pass;
    00081         int             fail;
    00082         int             nogold;
    00083
    00084         reportStruct(MemoryManager& theManager);
    00085
    00086         void
    00087         reset();
    00088     private:
    00089         //Not implemented
    00090         reportStruct();
    00091         reportStruct(const reportStruct&);
    00092
    00093     } data;
    00094
    00095     struct XALAN_HARNESS_EXPORT cmdParams
    00096     {
    00097     private:
    00098
    00099 #if defined(XALAN_NO_STD_NAMESPACE)
    00100         typedef ostrstream          StreamType;
    00101 #else
    00102         typedef std::ostrstream     StreamType;
    00103 #endif
    00104
    00105         StreamType  help;
    00106
    00107     public:
    00108
    00109         XalanDOMString  base;
    00110         XalanDOMString  output;
    00111         XalanDOMString  gold;
    00112         XalanDOMString  sub;
    00113         int             source;
    00114         bool            skip;
    00115         long            iters;
    00116
    00117
    00118         cmdParams(MemoryManager& theManager);
    00119
    00120         ~cmdParams()
    00121         {
    00122         }
    00123
    00124         const char*
    00125         getHelpMessage();
    00126
    00127         StreamType&
    00128         getHelpStream()
    00129         {
    00130             return help;
    00131         }
    00132     private:
    00133         //Not implemented
    00134         cmdParams();
    00135         cmdParams(const cmdParams&);
    00136
    00137     } args;
    00138
    00140     XalanFileUtility(MemoryManager& theManager);
    00141
    00142     ~XalanFileUtility();
    00143
    00148
    00149     XalanDOMString&
    00150     getDrive(XalanDOMString& theResult);
    00151
    00152     bool
    00153     getParams(
    00154             int             argc,
    00155             char*           argv[],
    00156             const char*     outDir,
    00157             bool            fsetGold = true);
    00158
    00159
    00160     FileNameVectorType&
    00161     getTestFileNames(
    00162             const XalanDOMString&   baseDir,
    00163             const XalanDOMString&   relDir,
    00164             bool                    useDirPrefix,
    00165             FileNameVectorType&     theFiles);
    00166
    00171     FileNameVectorType&
    00172     getDirectoryNames(const XalanDOMString&     rootDirectory,
    00173                       FileNameVectorType&       theFiles);
    00174
    00178     void
    00179     checkAndCreateDir(const XalanDOMString&     directory);
    00180
    00184     bool
    00185     checkDir(const XalanDOMString&  directory);
    00186
    00191     XalanDOMString&
    00192     getXSLFileName(const XalanDOMString&    theXMLFileName,
    00193                     XalanDOMString&         theResult);
    00194
    00199     XalanDOMString&
    00200     generateFileName(
    00201             const XalanDOMString&  theXMLFileName,
    00202             const char*             suffix,
    00203             XalanDOMString&         theResult,
    00204             bool*                   status = 0);
    00205
    00210     XalanDOMString&
    00211     generateUniqRunid(XalanDOMString& theResult);
    00212
    00217     XalanDOMString&
    00218     getXercesVersion(XalanDOMString& theResult);
    00219
    00220
    00221     void
    00222     checkResults(
    00223             const XalanDOMString&   outputFile,
    00224             const XalanDOMString&   goldFile,
    00225             XalanXMLFileReporter&   logfile);
    00226
    00227     void
    00228     checkAPIResults(
    00229             const XalanDOMString&   actual,
    00230             const XalanDOMString&   expected,
    00231             const char*             msg,
    00232             XalanXMLFileReporter&   logfile,
    00233             const XalanDOMString&   outputFile,
    00234             const XalanDOMString&   goldFile,
    00235             bool                    containsOnly = false);
    00236
    00237     // This API is deprecated.  Please use the following
    00238     // one.
    00239     void
    00240     checkAPIResults(
    00241             const char*             actual,
    00242             const char*             expected,
    00243             const char*             msg,
    00244             XalanXMLFileReporter&        logfile,
    00245             const XalanDOMString&   outputFile,
    00246             const XalanDOMString&   goldFile,
    00247             MemoryManager&          /* theManager */,
    00248             bool                    containsOnly = false)
    00249     {
    00250         checkAPIResults(
    00251             actual,
    00252             expected,
    00253             msg,
    00254             logfile,
    00255             outputFile,
    00256             goldFile,
    00257             containsOnly);
    00258     }
    00259
    00260     void
    00261     checkAPIResults(
    00262             const char*             actual,
    00263             const char*             expected,
    00264             const char*             msg,
    00265             XalanXMLFileReporter&   logfile,
    00266             const XalanDOMString&   outputFile,
    00267             const XalanDOMString&   goldFile,
    00268             bool                    containsOnly = false)
    00269     {
    00270         checkAPIResults(
    00271             XalanDOMString(actual, m_memoryManager),
    00272             XalanDOMString(expected, m_memoryManager),
    00273             msg,
    00274             logfile,
    00275             outputFile,
    00276             goldFile,
    00277             containsOnly);
    00278     }
    00279
    00285     void
    00286     checkDOMResults(
    00287             const XalanDOMString&           theOutputFile,
    00288             const XalanCompiledStylesheet*  compiledSS,
    00289             const XalanSourceTreeDocument*  dom,
    00290             const XSLTInputSource&          goldInputSource,
    00291             XalanXMLFileReporter&                logfile);
    00292
    00293     bool
    00294     compareSerializedResults(
    00295             const XalanDOMString&   transformResult,
    00296             const XalanDOMString&   goldInputSource);
    00302     FormatterListener*
    00303     getXMLFormatter(
    00304             PrintWriter&            resultWriter,
    00305             int                     indentAmount,
    00306             const XalanDOMString&   mimeEncoding,
    00307             const StylesheetRoot*   stylesheet);
    00308
    00309
    00310     bool
    00311     fileCompare(
    00312             const char*     goldFile,
    00313             const char*     outputFile);
    00314
    00319     bool
    00320     domCompare(const XalanNode& gold, const XalanNode& doc);
    00321
    00326     bool
    00327     domCompare(
    00328             const XalanDocument&    gold,
    00329             const XalanDocument&    doc);
    00330
    00335     bool
    00336     diffElement(const XalanNode& gold, const XalanNode& doc);
    00337
    00342     bool
    00343     diffNode(
    00344             const XalanNode&    gold,
    00345             const XalanNode&    doc);
    00346
    00351     bool
    00352     diffNode(
    00353             const XalanNode*    gold,
    00354             const XalanNode*    doc);
    00355
    00360     bool
    00361     diffElement2(
    00362             const XalanNode&    gold,
    00363             const XalanNode&    doc);
    00364
    00369     bool
    00370     diffAttr(const XalanNode* gAttr, const XalanNode* dAttr);
    00371
    00376     void
    00377     reportPassFail(XalanXMLFileReporter& logfile);
    00378
    00379     void
    00380     reportPassFail(XalanXMLFileReporter& logfile, const XalanDOMString& runid);
    00381
    00382     void
    00383     analyzeResults(XalanTransformer& xalan, const XalanDOMString& resultsFile);
    00384
    00385     static const XalanDOMChar   s_xmlSuffix[];
    00386
    00387     static const XalanDOMChar   s_pathSep[];
    00388
    00389     const MemoryManager&
    00390     getMemoryManager() const
    00391     {
    00392         return m_memoryManager;
    00393     }
    00394
    00395     MemoryManager&
    00396     getMemoryManager()
    00397     {
    00398         return m_memoryManager;
    00399     }
    00400
    00401 private:
    00402
    00403     static const XalanDOMString     s_emptyString;
    00404
    00405     XalanDOMString&
    00406     getProgramName(const char* fullName, XalanDOMString& theBuffer);
    00407
    00412     void
    00413     collectData(
    00414             const char*             errmsg,
    00415             const XalanDOMString&   currentnode,
    00416             const XalanDOMString&   actdata,
    00417             const XalanDOMString&   expdata);
    00418
    00423     void
    00424     reportError();
    00425
    00426 #if defined(NDEBUG)
    00427     void
    00428     debugNodeData(const XalanDOMString&     /* value */) const
    00429     {
    00430     }
    00431
    00432     void
    00433     debugNodeData(
    00434             const XalanDOMString&   /* node */,
    00435             const XalanDOMString&   /* value */) const
    00436     {
    00437     }
    00438
    00439     void
    00440     debugAttributeData(const XalanDOMString&    /* value */) const
    00441     {
    00442     }
    00443
    00444 #else
    00445
    00446     void
    00447     debugNodeData(const XalanDOMString&     value) const;
    00448
    00449     void
    00450     debugNodeData(
    00451             const XalanDOMString&   node,
    00452             const XalanDOMString&   value) const;
    00453
    00454     void
    00455     debugAttributeData(const XalanDOMString&    value) const;
    00456
    00457 #endif
    00458 private:
    00459
    00460     MemoryManager&  m_memoryManager;
    00461
    00462     //Not implemented
    00463     XalanFileUtility();
    00464     XalanFileUtility(const XalanFileUtility&);
    00465 };
    00466
    00467
    00468
    00469 XALAN_CPP_NAMESPACE_END
    00470
    00471
    00472
    00473 #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.

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