umbrello: umbrello/clipboard/idchangelog.h Source File

umbrello 2.32.0 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

idchangelog.h
Go to the documentation of this file.
1 /***************************************************************************
2 * This program is free software; you can redistribute it and/or modify *
3 * it under the terms of the GNU General Public License as published by *
4 * the Free Software Foundation; either version 2 of the License, or *
5 * (at your option) any later version. *
6 * *
7 * copyright (C) 2002-2020 *
8 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9 ***************************************************************************/
10
11 #ifndef IDCHANGELOG_H
12 #define IDCHANGELOG_H
13
14 #include "basictypes.h"
15
16 #include <QVector>
17
26 class IDChangeLog
27 {
28 public:
29
30 IDChangeLog();
31 IDChangeLog(const IDChangeLog& Other);
32
33 ~IDChangeLog();
34
35 IDChangeLog& operator=(const IDChangeLog& Other);
36
37 bool operator==(const IDChangeLog& Other) const;
38
39 void addIDChange(Uml::ID::Type OldID, Uml::ID::Type NewID);
40
41 IDChangeLog& operator+=(const IDChangeLog& Other);
42
43 Uml::ID::Type findNewID(Uml::ID::Type OldID);
44 Uml::ID::Type findOldID(Uml::ID::Type NewID);
45
46 void removeChangeByNewID(Uml::ID::Type OldID);
47
48 enum SpecialIDs
49 {
50 NullID = -1000
51 };
52
53 private:
54
58 class Point
59 {
60 public:
61 Point() {}
62 Point(const Uml::ID::Type &x, const Uml::ID::Type &y) : m_x(x), m_y(y) {}
63 virtual ~Point() {}
64 void setX(const Uml::ID::Type &x) { m_x = x; }
65 Uml::ID::Type x() const { return m_x; }
66 void setY(const Uml::ID::Type &y) { m_y = y; }
67 Uml::ID::Type y() const { return m_y; }
68 private:
69 Uml::ID::Type m_x, m_y;
70 };
71
72 class PointArray : QVector<Point*>
73 {
74 public:
75 void setPoint(uint i, const Uml::ID::Type &x, const Uml::ID::Type &y) {
76 QVector<Point*>::insert(i, new Point(x, y));
77 }
78 Point* point(uint i) const { return QVector<Point*>::at(i); }
79 uint size() const { return QVector<Point*>::size(); }
80 bool resize(uint size) { QVector<Point*>::resize(size); return true; }
81 };
82
83 PointArray m_LogArray;
84
85 bool findIDChange(Uml::ID::Type OldID, Uml::ID::Type NewID, uint& pos);
86 };
87
88 #endif
basictypes.h
IDChangeLog::PointArray
Definition: idchangelog.h:73
IDChangeLog::PointArray::point
Point * point(uint i) const
Definition: idchangelog.h:78
IDChangeLog::PointArray::size
uint size() const
Definition: idchangelog.h:79
IDChangeLog::PointArray::setPoint
void setPoint(uint i, const Uml::ID::Type &x, const Uml::ID::Type &y)
Definition: idchangelog.h:75
IDChangeLog::PointArray::resize
bool resize(uint size)
Definition: idchangelog.h:80
IDChangeLog::Point
Definition: idchangelog.h:59
IDChangeLog::Point::m_x
Uml::ID::Type m_x
Definition: idchangelog.h:69
IDChangeLog::Point::y
Uml::ID::Type y() const
Definition: idchangelog.h:67
IDChangeLog::Point::m_y
Uml::ID::Type m_y
Definition: idchangelog.h:69
IDChangeLog::Point::setX
void setX(const Uml::ID::Type &x)
Definition: idchangelog.h:64
IDChangeLog::Point::Point
Point(const Uml::ID::Type &x, const Uml::ID::Type &y)
Definition: idchangelog.h:62
IDChangeLog::Point::setY
void setY(const Uml::ID::Type &y)
Definition: idchangelog.h:66
IDChangeLog::Point::Point
Point()
Definition: idchangelog.h:61
IDChangeLog::Point::~Point
virtual ~Point()
Definition: idchangelog.h:63
IDChangeLog::Point::x
Uml::ID::Type x() const
Definition: idchangelog.h:65
IDChangeLog
Definition: idchangelog.h:27
IDChangeLog::operator==
bool operator==(const IDChangeLog &Other) const
Definition: idchangelog.cpp:51
IDChangeLog::operator+=
IDChangeLog & operator+=(const IDChangeLog &Other)
Definition: idchangelog.cpp:77
IDChangeLog::addIDChange
void addIDChange(Uml::ID::Type OldID, Uml::ID::Type NewID)
Definition: idchangelog.cpp:88
IDChangeLog::findNewID
Uml::ID::Type findNewID(Uml::ID::Type OldID)
Definition: idchangelog.cpp:62
IDChangeLog::m_LogArray
PointArray m_LogArray
Definition: idchangelog.h:83
IDChangeLog::~IDChangeLog
~IDChangeLog()
Definition: idchangelog.cpp:31
IDChangeLog::IDChangeLog
IDChangeLog()
Definition: idchangelog.cpp:16
IDChangeLog::removeChangeByNewID
void removeChangeByNewID(Uml::ID::Type OldID)
Definition: idchangelog.cpp:124
IDChangeLog::findOldID
Uml::ID::Type findOldID(Uml::ID::Type NewID)
Definition: idchangelog.cpp:99
IDChangeLog::operator=
IDChangeLog & operator=(const IDChangeLog &Other)
Definition: idchangelog.cpp:41
IDChangeLog::findIDChange
bool findIDChange(Uml::ID::Type OldID, Uml::ID::Type NewID, uint &pos)
Definition: idchangelog.cpp:111
IDChangeLog::SpecialIDs
SpecialIDs
Definition: idchangelog.h:49
IDChangeLog::NullID
@ NullID
An impossible id value.
Definition: idchangelog.h:50
x
int x
Definition: cxx11-lambda-functions-and-expressions.h:4
Uml::ID::Type
std::string Type
Definition: basictypes.h:385