diff options
author | David Robillard <d@drobilla.net> | 2008-09-23 15:55:34 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-09-23 15:55:34 +0000 |
commit | 1bee7c3f93b2b0a0eeea4ae3aefc112a8cf1da9a (patch) | |
tree | 56e2eb282564a855fc0d499f5725b2f1b9921cf1 /libs/pbd/search_path.cc | |
parent | 22dc575e4cbc35a5d486d6f448332fb721865d57 (diff) |
Make PBD::SearchPath less silly/boilerplatey.
Remove unnecessary copy in find_matching_files_in_search_path.
git-svn-id: svn://localhost/ardour2/branches/3.0@3797 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/search_path.cc')
-rw-r--r-- | libs/pbd/search_path.cc | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/libs/pbd/search_path.cc b/libs/pbd/search_path.cc index 9956c6c763..350eea05d3 100644 --- a/libs/pbd/search_path.cc +++ b/libs/pbd/search_path.cc @@ -42,8 +42,7 @@ SearchPath::SearchPath (const string& path) { vector<sys::path> tmp; - if(tokenize (path, string(path_delimiter), std::back_inserter (tmp))) - { + if (tokenize (path, string(path_delimiter), std::back_inserter (tmp))) { add_directories (tmp); } } @@ -58,17 +57,11 @@ SearchPath::SearchPath (const vector<sys::path>& paths) add_directories (paths); } -SearchPath::SearchPath (const SearchPath& other) - : m_dirs(other.m_dirs) -{ - -} - void SearchPath::add_directory (const sys::path& directory_path) { // test for existance and warn etc? - m_dirs.push_back(directory_path); + push_back(directory_path); } void @@ -84,7 +77,7 @@ SearchPath::to_string () const { string path; - for (vector<sys::path>::const_iterator i = m_dirs.begin(); i != m_dirs.end(); ++i) { + for (vector<sys::path>::const_iterator i = begin(); i != end(); ++i) { path += (*i).to_string(); path += path_delimiter; } @@ -94,17 +87,10 @@ SearchPath::to_string () const return path; } -SearchPath& -SearchPath::operator= (const SearchPath& path) -{ - m_dirs = path.m_dirs; - return *this; -} - SearchPath& SearchPath::operator+= (const SearchPath& spath) { - m_dirs.insert(m_dirs.end(), spath.m_dirs.begin(), spath.m_dirs.end()); + insert(end(), spath.begin(), spath.end()); return *this; } @@ -126,15 +112,14 @@ SearchPath& SearchPath::operator+ (const SearchPath& spath) { // concatenate paths into new SearchPath - m_dirs.insert(m_dirs.end(), spath.m_dirs.begin(), spath.m_dirs.end()); + insert(end(), spath.begin(), spath.end()); return *this; } SearchPath& SearchPath::add_subdirectory_to_paths (const string& subdir) { - for (vector<sys::path>::iterator i = m_dirs.begin(); i != m_dirs.end(); ++i) - { + for (vector<sys::path>::iterator i = begin(); i != end(); ++i) { // should these new paths just be added to the end of // the search path rather than replace? *i /= subdir; @@ -142,11 +127,5 @@ SearchPath::add_subdirectory_to_paths (const string& subdir) return *this; } - -SearchPath& -SearchPath::operator/= (const string& subdir) -{ - return add_subdirectory_to_paths (subdir); -} } // namespace PBD |