CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StrX.h
Go to the documentation of this file.
1 #include <cstdlib>
2 #include <string>
3 #include <iostream>
5 #include <xercesc/parsers/SAXParser.hpp>
6 
7 // ---------------------------------------------------------------------------
8 // This is a simple class that lets us do easy (though not terribly efficient)
9 // trancoding of XMLCh data to local code page for display.
10 // ---------------------------------------------------------------------------
11 class StrX
12 {
13 public :
14  typedef XERCES_CPP_NAMESPACE::XMLString XMLString;
15  // -----------------------------------------------------------------------
16  // Constructors and Destructor
17  // -----------------------------------------------------------------------
18  StrX(const XMLCh* const toTranscode)
19  {
20  // Call the private transcoding method
21  fLocalForm = XMLString::transcode(toTranscode);
22  }
23 
25  {
26  delete [] fLocalForm;
27  }
28 
29  // -----------------------------------------------------------------------
30  // Getter methods
31  // -----------------------------------------------------------------------
32  const char* localForm() const
33  {
34  return fLocalForm;
35  }
36 
37 private :
38  // -----------------------------------------------------------------------
39  // Private data members
40  //
41  // fLocalForm
42  // This is the local code page form of the string.
43  // -----------------------------------------------------------------------
44  char* fLocalForm;
45 };
46 
47 
48 inline std::ostream& operator<<(std::ostream& target, const StrX& toDump)
49 {
50  target << toDump.localForm();
51  return target;
52 }
53 
XERCES_CPP_NAMESPACE::XMLString XMLString
Definition: StrX.h:14
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
StrX(const XMLCh *const toTranscode)
Definition: StrX.h:18
~StrX()
Definition: StrX.h:24
char * fLocalForm
Definition: StrX.h:78
XMLCh * transcode(const T &fInput)
const char * localForm() const
Definition: StrX.h:32
Definition: StrX.h:32