From 2d35ee03c024bfc42b64d47244db3e9224ad0912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sun, 6 May 2012 16:50:02 +0200 Subject: [PATCH] Added operator== implementation --- src/libs/icon/shape/VectorPath.cpp | 30 +++++++++++++++++++++++++++++- src/libs/icon/shape/VectorPath.h | 4 ++-- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/libs/icon/shape/VectorPath.cpp b/src/libs/icon/shape/VectorPath.cpp index 87c317dbed..a2f88a8a73 100644 --- a/src/libs/icon/shape/VectorPath.cpp +++ b/src/libs/icon/shape/VectorPath.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2006-2009, Haiku. + * Copyright 2006-2012, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -317,6 +317,34 @@ VectorPath::operator=(const VectorPath& from) } +bool +VectorPath::operator==(const VectorPath& other) const +{ + if (fClosed != other.fClosed) + return false; + + if (fPointCount != other.fPointCount) + return false; + + if (fPath == NULL && other.fPath == NULL) + return true; + + if (fPath == NULL || other.fPath == NULL) + return false; + + for (int32 i = 0; i < fPointCount; i++) { + if (fPath[i].point != other.fPath[i].point + || fPath[i].point_in != other.fPath[i].point_in + || fPath[i].point_out != other.fPath[i].point_out + || fPath[i].connected != other.fPath[i].connected) { + return false; + } + } + + return true; +} + + void VectorPath::MakeEmpty() { diff --git a/src/libs/icon/shape/VectorPath.h b/src/libs/icon/shape/VectorPath.h index 7deb160cce..b0cd632e67 100644 --- a/src/libs/icon/shape/VectorPath.h +++ b/src/libs/icon/shape/VectorPath.h @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007, Haiku. + * Copyright 2006-2012, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -89,7 +89,7 @@ class VectorPath { // VectorPath VectorPath& operator=(const VectorPath& from); -// bool operator==(const VectorPath& from) const; + bool operator==(const VectorPath& from) const; void MakeEmpty();