/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013, by the GROMACS development team, led by
+ * Copyright (c) 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.
"analysis groups."
};
- options->setDescription(concatenateStrings(desc));
+ options->setDescription(desc);
options->addOption(FileNameOption("o")
.filetype(eftPlot).outputFile()
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,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.
#include "gromacs/options/abstractoption.h"
#include "gromacs/options/abstractoptionstorage.h"
+#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/messagestringcollector.h"
impl_->description_ = desc;
}
+void Options::setDescription(const ConstArrayRef<const char *> &descArray)
+{
+ impl_->description_ = concatenateStrings(descArray.data(), descArray.size());
+}
+
void Options::addSubSection(Options *section)
{
// Make sure that section is not already inserted somewhere.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,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.
namespace gmx
{
+template <typename T> class ConstArrayRef;
+
class AbstractOption;
class OptionsAssigner;
class OptionsIterator;
options.addOption(StringOption("arg1").store(&arg1));
options.addOption(IntegerOption("arg2").store(&arg2));
return &options;
- * \endcode
+ \endcode
* The caller of that method can then use a parser implementation such as
* CommandLineParser to provide values for the options.
*
*
* \param[in] desc String to set as the description.
*
- * concatenateStrings() is useful for forming the input string.
+ * This overload is mainly useful if the description is very short.
+ * Currently this is mostly the case in unit testing.
*/
void setDescription(const std::string &desc);
- //int addBugs(int nbugs, const char *const *bugs);
+ /*! \brief
+ * Sets the full description of the option collection from string array.
+ *
+ * \param[in] descArray String array to set as the description.
+ *
+ * All strings in `descArray` are concatenated to form the description.
+ * Spaces are inserted between strings if they are missing.
+ *
+ * Example usage:
+ * \code
+ const char *const desc[] = {
+ "This is the description",
+ "for the options"
+ };
+
+ gmx::Options options(NULL, NULL);
+ options.setDescription(desc);
+ \endcode
+ *
+ * To use this overload, you must also include
+ * `gromacs/utility/arrayref.h`.
+ */
+ void setDescription(const ConstArrayRef<const char *> &descArray);
/*! \brief
* Adds an option collection as a subsection of this collection.
#include "trajectoryanalysis/analysismodule.h"
#include "trajectoryanalysis/analysissettings.h"
#include "trajectoryanalysis/cmdlinerunner.h"
+#include "utility/arrayref.h"
#include "utility/exceptions.h"
-#include "utility/stringutil.h"
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013, by the GROMACS development team, led by
+ * Copyright (c) 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.
#include "gromacs/selection/selection.h"
#include "gromacs/selection/selectionoption.h"
#include "gromacs/trajectoryanalysis/analysissettings.h"
+#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/stringutil.h"
static const char *const cGroup2TypeEnum[] =
{ "none", "vector", "plane", "t0", "z", "sphnorm" };
- options->setDescription(concatenateStrings(desc));
+ options->setDescription(desc);
options->addOption(FileNameOption("oav").filetype(eftPlot).outputFile()
.store(&fnAverage_).defaultBasename("angaver")
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013, by the GROMACS development team, led by
+ * 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.
#include "gromacs/selection/selection.h"
#include "gromacs/selection/selectionoption.h"
#include "gromacs/trajectoryanalysis/analysissettings.h"
+#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/stringutil.h"
"each individual distance, calculated over the frames."
};
- options->setDescription(concatenateStrings(desc));
+ options->setDescription(desc);
options->addOption(FileNameOption("oav").filetype(eftPlot).outputFile()
.store(&fnAverage_).defaultBasename("distave")
#include "gromacs/selection/selection.h"
#include "gromacs/selection/selectionoption.h"
#include "gromacs/trajectoryanalysis/analysissettings.h"
+#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/exceptions.h"
-#include "gromacs/utility/stringutil.h"
namespace gmx
{
};
// Add the descriptive text (program help text) to the options
- options->setDescription(concatenateStrings(desc));
+ options->setDescription(desc);
// Add option for optional output file
options->addOption(FileNameOption("o").filetype(eftPlot).outputFile()
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
#include "gromacs/selection/selection.h"
#include "gromacs/selection/selectionoption.h"
#include "gromacs/trajectoryanalysis/analysissettings.h"
+#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/stringutil.h"
"dynamic selections."
};
- options->setDescription(concatenateStrings(desc));
+ options->setDescription(desc);
options->addOption(FileNameOption("os").filetype(eftPlot).outputFile()
.store(&fnSize_).defaultBasename("size")
#include "gromacs/trajectoryanalysis/analysismodule.h"
#include "gromacs/trajectoryanalysis/analysissettings.h"
#include "gromacs/trajectoryanalysis/cmdlinerunner.h"
+#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/exceptions.h"
-#include "gromacs/utility/stringutil.h"
namespace gmx
{
"This is a test program for selections."
};
- options->setDescription(concatenateStrings(desc));
+ options->setDescription(desc);
options->addOption(SelectionOption("select").storeVector(&selections_)
.required().multiValue()