0.6.2
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 1108 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 1136 of file yaml_decoders.cc.

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

◆ parse_scalar()

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

Definition at line 1109 of file yaml_decoders.cc.

1110 {
1111 int i{};
1112 double d{};
1113 bool b{};
1114 std::string s;
1115
1116 if (YAML::convert<int>::decode(node, i)) {
1117 rhs = i;
1118 return true;
1119 }
1120 if (YAML::convert<double>::decode(node, d)) {
1121 rhs = d;
1122 return true;
1123 }
1124 if (YAML::convert<bool>::decode(node, b)) {
1125 rhs = b;
1126 return true;
1127 }
1128 if (YAML::convert<std::string>::decode(node, s)) {
1129 rhs = s;
1130 return true;
1131 }
1132
1133 return false;
1134 }

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