TempoLines* tempo_lines;
ArdourCanvas::Group* time_line_group;
- ArdourCanvas::SimpleLine* get_time_line ();
void hide_measures ();
void draw_measures ();
vector<string> tmp_files;
get_files_in_directory (directory, tmp_files);
+ result.reserve(tmp_files.size());
for (vector<string>::iterator file_iter = tmp_files.begin();
file_iter != tmp_files.end();
const Glib::PatternSpec& pattern,
vector<sys::path>& result)
{
- vector<sys::path> 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
* 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<sys::path>
+{
public:
-
- typedef std::vector<sys::path>::iterator iterator;
- typedef std::vector<sys::path>::const_iterator const_iterator;
-
-public:
-
/**
* Create an empty SearchPath.
*/
*/
SearchPath (const vector<sys::path>& 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.
*
*/
const string to_string () const;
- /**
- * Assignment of another SearchPath to this.
- */
- SearchPath& operator= (const SearchPath& spath);
-
/**
* Add all the directories in path to this.
*/
*/
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<sys::path>& paths);
-
- vector<sys::path> m_dirs;
-
};
} // namespace PBD
{
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);
}
}
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
{
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;
}
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;
}
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;
return *this;
}
-
-SearchPath&
-SearchPath::operator/= (const string& subdir)
-{
- return add_subdirectory_to_paths (subdir);
-}
} // namespace PBD