Using a more straightforward comparison
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Fri, 30 Sep 2011 03:41:59 +0000 (00:41 -0300)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Fri, 30 Sep 2011 03:41:59 +0000 (00:41 -0300)
src/config/option/hostdownlimitoption.cpp
src/config/option/hostnameoption.cpp
src/config/option/hostpingintervaloption.cpp
src/config/option/hostpingprotocoloption.cpp
src/config/option/hostportoption.cpp
src/config/option/linkdownintervaloption.cpp
src/config/option/linkupintervaloption.cpp
src/config/option/nameserveroption.cpp
src/config/option/pingfaillimitoption.cpp
src/config/option/sourcenetworkinterfaceoption.cpp
src/config/option/statusnotifiercmdoption.cpp

index 000608d..4c35885 100644 (file)
@@ -46,7 +46,7 @@ HostDownLimitOption::~HostDownLimitOption()
 
 bool HostDownLimitOption::validate( const variables_map& vm ) const
 {
-    bool is_valid = ( vm.count( get_command_string() ) > 0 );
+    bool is_valid = ( 1 <= vm.count( get_command_string() ) );
 
     return is_valid;
 }
@@ -57,7 +57,7 @@ bool HostDownLimitOption::parse(
 )
 {
     // hosts-down-limit
-    if ( vm.count( get_command_string() ) > 0 )
+    if ( 1 <= vm.count( get_command_string() ) )
     {
         int host_down_limit = vm[ get_command_string() ].as<int> ();
         configuration->set_hosts_down_limit( host_down_limit );
index 101861b..51b506b 100644 (file)
@@ -67,7 +67,7 @@ bool HostNameOption::parse(
     bool parsed_success = false;
 
     // [host] name
-    if ( vm.count( get_command_string() ) > 0 )
+    if ( 1 <= vm.count( get_command_string() ) )
     {
         HostList hosts_list;
 
index b65ed83..4530fca 100644 (file)
@@ -51,7 +51,7 @@ HostPingIntervalOption::~HostPingIntervalOption()
 
 bool HostPingIntervalOption::validate( const variables_map& vm ) const
 {
-    bool is_valid = ( vm.count( get_command_string() ) > 0 );
+    bool is_valid = ( 1 <= vm.count( get_command_string() ) );
 
     return is_valid;
 }
index 553b14a..a73ccdc 100644 (file)
@@ -51,7 +51,7 @@ HostPingProtocolOption::~HostPingProtocolOption()
 
 bool HostPingProtocolOption::validate( const variables_map& vm ) const
 {
-    bool is_valid = ( vm.count( get_command_string() ) > 0 );
+    bool is_valid = ( 1 <= vm.count( get_command_string() ) );
 
     return is_valid;
 }
index 5d68ebd..dd48f0d 100644 (file)
@@ -52,7 +52,7 @@ HostPortOption::~HostPortOption()
 
 bool HostPortOption::validate( const variables_map& vm ) const
 {
-    bool is_valid = ( vm.count( get_command_string() ) > 0 );
+    bool is_valid = ( 1 <= vm.count( get_command_string() ) );
 
     return is_valid;
 }
index cde29ee..4067074 100644 (file)
@@ -46,7 +46,7 @@ LinkDownIntervalOption::~LinkDownIntervalOption()
 
 bool LinkDownIntervalOption::validate( const variables_map& vm ) const
 {
-    bool is_valid = ( vm.count( get_command_string() ) > 0 );
+    bool is_valid = ( 1 <= vm.count( get_command_string() ) );
 
     return is_valid;
 }
@@ -57,7 +57,7 @@ bool LinkDownIntervalOption::parse(
 )
 {
     // link-down-interval
-    if ( vm.count( get_command_string() ) > 0 )
+    if ( 1 <= vm.count( get_command_string() ) )
     {
         int link_down_interval_in_min = vm[ get_command_string() ].as<int>();
         configuration->set_link_down_interval_in_min( link_down_interval_in_min );
index 4859d30..a78bd36 100644 (file)
@@ -46,7 +46,7 @@ LinkUpIntervalOption::~LinkUpIntervalOption()
 
 bool LinkUpIntervalOption::validate( const variables_map& vm ) const
 {
-    bool is_valid = ( vm.count( get_command_string() ) > 0 );
+    bool is_valid = ( 1 <= vm.count( get_command_string() ) );
 
     return is_valid;
 }
@@ -57,7 +57,7 @@ bool LinkUpIntervalOption::parse(
 )
 {
     // link-up-interval
-    if ( vm.count( get_command_string() ) > 0 )
+    if ( 1 <= vm.count( get_command_string() ) )
     {
         int link_up_interval_in_min = vm[ get_command_string() ].as<int>();
         configuration->set_link_up_interval_in_min( link_up_interval_in_min );
index 9ad28e3..5f3bb7e 100644 (file)
@@ -46,7 +46,7 @@ NameserverOption::~NameserverOption()
 
 bool NameserverOption::validate( const variables_map& vm ) const
 {
-    bool is_valid = ( vm.count( get_command_string() ) > 0 );
+    bool is_valid = ( 1 <= vm.count( get_command_string() ) );
 
     return is_valid;
 }
@@ -57,7 +57,7 @@ bool NameserverOption::parse(
 )
 {
     // nameserver
-    if ( vm.count( get_command_string() ) > 0 )
+    if ( 1 <= vm.count( get_command_string() ) )
     {
         string nameserver = vm[ get_command_string() ].as<string> ();
         configuration->set_nameserver( nameserver );
index 1849581..d168db2 100644 (file)
@@ -46,7 +46,7 @@ PingFailLimitOption::~PingFailLimitOption()
 
 bool PingFailLimitOption::validate( const variables_map& vm ) const
 {
-    bool is_valid = ( vm.count( get_command_string() ) > 0 );
+    bool is_valid = ( 1 <= vm.count( get_command_string() ) );
 
     return is_valid;
 }
@@ -57,7 +57,7 @@ bool PingFailLimitOption::parse(
 )
 {
     // ping-fail-limit
-    if ( vm.count( get_command_string() ) > 0 )
+    if ( 1 <= vm.count( get_command_string() ) )
     {
         int ping_fail_limit = vm[ get_command_string() ].as<int> ();
         configuration->set_ping_fail_limit( ping_fail_limit );
index 78a7109..687ac62 100644 (file)
@@ -47,7 +47,7 @@ SourceNetworkInterfaceOption::~SourceNetworkInterfaceOption()
 bool SourceNetworkInterfaceOption::validate( const variables_map& vm ) const
 {
     // TODO validate if it is a valid interface
-    bool is_valid = ( vm.count( get_command_string() ) > 0 );
+    bool is_valid = ( 1 <= vm.count( get_command_string() ) );
 
     return is_valid;
 }
@@ -58,7 +58,7 @@ bool SourceNetworkInterfaceOption::parse(
 )
 {
     // source-network-interface
-    if ( vm.count( get_command_string() ) > 0 )
+    if ( 1 <= vm.count( get_command_string() ) )
     {
         string source_network_interface = vm[ get_command_string() ].as<string> ();
         configuration->set_source_network_interface( source_network_interface );
index 1e30528..bc1f080 100644 (file)
@@ -46,7 +46,7 @@ StatusNotifierCmdOption::~StatusNotifierCmdOption()
 
 bool StatusNotifierCmdOption::validate( const variables_map& vm ) const
 {
-    bool is_valid = ( vm.count( get_command_string() ) > 0 );
+    bool is_valid = ( 1 <= vm.count( get_command_string() ) );
 
     return is_valid;
 }
@@ -57,7 +57,7 @@ bool StatusNotifierCmdOption::parse(
 )
 {
     // status-notifier-cmd
-    if ( vm.count( get_command_string() ) > 0 )
+    if ( 1 <= vm.count( get_command_string() ) )
     {
         string status_notifier_cmd = vm[ get_command_string() ].as<string>();
         configuration->set_status_notifier_cmd( status_notifier_cmd );