# HG changeset patch # User Chris Cannam # Date 1192702507 0 # Node ID c0b9eec70639c4d2ae8da150a3d585af5eaae075 # Parent c30a7cd29f4ac94447fc0cb823c6d13e0a424fcf * Make XmlExportable::toXml the function that is universally overridden (and pure virtual) instead of toXmlString. Tidies up some classes, notably the model classes, significantly. Closes #1794561. diff -r c30a7cd29f4a -r c0b9eec70639 layer/Colour3DPlotLayer.cpp --- a/layer/Colour3DPlotLayer.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/Colour3DPlotLayer.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -779,21 +780,20 @@ return true; } -QString -Colour3DPlotLayer::toXmlString(QString indent, QString extraAttributes) const +void +Colour3DPlotLayer::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { - QString s; - - s += QString("scale=\"%1\" " - "colourScheme=\"%2\" " - "normalizeColumns=\"%3\" " - "normalizeVisibleArea=\"%4\"") + QString s = QString("scale=\"%1\" " + "colourScheme=\"%2\" " + "normalizeColumns=\"%3\" " + "normalizeVisibleArea=\"%4\"") .arg((int)m_colourScale) .arg(m_colourMap) .arg(m_normalizeColumns ? "true" : "false") .arg(m_normalizeVisibleArea ? "true" : "false"); - return Layer::toXmlString(indent, extraAttributes + " " + s); + Layer::toXml(stream, indent, extraAttributes + " " + s); } void diff -r c30a7cd29f4a -r c0b9eec70639 layer/Colour3DPlotLayer.h --- a/layer/Colour3DPlotLayer.h Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/Colour3DPlotLayer.h Thu Oct 18 10:15:07 2007 +0000 @@ -99,8 +99,8 @@ virtual const Model *getSliceableModel() const { return m_model; } - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; protected slots: void cacheInvalid(); diff -r c30a7cd29f4a -r c0b9eec70639 layer/ImageLayer.cpp --- a/layer/ImageLayer.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/ImageLayer.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -944,10 +945,11 @@ } } -QString -ImageLayer::toXmlString(QString indent, QString extraAttributes) const +void +ImageLayer::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { - return Layer::toXmlString(indent, extraAttributes); + Layer::toXml(stream, indent, extraAttributes); } void diff -r c30a7cd29f4a -r c0b9eec70639 layer/ImageLayer.h --- a/layer/ImageLayer.h Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/ImageLayer.h Thu Oct 18 10:15:07 2007 +0000 @@ -89,8 +89,8 @@ virtual bool getValueExtents(float &min, float &max, bool &logarithmic, QString &unit) const; - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; virtual void setLayerDormant(const View *v, bool dormant); diff -r c30a7cd29f4a -r c0b9eec70639 layer/Layer.cpp --- a/layer/Layer.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/Layer.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -22,6 +22,7 @@ #include #include +#include #include "LayerFactory.h" #include "base/PlayParameterRepository.h" @@ -167,26 +168,22 @@ } } -QString -Layer::MeasureRect::toXmlString(QString indent) const +void +Layer::MeasureRect::toXml(QTextStream &stream, QString indent) const { - QString s; - - s += indent; - s += QString("\n") + stream << QString("startY=\"%1\" endY=\"%2\"/>\n") .arg(startY).arg(endY); - - return s; } void @@ -464,14 +461,13 @@ v->drawMeasurementRect(paint, this, r.pixrect.normalized(), focus); } -QString -Layer::toXmlString(QString indent, QString extraAttributes) const +void +Layer::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { - QString s; - - s += indent; + stream << indent; - s += QString("getLayerTypeName (LayerFactory::getInstance()->getLayerType(this)))) .arg(getObjectExportId(this)) @@ -480,37 +476,32 @@ .arg(extraAttributes); if (m_measureRects.empty()) { - s += QString("/>\n"); - return s; + stream << QString("/>\n"); + return; } - s += QString(">\n"); + stream << QString(">\n"); for (MeasureRectSet::const_iterator i = m_measureRects.begin(); i != m_measureRects.end(); ++i) { - s += i->toXmlString(indent + " "); + i->toXml(stream, indent + " "); } - s += QString("\n"); - - return s; + stream << QString("\n"); } -QString -Layer::toBriefXmlString(QString indent, QString extraAttributes) const +void +Layer::toBriefXml(QTextStream &stream, + QString indent, QString extraAttributes) const { - QString s; - - s += indent; + stream << indent; - s += QString("\n") + stream << QString("\n") .arg(encodeEntities(LayerFactory::getInstance()->getLayerTypeName (LayerFactory::getInstance()->getLayerType(this)))) .arg(getObjectExportId(this)) .arg(encodeEntities(objectName())) .arg(getObjectExportId(getModel())) .arg(extraAttributes); - - return s; } diff -r c30a7cd29f4a -r c0b9eec70639 layer/Layer.h --- a/layer/Layer.h Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/Layer.h Thu Oct 18 10:15:07 2007 +0000 @@ -280,29 +280,30 @@ /** * Convert the layer's data (though not those of the model it - * refers to) into an XML string for file output. This class - * implements the basic name/type/model-id output; subclasses will - * typically call this superclass implementation with extra - * attributes describing their particular properties. + * refers to) into XML for file output. This class implements the + * basic name/type/model-id output; subclasses will typically call + * this superclass implementation with extra attributes describing + * their particular properties. */ - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; /** * Set the particular properties of a layer (those specific to the * subclass) from a set of XML attributes. This is the effective - * inverse of the toXmlString method. + * inverse of the toXml method. */ virtual void setProperties(const QXmlAttributes &) = 0; /** - * Produce an XML string containing the layer's ID and type. This - * is used to refer to the layer in the display section of the SV - * session file, for a layer that has already been described in - * the data section. + * Produce XML containing the layer's ID and type. This is used + * to refer to the layer in the display section of the SV session + * file, for a layer that has already been described in the data + * section. */ - virtual QString toBriefXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toBriefXml(QTextStream &stream, + QString indent = "", + QString extraAttributes = "") const; /** * Add a measurement rectangle from the given XML attributes @@ -467,7 +468,7 @@ double endY; bool operator<(const MeasureRect &mr) const; - QString toXmlString(QString indent) const; + void toXml(QTextStream &stream, QString indent) const; }; class AddMeasurementRectCommand : public Command diff -r c30a7cd29f4a -r c0b9eec70639 layer/NoteLayer.cpp --- a/layer/NoteLayer.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/NoteLayer.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -948,12 +949,13 @@ (QString(darkbg ? "White" : "Black")); } -QString -NoteLayer::toXmlString(QString indent, QString extraAttributes) const +void +NoteLayer::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { - return SingleColourLayer::toXmlString(indent, extraAttributes + - QString(" verticalScale=\"%1\"") - .arg(m_verticalScale)); + SingleColourLayer::toXml(stream, indent, extraAttributes + + QString(" verticalScale=\"%1\"") + .arg(m_verticalScale)); } void diff -r c30a7cd29f4a -r c0b9eec70639 layer/NoteLayer.h --- a/layer/NoteLayer.h Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/NoteLayer.h Thu Oct 18 10:15:07 2007 +0000 @@ -92,8 +92,8 @@ virtual bool getDisplayExtents(float &min, float &max) const; - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; void setProperties(const QXmlAttributes &attributes); diff -r c30a7cd29f4a -r c0b9eec70639 layer/SingleColourLayer.cpp --- a/layer/SingleColourLayer.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/SingleColourLayer.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -19,6 +19,7 @@ #include +#include #include SingleColourLayer::ColourRefCount @@ -254,8 +255,9 @@ return s; } -QString -SingleColourLayer::toXmlString(QString indent, QString extraAttributes) const +void +SingleColourLayer::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { QString s; @@ -270,7 +272,7 @@ .arg(colourSpec) .arg(darkbg); - return Layer::toXmlString(indent, extraAttributes + " " + s); + Layer::toXml(stream, indent, extraAttributes + " " + s); } void diff -r c30a7cd29f4a -r c0b9eec70639 layer/SingleColourLayer.h --- a/layer/SingleColourLayer.h Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/SingleColourLayer.h Thu Oct 18 10:15:07 2007 +0000 @@ -46,8 +46,8 @@ virtual RangeMapper *getNewPropertyRangeMapper(const PropertyName &) const; virtual void setProperty(const PropertyName &, int value); - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; virtual void setProperties(const QXmlAttributes &attributes); diff -r c30a7cd29f4a -r c0b9eec70639 layer/SliceLayer.cpp --- a/layer/SliceLayer.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/SliceLayer.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -27,6 +27,8 @@ #include #include +#include + SliceLayer::SliceLayer() : m_sliceableModel(0), @@ -870,8 +872,9 @@ (QString(darkbg ? "Bright Blue" : "Blue")); } -QString -SliceLayer::toXmlString(QString indent, QString extraAttributes) const +void +SliceLayer::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { QString s; @@ -886,7 +889,7 @@ .arg(m_gain) .arg(m_normalize ? "true" : "false"); - return SingleColourLayer::toXmlString(indent, extraAttributes + " " + s); + SingleColourLayer::toXml(stream, indent, extraAttributes + " " + s); } void diff -r c30a7cd29f4a -r c0b9eec70639 layer/SliceLayer.h --- a/layer/SliceLayer.h Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/SliceLayer.h Thu Oct 18 10:15:07 2007 +0000 @@ -101,8 +101,8 @@ void setNormalize(bool n); bool getNormalize() const; - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; public slots: void sliceableModelReplaced(const Model *, const Model *); diff -r c30a7cd29f4a -r c0b9eec70639 layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/SpectrogramLayer.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -35,6 +35,7 @@ #include #include #include +#include #include @@ -3133,8 +3134,9 @@ } -QString -SpectrogramLayer::toXmlString(QString indent, QString extraAttributes) const +void +SpectrogramLayer::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { QString s; @@ -3168,7 +3170,7 @@ .arg(m_normalizeColumns ? "true" : "false") .arg(m_normalizeVisibleArea ? "true" : "false"); - return Layer::toXmlString(indent, extraAttributes + " " + s); + Layer::toXml(stream, indent, extraAttributes + " " + s); } void diff -r c30a7cd29f4a -r c0b9eec70639 layer/SpectrogramLayer.h --- a/layer/SpectrogramLayer.h Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/SpectrogramLayer.h Thu Oct 18 10:15:07 2007 +0000 @@ -207,8 +207,8 @@ virtual bool getYScaleValue(const View *, int, float &, QString &) const; - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; void setProperties(const QXmlAttributes &attributes); diff -r c30a7cd29f4a -r c0b9eec70639 layer/SpectrumLayer.cpp --- a/layer/SpectrumLayer.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/SpectrumLayer.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -24,6 +24,8 @@ #include "base/ColourMapper.h" #include +#include + SpectrumLayer::SpectrumLayer() : m_originModel(0), @@ -795,17 +797,16 @@ curve = m_biasCurve; } -QString -SpectrumLayer::toXmlString(QString indent, QString extraAttributes) const +void +SpectrumLayer::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { - QString s; - - s += QString("windowSize=\"%1\" " - "windowHopLevel=\"%2\"") + QString s = QString("windowSize=\"%1\" " + "windowHopLevel=\"%2\"") .arg(m_windowSize) .arg(m_windowHopLevel); - return SliceLayer::toXmlString(indent, extraAttributes + " " + s); + SliceLayer::toXml(stream, indent, extraAttributes + " " + s); } void diff -r c30a7cd29f4a -r c0b9eec70639 layer/SpectrumLayer.h --- a/layer/SpectrumLayer.h Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/SpectrumLayer.h Thu Oct 18 10:15:07 2007 +0000 @@ -91,8 +91,8 @@ void setShowPeaks(bool); bool getShowPeaks() const { return m_showPeaks; } - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; protected slots: void preferenceChanged(PropertyContainer::PropertyName name); diff -r c30a7cd29f4a -r c0b9eec70639 layer/TextLayer.cpp --- a/layer/TextLayer.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/TextLayer.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -705,10 +706,11 @@ (QString(darkbg ? "Bright Orange" : "Orange")); } -QString -TextLayer::toXmlString(QString indent, QString extraAttributes) const +void +TextLayer::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { - return SingleColourLayer::toXmlString(indent, extraAttributes); + SingleColourLayer::toXml(stream, indent, extraAttributes); } void diff -r c30a7cd29f4a -r c0b9eec70639 layer/TextLayer.h --- a/layer/TextLayer.h Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/TextLayer.h Thu Oct 18 10:15:07 2007 +0000 @@ -79,8 +79,8 @@ virtual bool getValueExtents(float &min, float &max, bool &logarithmic, QString &unit) const; - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; void setProperties(const QXmlAttributes &attributes); diff -r c30a7cd29f4a -r c0b9eec70639 layer/TimeInstantLayer.cpp --- a/layer/TimeInstantLayer.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/TimeInstantLayer.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -727,12 +728,14 @@ (QString(darkbg ? "Bright Purple" : "Purple")); } -QString -TimeInstantLayer::toXmlString(QString indent, QString extraAttributes) const +void +TimeInstantLayer::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { - return SingleColourLayer::toXmlString(indent, extraAttributes + - QString(" plotStyle=\"%1\"") - .arg(m_plotStyle)); + SingleColourLayer::toXml(stream, indent, + extraAttributes + + QString(" plotStyle=\"%1\"") + .arg(m_plotStyle)); } void diff -r c30a7cd29f4a -r c0b9eec70639 layer/TimeInstantLayer.h --- a/layer/TimeInstantLayer.h Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/TimeInstantLayer.h Thu Oct 18 10:15:07 2007 +0000 @@ -91,8 +91,8 @@ return false; } - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; void setProperties(const QXmlAttributes &attributes); diff -r c30a7cd29f4a -r c0b9eec70639 layer/TimeRulerLayer.cpp --- a/layer/TimeRulerLayer.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/TimeRulerLayer.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -314,10 +314,11 @@ (QString(darkbg ? "White" : "Black")); } -QString -TimeRulerLayer::toXmlString(QString indent, QString extraAttributes) const +void +TimeRulerLayer::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { - return SingleColourLayer::toXmlString(indent, extraAttributes); + SingleColourLayer::toXml(stream, indent, extraAttributes); } void diff -r c30a7cd29f4a -r c0b9eec70639 layer/TimeRulerLayer.h --- a/layer/TimeRulerLayer.h Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/TimeRulerLayer.h Thu Oct 18 10:15:07 2007 +0000 @@ -51,8 +51,8 @@ return false; } - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; void setProperties(const QXmlAttributes &attributes); diff -r c30a7cd29f4a -r c0b9eec70639 layer/TimeValueLayer.cpp --- a/layer/TimeValueLayer.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/TimeValueLayer.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -1389,14 +1390,16 @@ return true; } -QString -TimeValueLayer::toXmlString(QString indent, QString extraAttributes) const +void +TimeValueLayer::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { - return SingleColourLayer::toXmlString(indent, extraAttributes + - QString(" colourMap=\"%1\" plotStyle=\"%2\" verticalScale=\"%3\"") - .arg(m_colourMap) - .arg(m_plotStyle) - .arg(m_verticalScale)); + SingleColourLayer::toXml(stream, indent, + extraAttributes + + QString(" colourMap=\"%1\" plotStyle=\"%2\" verticalScale=\"%3\"") + .arg(m_colourMap) + .arg(m_plotStyle) + .arg(m_verticalScale)); } void diff -r c30a7cd29f4a -r c0b9eec70639 layer/TimeValueLayer.h --- a/layer/TimeValueLayer.h Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/TimeValueLayer.h Thu Oct 18 10:15:07 2007 +0000 @@ -114,8 +114,8 @@ virtual bool getDisplayExtents(float &min, float &max) const; - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; void setProperties(const QXmlAttributes &attributes); diff -r c30a7cd29f4a -r c0b9eec70639 layer/WaveformLayer.cpp --- a/layer/WaveformLayer.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/WaveformLayer.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -23,6 +23,7 @@ #include #include +#include #include #include @@ -1248,8 +1249,9 @@ } } -QString -WaveformLayer::toXmlString(QString indent, QString extraAttributes) const +void +WaveformLayer::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { QString s; @@ -1274,7 +1276,7 @@ .arg(m_aggressive) .arg(m_autoNormalize); - return SingleColourLayer::toXmlString(indent, extraAttributes + " " + s); + SingleColourLayer::toXml(stream, indent, extraAttributes + " " + s); } void diff -r c30a7cd29f4a -r c0b9eec70639 layer/WaveformLayer.h --- a/layer/WaveformLayer.h Wed Oct 17 12:58:45 2007 +0000 +++ b/layer/WaveformLayer.h Thu Oct 18 10:15:07 2007 +0000 @@ -179,8 +179,8 @@ virtual bool getYScaleDifference(const View *v, int y0, int y1, float &diff, QString &unit) const; - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; virtual void setProperties(const QXmlAttributes &attributes); diff -r c30a7cd29f4a -r c0b9eec70639 view/Pane.cpp --- a/view/Pane.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/view/Pane.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -30,6 +30,8 @@ #include #include #include +#include + #include #include @@ -2237,11 +2239,12 @@ emit contextHelpChanged(""); } -QString -Pane::toXmlString(QString indent, QString extraAttributes) const +void +Pane::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { - return View::toXmlString - (indent, + View::toXml + (stream, indent, QString("type=\"pane\" centreLineVisible=\"%1\" height=\"%2\" %3") .arg(m_centreLineVisible).arg(height()).arg(extraAttributes)); } diff -r c30a7cd29f4a -r c0b9eec70639 view/Pane.h --- a/view/Pane.h Wed Oct 17 12:58:45 2007 +0000 +++ b/view/Pane.h Thu Oct 18 10:15:07 2007 +0000 @@ -58,8 +58,8 @@ virtual QSize getImageSize(size_t f0, size_t f1); virtual QSize getImageSize() { return View::getImageSize(); } - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; static void registerShortcuts(KeyReference &kr); diff -r c30a7cd29f4a -r c0b9eec70639 view/View.cpp --- a/view/View.cpp Wed Oct 17 12:58:45 2007 +0000 +++ b/view/View.cpp Thu Oct 18 10:15:07 2007 +0000 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -2128,20 +2129,19 @@ return QSize(x1 - x0, height()); } -QString -View::toXmlString(QString indent, QString extraAttributes) const +void +View::toXml(QTextStream &stream, + QString indent, QString extraAttributes) const { - QString s; + stream << indent; - s += indent; - - s += QString("\n") + stream << QString("\n") .arg(m_centreFrame) .arg(m_zoomLevel) .arg(m_followPan) @@ -2152,14 +2152,12 @@ for (size_t i = 0; i < m_layers.size(); ++i) { bool visible = !m_layers[i]->isLayerDormant(this); - s += m_layers[i]->toBriefXmlString(indent + " ", - QString("visible=\"%1\"") - .arg(visible ? "true" : "false")); + m_layers[i]->toBriefXml(stream, indent + " ", + QString("visible=\"%1\"") + .arg(visible ? "true" : "false")); } - s += indent + "\n"; - - return s; + stream << indent + "\n"; } ViewPropertyContainer::ViewPropertyContainer(View *v) : diff -r c30a7cd29f4a -r c0b9eec70639 view/View.h --- a/view/View.h Wed Oct 17 12:58:45 2007 +0000 +++ b/view/View.h Thu Oct 18 10:15:07 2007 +0000 @@ -243,8 +243,8 @@ virtual bool getValueExtents(QString unit, float &min, float &max, bool &log) const; - virtual QString toXmlString(QString indent = "", - QString extraAttributes = "") const; + virtual void toXml(QTextStream &stream, QString indent = "", + QString extraAttributes = "") const; // First frame actually in model, to right of scale, if present virtual size_t getFirstVisibleFrame() const;