MuseScore/mscore/importmxml.cpp
2015-04-03 07:09:23 +02:00

53 lines
1.7 KiB
C++

//=============================================================================
// MuseScore
// Linux Music Score Editor
//
// Copyright (C) 2015 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 "libmscore/box.h"
#include "libmscore/measure.h"
#include "libmscore/page.h"
#include "libmscore/part.h"
#include "libmscore/staff.h"
#include "libmscore/sym.h"
#include "libmscore/symbol.h"
#include "importmxml.h"
#include "importmxmlpass1.h"
#include "importmxmlpass2.h"
#include "preferences.h"
namespace Ms {
Score::FileError importMusicXMLfromBuffer(Score* score, const QString& name, QIODevice* dev)
{
qDebug("importMusicXMLfromBuffer(score %p, name '%s', dev %p)",
score, qPrintable(name), dev);
// pass 1
dev->seek(0);
MusicXMLParserPass1 pass1(score);
Score::FileError res = pass1.parse(dev);
if (res != Score::FileError::FILE_NO_ERROR)
return res;
// pass 2
dev->seek(0);
MusicXMLParserPass2 pass2(score, pass1);
return pass2.parse(dev);
}
} // namespace Ms