本文整理汇总了C++中json::Value::as_array方法的典型用法代码示例。如果您正苦于以下问题:C++ Value::as_array方法的具体用法?C++ Value::as_array怎么用?C++ Value::as_array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类json::Value
的用法示例。
在下文中一共展示了Value::as_array方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: m_read_vlanports
void Submodule::m_read_vlanports(const json::Value& vlans_configuration) {
for (const auto& vlan_json : vlans_configuration.as_array()) {
auto vlan = m_get_vlan_by_id(vlan_json["id"].as_uint());
if (nullptr != vlan) {
log_debug(GET_LOGGER("module"), "Reading Vlanport configuration.");
// Read tagged ports
for (const auto& tagged_port : vlan_json["tagged_ports"].as_array()) {
auto port = m_get_port_by_id(tagged_port.as_uint());
auto vlanport = VlanPort::make_vlanport();
vlanport->attach_port(port);
vlanport->attach_vlan(vlan);
vlanport->set_tagging(true);
add_vlanport(std::move(vlanport));
}
// Untagged ports
for (const auto& untagged_port : vlan_json["untagged_ports"].as_array()) {
auto port = m_get_port_by_id(untagged_port.as_uint());
auto vlanport = VlanPort::make_vlanport();
vlanport->attach_port(port);
vlanport->attach_vlan(vlan);
vlanport->set_tagging(false);
add_vlanport(std::move(vlanport));
}
}
}
}
示例2: m_read_ports
void Submodule::m_read_ports(const json::Value& ports_configuration) {
for(const auto& port_json : ports_configuration.as_array()) {
auto port = Port::make_port();
port->read_configuration(port_json);
add_switch_port(std::move(port));
}
}
示例3: m_read_vlans
void Submodule::m_read_vlans(const json::Value& vlans_configuration) {
for (const auto& vlan_json : vlans_configuration.as_array()){
auto vlan = Vlan::make_vlan();
vlan->read_configuration(vlan_json);
add_vlan(std::move(vlan));
}
}
示例4: m_read_storage_controllers_configuration
void Submodule::m_read_storage_controllers_configuration(
const json::Value& controllers_configuration) {
for (const auto& controller_json : controllers_configuration.as_array()) {
auto controller = StorageController::make_storage_controller();
controller->read_configuration(controller_json);
add_storage_controller(std::move(controller));
}
}
示例5: m_read_network_interfaces_configuration
void Submodule::m_read_network_interfaces_configuration(
const json::Value& interfaces_configuration) {
for (const auto& interface_json : interfaces_configuration.as_array()) {
auto interface = NetworkInterface::make_network_interface();
interface->read_configuration(interface_json);
add_network_interface(std::move(interface));
}
}