Support for OTML inline sequences

This commit is contained in:
Eduardo Bart 2012-07-23 17:50:34 -03:00
parent 19dd96fd02
commit 61d64c7417
1 changed files with 12 additions and 2 deletions

View File

@ -23,6 +23,7 @@
#include "otmlparser.h"
#include "otmldocument.h"
#include "otmlexception.h"
#include <boost/tokenizer.hpp>
OTMLParser::OTMLParser(OTMLDocumentPtr doc, std::istream& in) :
currentDepth(0), currentLine(0),
@ -186,8 +187,17 @@ void OTMLParser::parseNode(const std::string& data)
// ~ is considered the null value
if(value == "~")
node->setNull(true);
else
else {
if(boost::starts_with(value, "[") && boost::ends_with(value, "]")) {
std::string tmp = value.substr(1, value.length()-2);
boost::tokenizer<boost::escaped_list_separator<char>> tokens(tmp);
for(std::string v : tokens) {
stdext::trim(v);
node->writeIn(v);
}
} else
node->setValue(value);
}
currentParent->addChild(node);
previousNode = node;