| 159 | return encoded.str(); |
| 160 | } |
| 161 | int SocketIOPacket::typeAsNumber() const { |
| 162 | ccstd::string::size_type num = 0; |
| 163 | auto item = std::find(_types.begin(), _types.end(), _type); |
| 164 | if (item != _types.end()) { |
| 165 | num = item - _types.begin(); |
| 166 | } |
| 167 | return static_cast<int>(num); |
| 168 | } |
| 169 | const ccstd::string &SocketIOPacket::typeForIndex(int index) const { |
| 170 | return _types.at(index); |
| 171 | } |