Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

StrX.h

Go to the documentation of this file.
00001 #ifndef Impala_Application_SDash_StrX_h
00002 #define Impala_Application_SDash_StrX_h
00003 
00004 // ---------------------------------------------------------------------------
00005 //  This is a simple class that lets us do easy (though not terribly efficient)
00006 //  trancoding of XMLCh data to local code page for display.
00007 //
00008 //  SK: taken from Xerces sample file SAX2Count.hpp
00009 // ---------------------------------------------------------------------------
00010 
00011 #include <xercesc/util/PlatformUtils.hpp>
00012 #include <stdlib.h>
00013 #include <string.h>
00014 #if defined(XERCES_NEW_IOSTREAMS)
00015 #include <iostream>
00016 #else
00017 #include <iostream.h>
00018 #endif
00019 
00020 #include <xercesc/sax2/XMLReaderFactory.hpp>
00021 #include <xercesc/sax2/SAX2XMLReader.hpp>
00022 
00023 XERCES_CPP_NAMESPACE_USE
00024 
00025 class StrX
00026 {
00027 public :
00028 
00029     StrX(const XMLCh* const toTranscode)
00030     {
00031         // Call the private transcoding method
00032         fLocalForm = XMLString::transcode(toTranscode);
00033     }
00034 
00035     ~StrX()
00036     {
00037         XMLString::release(&fLocalForm);
00038     }
00039 
00040     // -----------------------------------------------------------------------
00041     //  Getter methods
00042     // -----------------------------------------------------------------------
00043     const char* localForm() const
00044     {
00045         return fLocalForm;
00046     }
00047 
00048 private :
00049     // -----------------------------------------------------------------------
00050     //  Private data members
00051     //
00052     //  fLocalForm
00053     //      This is the local code page form of the string.
00054     // -----------------------------------------------------------------------
00055     char*   fLocalForm;
00056 
00057 }; //class
00058 
00059 
00060 inline XERCES_STD_QUALIFIER ostream& operator<<(XERCES_STD_QUALIFIER ostream& target, const StrX& toDump)
00061 {
00062     target << toDump.localForm();
00063     return target;
00064 }
00065 
00066 #endif

Generated on Fri Mar 19 09:30:38 2010 for ImpalaSrc by  doxygen 1.5.1