blob: 6cbf9c3afe2a1df9845df779d98779764f1025ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
//=========================================================
// MusE
// Linux Music Editor
// $Id: header.cpp,v 1.1.1.1 2003/10/27 18:55:05 wschweer Exp $
// (C) Copyright 2000 Werner Schweer (ws@seh.de)
//=========================================================
#include "header.h"
#include "xml.h"
#include <qstringlist.h>
//---------------------------------------------------------
// readStatus
//---------------------------------------------------------
void Header::readStatus(Xml& xml)
{
for (;;) {
Xml::Token token = xml.parse();
const QString& tag = xml.s1();
switch (token) {
case Xml::Error:
case Xml::End:
return;
case Xml::Text:
{
QStringList l = QStringList::split(QString(" "), tag);
int index = count();
for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
int section = (*it).toInt();
moveSection(section, index);
--index;
}
}
break;
case Xml::TagStart:
xml.unknown("Header");
break;
case Xml::TagEnd:
if (tag == name())
return;
default:
break;
}
}
}
//---------------------------------------------------------
// writeStatus
//---------------------------------------------------------
void Header::writeStatus(int level, Xml& xml) const
{
//xml.nput(level, "<%s> ", name());
xml.nput(level, "<%s> ", Xml::xmlString(name()).latin1());
int n = count() - 1;
for (int i = n; i >= 0; --i)
xml.nput("%d ", mapToSection(i));
//xml.put("</%s>", name());
xml.put("</%s>", Xml::xmlString(name()).latin1());
}
|