Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OB_TOKENST_H
00021 #define OB_TOKENST_H
00022
00023 #include <openbabel/babelconfig.h>
00024
00025 #include <vector>
00026 #include <sstream>
00027 #include <string>
00028 #include <fstream>
00029
00030 namespace OpenBabel
00031 {
00032
00033 OBERROR bool tokenize(std::vector<std::string>&, const char *buf, const char *delimstr=" \t\n\r");
00034 OBERROR bool tokenize(std::vector<std::string>&, std::string&, const char *delimstr=" \t\n\r", int limit=-1);
00036 OBERROR std::string& Trim(std::string& txt);
00037
00038
00039 template<typename T>
00040 std::string toString(T val)
00041 {
00042 std::ostringstream s;
00043 s << val;
00044 return s.str();
00045 }
00046
00048 struct DeleteObject
00049 {
00050 template<typename T>
00051 void operator()(const T* ptr)const { delete ptr; }
00052 };
00053
00055 OBERROR std::istream& ignore(std::istream& ifs, const std::string& txt);
00056
00058
00059 OBERROR std::string OpenDatafile(std::ifstream& fs,
00060 const std::string& filename,
00061 const std::string& envvar = "BABEL_DATADIR");
00062
00063
00064 #ifdef WIN32
00065 #define FILE_SEP_CHAR "\\"
00066 #else
00067 #define FILE_SEP_CHAR "/"
00068 #endif
00069
00070
00071 }
00072 #endif
00073