diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 7d902fbfb8..32730d15f2 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1532,7 +1532,6 @@ public: TempoLines* tempo_lines; ArdourCanvas::Group* time_line_group; - ArdourCanvas::SimpleLine* get_time_line (); void hide_measures (); void draw_measures (); diff --git a/libs/pbd/file_utils.cc b/libs/pbd/file_utils.cc index f8dfe269c5..6af039a83e 100644 --- a/libs/pbd/file_utils.cc +++ b/libs/pbd/file_utils.cc @@ -53,6 +53,7 @@ find_matching_files_in_directory (const sys::path& directory, vector tmp_files; get_files_in_directory (directory, tmp_files); + result.reserve(tmp_files.size()); for (vector::iterator file_iter = tmp_files.begin(); file_iter != tmp_files.end(); @@ -85,9 +86,7 @@ find_matching_files_in_search_path (const SearchPath& search_path, const Glib::PatternSpec& pattern, vector& result) { - vector dirs; - std::copy(search_path.begin(), search_path.end(), std::back_inserter(dirs)); - find_matching_files_in_directories (dirs, pattern, result); + find_matching_files_in_directories (search_path, pattern, result); } bool diff --git a/libs/pbd/pbd/search_path.h b/libs/pbd/pbd/search_path.h index 3b10d4a319..505583b3e0 100644 --- a/libs/pbd/pbd/search_path.h +++ b/libs/pbd/pbd/search_path.h @@ -39,14 +39,9 @@ using std::vector; * The SearchPath class does not test whether the paths exist * or are directories. It is basically just a container. */ -class SearchPath { +class SearchPath : public vector +{ public: - - typedef std::vector::iterator iterator; - typedef std::vector::const_iterator const_iterator; - -public: - /** * Create an empty SearchPath. */ @@ -80,48 +75,6 @@ public: */ SearchPath (const vector& paths); - /** - * The copy constructor does what you would expect and copies the - * vector of paths contained by the SearchPath. - */ - SearchPath (const SearchPath& search_path); - - /** - * Indicate whether there are any directory paths in m_dirs. - * - * If SearchPath is initialized with an empty string as the - * result of for instance the contents of an unset environment - * variable. - * - * @return true if there are any paths in m_paths. - */ - operator void* () const { return (void*)!m_dirs.empty(); } - - /** - * @return a read/write iterator that points to the first - * path in the SearchPath. Iteration is done in ordinary - * element order. - */ - iterator begin () { return m_dirs.begin(); } - - /** - * @return A read-only (constant) iterator that points to the - * first path in the SearchPath. - */ - const_iterator begin () const { return m_dirs.begin(); } - - /** - * @return A read/write iterator that points one past the last - * path in the SearchPath. - */ - iterator end () { return m_dirs.end(); } - - /** - * @return A read-only (constant) iterator that points one past - * the last path in the SearchPath. - */ - const_iterator end () const { return m_dirs.end(); } - /** * @return a search path string. * @@ -130,11 +83,6 @@ public: */ const string to_string () const; - /** - * Assignment of another SearchPath to this. - */ - SearchPath& operator= (const SearchPath& spath); - /** * Add all the directories in path to this. */ @@ -162,20 +110,9 @@ public: */ SearchPath& add_subdirectory_to_paths (const string& subdir); - /** - * Add a sub-directory to each path in the search path. - * @see add_subdirectory_to_paths - */ - SearchPath& operator/= (const string& subdir); - protected: - void add_directory (const sys::path& directory_path); - void add_directories (const vector& paths); - - vector m_dirs; - }; } // namespace PBD 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 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& 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::const_iterator i = m_dirs.begin(); i != m_dirs.end(); ++i) { + for (vector::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::iterator i = m_dirs.begin(); i != m_dirs.end(); ++i) - { + for (vector::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