librcsb-core-wrapper  1.000
misc_util.h
Go to the documentation of this file.
1 #ifndef _MISC_UTIL_
2 #define _MISC_UTIL_
3 
4 
5 #include <string>
6 #include <iostream>
7 #include <fstream>
8 #include <functional>
9 
10 #include <rcsb/CifFile.h>
11 #include <rcsb/DataInfo.h>
12 
13 #include <xercesc/sax2/SAX2XMLReader.hpp>
14 #include <xercesc/util/XMLString.hpp>
15 
16 
17 XERCES_CPP_NAMESPACE_USE
18 
19 
20 class StrX
21 {
22  public:
23  StrX(const XMLCh* const toTranscode)
24  {
25  fLocalForm = XMLString::transcode(toTranscode);
26  }
27 
29  {
30  delete [] fLocalForm;
31  }
32 
33  const char* localForm() const
34  {
35  return(fLocalForm);
36  }
37 
38  private:
39  char* fLocalForm;
40 
41 };
42 
43 
44 class IsLostChar : public std::unary_function<char, bool>
45 {
46  public:
47  bool operator() (char oneChar) const
48  {
49  if ((oneChar == '[') || (oneChar == ']'))
50  {
51  return(true);
52  }
53 
54  return(false);
55  }
56 };
57 
58 
59 inline std::ostream& operator<<(std::ostream& target, const StrX& toDump)
60 {
61 
62  target << toDump.localForm();
63  return(target);
64 
65 }
66 
67 
68 string toString(const XMLCh* toConvert);
69 void Error(string& err);
70 void DeleteFile(const string& fileName);
71 void ResurrectOrigItemNames(CifFile& cifFile, DataInfo& dataInfo);
72 void CorrectEmptyValuesOfMandatoryItems(CifFile& cifFile, DataInfo& dataInfo);
73 
74 #endif