MuseScore/libmscore/icon.cpp

50 lines
1.4 KiB
C++
Raw Normal View History

2012-05-26 14:26:10 +02:00
//=============================================================================
// MuseScore
// Music Composition & Notation
2012-05-26 14:26:10 +02:00
//
// Copyright (C) 2002-2011 Werner Schweer
2012-05-26 14:26:10 +02:00
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENCE.GPL
2012-05-26 14:26:10 +02:00
//=============================================================================
#include "xml.h"
#include "icon.h"
2013-05-13 18:49:17 +02:00
namespace Ms {
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
// write
//---------------------------------------------------------
void Icon::write(Xml& xml) const
{
xml.stag(name());
xml.tag("subtype", int(_iconType));
if (!_action.isEmpty())
2014-11-14 18:08:02 +01:00
xml.tag("action", _action.data());
2012-05-26 14:26:10 +02:00
xml.etag();
}
//---------------------------------------------------------
// read
//---------------------------------------------------------
2013-01-11 18:10:18 +01:00
void Icon::read(XmlReader& e)
2012-05-26 14:26:10 +02:00
{
2013-01-11 18:10:18 +01:00
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
2012-05-26 14:26:10 +02:00
if (tag == "action")
2014-11-14 18:08:02 +01:00
_action = e.readElementText().toLocal8Bit();
2012-05-26 14:26:10 +02:00
else if (tag == "subtype")
_iconType = IconType(e.readInt());
2012-05-26 14:26:10 +02:00
else
2013-01-11 18:10:18 +01:00
e.unknown();
2012-05-26 14:26:10 +02:00
}
}
2013-05-13 18:49:17 +02:00
}