- Timestamp:
- Dec 26, 2012, 3:10:05 PM (12 years ago)
- Branches:
- master
- Children:
- 60776f2
- Parents:
- 4c202e0
- Location:
- common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
common/Player.cpp
r4c202e0 r3b8adee 2 2 3 3 #include <iostream> 4 #include <sstream> 5 #include <cstring> 4 6 5 7 using namespace std; … … 30 32 } 31 33 34 void Player::serialize(char* buffer) 35 { 36 ostringstream oss; 37 38 oss << this->name; 39 40 memcpy(buffer, oss.str().c_str(), this->name.length()+1); 41 } 42 43 void Player::deserialize(char* buffer) 44 { 45 istringstream iss; 46 47 iss >> this->name; 48 } 49 32 50 void Player::setAddr(sockaddr_in addr) 33 51 { 34 52 this->addr = addr; 35 53 } 36 37 void Player::clearSensitiveInfo()38 {39 this->password = "";40 this->addr.sin_family = 0;41 this->addr.sin_port = 0;42 this->addr.sin_addr.s_addr = 0;43 } -
common/Player.h
r4c202e0 r3b8adee 23 23 ~Player(); 24 24 25 void serialize(char* buffer); 26 void deserialize(char* buffer); 27 25 28 void setAddr(sockaddr_in addr); 26 void clearSensitiveInfo();27 29 28 30 string name;
Note:
See TracChangeset
for help on using the changeset viewer.