#include "gromacs/selection/selhelp.h"
#include "gromacs/topology/topology.h"
#include "gromacs/utility/exceptions.h"
-#include "gromacs/utility/file.h"
#include "gromacs/utility/filestream.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/smalloc.h"
/*! \brief
* Reads a single selection line from stdin.
*
- * \param[in] infile File to read from (typically File::standardInput()).
+ * \param[in] infile Stream to read from (typically the StandardInputStream).
* \param[in] bInteractive Whether to print interactive prompts.
* \param[out] line The read line in stored here.
* \returns true if something was read, false if at end of input.
*
* Handles line continuation, reading also the continuing line(s) in one call.
*/
-bool promptLine(File *infile, bool bInteractive, std::string *line)
+bool promptLine(TextInputStream *infile, bool bInteractive, std::string *line)
{
if (bInteractive)
{
fprintf(stderr, "> ");
}
- if (!infile->readLineWithTrailingSpace(line))
+ if (!infile->readLine(line))
{
return false;
}
std::string buffer;
// Return value ignored, buffer remains empty and works correctly
// if there is nothing to read.
- infile->readLineWithTrailingSpace(&buffer);
+ infile->readLine(&buffer);
line->append(buffer);
}
if (endsWith(*line, "\n"))
_gmx_sel_yypstate_new(), &_gmx_sel_yypstate_delete);
if (bStdIn)
{
- File &stdinFile(File::standardInput());
- const bool bInteractive = _gmx_sel_is_lexer_interactive(scanner);
+ TextInputStream &stdinFile(StandardInputStream::instance());
+ const bool bInteractive = _gmx_sel_is_lexer_interactive(scanner);
if (bInteractive)
{
printCurrentStatus(sc, grps, oldCount, maxnr, context, true);
try
{
- yyscan_t scanner;
- File file(filename, "r");
+ yyscan_t scanner;
+ TextInputFile file(filename);
// TODO: Exception-safe way of using the lexer.
_gmx_sel_init_lexer(&scanner, &impl_->sc_, false, -1,
impl_->bExternalGroupsSet_,