/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2017,2019, 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.
{
// static
-std::string TextReader::readFileToString(const char *filename)
+std::string TextReader::readFileToString(const char* filename)
{
TextReader reader(filename);
std::string result(reader.readAll());
}
// static
-std::string TextReader::readFileToString(const std::string &filename)
+std::string TextReader::readFileToString(const std::string& filename)
{
return readFileToString(filename.c_str());
}
//! Implementation class
class TextReader::Impl
{
- public:
- //! Constructor.
- explicit Impl(const TextInputStreamPointer &stream)
- : stream_(stream), trimLeadingWhiteSpace_(false), trimTrailingWhiteSpace_(false),
- trimTrailingComment_(false), commentChar_(0)
- {
- }
+public:
+ //! Constructor.
+ explicit Impl(const TextInputStreamPointer& stream) :
+ stream_(stream),
+ trimLeadingWhiteSpace_(false),
+ trimTrailingWhiteSpace_(false),
+ trimTrailingComment_(false),
+ commentChar_(0)
+ {
+ }
- //! Stream used by this reader.
- TextInputStreamPointer stream_;
- //! Whether leading whitespace should be removed.
- bool trimLeadingWhiteSpace_;
- //! Whether trailing whitespace should be removed.
- bool trimTrailingWhiteSpace_;
- //! Whether a trailing comment should be removed.
- bool trimTrailingComment_;
- /*! \brief Character that denotes the start of a comment on a line.
- *
- * Zero until TextReader::setTrimTrailingComment is called to
- * activate such trimming with a given character. */
- char commentChar_;
+ //! Stream used by this reader.
+ TextInputStreamPointer stream_;
+ //! Whether leading whitespace should be removed.
+ bool trimLeadingWhiteSpace_;
+ //! Whether trailing whitespace should be removed.
+ bool trimTrailingWhiteSpace_;
+ //! Whether a trailing comment should be removed.
+ bool trimTrailingComment_;
+ /*! \brief Character that denotes the start of a comment on a line.
+ *
+ * Zero until TextReader::setTrimTrailingComment is called to
+ * activate such trimming with a given character. */
+ char commentChar_;
};
-TextReader::TextReader(const std::string &filename)
- : impl_(new Impl(TextInputStreamPointer(new TextInputFile(filename))))
+TextReader::TextReader(const std::string& filename) :
+ impl_(new Impl(TextInputStreamPointer(new TextInputFile(filename))))
{
}
-TextReader::TextReader(TextInputStream *stream)
- : impl_(new Impl(TextInputStreamPointer(stream, no_delete<TextInputStream>())))
+TextReader::TextReader(TextInputStream* stream) :
+ impl_(new Impl(TextInputStreamPointer(stream, no_delete<TextInputStream>())))
{
}
-TextReader::TextReader(const TextInputStreamPointer &stream)
- : impl_(new Impl(stream))
-{
-}
+TextReader::TextReader(const TextInputStreamPointer& stream) : impl_(new Impl(stream)) {}
-TextReader::~TextReader()
-{
-}
+TextReader::~TextReader() {}
-bool TextReader::readLine(std::string *linePtr)
+bool TextReader::readLine(std::string* linePtr)
{
if (!impl_->stream_->readLine(linePtr))
{
return false;
}
- auto &line = *linePtr;
+ auto& line = *linePtr;
const char whiteSpaceChars[] = " \t\r\n";
if (impl_->trimLeadingWhiteSpace_)
{