Add basic grouping to Options
[alexxy/gromacs.git] / src / gromacs / options / optionsassigner.h
index 506ba395cfa8766495f2d3710ec4bd62046ead46..35bb70dce9225e3e5b71146ef832a3df43086011 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * 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,2015, 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
@@ -47,7 +47,7 @@
 
 #include <string>
 
-#include "../utility/common.h"
+#include "gromacs/utility/classhelpers.h"
 
 namespace gmx
 {
@@ -62,10 +62,10 @@ class Options;
  * to assign values to options in subsections within the Options object.
  * Typical use (without error handling):
  * \code
-   gmx::options::Options options("name", "Title");
+   gmx::Options options("name", "Title");
    // Set up options
 
-   gmx::options::OptionsAssigner assigner(&options);
+   gmx::OptionsAssigner assigner(&options);
    assigner.start();
    assigner.startOption("opt1");
    assigner.appendValue("3");
@@ -109,31 +109,15 @@ class OptionsAssigner
          * Does not throw.
          */
         void setAcceptBooleanNoPrefix(bool bEnabled);
-        /*! \brief
-         * Sets the assigner to find options in non-active sections.
-         *
-         * By default, options are only looked for in the currently active
-         * subsection.  With this option set, if no matching option is found in
-         * the current section, a breadth-first search is performed, first on
-         * all subsections of the current section, and then going up one level
-         * at a time.  The first matching option is used, and the current
-         * section is changed to the section that contains the matching option.
-         *
-         * Can be set or cleared at any time, and will have effect on all
-         * subsequent calls of startOption().
-         *
-         * Does not throw.
-         */
-        void setNoStrictSectioning(bool bEnabled);
 
         /*! \brief
-         * Start assigning values.
+         * Starts assigning values.
          *
          * Does not throw.
          */
         void start();
         /*! \brief
-         * Start assigning values to options in a subsection.
+         * Starts assigning values to options in a subsection.
          *
          * \param[in] name  Name of the subsection to start assigning to.
          * \throws InvalidInputError if such a subsection is not found.
@@ -142,15 +126,22 @@ class OptionsAssigner
          */
         void startSubSection(const char *name);
         /*! \brief
-         * Start assigning values for an option.
+         * Starts assigning values for an option.
          *
          * \param[in] name  Name of the option to start assigning to.
          * \throws InvalidInputError if such an option is not found, or if the
          *      option is specified more than once but doesn't support it.
-         *
-         * Strong exception safety guarantee.
          */
         void startOption(const char *name);
+        /*! \brief
+         * Starts assigning values for an option.
+         *
+         * \param[in] name  Name of the option to start assigning to.
+         * \returns   true if \p name is a valid option name.
+         * \throws InvalidInputError if the option is specified more than once
+         *      but doesn't support it.
+         */
+        bool tryStartOption(const char *name);
         /*! \brief
          * Appends a value to the value list of the current option.
          *