mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-03 20:29:35 +01:00
add operator-= variants for PBD::Searchpath
This commit is contained in:
parent
f4a84a0272
commit
d3e3f5f005
2 changed files with 51 additions and 0 deletions
|
|
@ -49,6 +49,30 @@ Searchpath::Searchpath (const vector<std::string>& paths)
|
|||
add_directories (paths);
|
||||
}
|
||||
|
||||
void
|
||||
Searchpath::remove_directory (const std::string& directory_path)
|
||||
{
|
||||
if (directory_path.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (vector<std::string>::iterator i = begin(); i != end();) {
|
||||
if (*i == directory_path) {
|
||||
i = erase (i);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Searchpath::remove_directories (const vector<std::string>& paths)
|
||||
{
|
||||
for(vector<std::string>::const_iterator i = paths.begin(); i != paths.end(); ++i) {
|
||||
remove_directory (*i);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Searchpath::add_directory (const std::string& directory_path)
|
||||
{
|
||||
|
|
@ -115,6 +139,21 @@ Searchpath::operator+ (const Searchpath& spath)
|
|||
return *this;
|
||||
}
|
||||
|
||||
Searchpath&
|
||||
Searchpath::operator-= (const Searchpath& spath)
|
||||
{
|
||||
remove_directories (spath);
|
||||
return *this;
|
||||
}
|
||||
|
||||
Searchpath&
|
||||
Searchpath::operator-= (const std::string& directory_path)
|
||||
{
|
||||
remove_directory (directory_path);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Searchpath&
|
||||
Searchpath::add_subdirectory_to_paths (const string& subdir)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue