#include "smlrendererhtml.h" #include "smlnode.h" SmlRendererHtml::SmlRendererHtml() { } SmlRendererHtml::~SmlRendererHtml() { } void SmlRendererHtml::render( Bu::Formatter &f, const SmlNode *pSml ) { switch( pSml->getType() ) { case SmlNode::typeRoot: f << "
"; for( SmlNode::SmlNodeList::const_iterator i = pSml->getChildren().begin(); i; i++ ) { render( f, *i ); } f << "
"; break; case SmlNode::typeText: f << pSml->getText(); break; case SmlNode::typeTag: if( pSml->getChildren().isEmpty() ) { if( pSml->getText() == "break" ) f << ""; } else { if( pSml->getText() == "red" ) { f << ""; for( SmlNode::SmlNodeList::const_iterator i = pSml->getChildren().begin(); i; i++ ) { render( f, *i ); } f << ""; } else if( pSml->getText() == "green" ) { f << ""; for( SmlNode::SmlNodeList::const_iterator i = pSml->getChildren().begin(); i; i++ ) { render( f, *i ); } f << ""; } } break; } }