Added doxygen comments and changed member names.
authorBjoern Sikora <bjoern.sikora@intra2net.com>
Mon, 27 Jul 2009 11:33:52 +0000 (13:33 +0200)
committerBjoern Sikora <bjoern.sikora@intra2net.com>
Mon, 27 Jul 2009 11:33:52 +0000 (13:33 +0200)
src/config.cpp
src/config.h

index 6aff240..597abdd 100644 (file)
@@ -1,26 +1,25 @@
-//
-// C++ Implementation: config
-//
-// Description: 
-//
-//
-// Author: Bjoern Sikora <bjoern.sikora@intra2net.com>, (C) 2009
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
-#include "config.h"
+/** @file
+ * @brief Config class implementation. This class represents the actual configuration.
+ *
+ *
+ *
+ * @copyright Intra2net AG
+ * @license GPLv2
+*/
 
+#include "config.h"
 
-// Define allowed command line and config file options
+/**
+ * Default Constructor. Available command line arguments with their default values are defined here.
+ */
 Config::Config()
-    : daemon_mode(true)
-    , loglevel(0)
-    , syslog(true)
+    : Daemon_mode(true)
+    , Loglevel(0)
+    , Syslog(true)
 {
     // Define valid command line parameters
-    opt_desc_cmd = new po::options_description("Command line options");
-    opt_desc_cmd->add_options()
+    Opt_desc_cmd = new po::options_description("Command line options");
+    Opt_desc_cmd->add_options()
         ("help,?","Show help.")
         ("version,v","Show version.")
         ("protocol,q",po::value<string>(),"Set the service protocol type.")
@@ -30,8 +29,8 @@ Config::Config()
     ;
 
     // Define valid config file main section parameters
-    opt_desc_conf_main = new po::options_description("Config file main section options");
-    opt_desc_conf_main->add_options()
+    Opt_desc_conf_main = new po::options_description("Config file main section options");
+    Opt_desc_conf_main->add_options()
         ("main.daemon_mode",po::value<bool>()->default_value(false),"Run as system daemon.")
         ("main.logfile",po::value<string>()->default_value("/var/log/bpdyndns.log"),"Where to log.")
         ("main.loglevel",po::value<int>()->default_value(0),"Loglevel.")
@@ -39,8 +38,8 @@ Config::Config()
     ;
 
     // Define valid config file main section parameters
-    opt_desc_conf_service = new po::options_description("Config file service section options");
-    opt_desc_conf_service->add_options()
+    Opt_desc_conf_service = new po::options_description("Config file service section options");
+    Opt_desc_conf_service->add_options()
         ("service.protocol",po::value<string>(),"The service protocol.")
         ("service.host",po::value<string>(),"The hostname to update.")
         ("service.login",po::value<string>(),"Login name.")
@@ -49,20 +48,29 @@ Config::Config()
 }
 
 
+/**
+ * Default Destructor
+ */
 Config::~Config()
 {
-    delete opt_desc_cmd;
-    delete opt_desc_conf_main;
-    delete opt_desc_conf_service;
+    delete Opt_desc_cmd;
+    delete Opt_desc_conf_main;
+    delete Opt_desc_conf_service;
 }
 
 
+/**
+ * Parses the command line arguments and does the needed actions.
+ * @param argc Command line argument number given to main.
+ * @param argv[] Pointer to command line argument array given to main.
+ * @return 0 if all is fine,
+ */
 int Config::parse_cmd_line(int argc, char *argv[])
 {
     try
     {
         po::variables_map vm;
-        po::store(po::parse_command_line(argc, argv, *this->opt_desc_cmd), vm);
+        po::store(po::parse_command_line(argc, argv, *this->Opt_desc_cmd), vm);
         po::notify(vm);
 
         if(vm.count("help"))
@@ -108,6 +116,11 @@ int Config::parse_cmd_line(int argc, char *argv[])
 }
 
 
+/**
+ * Loads the main and the service config file and does the needed action.
+ * @param config_path The path to the config directory.
+ * @return 0 if all is fine.
+ */
 int Config::load_config_from_files(string config_path)
 {
     fs::path full_config_path = fs::system_complete(fs::path(config_path));
@@ -185,19 +198,30 @@ int Config::load_config_from_files(string config_path)
 }
 
 
+/**
+ * Getter method for Service list member.
+ * @return Pointer to a list of Service's.
+ */
 list<Service*> Config::get_services()
 {
-    return this->services;
+    return this->Services;
 }
 
 
+/**
+ * Prints out the usage to the command line.
+ */
 void Config::print_usage()
 {
     cout << "Usage: bpdyndnsd [Command line options]" << "\n" << endl;
-    cout << *opt_desc_cmd << endl;
+    cout << *Opt_desc_cmd << endl;
 }
 
 
+/**
+ * Prints out the programm name and the given version string on stdout.
+ * @param version Version string.
+ */
 void Config::print_version(string version)
 {
     cout << "Bullet proof dynamic dns daemon.\nbpdyndnsd " << version << endl;
index 8fe49bf..40d2bc4 100644 (file)
@@ -1,14 +1,12 @@
-//
-// C++ Interface: config
-//
-// Description: 
-//
-//
-// Author: Bjoern Sikora <bjoern.sikora@intra2net.com>, (C) 2009
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-//
+/** @file
+ * @brief Config class header. This class represents the actual configuration.
+ *
+ *
+ *
+ * @copyright Intra2net AG
+ * @license GPLv2
+*/
+
 #ifndef CONFIG_H
 #define CONFIG_H
 
@@ -33,16 +31,16 @@ using namespace std;
 class Config
 {
 private:
-    po::options_description *opt_desc_cmd;
-    po::options_description *opt_desc_conf_main;
-    po::options_description *opt_desc_conf_service;
+    po::options_description *Opt_desc_cmd;
+    po::options_description *Opt_desc_conf_main;
+    po::options_description *Opt_desc_conf_service;
 
-    list<Service*> services;
+    list<Service*> Services;
 
-    bool daemon_mode;
-    string logfile;
-    int loglevel;
-    bool syslog;
+    bool Daemon_mode;
+    string Logfile;
+    int Loglevel;
+    bool Syslog;
 public:
     Config();