Remove gmx::File (except for File::exists())
[alexxy/gromacs.git] / src / gromacs / utility / textreader.cpp
index 4eef63e4fc4d450c230faa719d1bd16d276a205a..436614964bb9cfea23ed3a83bb5b6e83572dae48 100644 (file)
 namespace gmx
 {
 
+// static
+std::string TextReader::readFileToString(const char *filename)
+{
+    std::string result;
+    TextReader  reader(filename);
+    std::string line;
+    while (reader.readLine(&line))
+    {
+        result.append(line);
+    }
+    reader.close();
+    return result;
+}
+
+// static
+std::string TextReader::readFileToString(const std::string &filename)
+{
+    return readFileToString(filename.c_str());
+}
+
 class TextReader::Impl
 {
     public: