copy operator

This commit is contained in:
fluxgen 2004-02-28 16:55:22 +00:00
parent 489c2f4dd0
commit 60ec2e2177
2 changed files with 17 additions and 17 deletions

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: Color.cc,v 1.8 2004/01/09 21:36:21 fluxgen Exp $ // $Id: Color.cc,v 1.9 2004/02/28 16:55:22 fluxgen Exp $
#include "Color.hh" #include "Color.hh"
@ -105,16 +105,16 @@ bool Color::setFromString(const char *color_string, int screen) {
return true; return true;
} }
/*
Color &Color::Color::operator = (const Color &col_copy) {
// check for aliasing
if (this == &col_copy)
return *this;
copy(col_copy); Color &Color::Color::operator = (const Color &col_copy) {
return *this; // check for aliasing
} if (this == &col_copy)
*/ return *this;
copy(col_copy);
return *this;
}
void Color::free() { void Color::free() {
if (isAllocated()) { if (isAllocated()) {
@ -137,9 +137,9 @@ void Color::copy(const Color &col_copy) {
free(); free();
allocate(col_copy.red(), allocate(col_copy.red()*0xFF,
col_copy.green(), col_copy.green()*0xFF,
col_copy.blue(), col_copy.blue()*0xFF,
col_copy.m_screen); col_copy.m_screen);
} }

View file

@ -1,5 +1,5 @@
// Color.hh for Fluxbox Window Manager // Color.hh for Fluxbox Window Manager
// Copyright (c) 2002 Henrik Kinnunen (fluxgen@users.sourceforge.net) // Copyright (c) 2002-2004 Henrik Kinnunen (fluxgen@users.sourceforge.net)
// //
// from Image.hh for Blackbox - an X11 Window manager // from Image.hh for Blackbox - an X11 Window manager
// Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net)
@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: Color.hh,v 1.6 2003/12/16 17:06:49 fluxgen Exp $ // $Id: Color.hh,v 1.7 2004/02/28 16:55:22 fluxgen Exp $
#ifndef FBTK_COLOR_HH #ifndef FBTK_COLOR_HH
#define FBTK_COLOR_HH #define FBTK_COLOR_HH
@ -46,8 +46,8 @@ public:
bool setFromString(const char *color_string, int screen); bool setFromString(const char *color_string, int screen);
/// TODO don't like this /// TODO don't like this
void setPixel(unsigned long pixel) { m_pixel = pixel; } void setPixel(unsigned long pixel) { m_pixel = pixel; }
// TODO
//Color &operator = (const Color &col_copy); Color &operator = (const Color &col_copy);
inline bool isAllocated() const { return m_allocated; } inline bool isAllocated() const { return m_allocated; }
inline unsigned short red() const { return m_red; } inline unsigned short red() const { return m_red; }