| 299 | } |
| 300 | |
| 301 | bool isTopicInMap(map<string, map<string, string>>& topic2info, string topic_name) { // NOLINT |
| 302 | bool res = false; |
| 303 | if (topic2info.find(topic_name) != topic2info.end()) { |
| 304 | res = true; |
| 305 | } else { |
| 306 | size_t first_slash = topic_name.find_first_of("/"); |
| 307 | if (first_slash == 0) { |
| 308 | if (topic2info.find(topic_name.substr(1)) != topic2info.end()) { |
| 309 | res = true; |
| 310 | } |
| 311 | } else { |
| 312 | if (topic2info.find("/" + topic_name) != topic2info.end()) { |
| 313 | res = true; |
| 314 | } |
| 315 | } |
| 316 | } |
| 317 | return res; |
| 318 | } |
| 319 | |
| 320 | bool findTopicInMap(map<string, map<string, string>>& topic2info, // NOLINT |
| 321 | string topic_name, |