some helper APIs to find things in a Session

This commit is contained in:
Paul Davis 2025-06-07 21:08:49 -06:00
parent dbe7288dc4
commit 3ac59dc837
2 changed files with 30 additions and 1 deletions

View file

@ -382,11 +382,13 @@ public:
bool io_name_is_legal (const std::string&) const;
std::shared_ptr<Route> route_by_name (std::string) const;
std::shared_ptr<Route> route_by_id (PBD::ID) const;
std::shared_ptr<Stripable> stripable_by_name (std::string) const;
std::shared_ptr<Stripable> stripable_by_id (PBD::ID) const;
std::shared_ptr<Stripable> get_remote_nth_stripable (PresentationInfo::order_t n, PresentationInfo::Flag) const;
std::shared_ptr<Route> get_remote_nth_route (PresentationInfo::order_t n) const;
std::shared_ptr<Route> route_by_selected_count (uint32_t cnt) const;
void routes_using_input_from (const std::string& str, RouteList& rl);
void find_matching_stripables_by_partial_name (std::string const & partial, std::vector<std::string>&) const;
bool route_name_unique (std::string) const;
bool route_name_internal (std::string) const;

View file

@ -4466,7 +4466,34 @@ Session::route_by_name (string name) const
}
}
return std::shared_ptr<Route> ((Route*) 0);
return nullptr;
}
std::shared_ptr<Stripable>
Session::stripable_by_name (string name) const
{
StripableList sl;
get_stripables (sl);
for (auto & s : sl) {
if (s->name() == name) {
return s;
}
}
return nullptr;
}
void
Session::find_matching_stripables_by_partial_name (std::string const & partial, std::vector<std::string>& matches) const
{
StripableList sl;
get_stripables (sl);
for (auto & s : sl) {
if (s->name().find (partial) == 0) {
matches.push_back (s->name());
}
}
}
std::shared_ptr<Route>