mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 11:42:31 +01:00
...dumb
This commit is contained in:
parent
ee8805ca3f
commit
775386190a
@ -38,8 +38,7 @@ private:
|
||||
|
||||
public:
|
||||
Ip();
|
||||
Ip(unsigned char byte0, unsigned char byte1, unsigned char byte2, unsigned char byte3,
|
||||
unsigned char byte4, unsigned char byte5, unsigned char byte6, unsigned char byte7);
|
||||
Ip(unsigned char byte0, unsigned char byte1, unsigned char byte2, unsigned char byte3);
|
||||
Ip(const string& ipString);
|
||||
|
||||
unsigned char getByte(int byteIndex) {return bytes[byteIndex];}
|
||||
|
@ -32,8 +32,7 @@ private:
|
||||
|
||||
public:
|
||||
Ip();
|
||||
Ip(unsigned char byte0, unsigned char byte1, unsigned char byte2, unsigned char byte3,
|
||||
unsigned char byte4, unsigned char byte5, unsigned char byte6, unsigned char byte7);
|
||||
Ip(unsigned char byte0, unsigned char byte1, unsigned char byte2, unsigned char byte3);
|
||||
Ip(const string& ipString);
|
||||
|
||||
unsigned char getByte(int byteIndex) {return bytes[byteIndex];}
|
||||
|
@ -39,22 +39,13 @@ Ip::Ip(){
|
||||
bytes[1]= 0;
|
||||
bytes[2]= 0;
|
||||
bytes[3]= 0;
|
||||
bytes[4]= 0;
|
||||
bytes[5]= 0;
|
||||
bytes[6]= 0;
|
||||
bytes[7]= 0;
|
||||
}
|
||||
|
||||
Ip::Ip(unsigned char byte0, unsigned char byte1, unsigned char byte2, unsigned char byte3,
|
||||
unsigned char byte4, unsigned char byte5, unsigned char byte6, unsigned char byte7){
|
||||
Ip::Ip(unsigned char byte0, unsigned char byte1, unsigned char byte2, unsigned char byte3){
|
||||
bytes[0]= byte0;
|
||||
bytes[1]= byte1;
|
||||
bytes[2]= byte2;
|
||||
bytes[3]= byte3;
|
||||
bytes[4]= byte4;
|
||||
bytes[5]= byte5;
|
||||
bytes[6]= byte6;
|
||||
bytes[7]= byte7;
|
||||
}
|
||||
|
||||
|
||||
@ -62,7 +53,7 @@ Ip::Ip(const string& ipString){
|
||||
int offset= 0;
|
||||
int byteIndex= 0;
|
||||
|
||||
for(byteIndex= 0; byteIndex<8; ++byteIndex){
|
||||
for(byteIndex= 0; byteIndex<4; ++byteIndex){
|
||||
int dotPos= ipString.find_first_of('.', offset);
|
||||
|
||||
bytes[byteIndex]= atoi(ipString.substr(offset, dotPos-offset).c_str());
|
||||
|
@ -165,29 +165,20 @@ Ip::Ip(){
|
||||
bytes[1]= 0;
|
||||
bytes[2]= 0;
|
||||
bytes[3]= 0;
|
||||
bytes[4]= 4;
|
||||
bytes[5]= 5;
|
||||
bytes[6]= 6;
|
||||
bytes[7]= 7;
|
||||
}
|
||||
|
||||
Ip::Ip(unsigned char byte0, unsigned char byte1, unsigned char byte2, unsigned char byte3,
|
||||
unsigned char byte4, unsigned char byte5, unsigned char byte6, unsigned char byte7){
|
||||
Ip::Ip(unsigned char byte0, unsigned char byte1, unsigned char byte2, unsigned char byte3){
|
||||
bytes[0]= byte0;
|
||||
bytes[1]= byte1;
|
||||
bytes[2]= byte2;
|
||||
bytes[3]= byte3;
|
||||
bytes[4]= byte4;
|
||||
bytes[5]= byte5;
|
||||
bytes[6]= byte6;
|
||||
bytes[7]= byte7;
|
||||
}
|
||||
|
||||
Ip::Ip(const string& ipString){
|
||||
int offset= 0;
|
||||
int byteIndex= 0;
|
||||
|
||||
for(byteIndex= 0; byteIndex<8; ++byteIndex){
|
||||
for(byteIndex= 0; byteIndex<4; ++byteIndex){
|
||||
int dotPos= ipString.find_first_of('.', offset);
|
||||
|
||||
bytes[byteIndex]= atoi(ipString.substr(offset, dotPos-offset).c_str());
|
||||
@ -196,8 +187,7 @@ Ip::Ip(const string& ipString){
|
||||
}
|
||||
|
||||
string Ip::getString() const{
|
||||
return intToStr(bytes[0]) + "." + intToStr(bytes[1]) + "." + intToStr(bytes[2]) + "." + intToStr(bytes[3])
|
||||
+ "." +intToStr(bytes[4]) + "." + intToStr(bytes[5]) + "." + intToStr(bytes[6]) + "." + intToStr(bytes[7]);
|
||||
return intToStr(bytes[0]) + "." + intToStr(bytes[1]) + "." + intToStr(bytes[2]) + "." + intToStr(bytes[3]);
|
||||
}
|
||||
|
||||
// =====================================================
|
||||
|
Loading…
x
Reference in New Issue
Block a user