dbertoni    2002/11/27 11:22:07

  Modified:    c/samples/ThreadSafe ThreadSafe.cpp
               c/samples/TraceListen TraceListen.cpp
               c/samples/UseStylesheetParam UseStylesheetParam.cpp
               c/samples/XPathWrapper TestDriver.cpp TestDriver.dsp
                        XPathWrapper.cpp XPathWrapper.hpp
               c/samples/XalanTransform XalanTransform.cpp
               c/samples/XalanTransformerCallback
                        XalanTransformerCallback.cpp
  Log:
  Updates for C++ namespace support.
  
  Revision  Changes    Path
  1.20      +15 -9     xml-xalan/c/samples/ThreadSafe/ThreadSafe.cpp
  
  Index: ThreadSafe.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/samples/ThreadSafe/ThreadSafe.cpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ThreadSafe.cpp    30 Aug 2002 23:59:24 -0000      1.19
  +++ ThreadSafe.cpp    27 Nov 2002 19:22:06 -0000      1.20
  @@ -27,15 +27,19 @@
   
   
   
  -#if !defined(XALAN_NO_NAMESPACES)
  -     using std::cerr;
  -     using std::cout;
  -     using std::endl;
  -     using std::ifstream;
  -     using std::ios_base;
  -     using std::ostrstream;
  -     using std::string;
  -#endif
  +XALAN_USING_STD(cerr)
  +XALAN_USING_STD(cout)
  +XALAN_USING_STD(endl)
  +XALAN_USING_STD(ostrstream)
  +
  +
  +
  +XALAN_USING_XALAN(XalanCompiledStylesheet)
  +XALAN_USING_XALAN(XalanDOMString)
  +XALAN_USING_XALAN(XalanParsedSource)
  +XALAN_USING_XALAN(XalanTransformer)
  +XALAN_USING_XALAN(XSLTInputSource)
  +XALAN_USING_XALAN(XSLTResultTarget)
   
   
   
  @@ -175,6 +179,8 @@
        {
                try
                {
  +                     XALAN_USING_XERCES(XMLPlatformUtils)
  +
                        // Call the static initializer for Xerces.
                        XMLPlatformUtils::Initialize();
   
  
  
  
  1.16      +20 -10    xml-xalan/c/samples/TraceListen/TraceListen.cpp
  
  Index: TraceListen.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/samples/TraceListen/TraceListen.cpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TraceListen.cpp   14 Nov 2002 23:54:16 -0000      1.15
  +++ TraceListen.cpp   27 Nov 2002 19:22:06 -0000      1.16
  @@ -36,19 +36,18 @@
                        int                             argc,
                        const char*             argv[])
   {
  -#if !defined(XALAN_NO_NAMESPACES)
  -     using std::cerr;
  -     using std::endl;
  +     XALAN_USING_STD(cerr)
  +     XALAN_USING_STD(endl)
  +
   #if defined(XALAN_STRICT_ANSI_HEADERS)
        using std::strcmp;
   #endif
  -#endif
   
        // TraceListener flags...
  -     bool traceTemplates = false;
  -     bool traceTemplateChildren = false;
  -     bool traceGenerationEvent = false;
  -     bool traceSelectionEvent = false;
  +     bool    traceTemplates = false;
  +     bool    traceTemplateChildren = false;
  +     bool    traceGenerationEvent = false;
  +     bool    traceSelectionEvent = false;
   
        if (argc < 2 || argc > 5)
        {
  @@ -86,6 +85,10 @@
    
        try
        {
  +             XALAN_USING_XERCES(XMLPlatformUtils)
  +
  +             XALAN_USING_XALAN(XalanTransformer)
  +
                // Initialize Xerces...
                XMLPlatformUtils::Initialize();
   
  @@ -93,6 +96,13 @@
                XalanTransformer::initialize();
   
                {
  +                     XALAN_USING_XALAN(TraceListenerDefault)
  +                     XALAN_USING_XALAN(XalanDOMString)
  +                     XALAN_USING_XALAN(XalanOutputStreamPrintWriter)
  +                     XALAN_USING_XALAN(XalanStdOutputStream)
  +                     XALAN_USING_XALAN(XSLTInputSource)
  +                     XALAN_USING_XALAN(XSLTResultTarget)
  +
                        // Create a XalanTransformer.
                        XalanTransformer        theXalanTransformer;
   
  @@ -100,8 +110,8 @@
                        const XalanDOMString    theXSLFileName("birds.xsl");
   
                        // Our input sources...
  -                     const XSLTInputSource   
theInputSource(c_wstr(theXMLFileName));
  -                     const XSLTInputSource   
theStylesheetSource(c_wstr(theXSLFileName));
  +                     const XSLTInputSource   theInputSource(theXMLFileName);
  +                     const XSLTInputSource   
theStylesheetSource(theXSLFileName);
   
                        // Our output target...
                        const XalanDOMString    theOutputFile("birds.out");
  
  
  
  1.19      +8 -4      
xml-xalan/c/samples/UseStylesheetParam/UseStylesheetParam.cpp
  
  Index: UseStylesheetParam.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/samples/UseStylesheetParam/UseStylesheetParam.cpp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- UseStylesheetParam.cpp    14 Nov 2002 23:54:16 -0000      1.18
  +++ UseStylesheetParam.cpp    27 Nov 2002 19:22:07 -0000      1.19
  @@ -24,10 +24,8 @@
                  int                   argc,
                  const char*   argv[])
   {
  -#if !defined(XALAN_NO_NAMESPACES)
  -     using std::cerr;
  -     using std::endl;
  -#endif
  +     XALAN_USING_STD(cerr)
  +     XALAN_USING_STD(endl)
   
        int     theResult = 0;
   
  @@ -39,6 +37,10 @@
        }
        else
        {
  +             XALAN_USING_XERCES(XMLPlatformUtils)
  +
  +             XALAN_USING_XALAN(XalanTransformer)
  +
                // Call the static initializer for Xerces.
                XMLPlatformUtils::Initialize();
   
  @@ -46,6 +48,8 @@
                XalanTransformer::initialize();
   
                {
  +                     XALAN_USING_XALAN(XalanDOMString)
  +
                        // Create a XalanTransformer.
                        XalanTransformer        theXalanTransformer;
   
  
  
  
  1.10      +6 -9      xml-xalan/c/samples/XPathWrapper/TestDriver.cpp
  
  Index: TestDriver.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/samples/XPathWrapper/TestDriver.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestDriver.cpp    14 Nov 2002 23:54:16 -0000      1.9
  +++ TestDriver.cpp    27 Nov 2002 19:22:07 -0000      1.10
  @@ -29,13 +29,10 @@
                        int                             argc,
                        const char*             argv[])
   {
  -#if !defined(XALAN_NO_NAMESPACES)
  -     using std::cerr;
  -     using std::cout;
  -     using std::endl;
  -     using std::ifstream;
  -     using std::vector;
  -#endif
  +     XALAN_USING_STD(cerr)
  +     XALAN_USING_STD(cout)
  +     XALAN_USING_STD(endl)
  +     XALAN_USING_STD(ifstream)
   
        if (argc < 4)
        {
  @@ -43,7 +40,7 @@
                return -1;
        }
   
  -     CharVectorType          theXML;
  +     XPathWrapper::CharVectorType    theXML;
   
        ifstream        in(argv[1]);
   
  @@ -69,7 +66,7 @@
                cout << "the result set has " << len << " strings\n";
   
                for (size_t i=0; i<len; i++)
  -                     cout << "item " << (i+1) << "= \"" << result[i] << "\"" 
<< endl;
  +                     cout << "item " << (i+1) << "= \"" << 
&*result[i].begin() << "\"" << endl;
        }
        catch(const XMLException&)
        {
  
  
  
  1.9       +10 -2     xml-xalan/c/samples/XPathWrapper/TestDriver.dsp
  
  Index: TestDriver.dsp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/samples/XPathWrapper/TestDriver.dsp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestDriver.dsp    15 Feb 2001 22:44:53 -0000      1.8
  +++ TestDriver.dsp    27 Nov 2002 19:22:07 -0000      1.9
  @@ -51,7 +51,7 @@
   # ADD BSC32 /nologo
   LINK32=link.exe
   # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib 
odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib 
odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
  -# ADD LINK32 /nologo /subsystem:console /machine:I386
  +# ADD LINK32 xerces-c_2.lib /nologo /subsystem:console /machine:I386 
/libpath:"..\..\..\..\xml-xerces\c\Build\Win32\VC6\Release"
   
   !ELSEIF  "$(CFG)" == "TestDriver - Win32 Debug"
   
  @@ -75,7 +75,7 @@
   # ADD BSC32 /nologo
   LINK32=link.exe
   # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib 
odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib 
odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 
/pdbtype:sept
  -# ADD LINK32 /nologo /subsystem:console /map /debug /machine:I386 
/pdbtype:sept
  +# ADD LINK32 xerces-c_2D.lib /nologo /subsystem:console /map /debug 
/machine:I386 /pdbtype:sept 
/libpath:"..\..\..\..\xml-xerces\c\Build\Win32\VC6\Debug"
   
   !ENDIF 
   
  @@ -90,10 +90,18 @@
   
   SOURCE=.\TestDriver.cpp
   # End Source File
  +# Begin Source File
  +
  +SOURCE=.\XPathWrapper.cpp
  +# End Source File
   # End Group
   # Begin Group "Header Files"
   
   # PROP Default_Filter "h;hpp;hxx;hm;inl"
  +# Begin Source File
  +
  +SOURCE=.\XPathWrapper.hpp
  +# End Source File
   # End Group
   # Begin Group "Resource Files"
   
  
  
  
  1.21      +10 -2     xml-xalan/c/samples/XPathWrapper/XPathWrapper.cpp
  
  Index: XPathWrapper.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/samples/XPathWrapper/XPathWrapper.cpp,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- XPathWrapper.cpp  14 Nov 2002 23:54:16 -0000      1.20
  +++ XPathWrapper.cpp  27 Nov 2002 19:22:07 -0000      1.21
  @@ -73,7 +73,7 @@
                const char*             xml,
                const char*             context, 
                const char*             expr,
  -#if defined(XALAN_NO_NAMESPACES)
  +#if defined(XALAN_NO_STD_NAMESPACE)
                ostream&                errorStream)
   #else
                std::ostream&   errorStream)
  @@ -83,6 +83,9 @@
                using std::strlen;
   #endif
   
  +             XALAN_USING_XERCES(XMLPlatformUtils)
  +             XALAN_USING_XERCES(XMLException)
  +
                //initialize Xerces...
                try
                {
  @@ -98,6 +101,9 @@
                XPathWrapper::CharVectorTypeVectorType  theResultList;
   
                {
  +                     // Just hoist everything...
  +                     XALAN_CPP_NAMESPACE_USE
  +
                        // Initialize the XPath subsystem...
                        XPathInit                                               
theInit;
   
  @@ -112,8 +118,10 @@
   
                        try
                        {
  +                             XALAN_USING_XERCES(MemBufInputSource)
  +
                                // parse XML and get root element
  -                             MemBufInputSource inStream((XMLByte*)xml, 
strlen(xml), "foo", false);
  +                             MemBufInputSource       inStream((XMLByte*)xml, 
strlen(xml), "foo", false);
   
                                XalanDocument* const    doc = 
theLiaison.parseXMLStream(inStream);
                                assert(doc != 0);
  
  
  
  1.7       +5 -15     xml-xalan/c/samples/XPathWrapper/XPathWrapper.hpp
  
  Index: XPathWrapper.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/samples/XPathWrapper/XPathWrapper.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XPathWrapper.hpp  13 Dec 2001 19:12:33 -0000      1.6
  +++ XPathWrapper.hpp  27 Nov 2002 19:22:07 -0000      1.7
  @@ -77,31 +77,21 @@
   
   
   
  -#if defined(WIN32)
  -#if defined(_XPathWrapper)
  -#define XALAN_XPATHWRAPPER_EXPORT XALAN_PLATFORM_EXPORT
  -#else
  -#define XALAN_XPATHWRAPPER_EXPORT XALAN_PLATFORM_IMPORT
  -#endif
  -#else
  -#define XALAN_XPATHWRAPPER_EXPORT
  -#endif
  -
  -
  -
   class XPathWrapperImpl;
   
   
   
  -class XALAN_XPATHWRAPPER_EXPORT XPathWrapper
  +class XPathWrapper
   {
   
   public:
   
  +     typedef XALAN_CPP_NAMESPACE_QUALIFIER CharVectorType    CharVectorType;
  +
   #if defined(XALAN_NO_NAMESPACES)
  -     typedef vector<CharVectorType> CharVectorTypeVectorType;        
  +     typedef vector<CharVectorType>                  
CharVectorTypeVectorType;       
   #else
  -     typedef std::vector<CharVectorType> CharVectorTypeVectorType;   
  +     typedef std::vector<CharVectorType>             
CharVectorTypeVectorType;       
   #endif       
   
        XPathWrapper();
  
  
  
  1.11      +7 -5      xml-xalan/c/samples/XalanTransform/XalanTransform.cpp
  
  Index: XalanTransform.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/samples/XalanTransform/XalanTransform.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XalanTransform.cpp        14 Nov 2002 23:54:16 -0000      1.10
  +++ XalanTransform.cpp        27 Nov 2002 19:22:07 -0000      1.11
  @@ -80,11 +80,9 @@
                        int                              argc,
                        const char*              argv[])
   {
  -#if !defined(XALAN_NO_NAMESPACES)
  -     using std::cout;
  -     using std::cerr;
  -    using std::endl;
  -#endif
  +     XALAN_USING_STD(cerr)
  +     XALAN_USING_STD(cout)
  +     XALAN_USING_STD(endl)
   
       if (argc < 3 || argc > 4)
        {
  @@ -96,6 +94,10 @@
   
        try
        {
  +             XALAN_USING_XERCES(XMLPlatformUtils)
  +
  +             XALAN_USING_XALAN(XalanTransformer)
  +
                // Call the static initializer for Xerces.
                XMLPlatformUtils::Initialize();
   
  
  
  
  1.10      +43 -33    
xml-xalan/c/samples/XalanTransformerCallback/XalanTransformerCallback.cpp
  
  Index: XalanTransformerCallback.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/samples/XalanTransformerCallback/XalanTransformerCallback.cpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XalanTransformerCallback.cpp      14 Nov 2002 23:54:16 -0000      1.9
  +++ XalanTransformerCallback.cpp      27 Nov 2002 19:22:07 -0000      1.10
  @@ -93,10 +93,10 @@
                        const char*             theXSLFile,
                        FILE*                   theOutputFile)
   {
  -#if !defined(XALAN_NO_NAMESPACES)
  -     using std::cerr;
  -    using std::endl;
  -#endif
  +     XALAN_USING_STD(cerr)
  +     XALAN_USING_STD(endl)
  +
  +     XALAN_USING_XALAN(XalanTransformer)
   
       // Create a XalanTransformer...
        XalanTransformer        theXalanTransformer;
  @@ -128,10 +128,9 @@
                        int                              argc,
                        const char*              argv[])
   {
  -#if !defined(XALAN_NO_NAMESPACES)
  -     using std::cerr;
  -    using std::endl;
  -#endif
  +     XALAN_USING_STD(cerr)
  +     XALAN_USING_STD(cout)
  +     XALAN_USING_STD(endl)
   
       if (argc < 3 || argc > 4)
        {
  @@ -140,44 +139,55 @@
                return -1;
        }
   
  -     // Call the static initializer for Xerces.
  -     XMLPlatformUtils::Initialize();
  +     int             theResult = -1;
  +
  +     try
  +     {
  +             XALAN_USING_XERCES(XMLPlatformUtils)
   
  -    // Initialize Xalan.
  -    XalanTransformer::initialize();
  +             XALAN_USING_XALAN(XalanTransformer)
   
  -    int                              theResult = 0;
  +             // Call the static initializer for Xerces.
  +             XMLPlatformUtils::Initialize();
   
  -    if (argc == 3)
  -     {
  -             // No output file, so use stdout...
  -             theResult = doTransform(argv[1], argv[2], stdout);
  -    }
  -    else
  -    {
  -             // Output file specified, so try to open it...
  -             FILE* const     theOutputFile = fopen(argv[3], "w");
  +             // Initialize Xalan.
  +             XalanTransformer::initialize();
   
  -             if (theOutputFile == 0)
  +             if (argc == 3)
                {
  -                     cerr << "Error: " << "Unable to open output file " << 
argv[3] << endl;
  +                     // No output file, so use stdout...
  +                     theResult = doTransform(argv[1], argv[2], stdout);
                }
                else
                {
  -                     theResult = doTransform(argv[1], argv[2], 
theOutputFile);
  +                     // Output file specified, so try to open it...
  +                     FILE* const     theOutputFile = fopen(argv[3], "w");
   
  -                     fclose(theOutputFile);
  +                     if (theOutputFile == 0)
  +                     {
  +                             cerr << "Error: " << "Unable to open output 
file " << argv[3] << endl;
  +                     }
  +                     else
  +                     {
  +                             theResult = doTransform(argv[1], argv[2], 
theOutputFile);
  +
  +                             fclose(theOutputFile);
  +                     }
                }
  -    }
   
  -     // Terminate Xalan...
  -     XalanTransformer::terminate();
  +             // Terminate Xalan...
  +             XalanTransformer::terminate();
   
  -     // Terminate Xerces...
  -     XMLPlatformUtils::Terminate();
  +             // Terminate Xerces...
  +             XMLPlatformUtils::Terminate();
   
  -     // Clean up the ICU, if it's integrated...
  -     XalanTransformer::ICUCleanUp();
  +             // Clean up the ICU, if it's integrated...
  +             XalanTransformer::ICUCleanUp();
  +     }
  +     catch(...)
  +     {
  +             cerr << "An unknown error occurred!" << endl;
  +     }
   
        return theResult;
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to