本文整理汇总了C++中strings::at方法的典型用法代码示例。如果您正苦于以下问题:C++ strings::at方法的具体用法?C++ strings::at怎么用?C++ strings::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类strings
的用法示例。
在下文中一共展示了strings::at方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: notifyAsebaEnvironment
void PlaygroundViewer::notifyAsebaEnvironment(const EnvironmentNotificationType type, const std::string& description, const strings& arguments)
{
if (type == EnvironmentNotificationType::DISPLAY_INFO)
{
if (description == "missing Thymio2 feature")
{
addInfoMessage(tr("You are using a feature not available in the simulator, click here to buy a real Thymio."), 5.0, Qt::blue, QUrl(tr("https://www.thymio.org/en:thymiobuy")));
}
else
qDebug() << "Unknown description for notifying DISPLAY_INFO" << QString::fromStdString(description);
}
else if ((type == EnvironmentNotificationType::LOG_INFO) ||
(type == EnvironmentNotificationType::LOG_WARNING) ||
(type == EnvironmentNotificationType::LOG_ERROR))
{
if (description == "cannot read from socket")
{
log(tr("Target %0, cannot read from socket: %1").arg(QString::fromStdString(arguments.at(0))).arg(QString::fromStdString(arguments.at(1))), notificationLogTypeToColor.at(type));
}
else if (description == "new client connected")
{
log(tr("New client connected from %0").arg(QString::fromStdString(arguments.at(0))), notificationLogTypeToColor.at(type));
}
else if (description == "cannot read from socket")
{
log(tr("Target %0, cannot read from socket: %1").arg(QString::fromStdString(arguments.at(0))).arg(QString::fromStdString(arguments.at(1))), notificationLogTypeToColor.at(type));
}
else if (description == "client disconnected properly")
{
log(tr("Client disconnected properly from %0").arg(QString::fromStdString(arguments.at(0))), notificationLogTypeToColor.at(type));
}
else if (description == "client disconnected abnormally")
{
log(tr("Client disconnected abnormally from %0").arg(QString::fromStdString(arguments.at(0))), notificationLogTypeToColor.at(type));
}
else if (description == "old client disconnected")
{
log(tr("Old client disconnected from %0").arg(QString::fromStdString(arguments.at(0))), notificationLogTypeToColor.at(type));
}
else
{
QString fullDescription(QString::fromStdString(description));
for (const auto& argument: arguments)
fullDescription += " " + QString::fromStdString(argument);
log(fullDescription, notificationLogTypeToColor.at(type));
}
}
else if (type == EnvironmentNotificationType::FATAL_ERROR)
{
if (description == "cannot create listening port")
{
QMessageBox::critical(0, "Aseba Playground", tr("Cannot create listening port %0: %1").arg(QString::fromStdString(arguments.at(0))).arg(QString::fromStdString(arguments.at(1))));
abort();
}
else
qDebug() << "Unknown description for notifying FATAL_ERROR" << QString::fromStdString(description);
}
}