void CommandLineTestHelper::setInputFileContents( CommandLine *args, const char *option, const char *extension, const ConstArrayRef<const char *> &contents) { GMX_ASSERT(extension[0] != '.', "Extension should not contain a dot"); std::string fullFilename = impl_->fileManager_.getTemporaryFilePath( formatString("%d.%s", args->argc(), extension)); TextWriter file(fullFilename); ConstArrayRef<const char *>::const_iterator i; for (i = contents.begin(); i != contents.end(); ++i) { file.writeLine(*i); } file.close(); args->addOption(option, fullFilename); }
CommandLine::CommandLine(const ConstArrayRef<const char *> &cmdline) : impl_(new Impl(cmdline.data(), cmdline.size())) { }
void CommandLine::initFromArray(const ConstArrayRef<const char *> &cmdline) { impl_.reset(new Impl(cmdline.data(), cmdline.size())); }
StringInputStream::StringInputStream(ConstArrayRef<const char *> const &input) : input_(joinStrings(input.begin(), input.end(), "\n")), pos_(0) { input_.append("\n"); }