コード例 #1
0
ファイル: ComponentParser.cpp プロジェクト: dezed/mantid
//----------------------------------------------------------------------------------------------
/// Signals end of element
void ComponentParser::endElement(const Poco::XML::XMLString &,
                                 const Poco::XML::XMLString &localName,
                                 const Poco::XML::XMLString &) {
  Component *current = nullptr;
  if (!m_current.empty())
    current = m_current.back();

  if (!current) {
    throw std::runtime_error("Failed to find last component");
  }

  if (localName == "pos") {
    V3D pos;
    pos.fromString(m_innerText);
    // std::cout << "found pos " << pos << std::endl;
    current->setPos(pos);
  } else if (localName == "rot") {
    Quat rot;
    rot.fromString(m_innerText);
    // std::cout << "found rot " << rot << std::endl;
    current->setRot(rot);
  }
}