r22028 by craig - Rework some of the marks code, not really any functional changes other than stopping initialising QStrings unnecessarily
scribus-commit
scribus-commit at lists.scribus.net
Tue May 16 21:12:39 UTC 2017
Author: craig
Date: Tue May 16 21:12:38 2017
New Revision: 22028
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22028
Log:
Rework some of the marks code, not really any functional changes other than stopping initialising QStrings unnecessarily
Modified:
trunk/Scribus/scribus/marks.cpp
trunk/Scribus/scribus/marks.h
Modified: trunk/Scribus/scribus/marks.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22028&path=/trunk/Scribus/scribus/marks.cpp
==============================================================================
--- trunk/Scribus/scribus/marks.cpp (original)
+++ trunk/Scribus/scribus/marks.cpp Tue May 16 21:12:38 2017
@@ -2,6 +2,35 @@
#include <QString>
#include "marks.h"
+
+Mark::Mark(const Mark& other)
+ : label(other.label),
+ OwnPage(other.OwnPage),
+ typ(other.typ),
+ data(other.data)
+{
+
+}
+
+void Mark::setValues(const QString& l, int p, MarkType t, MarkData d)
+{
+ label = l;
+ OwnPage = p;
+ typ = t;
+ data = d;
+}
+
+void Mark::getMark(QString& l, MarkType& t)
+{
+ l = data.destmarkName;
+ t = data.destmarkType;
+}
+
+void Mark::setMark(const QString& l, MarkType t)
+{
+ data.destmarkName = l;
+ data.destmarkType = t;
+}
const QString Mark::getString()
{
@@ -12,3 +41,45 @@
{
data.strtxt = str;
}
+
+void Mark::setNotePtr(TextNote* note)
+{
+ data.notePtr = note;
+}
+
+bool Mark::hasItemPtr()
+{
+ return data.itemPtr != NULL;
+}
+
+bool Mark::hasString()
+{
+ return !data.strtxt.isEmpty();
+}
+
+bool Mark::hasMark()
+{
+ return data.destmarkName != "";
+}
+
+bool Mark::isUnique()
+{
+ return ((typ != MARKVariableTextType) && (typ != MARKIndexType) && (typ != MARKBullNumType));
+}
+
+bool Mark::isNoteType()
+{
+ return ((typ == MARKNoteMasterType) || (typ==MARKNoteFrameType));
+}
+
+bool Mark::isType(const MarkType t)
+{
+ return t==typ;
+}
+
+BulNumMark::BulNumMark()
+ : Mark()
+{
+ label = "BullNumMark";
+ typ = MARKBullNumType;
+}
Modified: trunk/Scribus/scribus/marks.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22028&path=/trunk/Scribus/scribus/marks.h
==============================================================================
--- trunk/Scribus/scribus/marks.h (original)
+++ trunk/Scribus/scribus/marks.h Tue May 16 21:12:38 2017
@@ -34,7 +34,7 @@
QString itemName;
MarkType markTyp;
- MarkData() : strtxt(""), itemPtr(NULL), destmarkName(""), destmarkType(MARKNoType), notePtr(NULL), itemName(""), markTyp(MARKNoType) {}
+ MarkData() : itemPtr(NULL), destmarkType(MARKNoType), notePtr(NULL), markTyp(MARKNoType) {}
};
class SCRIBUS_API Mark
@@ -44,15 +44,15 @@
friend class BulNumMark;
//only ScribusDoc && ScribusMainWindow can create and delete marks
private:
- Mark() : label(""), OwnPage(-1), typ(MARKNoType), data() {}
- Mark(const Mark& other) : label(other.label), OwnPage(other.OwnPage), typ(other.typ), data(other.data) {}
+ Mark() : OwnPage(-1), typ(MARKNoType), data() {}
+ Mark(const Mark& other);
public:
QString label;
int OwnPage;
- void setValues(QString l, int p, MarkType t, MarkData d) { label = l; OwnPage = p; typ = t; data = d; }
- const MarkType getType() { return typ; }
+ void setValues(const QString& l, int p, MarkType t, MarkData d);
+ MarkType getType() { return typ; }
void setType(MarkType t) { typ = t; }
const MarkData getData() { return data; }
void setData(const MarkData d) { data = d; }
@@ -62,7 +62,7 @@
void setItemName( const QString name ) { data.itemName = name; }
//for marks to marks - return label and type of target mark by reference
- const void getMark(QString &l, MarkType &t) { l = data.destmarkName; t = data.destmarkType; }
+ void getMark(QString& l, MarkType &t);
//for marks to marks - set label and type of target mark from mark pointer
void setMark(Mark* mP)
{
@@ -77,20 +77,20 @@
data.destmarkType = mP->getType();
}
}
- void setMark(QString l, MarkType t) { data.destmarkName = l; data.destmarkType = t; }
- const MarkType getMarkType() { return data.markTyp; }
+ void setMark(const QString& l, MarkType t);
+ MarkType getMarkType() { return data.markTyp; }
void setMarkType(MarkType t) { data.markTyp = t; }
const QString getString();
void setString( const QString str );
TextNote* getNotePtr() { return data.notePtr; }
- void setNotePtr(TextNote *note) { data.notePtr = note; }
+ void setNotePtr(TextNote *note);
- bool hasItemPtr() { return data.itemPtr != NULL; }
- bool hasString() { return !data.strtxt.isEmpty(); }
- bool hasMark() { return data.destmarkName != ""; }
- bool isUnique() { return ((typ != MARKVariableTextType) && (typ != MARKIndexType) && (typ != MARKBullNumType)); }
- bool isNoteType() { return ((typ == MARKNoteMasterType) || (typ==MARKNoteFrameType)); }
- bool isType(const MarkType t) { return t==typ; }
+ bool hasItemPtr();
+ bool hasString();
+ bool hasMark();
+ bool isUnique();
+ bool isNoteType();
+ bool isType(const MarkType t);
virtual ~Mark() {}
@@ -102,7 +102,7 @@
class SCRIBUS_API BulNumMark : public Mark
{
public:
- BulNumMark() : Mark() { label = "BullNumMark"; typ = MARKBullNumType; }
+ BulNumMark();
~BulNumMark() {}
};
More information about the scribus-commit
mailing list