本文整理汇总了C++中DeviceManager::devices方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceManager::devices方法的具体用法?C++ DeviceManager::devices怎么用?C++ DeviceManager::devices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceManager
的用法示例。
在下文中一共展示了DeviceManager::devices方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: display_name
string HardwareDevice::display_name(
const DeviceManager &device_manager) const {
const auto hw_dev = hardware_device();
// If we can find another device with the same model/vendor then
// we have at least two such devices and need to distinguish them.
const auto &devices = device_manager.devices();
const bool multiple_dev = hw_dev && any_of(
devices.begin(), devices.end(),
[&](shared_ptr<devices::HardwareDevice> dev) {
return dev->hardware_device()->vendor() ==
hw_dev->vendor() &&
dev->hardware_device()->model() ==
hw_dev->model() &&
dev->device_ != device_;
});
vector<string> parts = {device_->vendor(), device_->model()};
if (multiple_dev) {
parts.push_back(device_->version());
parts.push_back(device_->serial_number());
if ((device_->serial_number().length() == 0) &&
(device_->connection_id().length() > 0))
parts.push_back("(" + device_->connection_id() + ")");
}
return join(parts, " ");
}