USGS

Isis 3.0 Object Programmers' Reference

Home

IsisXMLChTrans.h

Go to the documentation of this file.
00001 
00024 #ifndef IsisXMLChTrans_h
00025 #define IsisXMLChTrans_h
00026 
00027 #include <string>
00028 #include <iostream>
00029 #include <cstdlib>
00030 
00031 namespace XERCES = XERCES_CPP_NAMESPACE;
00032 
00033 //  This class converts from the internal XMLCh character format to simple c strings
00034 
00040 class XMLChTrans {
00041   public :
00042     //  Constructors and Destructor
00043     XMLChTrans(const XMLCh *const toTranscode) {
00044       // Call the private transcoding method
00045       fLocalForm = XERCES::XMLString::transcode(toTranscode);
00046     }
00047 
00048     ~XMLChTrans() {
00049       delete [] fLocalForm;
00050     }
00051 
00052     //  Getter methods
00053     const char *localForm() const {
00054       return fLocalForm;
00055     }
00056 
00057   private :
00058     char   *fLocalForm;
00059 };
00060 
00061 
00062 inline std::ostream &operator<<(std::ostream &target, const XMLChTrans &toDump) {
00063   target << toDump.localForm();
00064   return target;
00065 }
00066 
00067 #endif