Make PBD::SearchPath less silly/boilerplatey.
[ardour.git] / libs / pbd / search_path.cc
index 9956c6c76339d589a691e8b5ac81ca9eb40f0099..350eea05d35b4fa55d7a25437a601bde0093ce00 100644 (file)
@@ -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