comparison data/model/Model.cpp @ 150:4b2ea82fd0ed

* Reorganising code base. This revision probably should compile once more.
author Chris Cannam
date Mon, 31 Jul 2006 14:05:22 +0000
parents
children 3e6fee4e4257
comparison
equal deleted inserted replaced
149:3e4c384f518e 150:4b2ea82fd0ed
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2006 Chris Cannam.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #include "Model.h"
17 #include "base/PlayParameterRepository.h"
18
19 #include <QTextStream>
20
21 #include <iostream>
22
23 const int Model::COMPLETION_UNKNOWN = -1;
24
25 Model::~Model()
26 {
27 // std::cerr << "Model::~Model(" << this << ")" << std::endl;
28
29 // Subclasses have to handle adding themselves to the repository,
30 // if they want to be played. We can't do it from here because
31 // the repository would be unable to tell whether we were playable
32 // or not (because dynamic_cast won't work from the base class ctor)
33 PlayParameterRepository::getInstance()->removeModel(this);
34 }
35
36 void
37 Model::toXml(QTextStream &stream, QString indent,
38 QString extraAttributes) const
39 {
40 stream << indent;
41 stream << QString("<model id=\"%1\" name=\"%2\" sampleRate=\"%3\" start=\"%4\" end=\"%5\" %6/>\n")
42 .arg(getObjectExportId(this))
43 .arg(encodeEntities(objectName()))
44 .arg(getSampleRate())
45 .arg(getStartFrame())
46 .arg(getEndFrame())
47 .arg(extraAttributes);
48 }
49
50 QString
51 Model::toXmlString(QString indent, QString extraAttributes) const
52 {
53 QString s;
54
55 s += indent;
56
57 s += QString("<model id=\"%1\" name=\"%2\" sampleRate=\"%3\" start=\"%4\" end=\"%5\" %6/>\n")
58 .arg(getObjectExportId(this))
59 .arg(encodeEntities(objectName()))
60 .arg(getSampleRate())
61 .arg(getStartFrame())
62 .arg(getEndFrame())
63 .arg(extraAttributes);
64
65 return s;
66 }
67
68 #ifdef INCLUDE_MOCFILES
69 #include "Model.moc.cpp"
70 #endif
71