当前位置: 首页>>代码示例>>C++>>正文


C++ strings::at方法代码示例

本文整理汇总了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);
		}
	}
开发者ID:davidjsherman,项目名称:aseba,代码行数:58,代码来源:PlaygroundViewer.cpp


注:本文中的strings::at方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。