00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef OPENMS_FORMAT_TEXTFILE_H
00028 #define OPENMS_FORMAT_TEXTFILE_H
00029
00030 #include <OpenMS/DATASTRUCTURES/String.h>
00031 #include <OpenMS/CONCEPT/Exception.h>
00032
00033 #include <vector>
00034
00035 namespace OpenMS
00036 {
00042 class TextFile
00043 : public std::vector<String>
00044 {
00045 public:
00046
00050
00051 typedef iterator Iterator;
00053 typedef const_iterator ConstIterator;
00055 typedef reverse_iterator ReverseIterator;
00057 typedef const_reverse_iterator ConstReverseIterator;
00059
00061 TextFile();
00062
00064 virtual ~TextFile();
00065
00072 TextFile(const String& filename, bool trim_lines=false) throw (Exception::FileNotFound);
00073
00080 void load(const String& filename, bool trim_lines=false) throw (Exception::FileNotFound);
00081
00088 void store(const String& filename) throw (Exception::UnableToCreateFile);
00089
00098 Iterator search(const Iterator& start, const String& text, bool trim=false);
00099
00106 Iterator search(const String& text, bool trim=false);
00107
00116 Iterator searchSuffix(const Iterator& start, const String& text, bool trim=false);
00117
00125 Iterator searchSuffix(const String& text, bool trim=false);
00126
00135 ConstIterator search(const ConstIterator& start, const String& text, bool trim=false) const;
00136
00143 ConstIterator search(const String& text, bool trim=false) const;
00144
00153 ConstIterator searchSuffix(const ConstIterator& start, const String& text, bool trim=false) const;
00154
00162 ConstIterator searchSuffix(const String& text, bool trim=false) const;
00163
00165 String asString() const;
00166
00167 };
00168
00169 }
00170
00171 #endif // OPENMS_FORMAT_TEXTFILE_H