83 |
|
} |
84 |
|
} |
85 |
|
|
86 |
< |
void Host::operator++() |
86 |
> |
bool Host::operator==(const Host& host) const |
87 |
> |
{ |
88 |
> |
if (this->host == host.host) |
89 |
> |
{ |
90 |
> |
if (name == host.name) |
91 |
> |
{ |
92 |
> |
if (address == host.address) |
93 |
> |
{ |
94 |
> |
return platform == host.platform; |
95 |
> |
} |
96 |
> |
else |
97 |
> |
{ |
98 |
> |
return false; |
99 |
> |
} |
100 |
> |
} |
101 |
> |
else |
102 |
> |
{ |
103 |
> |
return false; |
104 |
> |
} |
105 |
> |
} |
106 |
> |
else |
107 |
> |
{ |
108 |
> |
return false; |
109 |
> |
} |
110 |
> |
} |
111 |
> |
|
112 |
> |
Host Host::operator++() |
113 |
|
{ |
114 |
|
ifstream fin(host.c_str()); |
115 |
|
|
116 |
< |
getline(fin, name); |
117 |
< |
fin.read((char*)(address), sizeof(in_addr)); |
118 |
< |
getline(fin, platform); |
119 |
< |
fin.close(); |
116 |
> |
if (fin.is_open()) |
117 |
> |
{ |
118 |
> |
getline(fin, name); |
119 |
> |
fin.read((char*)(address), sizeof(in_addr)); |
120 |
> |
getline(fin, platform); |
121 |
> |
fin.close(); |
122 |
> |
} |
123 |
> |
|
124 |
> |
return *this; |
125 |
> |
} |
126 |
> |
|
127 |
> |
Host Host::operator++(int) |
128 |
> |
{ |
129 |
> |
Host old = *this; |
130 |
> |
|
131 |
> |
++*this; |
132 |
> |
|
133 |
> |
return old; |
134 |
|
} |
135 |
|
|
136 |
< |
void Host::operator--() |
136 |
> |
Host Host::operator--() |
137 |
|
{ |
138 |
|
ofstream fout(host.c_str()); |
139 |
|
|
144 |
|
fout << platform; |
145 |
|
|
146 |
|
fout.close(); |
147 |
+ |
|
148 |
+ |
return *this; |
149 |
+ |
} |
150 |
+ |
|
151 |
+ |
Host Host::operator--(int) |
152 |
+ |
{ |
153 |
+ |
Host old = *this; |
154 |
+ |
|
155 |
+ |
--*this; |
156 |
+ |
|
157 |
+ |
return old; |
158 |
|
} |
159 |
|
|
160 |
|
#ifdef _WIN32 |