]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5126] Shared getUint* in simple_parser.h
authorFrancis Dupont <fdupont@isc.org>
Fri, 10 Feb 2017 12:25:26 +0000 (13:25 +0100)
committerFrancis Dupont <fdupont@isc.org>
Fri, 10 Feb 2017 12:25:26 +0000 (13:25 +0100)
src/bin/dhcp4/json_config_parser.cc
src/bin/dhcp6/json_config_parser.cc
src/lib/cc/simple_parser.h
src/lib/cc/tests/simple_parser_unittest.cc
src/lib/dhcpsrv/parsers/dhcp_parsers.cc
src/lib/dhcpsrv/parsers/dhcp_parsers.h

index 1ab22bfef8bcb7fc2f03f1922b709cfe7d3a3168..adfbbad84908327026dcd8a3494110d67d424a18 100644 (file)
@@ -342,32 +342,6 @@ public:
         uint16_t dhcp4o6_port = getUint16(global, "dhcp4o6-port");
         cfg->setDhcp4o6Port(dhcp4o6_port);
     }
-
-private:
-
-    /// @brief Returns a value converted to uint32_t
-    ///
-    /// Instantiation of getIntType() to uint32_t
-    ///
-    /// @param scope specified parameter will be extracted from this scope
-    /// @param name name of the parameter
-    /// @return an uint32_t value
-    uint32_t getUint32(isc::data::ConstElementPtr scope,
-                       const std::string& name) {
-        return (getIntType<uint32_t>(scope, name));
-    }
-
-    /// @brief Returns a value converted to uint16_t
-    ///
-    /// Instantiation of getIntType() to uint16_t
-    ///
-    /// @param scope specified parameter will be extracted from this scope
-    /// @param name name of the parameter
-    /// @return an uint16_t value
-    uint16_t getUint16(isc::data::ConstElementPtr scope,
-                       const std::string& name) {
-        return (getIntType<uint16_t>(scope, name));
-    }
 };
 
 } // anonymous namespace
index 3521174b3e1e354c31d4c1c1512c3e51743bc637..7a51daf8b3c1c49a9ef842fb4514ed99e2332f0e 100644 (file)
@@ -212,18 +212,6 @@ public:
 
 private:
 
-    /// @brief Get an uint8_t value
-    ///
-    /// Instantiation of getIntType() to uint8_t
-    ///
-    /// @param scope specified parameter will be extracted from this scope
-    /// @param name name of the parameter
-    /// @return uint8_t value
-    /// @throw isc::dhcp::DhcpConfigError when it is not an uint8_t
-    uint8_t getUint8(ConstElementPtr scope, const std::string& name) {
-        return (getIntType<uint8_t>(scope, name));
-    }
-
     /// Pointer to the created pool object.
     isc::dhcp::Pool6Ptr pool_;
 
@@ -548,32 +536,6 @@ public:
         uint16_t dhcp4o6_port = getUint16(global, "dhcp4o6-port");
         srv_config->setDhcp4o6Port(dhcp4o6_port);
     }
-
-private:
-
-    /// @brief Returns a value converted to uint32_t
-    ///
-    /// Instantiation of getIntType() to uint32_t
-    ///
-    /// @param scope specified parameter will be extracted from this scope
-    /// @param name name of the parameter
-    /// @return an uint32_t value
-    uint32_t getUint32(isc::data::ConstElementPtr scope,
-                       const std::string& name) {
-        return (getIntType<uint32_t>(scope, name));
-    }
-
-    /// @brief Returns a value converted to uint16_t
-    ///
-    /// Instantiation of getIntType() to uint16_t
-    ///
-    /// @param scope specified parameter will be extracted from this scope
-    /// @param name name of the parameter
-    /// @return an uint16_t value
-    uint16_t getUint16(isc::data::ConstElementPtr scope,
-                       const std::string& name) {
-        return (getIntType<uint16_t>(scope, name));
-    }
 };
 
 } // anonymous namespace
index 524449806eef51e14c2c3e69e6d215bf439b91ed..3ff60b7bb86f84c52e783f6a4d06e7d083d2e785 100644 (file)
@@ -203,6 +203,44 @@ protected:
                       << "' (" << getPosition(name, scope) << ")");
         }
     }
+
+    /// @brief Returns a value converted to uint32_t
+    ///
+    /// Instantiation of getIntType() to uint32_t
+    ///
+    /// @param scope specified parameter will be extracted from this scope
+    /// @param name name of the parameter
+    /// @return an uint32_t value
+    /// @throw isc::dhcp::DhcpConfigError when it is not an uint32_t
+    uint32_t getUint32(isc::data::ConstElementPtr scope,
+                       const std::string& name) {
+        return (getIntType<uint32_t>(scope, name));
+    }
+
+    /// @brief Returns a value converted to uint16_t
+    ///
+    /// Instantiation of getIntType() to uint16_t
+    ///
+    /// @param scope specified parameter will be extracted from this scope
+    /// @param name name of the parameter
+    /// @return an uint16_t value
+    /// @throw isc::dhcp::DhcpConfigError when it is not an uint16_t
+    uint16_t getUint16(isc::data::ConstElementPtr scope,
+                       const std::string& name) {
+        return (getIntType<uint16_t>(scope, name));
+    }
+
+    /// @brief Get an uint8_t value
+    ///
+    /// Instantiation of getIntType() to uint8_t
+    ///
+    /// @param scope specified parameter will be extracted from this scope
+    /// @param name name of the parameter
+    /// @return uint8_t value
+    /// @throw isc::dhcp::DhcpConfigError when it is not an uint8_t
+    uint8_t getUint8(ConstElementPtr scope, const std::string& name) {
+        return (getIntType<uint8_t>(scope, name));
+    }
 };
 
 };
index dfe384c990aaf74d8530939c5754dcefdc5dc2ce..0a8bf579880a00aaed9292bb87fb4ab068c38580 100644 (file)
@@ -58,14 +58,9 @@ public:
 
 class SimpleParserClassTest : public SimpleParser {
 public:
-    /// @brief Instantiation of getIntType for uint8_t
-    ///
-    /// @param scope specified parameter will be extracted from this scope
-    /// @param name name of the parameter for error report
-    /// @return an uint8_t value
-    uint8_t getUint8(ConstElementPtr scope, const std::string& name) {
-        return (getIntType<uint8_t>(scope, name));
-    }
+
+    /// Make getUint8 public
+    using SimpleParser::getUint8;
 
     /// @brief Instantiation of getAndConvert
     ///
index ad0d6de7110a934a89ed7b25fa02e76f3199924f..4730c95b911bd9b188a8b4ab82c3a18a716cba96 100644 (file)
@@ -1065,12 +1065,6 @@ SubnetConfigParser::createSubnet(ConstElementPtr params) {
 
 //**************************** D2ClientConfigParser **********************
 
-uint32_t
-D2ClientConfigParser::getUint32(ConstElementPtr scope,
-                                const std::string& name) {
-    return (getIntType<uint32_t>(scope, name));
-}
-
 // Can't use a constructor as a function
 namespace {
 IOAddress buildIOAddress(const std::string& str) { return (IOAddress(str)); }
index 67f253a5bf6839a70df51f050e9d9d3f60de2571..6d84cb731cb6e005279711dad046c7ac70834d4c 100644 (file)
@@ -889,16 +889,6 @@ public:
 
 private:
 
-    /// @brief Returns a value converted to uint32_t
-    ///
-    /// Instantiation of getIntType() to uint32_t
-    ///
-    /// @param scope specified parameter will be extracted from this scope
-    /// @param name name of the parameter
-    /// @return an uint32_t value
-    uint32_t
-    getUint32(isc::data::ConstElementPtr scope, const std::string& name);
-
     /// @brief Returns a value converted to IOAddress
     ///
     /// Instantiation of getAndConvert() to IOAddress