| 47 | } |
| 48 | |
| 49 | std::string RestfulMethodPath::to_string() const { |
| 50 | std::string s; |
| 51 | s.reserve(service_name.size() + prefix.size() + 2 + postfix.size()); |
| 52 | if (!service_name.empty()) { |
| 53 | s.push_back('/'); |
| 54 | s.append(service_name); |
| 55 | } |
| 56 | if (has_wildcard) { |
| 57 | s.append(prefix); |
| 58 | s.push_back('*'); |
| 59 | butil::StringPiece tmp = remove_last_char(postfix); |
| 60 | s.append(tmp.data(), tmp.size()); |
| 61 | } else { |
| 62 | butil::StringPiece tmp = remove_last_char(prefix); |
| 63 | s.append(tmp.data(), tmp.size()); |
| 64 | } |
| 65 | return s; |
| 66 | } |
| 67 | |
| 68 | struct DebugPrinter { |
| 69 | explicit DebugPrinter(const RestfulMethodPath& p) : path(&p) {} |