#include "buildinfo.h"
#include "gromacs/utility/exceptions.h"
-#include "gromacs/utility/file.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/path.h"
#include "gromacs/utility/stringutil.h"
#include "gromacs/commandline/cmdlinemodulemanager.h"
#include "gromacs/options/basicoptions.h"
#include "gromacs/options/options.h"
-#include "gromacs/utility/file.h"
+#include "gromacs/utility/textwriter.h"
#include "gromacs/onlinehelp/tests/mock_helptopic.h"
#include "testutils/cmdlinetest.h"
"test", "help", "-export", "rst"
};
// TODO: Find a more elegant solution, or get rid of the links.dat altogether.
- gmx::File::writeFileFromString("links.dat", "");
+ gmx::TextWriter::writeFileFromString("links.dat", "");
CommandLine args(cmdline);
initManager(args, "test");
MockOptionsModule &mod1 = addOptionsModule("module", "First module");
#include <gtest/gtest.h>
#include "gromacs/utility/arrayref.h"
-#include "gromacs/utility/file.h"
#include "gromacs/utility/path.h"
#include "gromacs/utility/stringutil.h"
+#include "gromacs/utility/textwriter.h"
#include "testutils/cmdlinetest.h"
#include "testutils/testasserts.h"
FileArgumentType type)
{
std::string filename(tempFiles_.getTemporaryFilePath(extension));
- gmx::File::writeFileFromString(filename, "Dummy file");
+ gmx::TextWriter::writeFileFromString(filename, "Dummy file");
if (name != NULL)
{
args_.append(name);
#include "gromacs/utility/directoryenumerator.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
-#include "gromacs/utility/file.h"
#include "gromacs/utility/futil.h"
#include "gromacs/utility/path.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/dir_separator.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
-#include "gromacs/utility/file.h"
#include "gromacs/utility/futil.h"
#include "gromacs/utility/path.h"
#include "gromacs/utility/programcontext.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
namespace gmx
{
-class File;
class HelpWriterContext;
/*! \libinternal \brief
errorcodes.h
exceptions.h
fatalerror.h
- file.h
flags.h
futil.h
gmxassert.h
#include "buildinfo.h"
#include "gromacs/utility/directoryenumerator.h"
#include "gromacs/utility/exceptions.h"
-#include "gromacs/utility/file.h"
+#include "gromacs/utility/filestream.h"
#include "gromacs/utility/path.h"
#include "gromacs/utility/programcontext.h"
#include "gromacs/utility/stringutil.h"
fprintf(debug, "Opening library file %s\n", fn);
}
#endif
- return File::openRawHandle(filename, "r");
+ return TextInputFile::openRawHandle(filename);
}
std::string DataFileFinder::findFile(const DataFileOptions &options) const
+++ /dev/null
-/*
- * This file is part of the GROMACS molecular simulation package.
- *
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
- * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
- * and including many others, as listed in the AUTHORS file in the
- * top-level source directory and at http://www.gromacs.org.
- *
- * GROMACS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * GROMACS is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with GROMACS; if not, see
- * http://www.gnu.org/licenses, or write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * If you want to redistribute modifications to GROMACS, please
- * consider that scientific software is very special. Version
- * control is crucial - bugs must be traceable. We will be happy to
- * consider code for inclusion in the official distribution, but
- * derived work must not be called official GROMACS. Details are found
- * in the README & COPYING files - if they are missing, get the
- * official version at http://www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the research papers on the package. Check out http://www.gromacs.org.
- */
-/*! \internal \file
- * \brief
- * Implements gmx::File.
- *
- * \author Teemu Murtola <teemu.murtola@gmail.com>
- * \ingroup module_utility
- */
-#include "gmxpre.h"
-
-#include "file.h"
-
-#include "config.h"
-
-#include <cerrno>
-#include <cstdio>
-#include <cstring>
-
-#include <algorithm>
-#include <string>
-#include <vector>
-
-#include <sys/stat.h>
-
-#include "gromacs/utility/exceptions.h"
-#include "gromacs/utility/gmxassert.h"
-#include "gromacs/utility/stringutil.h"
-
-namespace gmx
-{
-
-/*! \internal \brief
- * Private implementation class for File.
- *
- * \ingroup module_utility
- */
-class File::Impl
-{
- public:
- /*! \brief
- * Initialize a file object with the given handle.
- *
- * \param[in] fp %File handle to use (may be NULL).
- * \param[in] bClose Whether this object should close its file handle.
- */
- Impl(FILE *fp, bool bClose);
- ~Impl();
-
- //! File handle for this object (may be NULL).
- FILE *fp_;
- /*! \brief
- * Whether \p fp_ should be closed by this object.
- *
- * Can be true if \p fp_ is NULL.
- */
- bool bClose_;
-};
-
-File::Impl::Impl(FILE *fp, bool bClose)
- : fp_(fp), bClose_(bClose)
-{
-}
-
-File::Impl::~Impl()
-{
- if (fp_ != NULL && bClose_)
- {
- if (fclose(fp_) != 0)
- {
- // TODO: Log the error somewhere
- }
- }
-}
-
-// static
-FILE *File::openRawHandle(const char *filename, const char *mode)
-{
- FILE *fp = fopen(filename, mode);
- if (fp == NULL)
- {
- GMX_THROW_WITH_ERRNO(
- FileIOError(formatString("Could not open file '%s'", filename)),
- "fopen", errno);
- }
- return fp;
-}
-
-// static
-FILE *File::openRawHandle(const std::string &filename, const char *mode)
-{
- return openRawHandle(filename.c_str(), mode);
-}
-
-File::File(const char *filename, const char *mode)
- : impl_(new Impl(NULL, true))
-{
- open(filename, mode);
-}
-
-File::File(const std::string &filename, const char *mode)
- : impl_(new Impl(NULL, true))
-{
- open(filename, mode);
-}
-
-File::~File()
-{
-}
-
-void File::open(const char *filename, const char *mode)
-{
- GMX_RELEASE_ASSERT(impl_->fp_ == NULL,
- "Attempted to open the same file object twice");
- // TODO: Port all necessary functionality from gmx_ffopen() here.
- impl_->fp_ = openRawHandle(filename, mode);
-}
-
-void File::open(const std::string &filename, const char *mode)
-{
- open(filename.c_str(), mode);
-}
-
-void File::close()
-{
- GMX_RELEASE_ASSERT(impl_->fp_ != NULL,
- "Attempted to close a file object that is not open");
- GMX_RELEASE_ASSERT(impl_->bClose_,
- "Attempted to close a file object that should not be");
- bool bOk = (fclose(impl_->fp_) == 0);
- impl_->fp_ = NULL;
- if (!bOk)
- {
- GMX_THROW_WITH_ERRNO(
- FileIOError("Error while closing file"), "fclose", errno);
- }
-}
-
-FILE *File::handle()
-{
- GMX_RELEASE_ASSERT(impl_->fp_ != NULL,
- "Attempted to access a file object that is not open");
- return impl_->fp_;
-}
-
-void File::readBytes(void *buffer, size_t bytes)
-{
- errno = 0;
- FILE *fp = handle();
- // TODO: Retry based on errno or something else?
- size_t bytesRead = std::fread(buffer, 1, bytes, fp);
- if (bytesRead != bytes)
- {
- if (feof(fp))
- {
- GMX_THROW(FileIOError(
- formatString("Premature end of file\n"
- "Attempted to read: %d bytes\n"
- "Successfully read: %d bytes",
- static_cast<int>(bytes),
- static_cast<int>(bytesRead))));
- }
- else
- {
- GMX_THROW_WITH_ERRNO(FileIOError("Error while reading file"),
- "fread", errno);
- }
- }
-}
-
-void File::writeString(const char *str)
-{
- if (fprintf(handle(), "%s", str) < 0)
- {
- GMX_THROW_WITH_ERRNO(FileIOError("Writing to file failed"),
- "fprintf", errno);
- }
-}
-
-// static
-bool File::exists(const char *filename)
-{
- if (filename == NULL)
- {
- return false;
- }
- FILE *test = fopen(filename, "r");
- if (test == NULL)
- {
- return false;
- }
- else
- {
- fclose(test);
- // Windows doesn't allow fopen of directory, so we don't need to check
- // this separately.
-#ifndef GMX_NATIVE_WINDOWS
- struct stat st_buf;
- int status = stat(filename, &st_buf);
- if (status != 0 || !S_ISREG(st_buf.st_mode))
- {
- return false;
- }
-#endif
- return true;
- }
-}
-
-// static
-bool File::exists(const std::string &filename)
-{
- return exists(filename.c_str());
-}
-
-// static
-std::string File::readToString(const char *filename)
-{
- // Binary mode is required on Windows to be able to determine a size
- // that can be passed to fread().
- File file(filename, "rb");
- FILE *fp = file.handle();
-
- if (std::fseek(fp, 0L, SEEK_END) != 0)
- {
- GMX_THROW_WITH_ERRNO(FileIOError("Seeking to end of file failed"),
- "fseek", errno);
- }
- long len = std::ftell(fp);
- if (len == -1)
- {
- GMX_THROW_WITH_ERRNO(FileIOError("Reading file length failed"),
- "ftell", errno);
- }
- if (std::fseek(fp, 0L, SEEK_SET) != 0)
- {
- GMX_THROW_WITH_ERRNO(FileIOError("Seeking to start of file failed"),
- "fseek", errno);
- }
-
- std::vector<char> data(len);
- file.readBytes(&data[0], len);
- file.close();
-
- std::string result(&data[0], len);
- // The below is necessary on Windows to make newlines stay as '\n' on a
- // roundtrip.
- result = replaceAll(result, "\r\n", "\n");
-
- return result;
-}
-
-// static
-std::string File::readToString(const std::string &filename)
-{
- return readToString(filename.c_str());
-}
-
-// static
-void File::writeFileFromString(const std::string &filename,
- const std::string &text)
-{
- File file(filename, "w");
- file.writeString(text);
- file.close();
-}
-
-} // namespace gmx
+++ /dev/null
-/*
- * This file is part of the GROMACS molecular simulation package.
- *
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
- * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
- * and including many others, as listed in the AUTHORS file in the
- * top-level source directory and at http://www.gromacs.org.
- *
- * GROMACS is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * GROMACS is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with GROMACS; if not, see
- * http://www.gnu.org/licenses, or write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * If you want to redistribute modifications to GROMACS, please
- * consider that scientific software is very special. Version
- * control is crucial - bugs must be traceable. We will be happy to
- * consider code for inclusion in the official distribution, but
- * derived work must not be called official GROMACS. Details are found
- * in the README & COPYING files - if they are missing, get the
- * official version at http://www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the research papers on the package. Check out http://www.gromacs.org.
- */
-/*! \file
- * \brief
- * Declares gmx::File.
- *
- * \author Teemu Murtola <teemu.murtola@gmail.com>
- * \inpublicapi
- * \ingroup module_utility
- */
-#ifndef GMX_UTILITY_FILE_H
-#define GMX_UTILITY_FILE_H
-
-#include <cstdio>
-
-#include <string>
-
-#include "gromacs/utility/classhelpers.h"
-
-namespace gmx
-{
-
-/*! \brief
- * Basic file object.
- *
- * This class provides basic file I/O functionality and uses exceptions
- * (FileIOError) for error reporting.
- *
- * \inpublicapi
- * \ingroup module_utility
- */
-class File
-{
- public:
- /*! \brief
- * Opens a file and returns a `FILE` handle.
- *
- * \param[in] filename Path of the file to open.
- * \param[in] mode Mode to open the file in (for fopen()).
- * \throws FileIOError on any I/O error.
- *
- * Instead of returning `NULL` on errors, throws an exception with
- * additional details (including the file name and `errno`).
- */
- static FILE *openRawHandle(const char *filename, const char *mode);
- //! \copydoc openRawHandle(const char *, const char *)
- static FILE *openRawHandle(const std::string &filename, const char *mode);
- /*! \brief
- * Creates a file object and opens a file.
- *
- * \param[in] filename Path of the file to open.
- * \param[in] mode Mode to open the file in (for fopen()).
- * \throws std::bad_alloc if out of memory.
- * \throws FileIOError on any I/O error.
- *
- * \see open(const char *, const char *)
- */
- File(const char *filename, const char *mode);
- //! \copydoc File(const char *, const char *)
- File(const std::string &filename, const char *mode);
- /*! \brief
- * Destroys the file object.
- *
- * If the file is still open, it is closed.
- * Any error conditions will be ignored.
- */
- ~File();
-
- /*! \brief
- * Opens a file.
- *
- * \param[in] filename Path of the file to open.
- * \param[in] mode Mode to open the file in (for fopen()).
- * \throws FileIOError on any I/O error.
- *
- * The file object must not be open.
- */
- void open(const char *filename, const char *mode);
- //! \copydoc open(const char *, const char *)
- void open(const std::string &filename, const char *mode);
- /*! \brief
- * Closes the file object.
- *
- * \throws FileIOError on any I/O error.
- *
- * The file must be open.
- */
- void close();
-
- /*! \brief
- * Returns a file handle for interfacing with C functions.
- *
- * The file must be open.
- * Does not throw.
- */
- FILE *handle();
-
- /*! \brief
- * Reads given number of bytes from the file.
- *
- * \param[out] buffer Pointer to buffer that receives the bytes.
- * \param[in] bytes Number of bytes to read.
- * \throws FileIOError on any I/O error.
- *
- * The file must be open.
- */
- void readBytes(void *buffer, size_t bytes);
-
- /*! \brief
- * Writes a string to the file.
- *
- * \param[in] str String to write.
- * \throws FileIOError on any I/O error.
- *
- * The file must be open.
- */
- void writeString(const char *str);
- //! \copydoc writeString(const char *)
- void writeString(const std::string &str) { writeString(str.c_str()); }
-
- /*! \brief
- * Checks whether a file exists and is a regular file.
- *
- * \param[in] filename Path to the file to check.
- * \returns true if \p filename exists and is accessible.
- *
- * Does not throw.
- */
- static bool exists(const char *filename);
- //! \copydoc exists(const char *)
- static bool exists(const std::string &filename);
-
- /*! \brief
- * Reads contents of a file to a std::string.
- *
- * \param[in] filename Name of the file to read.
- * \returns The contents of \p filename.
- * \throws std::bad_alloc if out of memory.
- * \throws FileIOError on any I/O error.
- */
- static std::string readToString(const char *filename);
- //! \copydoc readToString(const char *)
- static std::string readToString(const std::string &filename);
- /*! \brief
- * Convenience method for writing a file from a string in a single call.
- *
- * \param[in] filename Name of the file to read.
- * \param[in] text String to write to \p filename.
- * \throws FileIOError on any I/O error.
- *
- * If \p filename exists, it is overwritten.
- */
- static void writeFileFromString(const std::string &filename,
- const std::string &text);
-
- private:
- class Impl;
-
- PrivateImplPointer<Impl> impl_;
-};
-
-} // namespace gmx
-
-#endif
#include "fileredirector.h"
-#include "gromacs/utility/file.h"
#include "gromacs/utility/filestream.h"
+#include "gromacs/utility/path.h"
namespace gmx
{
* TextInputFile
*/
+// static
+FILE *TextInputFile::openRawHandle(const char *filename)
+{
+ FILE *fp = fopen(filename, "r");
+ if (fp == NULL)
+ {
+ GMX_THROW_WITH_ERRNO(
+ FileIOError(formatString("Could not open file '%s'", filename)),
+ "fopen", errno);
+ }
+ return fp;
+}
+
+// static
+FILE *TextInputFile::openRawHandle(const std::string &filename)
+{
+ return openRawHandle(filename.c_str());
+}
+
TextInputFile::TextInputFile(const std::string &filename)
: impl_(new FileStreamImpl(filename.c_str(), "r"))
{
class TextInputFile : public TextInputStream
{
public:
+ /*! \brief
+ * Opens a file and returns a `FILE` handle.
+ *
+ * \param[in] filename Path of the file to open.
+ * \throws FileIOError on any I/O error.
+ *
+ * Instead of returning `NULL` on errors, throws an exception with
+ * additional details (including the file name and `errno`).
+ */
+ static FILE *openRawHandle(const char *filename);
+ //! \copydoc openRawHandle(const char *, const char *)
+ static FILE *openRawHandle(const std::string &filename);
+
/*! \brief
* Opens a text file as a stream.
*
#include <cctype>
#include <cerrno>
+#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
+#include <string>
#include <sys/stat.h>
return result;
}
+/********************************************************************
+ * File
+ */
+
+// static
+bool File::exists(const char *filename)
+{
+ if (filename == NULL)
+ {
+ return false;
+ }
+ FILE *test = std::fopen(filename, "r");
+ if (test == NULL)
+ {
+ return false;
+ }
+ else
+ {
+ std::fclose(test);
+ // Windows doesn't allow fopen of directory, so we don't need to check
+ // this separately.
+#ifndef GMX_NATIVE_WINDOWS
+ struct stat st_buf;
+ int status = stat(filename, &st_buf);
+ if (status != 0 || !S_ISREG(st_buf.st_mode))
+ {
+ return false;
+ }
+#endif
+ return true;
+ }
+}
+
+// static
+bool File::exists(const std::string &filename)
+{
+ return exists(filename.c_str());
+}
/********************************************************************
* Directory
Path();
};
+class File
+{
+ public:
+ /*! \brief
+ * Checks whether a file exists and is a regular file.
+ *
+ * \param[in] filename Path to the file to check.
+ * \returns `true` if \p filename exists and is accessible.
+ *
+ * Does not throw.
+ */
+ static bool exists(const char *filename);
+ //! \copydoc exists(const char *)
+ static bool exists(const std::string &filename);
+
+ private:
+ // Disallow instantiation.
+ File();
+};
class Directory
{
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:
class TextReader
{
public:
+ /*! \brief
+ * Reads contents of a file to a std::string.
+ *
+ * \param[in] filename Name of the file to read.
+ * \returns The contents of \p filename.
+ * \throws std::bad_alloc if out of memory.
+ * \throws FileIOError on any I/O error.
+ */
+ static std::string readFileToString(const char *filename);
+ //! \copydoc readFileToString(const char *)
+ static std::string readFileToString(const std::string &filename);
+
/*! \brief
* Creates a reader that reads from specified file.
*
TextOutputStreamPointer stream_;
};
+// static
+void TextWriter::writeFileFromString(const std::string &filename,
+ const std::string &text)
+{
+ TextWriter file(filename);
+ file.writeString(text);
+ file.close();
+}
+
TextWriter::TextWriter(const std::string &filename)
: impl_(new Impl(TextOutputStreamPointer(new TextOutputFile(filename))))
{
class TextWriter
{
public:
+ /*! \brief
+ * Convenience method for writing a file from a string in a single call.
+ *
+ * \param[in] filename Name of the file to read.
+ * \param[in] text String to write to \p filename.
+ * \throws std::bad_alloc if out of memory.
+ * \throws FileIOError on any I/O error.
+ *
+ * If \p filename exists, it is overwritten.
+ */
+ static void writeFileFromString(const std::string &filename,
+ const std::string &text);
+
/*! \brief
* Creates a writer that writes to specified file.
*
#include "gromacs/options/options.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/basenetwork.h"
-#include "gromacs/utility/file.h"
#include "gromacs/utility/gmxmpi.h"
+#include "gromacs/utility/textwriter.h"
#include "programs/mdrun/mdrun_main.h"
#include "testutils/cmdlinetest.h"
void
SimulationRunner::useStringAsMdpFile(const std::string &mdpString)
{
- gmx::File::writeFileFromString(mdpInputFileName_, mdpString);
+ gmx::TextWriter::writeFileFromString(mdpInputFileName_, mdpString);
}
void
SimulationRunner::useStringAsNdxFile(const char *ndxString)
{
- gmx::File::writeFileFromString(ndxFileName_, ndxString);
+ gmx::TextWriter::writeFileFromString(ndxFileName_, ndxString);
}
void
#include "gromacs/commandline/cmdlineoptionsmodule.h"
#include "gromacs/commandline/cmdlineprogramcontext.h"
#include "gromacs/utility/arrayref.h"
-#include "gromacs/utility/file.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/stringutil.h"
+#include "gromacs/utility/textreader.h"
#include "gromacs/utility/textwriter.h"
#include "testutils/refdata.h"
GMX_ASSERT(extension[0] != '.', "Extension should not contain a dot");
std::string fullFilename = impl_->fileManager_.getTemporaryFilePath(
formatString("%d.%s", args->argc(), extension));
- File::writeFileFromString(fullFilename, contents);
+ TextWriter::writeFileFromString(fullFilename, contents);
args->addOption(option, fullFilename);
}
outfile != impl_->outputFiles_.end();
++outfile)
{
- std::string output = File::readToString(outfile->path);
+ std::string output = TextReader::readFileToString(outfile->path);
outputChecker.checkStringBlock(output, outfile->option.c_str());
}
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <stdio.h>
#include "gromacs/utility/exceptions.h"
-#include "gromacs/utility/file.h"
+#include "gromacs/utility/textwriter.h"
namespace gmx
{
IntegrationTestFixture::redirectStringToStdin(const char* theString)
{
std::string fakeStdin("fake-stdin");
- gmx::File::writeFileFromString(fakeStdin, theString);
+ gmx::TextWriter::writeFileFromString(fakeStdin, theString);
if (NULL == std::freopen(fakeStdin.c_str(), "r", stdin))
{
GMX_THROW_WITH_ERRNO(FileIOError("Failed to redirect a string to stdin"),
#include "gromacs/options/basicoptions.h"
#include "gromacs/options/options.h"
-#include "gromacs/utility/file.h"
+#include "gromacs/utility/textreader.h"
#include "testutils/refdata.h"
#include "testutils/testoptions.h"
void
StringTestBase::checkFileContents(const std::string &filename, const char *id)
{
- const std::string text = File::readToString(filename);
+ const std::string text = TextReader::readFileToString(filename);
checkText(text, id);
}