MuseScore  3.4
Music composition and notation
xmlwriter.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2013 Werner Schweer
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License version 2
9 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __XMLWRITER_H__
14 #define __XMLWRITER_H__
15 
16 #include <QIODevice>
17 #include <QTextStream>
18 #include <QList>
19 #include <QString>
20 #include <QVariant>
21 
22 //---------------------------------------------------------
23 // XmlWriter
24 //---------------------------------------------------------
25 
26 class XmlWriter : public QTextStream {
27  static const int BS = 2048;
28 
29  QList<QString> stack;
30  void putLevel();
31 
32  public:
33  XmlWriter(QIODevice* dev);
34  XmlWriter();
35 
36  void header();
37 
38  void stag(const QString&);
39  void etag();
40 
41  void tagE(const QString&);
42  void tagE(const char* format, ...);
43  void ntag(const char* name);
44  void netag(const char* name);
45 
46  void tag(const QString&, QVariant data);
47  void tag(const char* name, const char* s) { tag(name, QVariant(s)); }
48  void tag(const char* name, const QString& s) { tag(name, QVariant(s)); }
49 
50  static QString xmlString(const QString&);
51  };
52 
53 #endif
54 
void putLevel()
Definition: xmlwriter.cpp:39
void tag(const char *name, const QString &s)
Definition: xmlwriter.h:48
void stag(const QString &)
Definition: xmlwriter.cpp:60
static QString xmlString(const QString &)
Definition: xmlwriter.cpp:198
void tagE(const QString &)
Definition: xmlwriter.cpp:100
XmlWriter()
Definition: xmlwriter.cpp:23
void etag()
Definition: xmlwriter.cpp:72
void header()
Definition: xmlwriter.cpp:50
void tag(const char *name, const char *s)
Definition: xmlwriter.h:47
void tag(const QString &, QVariant data)
Definition: xmlwriter.cpp:132
static const int BS
Definition: xmlwriter.h:27
Definition: xmlwriter.h:26
void netag(const char *name)
Definition: xmlwriter.cpp:122
QList< QString > stack
Definition: xmlwriter.h:29
void ntag(const char *name)
Definition: xmlwriter.cpp:111