/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012, by the GROMACS development team, led by
- * David van der Spoel, Berk Hess, Erik Lindahl, and including many
- * others, as listed in the AUTHORS file in the top-level source
- * directory and at http://www.gromacs.org.
+ * Copyright (c) 2010,2011,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.
*
* GROMACS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* \author Teemu Murtola <teemu.murtola@gmail.com>
* \ingroup module_options
*/
-#include "gromacs/options/optionsassigner.h"
+#include "gmxpre.h"
+
+#include "optionsassigner.h"
#include <deque>
}
void OptionsAssigner::startOption(const char *name)
+{
+ if (!tryStartOption(name))
+ {
+ GMX_THROW(InvalidInputError("Unknown option " + std::string(name)));
+ }
+}
+
+bool OptionsAssigner::tryStartOption(const char *name)
{
GMX_RELEASE_ASSERT(impl_->currentOption_ == NULL, "finishOption() not called");
AbstractOptionStorage *option = impl_->findOption(name);
if (option == NULL)
{
- GMX_THROW(InvalidInputError("Unknown option"));
+ return false;
}
option->startSet();
impl_->currentOption_ = option;
impl_->currentValueCount_ = 0;
+ return true;
}
void OptionsAssigner::appendValue(const std::string &value)