MeVisLabToolboxReference
MeVisLab/Standard/Sources/ML/MLParser/mlXMLParser/mlXMLParserSystem.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //====================================================
00004 
00009 //====================================================
00010 #ifndef __XML_PARSERSYSTEM_H
00011 #define __XML_PARSERSYSTEM_H
00012 
00013 
00014 #include "../mlParserSystem.h"
00015 
00016 #ifdef WIN32
00017 #pragma warning (disable : 4275)
00018 #pragma warning (disable : 4506)
00019 
00020 #pragma warning( push, 3 )
00021 
00022 #include <xercesc/util/PlatformUtils.hpp>
00023 #include <xercesc/util/XMLString.hpp>
00024 #include <xercesc/parsers/XercesDOMParser.hpp>
00025 #include <xercesc/dom/DOMImplementationRegistry.hpp>
00026 #include <xercesc/dom/DOMImplementation.hpp>
00027 #include <xercesc/dom/DOMNodeList.hpp>
00028 #include <xercesc/dom/DOMBuilder.hpp>
00029 #include <xercesc/dom/DOMElement.hpp>
00030 #include <xercesc/dom/DOMAttr.hpp>
00031 #include <xercesc/dom/DOMText.hpp>
00032 #include <xercesc/dom/DOMNamedNodeMap.hpp>
00033 #include <xercesc/dom/DOMWriter.hpp>
00034 #include <xercesc/framework/LocalFileInputSource.hpp>
00035 #include <xercesc/framework/MemBufInputSource.hpp>
00036 #include <xercesc/framework/LocalFileFormatTarget.hpp>
00037 #include <xercesc/framework/MemBufFormatTarget.hpp>
00038 #include "base64/Base64Coder.h"
00039 
00040 #include <fstream>
00041 
00042 #pragma warning( pop )
00043 
00044 #pragma warning (default : 4506)
00045 
00046 #else
00047 
00048 #include <xercesc/util/PlatformUtils.hpp>
00049 #include <xercesc/util/XMLString.hpp>
00050 #include <xercesc/parsers/XercesDOMParser.hpp>
00051 #include <xercesc/dom/DOMImplementationRegistry.hpp>
00052 #include <xercesc/dom/DOMImplementation.hpp>
00053 #include <xercesc/dom/DOMNodeList.hpp>
00054 #include <xercesc/dom/DOMBuilder.hpp>
00055 #include <xercesc/dom/DOMElement.hpp>
00056 #include <xercesc/dom/DOMAttr.hpp>
00057 #include <xercesc/dom/DOMText.hpp>
00058 #include <xercesc/dom/DOMNamedNodeMap.hpp>
00059 #include <xercesc/dom/DOMWriter.hpp>
00060 #include <xercesc/framework/LocalFileInputSource.hpp>
00061 #include <xercesc/framework/MemBufInputSource.hpp>
00062 #include <xercesc/framework/LocalFileFormatTarget.hpp>
00063 #include <xercesc/framework/MemBufFormatTarget.hpp>
00064 #include "base64/Base64Coder.h"
00065 
00066 #include <fstream>
00067 
00068 #endif
00069 
00070 XERCES_CPP_NAMESPACE_USE
00071 
00072 // ---------------------------------------------------------------------------
00074 // ---------------------------------------------------------------------------
00075 class StringX
00076 {
00077 public :
00078     // -----------------------------------------------------------------------
00080     // -----------------------------------------------------------------------
00081     StringX(const XMLCh* const toTranscode = NULL)
00082     {
00084       fLocalForm = toTranscode ? XMLString::transcode(toTranscode) : NULL;
00085     }
00086 
00087     // -----------------------------------------------------------------------
00089     // -----------------------------------------------------------------------
00090     ~StringX()
00091     {
00092         ML_DELETE_ARR(fLocalForm);
00093     }
00094 
00095 
00096     // -----------------------------------------------------------------------
00098     // -----------------------------------------------------------------------
00099     void operator = (const XMLCh* const toTranscode)
00100     {
00101         ML_DELETE_ARR(fLocalForm);
00102         fLocalForm = toTranscode ? XMLString::transcode(toTranscode) : NULL;
00103     }
00104 
00105 
00106     // -----------------------------------------------------------------------
00108     // -----------------------------------------------------------------------
00109     const char* localForm() const
00110     {
00111         return fLocalForm;
00112     }
00113 
00114 
00115 private :
00116     // -----------------------------------------------------------------------
00117     //  Private data members
00118     //
00120     // -----------------------------------------------------------------------
00121     const char*   fLocalForm;
00122 };
00123 
00124 
00125 // ---------------------------------------------------------------------------
00127 // ---------------------------------------------------------------------------
00128 class XString
00129 {
00130 public :
00131     // -----------------------------------------------------------------------
00133     // -----------------------------------------------------------------------
00134     XString(const char* const toTranscode)
00135     {
00136         // Call the private transcoding method
00137         fUnicodeForm = XMLString::transcode(toTranscode);
00138     }
00139 
00140     // -----------------------------------------------------------------------
00142     // -----------------------------------------------------------------------
00143     ~XString()
00144     {
00145         ML_DELETE_ARR(fUnicodeForm);
00146     }
00147 
00148 
00149     // -----------------------------------------------------------------------
00151     // -----------------------------------------------------------------------
00152     const XMLCh* unicodeForm() const
00153     {
00154         return fUnicodeForm;
00155     }
00156 
00157 private :
00158     // -----------------------------------------------------------------------
00159     //  Private data members
00160     //
00162     // -----------------------------------------------------------------------
00163     const XMLCh*   fUnicodeForm;
00164 };
00165 
00166 
00167 #endif