00001 #ifndef _MISC_UTIL_
00002 #define _MISC_UTIL_
00003
00004
00005 #include <string>
00006 #include <iostream>
00007 #include <fstream>
00008 #include <functional>
00009
00010 #include "CifFile.h"
00011 #include "DictObjFile.h"
00012
00013 #include <sax2/SAX2XMLReader.hpp>
00014 #include <util/XMLString.hpp>
00015
00016
00017 using namespace std;
00018 XERCES_CPP_NAMESPACE_USE
00019
00020
00021 class StrX
00022 {
00023 public:
00024 StrX(const XMLCh* const toTranscode)
00025 {
00026 fLocalForm = XMLString::transcode(toTranscode);
00027 }
00028
00029 ~StrX()
00030 {
00031 delete [] fLocalForm;
00032 }
00033
00034 const char* localForm() const
00035 {
00036 return(fLocalForm);
00037 }
00038
00039 private:
00040 char* fLocalForm;
00041
00042 };
00043
00044
00045 class IsLostChar : public unary_function<char, bool>
00046 {
00047 public:
00048 bool operator() (char oneChar) const
00049 {
00050 if ((oneChar == '[') || (oneChar == ']'))
00051 {
00052 return(true);
00053 }
00054
00055 return(false);
00056 }
00057 };
00058
00059
00060 inline ostream& operator<<(ostream& target, const StrX& toDump)
00061 {
00062
00063 target << toDump.localForm();
00064 return(target);
00065
00066 }
00067
00068
00069 string toString(const XMLCh* toConvert);
00070 void Error(string& err);
00071 void DeleteFile(const string& fileName);
00072 void ResurrectOrigItemNames(CifFile& cifFile, DictObjCont& dictObjCont);
00073 void CorrectEmptyValuesOfMandatoryItems(CifFile& cifFile,
00074 DictObjCont& dictObjCont);
00075
00076 #endif