Isis 3 Programmer Reference
IsisXMLChTrans.h
1 
2 #ifndef IsisXMLChTrans_h
3 #define IsisXMLChTrans_h
4 
9 /* SPDX-License-Identifier: CC0-1.0 */
10 #include <string>
11 #include <iostream>
12 #include <cstdlib>
13 
14 namespace XERCES = XERCES_CPP_NAMESPACE;
15 
16 // This class converts from the internal XMLCh character format to simple c strings
17 
23 class XMLChTrans {
24  public :
25  // Constructors and Destructor
26  XMLChTrans(const XMLCh *const toTranscode) {
27  // Call the private transcoding method
28  fLocalForm = XERCES::XMLString::transcode(toTranscode);
29  }
30 
31  ~XMLChTrans() {
32  delete [] fLocalForm;
33  }
34 
35  // Getter methods
36  const char *localForm() const {
37  return fLocalForm;
38  }
39 
40  private :
41  char *fLocalForm;
42 };
43 
44 
45 inline std::ostream &operator<<(std::ostream &target, const XMLChTrans &toDump) {
46  target << toDump.localForm();
47  return target;
48 }
49 
50 #endif
XMLChTrans
This is free and unencumbered software released into the public domain.
Definition: IsisXMLChTrans.h:23