~ubuntu-branches/ubuntu/oneiric/muse/oneiric

« back to all changes in this revision

Viewing changes to widgets/header.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2002-04-23 17:28:23 UTC
  • Revision ID: james.westby@ubuntu.com-20020423172823-w8yplzr81a759xa3
Tags: upstream-0.5.2
ImportĀ upstreamĀ versionĀ 0.5.2

Show diffs side-by-side

added added

removed removed

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