Implement int8, uint8, int16, uint16, int64, uint64 types

This sw did not support uint8 type, which is needed by the upcoming
driver CalibrationBox within cla-sysrepo, so we implemented uint8 and
other types in TODO sections.

Creating leaf_data_XXX_classes for all types would result in a lot of
redundant code so the base class was turned into a template and the type
is passed through the template argument.

Change-Id: I866a3933fe21ea7844299556e5aaf39b3e40e92f
Co-Authored-By: Jan Kundrát <jan.kundrat@cesnet.cz>
diff --git a/src/grammars.hpp b/src/grammars.hpp
index 583a960..276e716 100644
--- a/src/grammars.hpp
+++ b/src/grammars.hpp
@@ -39,13 +39,19 @@
 
 x3::rule<leaf_data_class, leaf_data_> const leaf_data = "leaf_data";
 x3::rule<leaf_data_enum_class, enum_> const leaf_data_enum = "leaf_data_enum";
-x3::rule<leaf_data_decimal_class, double> const leaf_data_decimal = "leaf_data_decimal";
-x3::rule<leaf_data_bool_class, bool> const leaf_data_bool = "leaf_data_bool";
-x3::rule<leaf_data_int_class, int32_t> const leaf_data_int = "leaf_data_int";
-x3::rule<leaf_data_uint_class, uint32_t> const leaf_data_uint = "leaf_data_uint";
-x3::rule<leaf_data_string_class, std::string> const leaf_data_string = "leaf_data_string";
+x3::rule<leaf_data_base_class<yang::LeafDataTypes::Decimal>, double> const leaf_data_decimal = "leaf_data_decimal";
+x3::rule<leaf_data_base_class<yang::LeafDataTypes::Bool>, bool> const leaf_data_bool = "leaf_data_bool";
+x3::rule<leaf_data_base_class<yang::LeafDataTypes::Int8>, int8_t> const leaf_data_int8 = "leaf_data_int8";
+x3::rule<leaf_data_base_class<yang::LeafDataTypes::Uint8>, uint8_t> const leaf_data_uint8 = "leaf_data_uint8";
+x3::rule<leaf_data_base_class<yang::LeafDataTypes::Int16>, int16_t> const leaf_data_int16 = "leaf_data_int16";
+x3::rule<leaf_data_base_class<yang::LeafDataTypes::Uint16>, uint16_t> const leaf_data_uint16 = "leaf_data_uint16";
+x3::rule<leaf_data_base_class<yang::LeafDataTypes::Int32>, int32_t> const leaf_data_int32 = "leaf_data_int32";
+x3::rule<leaf_data_base_class<yang::LeafDataTypes::Uint32>, uint32_t> const leaf_data_uint32 = "leaf_data_uint32";
+x3::rule<leaf_data_base_class<yang::LeafDataTypes::Int64>, int64_t> const leaf_data_int64 = "leaf_data_int64";
+x3::rule<leaf_data_base_class<yang::LeafDataTypes::Uint64>, uint64_t> const leaf_data_uint64 = "leaf_data_uint64";
+x3::rule<leaf_data_base_class<yang::LeafDataTypes::String>, std::string> const leaf_data_string = "leaf_data_string";
 x3::rule<leaf_data_binary_data_class, std::string> const leaf_data_binary_data = "leaf_data_binary_data";
-x3::rule<leaf_data_binary_class, binary_> const leaf_data_binary = "leaf_data_binary";
+x3::rule<leaf_data_base_class<yang::LeafDataTypes::Binary>, binary_> const leaf_data_binary = "leaf_data_binary";
 x3::rule<leaf_data_identityRef_data_class, identityRef_> const leaf_data_identityRef_data = "leaf_data_identityRef_data";
 x3::rule<leaf_data_identityRef_class, identityRef_> const leaf_data_identityRef = "leaf_data_identityRef";
 
@@ -212,10 +218,22 @@
 
 auto const leaf_data_bool_def =
     bool_rule;
-auto const leaf_data_int_def =
-    int_;
-auto const leaf_data_uint_def =
-    uint_;
+auto const leaf_data_int8_def =
+    int8;
+auto const leaf_data_int16_def =
+    int16;
+auto const leaf_data_int32_def =
+    int32;
+auto const leaf_data_int64_def =
+    int64;
+auto const leaf_data_uint8_def =
+    uint8;
+auto const leaf_data_uint16_def =
+    uint16;
+auto const leaf_data_uint32_def =
+    uint32;
+auto const leaf_data_uint64_def =
+    uint64;
 auto const leaf_data_string_def =
     *char_;
 
@@ -240,8 +258,14 @@
     leaf_data_enum |
     leaf_data_decimal |
     leaf_data_bool |
-    leaf_data_int |
-    leaf_data_uint |
+    leaf_data_int8 |
+    leaf_data_int16 |
+    leaf_data_int32 |
+    leaf_data_int64 |
+    leaf_data_uint8 |
+    leaf_data_uint16 |
+    leaf_data_uint32 |
+    leaf_data_uint64 |
     leaf_data_binary |
     leaf_data_identityRef |
     leaf_data_string];
@@ -332,8 +356,14 @@
 BOOST_SPIRIT_DEFINE(leaf_data_enum)
 BOOST_SPIRIT_DEFINE(leaf_data_decimal)
 BOOST_SPIRIT_DEFINE(leaf_data_bool)
-BOOST_SPIRIT_DEFINE(leaf_data_int)
-BOOST_SPIRIT_DEFINE(leaf_data_uint)
+BOOST_SPIRIT_DEFINE(leaf_data_int8)
+BOOST_SPIRIT_DEFINE(leaf_data_int16)
+BOOST_SPIRIT_DEFINE(leaf_data_int32)
+BOOST_SPIRIT_DEFINE(leaf_data_int64)
+BOOST_SPIRIT_DEFINE(leaf_data_uint8)
+BOOST_SPIRIT_DEFINE(leaf_data_uint16)
+BOOST_SPIRIT_DEFINE(leaf_data_uint32)
+BOOST_SPIRIT_DEFINE(leaf_data_uint64)
 BOOST_SPIRIT_DEFINE(leaf_data_string)
 BOOST_SPIRIT_DEFINE(leaf_data_binary_data)
 BOOST_SPIRIT_DEFINE(leaf_data_binary)