0.6.0
C++ to UML diagram generator based on Clang
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
YAML::convert< inja::json > Struct Reference

Detailed Description

Definition at line 1102 of file yaml_decoders.cc.

Static Public Member Functions

static bool parse_scalar (const YAML::Node &node, inja::json &rhs)
 
static bool decode (const Node &node, inja::json &rhs)
 

Member Function Documentation

◆ decode()

static bool YAML::convert< inja::json >::decode ( const Node &  node,
inja::json &  rhs 
)
inlinestatic

Definition at line 1130 of file yaml_decoders.cc.

1131 {
1132 switch (node.Type()) {
1133 case YAML::NodeType::Null:
1134 break;
1135 case YAML::NodeType::Scalar:
1136 parse_scalar(node, rhs);
1137 break;
1138 case YAML::NodeType::Sequence:
1139 for (auto &&array_element : node)
1140 rhs.emplace_back(array_element.as<inja::json>());
1141 break;
1142 case YAML::NodeType::Map:
1143 for (auto &&it : node)
1144 rhs[it.first.as<std::string>()] = it.second.as<inja::json>();
1145 break;
1146 default:
1147 break;
1148 }
1149 return true;
1150 }

◆ parse_scalar()

static bool YAML::convert< inja::json >::parse_scalar ( const YAML::Node &  node,
inja::json &  rhs 
)
inlinestatic

Definition at line 1103 of file yaml_decoders.cc.

1104 {
1105 int i{};
1106 double d{};
1107 bool b{};
1108 std::string s;
1109
1110 if (YAML::convert<int>::decode(node, i)) {
1111 rhs = i;
1112 return true;
1113 }
1114 if (YAML::convert<double>::decode(node, d)) {
1115 rhs = d;
1116 return true;
1117 }
1118 if (YAML::convert<bool>::decode(node, b)) {
1119 rhs = b;
1120 return true;
1121 }
1122 if (YAML::convert<std::string>::decode(node, s)) {
1123 rhs = s;
1124 return true;
1125 }
1126
1127 return false;
1128 }

The documentation for this struct was generated from the following file: