Subversion Repositories Scribus

Rev

Rev 12285 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#include <cassert>  //added to make Fedora-5 happy

//#include <QDebug>

#include "fpoint.h"
#include "scfonts.h"
#include "scribus.h"
#include "scribusdoc.h"
#include "sctext_shared.h"
#include "util.h"

ScText_Shared::ScText_Shared() : QList<ScText*>(),refs(1), len(0)
{
}
               

ScText_Shared::ScText_Shared(const ScText_Shared& other) : QList<ScText*>(),
        defaultStyle(other.defaultStyle),
        refs(1), len(0), trailingStyle(other.trailingStyle)
{
        QListIterator<ScText*> it( other );
        ScText* elem;
        while ( it.hasNext() ) {
                elem = it.next();
                ScText* elem2 = new ScText(*elem);
                append(elem2);
        }
        len = count();
}

ScText_Shared& ScText_Shared::operator= (const ScText_Shared& other)
{
        if (this != &other)
        {
                defaultStyle = other.defaultStyle;
                trailingStyle = other.trailingStyle;
                clear();
                QListIterator<ScText*> it( other );
                ScText* elem;
                while ( it.hasNext() ) {
                        elem = it.next();
                        ScText* elem2 = new ScText(*elem);
                        append(elem2);
                }
                len = count();
        }
        return *this;
}

ScText_Shared::~ScText_Shared()
{
//              qDebug(QString("~ScText_Shared() %1").arg(reinterpret_cast<uint>(this)));
        while(!this->isEmpty())
                delete this->takeFirst();
}