/* * Copyright (c) 2012 Mateusz Piękos * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ #include namespace Swift { WhiteboardParser::WhiteboardParser() : level_(0) { } void WhiteboardParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) { if (level_ == 0) { std::string type = attributes.getAttribute("type"); if (type.empty()) { getPayloadInternal()->setType(WhiteboardPayload::Data); } else if (type == "request") { getPayloadInternal()->setType(WhiteboardPayload::SessionRequest); } } ++level_; } void WhiteboardParser::handleEndElement(const std::string& element, const std::string&) { --level_; if (level_ == 0) { getPayloadInternal()->setData(data_); } } void WhiteboardParser::handleCharacterData(const std::string& data) { data_ += data; } }