MuseScore/libmscore/icon.cpp

55 lines
1.8 KiB
C++
Raw Normal View History

2012-05-26 14:26:10 +02:00
//=============================================================================
// MuseScore
// Linux Music Score Editor
// $Id: element.cpp 4385 2011-06-15 13:26:41Z wschweer $
//
// Copyright (C) 2002-2011 Werner Schweer and others
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================
#include <string.h>
#include "xml.h"
#include "icon.h"
//---------------------------------------------------------
// write
//---------------------------------------------------------
void Icon::write(Xml& xml) const
{
xml.stag(name());
xml.tag("subtype", _subtype);
2012-09-14 10:09:06 +02:00
if (_action)
xml.tag("action", _action);
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")
2013-01-11 18:10:18 +01:00
_action = strdup(e.readElementText().toLatin1().data());
2012-05-26 14:26:10 +02:00
else if (tag == "subtype")
2013-01-11 18:10:18 +01:00
_subtype = 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
}
}