--- /dev/null
+/*
+ The software in this package is distributed under the GNU General
+ Public License version 2 (with a special exception described below).
+
+ A copy of GNU General Public License (GPL) is included in this distribution,
+ in the file COPYING.GPL.
+
+ As a special exception, if other files instantiate templates or use macros
+ or inline functions from this file, or you compile this file and link it
+ with other works to produce a work based on this file, this file
+ does not by itself cause the resulting work to be covered
+ by the GNU General Public License.
+
+ However the source code for this file must still be made available
+ in accordance with section (3) of the GNU General Public License.
+
+ This exception does not invalidate any other reasons why a work based
+ on this file might be covered by the GNU General Public License.
+ */
+
+#include "config/option/configurationoption.h"
+
+using namespace std;
+using boost::program_options::option_description;
+using boost::program_options::option_description;
+using boost::program_options::value_semantic;
+using boost::shared_ptr;
+
+//-----------------------------------------------------------------------------
+// ConfigurationOption
+//-----------------------------------------------------------------------------
+
+/**
+ * @brief Parameterized constructor.
+ *
+ * @param command_string Option name.
+ * @param command_description Option description.
+ */
+ConfigurationOption::ConfigurationOption(
+ const char *command_string,
+ const char *command_description
+) :
+ option( command_string, NULL, command_description )
+{
+}
+
+/**
+ * @brief Parameterized constructor.
+ *
+ * @param command_string Option name.
+ * @param semantic Specifies how the option's value is to be parsed and converted into C++ types.
+ * @param command_description Option description.
+ */
+ConfigurationOption::ConfigurationOption(
+ const char *command_string,
+ const value_semantic *semantic,
+ const char *command_description
+) :
+ option( command_string, semantic, command_description )
+{
+}
+
+/**
+ * @brief Destructor.
+ */
+ConfigurationOption::~ConfigurationOption()
+{
+}
+
+/**
+ * @return The underlining @c boost::program_options::option_description object.
+ */
+shared_ptr<option_description> ConfigurationOption::get_option_description()
+{
+ return shared_ptr<option_description>( &option );
+}
+
+/**
+ * @return A string representing the command name.
+ */
+string ConfigurationOption::get_command_string() const
+{
+ return option.long_name();
+}
+
+/**
+ * @return A string representing the command description.
+ */
+string ConfigurationOption::get_command_description() const
+{
+ return option.description();
+}
--- /dev/null
+/*
+ The software in this package is distributed under the GNU General
+ Public License version 2 (with a special exception described below).
+
+ A copy of GNU General Public License (GPL) is included in this distribution,
+ in the file COPYING.GPL.
+
+ As a special exception, if other files instantiate templates or use macros
+ or inline functions from this file, or you compile this file and link it
+ with other works to produce a work based on this file, this file
+ does not by itself cause the resulting work to be covered
+ by the GNU General Public License.
+
+ However the source code for this file must still be made available
+ in accordance with section (3) of the GNU General Public License.
+
+ This exception does not invalidate any other reasons why a work based
+ on this file might be covered by the GNU General Public License.
+ */
+
+#ifndef CONFIGURATION_OPTION_H
+#define CONFIGURATION_OPTION_H
+
+#include <string>
+#include <vector>
+
+#include <boost/program_options.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include "config/configuration.h"
+
+//-----------------------------------------------------------------------------
+// ConfigurationOption
+//-----------------------------------------------------------------------------
+
+/**
+ * @brief Abstract class for configuration option.
+ */
+class ConfigurationOption
+{
+public:
+ ConfigurationOption(
+ const char *command_string,
+ const char *command_description
+ );
+ ConfigurationOption(
+ const char *command_string,
+ const boost::program_options::value_semantic *semantic,
+ const char *command_description
+ );
+ virtual ~ConfigurationOption();
+
+ boost::shared_ptr< boost::program_options::option_description > get_option_description();
+ std::string get_command_string() const;
+ std::string get_command_description() const;
+
+ virtual bool validate(
+ const boost::program_options::variables_map &vm
+ ) const = 0;
+
+ virtual bool parse(
+ const boost::program_options::variables_map &vm,
+ Configuration *configuration
+ ) const = 0;
+
+private:
+ boost::program_options::option_description option;
+
+};
+
+//-----------------------------------------------------------------------------
+// ConfigurationOptionItem
+//-----------------------------------------------------------------------------
+
+typedef boost::shared_ptr< ConfigurationOption > ConfigurationOptionItem;
+
+//-----------------------------------------------------------------------------
+// ConfigurationOptionList
+//-----------------------------------------------------------------------------
+
+typedef std::vector< ConfigurationOptionItem > ConfigurationOptionList;
+
+#endif // CONFIGURATION_OPTION_H