28 typedef std::vector<String>::iterator
Iterator;
54 TextFile(
const String& filename,
bool trim_lines =
false,
Int first_n = -1,
bool skip_empty_lines =
false);
66 void load(
const String& filename,
bool trim_lines =
false,
Int first_n = -1,
bool skip_empty_lines =
false);
78 template <
typename StringType>
81 buffer_.push_back(
static_cast<String>(
string));
85 template <
typename StringType>
88 buffer_.push_back(
static_cast<String>(line));
97 static std::istream&
getLine(std::istream& is, std::string& t);
A more convenient string class.
Definition: String.h:34
This class provides some basic file handling methods for text files.
Definition: TextFile.h:21
std::vector< String >::reverse_iterator ReverseIterator
Mutable reverse iterator.
Definition: TextFile.h:32
std::vector< String >::const_iterator ConstIterator
Non-mutable iterator.
Definition: TextFile.h:30
TextFile(const String &filename, bool trim_lines=false, Int first_n=-1, bool skip_empty_lines=false)
Constructor with filename.
void addLine(const StringType &line)
Definition: TextFile.h:86
void store(const String &filename)
Writes the data to a file.
TextFile & operator<<(const StringType &string)
Operator for appending entries with less code.
Definition: TextFile.h:79
virtual ~TextFile()
destructor
TextFile()
Default constructor.
ConstIterator end() const
Gives access to the underlying text buffer.
std::vector< String >::const_reverse_iterator ConstReverseIterator
Non-mutable reverse iterator.
Definition: TextFile.h:34
static std::istream & getLine(std::istream &is, std::string &t)
Platform-agnostic getline() which can deal with all line endings (\r, \r\n, \n)
void load(const String &filename, bool trim_lines=false, Int first_n=-1, bool skip_empty_lines=false)
Loads data from a text file.
std::vector< String >::iterator Iterator
Mutable iterator.
Definition: TextFile.h:28
ConstIterator begin() const
Gives access to the underlying text buffer.
std::vector< String > buffer_
Internal buffer storing the lines before writing them to the file.
Definition: TextFile.h:114
int Int
Signed integer type.
Definition: Types.h:76
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22