diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2013-08-15 20:04:08 +1000 |
---|---|---|
committer | Tim Mayberry <mojofunk@gmail.com> | 2013-09-06 14:31:11 +1000 |
commit | 8ddd12a60d08d895cb5400013cdda2e893fb81bb (patch) | |
tree | 84c0082083295835e33c38c12acc5e21cb9b7c7e /libs/pbd | |
parent | e6c7ecf0e369ba886a7dc57a195226921f0f11f1 (diff) |
Rename SearchPath class Searchpath
Windows headers define SearchPath which means we have to undefine it
where necessary. This is a pain and can be tricksy, so I feel renaming
the class slightly is the easiest solution.
Diffstat (limited to 'libs/pbd')
-rw-r--r-- | libs/pbd/file_utils.cc | 4 | ||||
-rw-r--r-- | libs/pbd/pbd/file_utils.h | 8 | ||||
-rw-r--r-- | libs/pbd/pbd/search_path.h | 36 | ||||
-rw-r--r-- | libs/pbd/search_path.cc | 34 | ||||
-rw-r--r-- | libs/pbd/test/test_common.cc | 2 | ||||
-rw-r--r-- | libs/pbd/test/test_common.h | 2 |
6 files changed, 41 insertions, 45 deletions
diff --git a/libs/pbd/file_utils.cc b/libs/pbd/file_utils.cc index 50287149e1..44254989c1 100644 --- a/libs/pbd/file_utils.cc +++ b/libs/pbd/file_utils.cc @@ -104,7 +104,7 @@ find_matching_files_in_directories (const vector<std::string>& paths, } void -find_matching_files_in_search_path (const SearchPath& search_path, +find_matching_files_in_search_path (const Searchpath& search_path, const Glib::PatternSpec& pattern, vector<std::string>& result) { @@ -112,7 +112,7 @@ find_matching_files_in_search_path (const SearchPath& search_path, } bool -find_file_in_search_path(const SearchPath& search_path, +find_file_in_search_path(const Searchpath& search_path, const string& filename, std::string& result) { diff --git a/libs/pbd/pbd/file_utils.h b/libs/pbd/pbd/file_utils.h index 72696f6abd..4b4bdf0735 100644 --- a/libs/pbd/pbd/file_utils.h +++ b/libs/pbd/pbd/file_utils.h @@ -68,15 +68,15 @@ find_matching_files_in_directories (const std::vector<std::string>& directory_pa std::vector<std::string>& result); /** - * Takes a SearchPath and puts a list of all the files in the search path + * Takes a Searchpath and puts a list of all the files in the search path * that match pattern into the result vector. * - * @param search_path A SearchPath + * @param search_path A Searchpath * @param pattern A Glib::PatternSpec used to match the files * @param result A vector in which to place the resulting matches. */ void -find_matching_files_in_search_path (const SearchPath& search_path, +find_matching_files_in_search_path (const Searchpath& search_path, const Glib::PatternSpec& pattern, std::vector<std::string>& result); @@ -87,7 +87,7 @@ find_matching_files_in_search_path (const SearchPath& search_path, * @return true If file is found within the search path. */ bool -find_file_in_search_path (const SearchPath& search_path, +find_file_in_search_path (const Searchpath& search_path, const std::string& filename, std::string& result); diff --git a/libs/pbd/pbd/search_path.h b/libs/pbd/pbd/search_path.h index cc53dbebac..5e1bce9aa3 100644 --- a/libs/pbd/pbd/search_path.h +++ b/libs/pbd/pbd/search_path.h @@ -20,36 +20,32 @@ #ifndef PBD_SEARCH_PATH_INCLUDED #define PBD_SEARCH_PATH_INCLUDED -#ifdef SearchPath -#undef SearchPath -#endif - #include <string> #include <vector> namespace PBD { /** - * @class SearchPath + * @class Searchpath * - * The SearchPath class is a helper class for getting a + * The Searchpath class is a helper class for getting a * vector of paths contained in a search path string where a * "search path string" contains absolute directory paths * separated by a colon(:) or a semi-colon(;) on windows. * - * The SearchPath class does not test whether the paths exist + * The Searchpath class does not test whether the paths exist * or are directories. It is basically just a container. */ -class SearchPath : public std::vector<std::string> +class Searchpath : public std::vector<std::string> { public: /** - * Create an empty SearchPath. + * Create an empty Searchpath. */ - SearchPath (); + Searchpath (); /** - * Initialize SearchPath from a string where the string contains + * Initialize Searchpath from a string where the string contains * one or more absolute paths to directories which are delimited * by a path separation character. The path delimeter is a * colon(:) on unix and a semi-colon(;) on windows. @@ -59,15 +55,15 @@ public: * * @param search_path A path string. */ - SearchPath (const std::string& search_path); + Searchpath (const std::string& search_path); /** - * Initialize SearchPath from a vector of paths that may or may + * Initialize Searchpath from a vector of paths that may or may * not exist. * * @param paths A vector of paths. */ - SearchPath (const std::vector<std::string>& paths); + Searchpath (const std::vector<std::string>& paths); /** * @return a search path string. @@ -80,29 +76,29 @@ public: /** * Add all the directories in path to this. */ - SearchPath& operator+= (const SearchPath& spath); + Searchpath& operator+= (const Searchpath& spath); /** * Add another directory path to the search path. */ - SearchPath& operator+= (const std::string& directory_path); + Searchpath& operator+= (const std::string& directory_path); /** - * Concatenate another SearchPath onto this. + * Concatenate another Searchpath onto this. */ - SearchPath& operator+ (const SearchPath& other); + Searchpath& operator+ (const Searchpath& other); /** * Add another path to the search path. */ - SearchPath& operator+ (const std::string& directory_path); + Searchpath& operator+ (const std::string& directory_path); /** * Add a sub-directory to each path in the search path. * @param subdir The directory name, it should not contain * any path separating tokens. */ - SearchPath& add_subdirectory_to_paths (const std::string& subdir); + Searchpath& add_subdirectory_to_paths (const std::string& subdir); protected: diff --git a/libs/pbd/search_path.cc b/libs/pbd/search_path.cc index e56e22fee3..ea08785f68 100644 --- a/libs/pbd/search_path.cc +++ b/libs/pbd/search_path.cc @@ -37,12 +37,12 @@ const char * const path_delimiter = ":"; namespace PBD { -SearchPath::SearchPath () +Searchpath::Searchpath () { } -SearchPath::SearchPath (const string& path) +Searchpath::Searchpath (const string& path) { vector<std::string> tmp; @@ -51,13 +51,13 @@ SearchPath::SearchPath (const string& path) } } -SearchPath::SearchPath (const vector<std::string>& paths) +Searchpath::Searchpath (const vector<std::string>& paths) { add_directories (paths); } void -SearchPath::add_directory (const std::string& directory_path) +Searchpath::add_directory (const std::string& directory_path) { if (!directory_path.empty()) { push_back(directory_path); @@ -65,7 +65,7 @@ SearchPath::add_directory (const std::string& directory_path) } void -SearchPath::add_directories (const vector<std::string>& paths) +Searchpath::add_directories (const vector<std::string>& paths) { for(vector<std::string>::const_iterator i = paths.begin(); i != paths.end(); ++i) { add_directory (*i); @@ -73,7 +73,7 @@ SearchPath::add_directories (const vector<std::string>& paths) } const string -SearchPath::to_string () const +Searchpath::to_string () const { string path; @@ -87,37 +87,37 @@ SearchPath::to_string () const return path; } -SearchPath& -SearchPath::operator+= (const SearchPath& spath) +Searchpath& +Searchpath::operator+= (const Searchpath& spath) { insert(end(), spath.begin(), spath.end()); return *this; } -SearchPath& -SearchPath::operator+= (const std::string& directory_path) +Searchpath& +Searchpath::operator+= (const std::string& directory_path) { add_directory (directory_path); return *this; } -SearchPath& -SearchPath::operator+ (const std::string& directory_path) +Searchpath& +Searchpath::operator+ (const std::string& directory_path) { add_directory (directory_path); return *this; } -SearchPath& -SearchPath::operator+ (const SearchPath& spath) +Searchpath& +Searchpath::operator+ (const Searchpath& spath) { - // concatenate paths into new SearchPath + // concatenate paths into new Searchpath insert(end(), spath.begin(), spath.end()); return *this; } -SearchPath& -SearchPath::add_subdirectory_to_paths (const string& subdir) +Searchpath& +Searchpath::add_subdirectory_to_paths (const string& subdir) { for (vector<std::string>::iterator i = begin(); i != end(); ++i) { // should these new paths just be added to the end of diff --git a/libs/pbd/test/test_common.cc b/libs/pbd/test/test_common.cc index 397a69ad8c..6e099d2f3e 100644 --- a/libs/pbd/test/test_common.cc +++ b/libs/pbd/test/test_common.cc @@ -25,7 +25,7 @@ * in an installed location on windows or by setting an environment variable * on unix. */ -PBD::SearchPath +PBD::Searchpath test_search_path () { #ifdef PLATFORM_WINDOWS diff --git a/libs/pbd/test/test_common.h b/libs/pbd/test/test_common.h index 0dc62f61dc..825c01fecb 100644 --- a/libs/pbd/test/test_common.h +++ b/libs/pbd/test/test_common.h @@ -21,6 +21,6 @@ #include "pbd/search_path.h" -PBD::SearchPath test_search_path (); +PBD::Searchpath test_search_path (); #endif |