#include "writer.h"
#include "list.h"
using namespace std;
void Writer::indent ()
{
if (level > 0)
f << string (level*4, ' ');
}
void Writer::newLine ()
{
f << endl;
}
void Writer::writeSection (List & v)
{
level ++;
indent ();
f << "
";
newLine ();
level ++;
Item * p = v.getFirst ();
while (p != nullptr)
{
indent ();
f << "- ";
f << p->name;
f << "
";
if (p->info != "")
{
const char quote = '"';
f << "
info;
f << quote ;
f << " " << "height=160" << "/>";
}
newLine ();
if (p->inner.getFirst () != nullptr)
{
writeSection (p->inner);
}
p = p->getNext ();
}
level --;
indent ();
f << "
";
newLine ();
level --;
}
void Writer::writeHtml (List & v)
{
level = 0;
f << "" << endl;
f << "" << endl;
f << "" << endl;
f << "Vystupni soubor " << endl;
f << "" << endl;
f << "" << endl;
writeSection (v);
f << "" << endl;
f << "" << endl;
}