| 35 | } |
| 36 | |
| 37 | SegmentHint SegmentHint::FromBase64(const std::string &base64Hint) |
| 38 | { |
| 39 | BOOST_ASSERT_MSG(base64Hint.size() == ENCODED_SEGMENT_HINT_SIZE, "Hint has invalid size"); |
| 40 | |
| 41 | // We need mutability but don't want to change the API |
| 42 | auto encoded = base64Hint; |
| 43 | |
| 44 | // Reverses above encoding we need for GET parameters in URL |
| 45 | std::replace(begin(encoded), end(encoded), '-', '+'); |
| 46 | std::replace(begin(encoded), end(encoded), '_', '/'); |
| 47 | |
| 48 | return decodeBase64Bytewise<SegmentHint>(encoded); |
| 49 | } |
| 50 | |
| 51 | bool operator==(const SegmentHint &lhs, const SegmentHint &rhs) |
| 52 | { |