/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014, 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.
* \author Teemu Murtola <teemu.murtola@gmail.com>
* \ingroup module_testutils
*/
+#include "gmxpre.h"
+
#include "cmdlinetest.h"
#include <cstdlib>
#include <cstring>
-#include <sstream>
#include <new>
+#include <sstream>
#include <vector>
+#include "gromacs/commandline/cmdlineprogramcontext.h"
+#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/gmxassert.h"
-#include "gromacs/utility/programinfo.h"
namespace gmx
{
{
}
-CommandLine::CommandLine(const char *const cmdline[], size_t count)
- : impl_(new Impl(cmdline, count))
+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()));
+}
+
void CommandLine::append(const char *arg)
{
GMX_RELEASE_ASSERT(impl_->argc_ == static_cast<int>(impl_->args_.size()),
std::string CommandLine::toString() const
{
- return ProgramInfo(argc(), argv()).commandLine();
+ return CommandLineProgramContext(argc(), argv()).commandLine();
}
} // namespace test