Move OptionInfo to abstractoption.cpp.
authorTeemu Murtola <teemu.murtola@gmail.com>
Fri, 27 Apr 2012 03:44:58 +0000 (06:44 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Thu, 3 May 2012 04:32:50 +0000 (07:32 +0300)
This makes it consistent with how implementation of derived classes is
located: the storage, info, and settings classes are always implemented
together in a single file.  Originally, the OptionInfo was only used for
the OptionsVisitor, but it is now more tighly integrated into the system
and this is no longer the case.

Change-Id: I3be311343a35b6e7e045b94f4ba70283a6b99278

src/gromacs/options/abstractoption.cpp
src/gromacs/options/optioninfo.h
src/gromacs/options/optionsvisitor.cpp

index 696f853eb4e238eb5f2a4664e21b8de89089833a..40f752d1d7e51bc471e6ed278f15a7a583eff397 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "gromacs/options/abstractoptionstorage.h"
 #include "gromacs/options/optionflags.h"
+#include "gromacs/options/optioninfo.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/gmxassert.h"
 
@@ -155,4 +156,59 @@ void AbstractOptionStorage::setMaxValueCount(int count)
     }
 }
 
+/********************************************************************
+ * OptionInfo
+ */
+
+/*! \cond libapi */
+OptionInfo::OptionInfo(AbstractOptionStorage *option)
+    : option_(*option)
+{
+}
+//! \endcond
+
+OptionInfo::~OptionInfo()
+{
+}
+
+bool OptionInfo::isSet() const
+{
+    return option().isSet();
+}
+
+bool OptionInfo::isHidden() const
+{
+    return option().isHidden();
+}
+
+bool OptionInfo::isRequired() const
+{
+    return option().isRequired();
+}
+
+const std::string &OptionInfo::name() const
+{
+    return option().name();
+}
+
+const std::string &OptionInfo::description() const
+{
+    return option().description();
+}
+
+const char *OptionInfo::type() const
+{
+    return option().typeString();
+}
+
+int OptionInfo::valueCount() const
+{
+    return option().valueCount();
+}
+
+std::string OptionInfo::formatValue(int i) const
+{
+    return option().formatValue(i);
+}
+
 } // namespace gmx
index e65c0be6cbd411dae544c361238dd188c3f377ef..6c2d2b88bebda6a29d6e80773253d7425197edf9 100644 (file)
@@ -127,14 +127,14 @@ class OptionInfo
         explicit OptionInfo(AbstractOptionStorage *option);
 
         //! Returns the wrapped option storage object.
-        AbstractOptionStorage &option() { return _option; }
+        AbstractOptionStorage &option() { return option_; }
         //! Returns the wrapped option storage object.
-        const AbstractOptionStorage &option() const { return _option; }
+        const AbstractOptionStorage &option() const { return option_; }
         //! \endcond
 
     private:
         //! The wrapped option.
-        AbstractOptionStorage  &_option;
+        AbstractOptionStorage  &option_;
 
         GMX_DISALLOW_COPY_AND_ASSIGN(OptionInfo);
 };
index 48167d17a03ec886c5ccc7dc92b5049e266d914c..b1e8e7223e0a1ba3d5abfb28985917c656754f4b 100644 (file)
@@ -38,7 +38,6 @@
 #include "gromacs/options/optionsvisitor.h"
 
 #include "gromacs/options/abstractoptionstorage.h"
-#include "gromacs/options/optioninfo.h"
 #include "gromacs/options/options.h"
 
 #include "options-impl.h"
 namespace gmx
 {
 
-/********************************************************************
- * OptionInfo
- */
-
-/*! \cond libapi */
-OptionInfo::OptionInfo(AbstractOptionStorage *option)
-    : _option(*option)
-{
-}
-//! \endcond
-
-OptionInfo::~OptionInfo()
-{
-}
-
-bool OptionInfo::isSet() const
-{
-    return _option.isSet();
-}
-
-bool OptionInfo::isHidden() const
-{
-    return _option.isHidden();
-}
-
-bool OptionInfo::isRequired() const
-{
-    return _option.isRequired();
-}
-
-const std::string &OptionInfo::name() const
-{
-    return _option.name();
-}
-
-const std::string &OptionInfo::description() const
-{
-    return _option.description();
-}
-
-const char *OptionInfo::type() const
-{
-    return _option.typeString();
-}
-
-int OptionInfo::valueCount() const
-{
-    return _option.valueCount();
-}
-
-std::string OptionInfo::formatValue(int i) const
-{
-    return _option.formatValue(i);
-}
-
 /********************************************************************
  * OptionsIterator
  */