From f81e2c908f8c9f6a0b93b5a37bd3855d99dd7c4d Mon Sep 17 00:00:00 2001 From: Josh Allen Date: Sat, 11 Sep 2004 15:11:06 +0000 Subject: [PATCH] Added = operator --- stepmania/src/ezsockets.cpp | 27 +++++++++++++++++++++++++++ stepmania/src/ezsockets.h | 1 + 2 files changed, 28 insertions(+) diff --git a/stepmania/src/ezsockets.cpp b/stepmania/src/ezsockets.cpp index 413a1082a2..ac4c1c1d67 100644 --- a/stepmania/src/ezsockets.cpp +++ b/stepmania/src/ezsockets.cpp @@ -389,6 +389,33 @@ ostream& operator<<(ostream &os, EzSockets &obj) return os; } +EzSockets& EzSockets::operator=(const EzSockets &socket) +{ + if (this == &socket) { + return *this; + } + else + { + blocking = socket.blocking; + fromAddr = socket.fromAddr; + fromAddr_len = socket.fromAddr_len; + string inBuffer = socket.inBuffer; + outBuffer = socket.outBuffer; + state = socket.state; + lastCode = socket.lastCode; //Used for debugging purposes + MAXCON = socket.MAXCON; + sock = socket.sock; + addr = socket.addr; + if (scks == NULL) + scks = new fd_set; + *scks = *socket.scks; + if (scks == NULL) + times = new timeval; + *times = *socket.times; + return *this; + } +} + /**************************\ | Internal Data System | diff --git a/stepmania/src/ezsockets.h b/stepmania/src/ezsockets.h index 7ca811bd38..f5b4e2dfb7 100644 --- a/stepmania/src/ezsockets.h +++ b/stepmania/src/ezsockets.h @@ -93,6 +93,7 @@ public: char operator[] (int i); //Access buffer friend istream& operator>>(istream& is, EzSockets& obj); friend ostream& operator<<(ostream& os, const EzSockets& obj); + EzSockets& operator=(const EzSockets &socket); bool blocking;