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 #ifndef OB_TEXT_H
00020 #define OB_TEXT_H
00021
00022 #include <openbabel/babelconfig.h>
00023 #include <openbabel/base.h>
00024
00025 namespace OpenBabel
00026 {
00029 class OBText : public OBBase
00030 {
00031 private:
00032 std::string txt;
00033 public:
00034
00035 OBText(){}
00036 OBText(const std::string& text) :txt(text) {}
00037
00039 std::string GetText()const { return txt; }
00040
00068 std::string GetText(std::string::size_type& pos, bool ToInsertOnly=false) const
00069 {
00070 std::string::size_type oldpos = pos;
00071 std::string::size_type newpos = txt.find("OPENBABEL_INSERT", pos);
00072 if(newpos== std::string::npos)
00073 {
00074 if(ToInsertOnly)
00075 return("");
00076 pos = 0;
00077 return txt.substr(oldpos);
00078 }
00079
00080 newpos = txt.rfind('\n', newpos);
00081 pos = txt.find("\n", newpos+1)+1;
00082 return txt.substr(oldpos, newpos-oldpos);
00083 }
00084
00085 void SetText(const std::string& text){ txt = text; }
00086 };
00087
00088 }
00089 #endif //OB_TEXT_H
00090