tool_namespace.h¶
src/facade/tool_namespace.h
@file tool_namespace.h @brief gh#145: the bridge's tool namespace, as a pure pair of functions.
Owners: @tvanfossen
qualify_tool_name
std::string entropic::facade::qualify_tool_name(const std::string &prefix, const std::string &suffix)
Qualify a bare tool suffix with the configured namespace.
src/facade/tool_namespace.h:45
Called by SCENARIO, ask_status_tool, ask_tool, no_args_tool, session_scoped_tool
Calls none
Source · 7 lines
inline std::string qualify_tool_name(const std::string& prefix,
const std::string& suffix) {
if (prefix.empty()) {
return suffix;
}
return prefix + "." + suffix;
}Activity · 3 steps
Requirements
strip_tool_prefix
std::string entropic::facade::strip_tool_prefix(const std::string &prefix, const std::string &name)
Recover the bare suffix from a wire name.
src/facade/tool_namespace.h:70
Source · 11 lines
inline std::string strip_tool_prefix(const std::string& prefix,
const std::string& name) {
if (prefix.empty()) {
return name;
}
const std::string qualified = prefix + ".";
if (name.rfind(qualified, 0) != 0) {
return name;
}
return name.substr(qualified.size());
}