Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
7970 cbradney 1
#include <cassert>  //added to make Fedora-5 happy
11184 avox 2
 
11645 fschmid 3
//#include <QDebug>
11184 avox 4
 
7970 cbradney 5
#include "fpoint.h"
6
#include "scfonts.h"
11184 avox 7
#include "scribus.h"
7970 cbradney 8
#include "scribusdoc.h"
9
#include "sctext_shared.h"
10
#include "util.h"
11
 
12340 pierre 12
ScText_Shared::ScText_Shared() : QList<ScText*>(),refs(1), len(0)
7970 cbradney 13
{
14
}
15
 
16
 
10366 jghali 17
ScText_Shared::ScText_Shared(const ScText_Shared& other) : QList<ScText*>(),
7970 cbradney 18
        defaultStyle(other.defaultStyle),
19
        refs(1), len(0), trailingStyle(other.trailingStyle)
20
{
10366 jghali 21
        QListIterator<ScText*> it( other );
7970 cbradney 22
        ScText* elem;
10366 jghali 23
        while ( it.hasNext() ) {
24
                elem = it.next();
7970 cbradney 25
                ScText* elem2 = new ScText(*elem);
26
                append(elem2);
27
        }
28
        len = count();
29
}
30
 
31
ScText_Shared& ScText_Shared::operator= (const ScText_Shared& other)
32
{
33
        if (this != &other)
34
        {
35
                defaultStyle = other.defaultStyle;
36
                trailingStyle = other.trailingStyle;
37
                clear();
10366 jghali 38
                QListIterator<ScText*> it( other );
7970 cbradney 39
                ScText* elem;
10366 jghali 40
                while ( it.hasNext() ) {
41
                        elem = it.next();
7970 cbradney 42
                        ScText* elem2 = new ScText(*elem);
43
                        append(elem2);
44
                }
45
                len = count();
46
        }
47
        return *this;
48
}
49
 
10366 jghali 50
ScText_Shared::~ScText_Shared()
51
{
7970 cbradney 52
//              qDebug(QString("~ScText_Shared() %1").arg(reinterpret_cast<uint>(this)));
10366 jghali 53
        while(!this->isEmpty())
54
                delete this->takeFirst();
7970 cbradney 55
}
56