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.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -21,6 +21,6 @@
|
||||
|
||||
#include "pbd/search_path.h"
|
||||
|
||||
PBD::SearchPath test_search_path ();
|
||||
PBD::Searchpath test_search_path ();
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user