idchangelog.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "idchangelog.h"
00013
00014 #include <kdebug.h>
00015
00016 IDChangeLog::IDChangeLog() {}
00017
00018 IDChangeLog::IDChangeLog(const IDChangeLog& Other) {
00019 m_LogArray = Other.m_LogArray;
00020 }
00021
00022 IDChangeLog::~IDChangeLog() {}
00023
00024 IDChangeLog& IDChangeLog::operator=(const IDChangeLog& Other) {
00025 m_LogArray = Other.m_LogArray;
00026
00027 return *this;
00028 }
00029
00030 bool IDChangeLog::operator==(const IDChangeLog& ) {
00031
00032 return false;
00033 }
00034
00035 Uml::IDType IDChangeLog::findNewID(Uml::IDType OldID) {
00036 uint count = m_LogArray.size();
00037 for(uint i = 0; i < count; i++) {
00038 if((m_LogArray.point(i)).y() == OldID) {
00039 return (m_LogArray.point(i)).x();
00040 }
00041 }
00042
00043 return Uml::id_None;
00044 }
00045
00046 IDChangeLog& IDChangeLog::operator+=(const IDChangeLog& Other) {
00047
00048 uint count = Other.m_LogArray.size();
00049 for(uint i = 0; i < count; i++) {
00050 addIDChange((Other.m_LogArray.point(i)).y(), (Other.m_LogArray.point(i)).x());
00051 }
00052
00053 return *this;
00054 }
00055
00056 void IDChangeLog::addIDChange(Uml::IDType OldID, Uml::IDType NewID) {
00057 uint pos;
00058 if(!findIDChange(OldID, NewID, pos)) {
00059 pos = m_LogArray.size();
00060 m_LogArray.resize(pos + 1);
00061 m_LogArray.setPoint(pos, NewID, OldID);
00062 } else {
00063 m_LogArray.setPoint(pos, NewID, OldID);
00064 }
00065 }
00066
00067 Uml::IDType IDChangeLog::findOldID(Uml::IDType NewID) {
00068 uint count = m_LogArray.size();
00069 for(uint i = 0; i < count; i++) {
00070 if((m_LogArray.point(i)).x() == NewID) {
00071 return (m_LogArray.point(i)).y();
00072 }
00073 }
00074
00075 return Uml::id_None;
00076 }
00077
00078 bool IDChangeLog::findIDChange(Uml::IDType OldID, Uml::IDType NewID, uint& pos) {
00079 uint count = m_LogArray.size();
00080 for(uint i = 0; i < count; i++) {
00081 if(((m_LogArray.point(i)).y() == OldID) && ((m_LogArray.point(i)).x() == NewID)) {
00082 pos = i;
00083 return true;
00084 }
00085 }
00086
00087 return false;
00088 }
00089
00090 void IDChangeLog::removeChangeByNewID(Uml::IDType OldID) {
00091 uint count = m_LogArray.size();
00092 for(uint i = 0; i < count; i++) {
00093 if((m_LogArray.point(i)).y() == OldID) {
00094 m_LogArray.setPoint(i, Uml::id_None, OldID);
00095 }
00096 }
00097 }
This file is part of the documentation for umbrello Version 3.1.0.