Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

TextFile.h (Maintainer: Marc Sturm)

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // --------------------------------------------------------------------------
00005 //                   OpenMS Mass Spectrometry Framework
00006 // --------------------------------------------------------------------------
00007 //  Copyright (C) 2003-2008 -- Oliver Kohlbacher, Knut Reinert
00008 //
00009 //  This library is free software; you can redistribute it and/or
00010 //  modify it under the terms of the GNU Lesser General Public
00011 //  License as published by the Free Software Foundation; either
00012 //  version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //  This library is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //  Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with this library; if not, write to the Free Software
00021 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 // --------------------------------------------------------------------------
00024 // $Maintainer: Marc Sturm $
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 } // namespace OpenMS
00170 
00171 #endif // OPENMS_FORMAT_TEXTFILE_H

Generated Tue Apr 1 15:36:38 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1