| 306 | // ���� handlersocket �ı��뷽ʽ |
| 307 | |
| 308 | void session::serialize(const std::map<string, session_string>& attrs, |
| 309 | string& out) |
| 310 | { |
| 311 | out.clear(); // ����������� |
| 312 | |
| 313 | std::map<string, session_string>::const_iterator it = attrs.begin(); |
| 314 | if (it == attrs.end()) { |
| 315 | return; |
| 316 | } |
| 317 | |
| 318 | // ���ӵ�һ������ |
| 319 | const char ch = 1; |
| 320 | escape(it->first.c_str(), it->first.length(), out); |
| 321 | escape(&ch, 1, out); |
| 322 | escape(it->second.c_str(), it->second.length(), out); |
| 323 | ++it; |
| 324 | |
| 325 | // ���Ӻ��������� |
| 326 | for (; it != attrs.end(); ++it) { |
| 327 | // ����һ������������Ķ���Ҫ���ӷָ��� |
| 328 | out << '\t'; |
| 329 | escape(it->first.c_str(), it->first.length(), out); |
| 330 | escape(&ch, 1, out); |
| 331 | escape(it->second.c_str(), it->second.length(), out); |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | // ���� handlersocket �Ľ��뷽ʽ |
| 336 | |