本文整理汇总了C++中xml::Document::getFirstChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Document::getFirstChild方法的具体用法?C++ Document::getFirstChild怎么用?C++ Document::getFirstChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml::Document
的用法示例。
在下文中一共展示了Document::getFirstChild方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onAction
ActionResponse Service::onAction(const std::string& action, const xml::Document& doc)
{
try
{
ActionResponse response(action, ServiceType::ConnectionManager);
auto request = doc.getFirstChild();
switch (actionFromString(action))
{
case Action::GetProtocolInfo:
response.addArgument("Source", getVariable(Variable::SourceProtocolInfo).getValue());
response.addArgument("Sink", getVariable(Variable::SinkProtocolInfo).getValue());
break;
case Action::PrepareForConnection:
{
ConnectionInfo connInfo;
connInfo.peerConnectionManager = request.getChildNodeValue("PeerConnectionManager");
connInfo.peerConnectionId = std::stoi(request.getChildNodeValue("PeerConnectionID"));
connInfo.direction = directionFromString(request.getChildNodeValue("Direction"));
ProtocolInfo protoInfo(request.getChildNodeValue("RemoteProtocolInfo"));;
m_connectionManager.prepareForConnection(protoInfo, connInfo);
response.addArgument("ConnectionID", std::to_string(connInfo.connectionId));
response.addArgument("AVTransportID", std::to_string(connInfo.avTransportId));
response.addArgument("RcsID", std::to_string(connInfo.renderingControlServiceId));
break;
}
case Action::ConnectionComplete:
m_connectionManager.connectionComplete(std::stoi(request.getChildNodeValue("ConnectionID")));
break;
case Action::GetCurrentConnectionIDs:
response.addArgument("ConnectionIDs", getVariable(Variable::CurrentConnectionIds).getValue());
break;
case Action::GetCurrentConnectionInfo:
{
auto connInfo = m_connectionManager.getCurrentConnectionInfo(std::stoi(request.getChildNodeValue("ConnectionID")));
response.addArgument("RcsID", std::to_string(connInfo.renderingControlServiceId));
response.addArgument("AVTransportID", std::to_string(connInfo.avTransportId));
response.addArgument("ProtocolInfo", connInfo.protocolInfo.toString());
response.addArgument("PeerConnectionManager", connInfo.peerConnectionManager);
response.addArgument("PeerConnectionID", std::to_string(connInfo.peerConnectionId));
response.addArgument("Direction", toString(connInfo.direction));
response.addArgument("Status", toString(connInfo.connectionStatus));
break;
}
default:
throw InvalidActionException();
}
return response;
}
catch (std::exception& e)
{
log::error("Error processing ConnectionManager request: %s", e.what());
throw InvalidActionException();
}
}