X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fpbd%2Fsearch_path.h;h=74ac764dc0b6febba25590a14947b4f6b710e933;hb=ea32eecf3d2fa22c87350a3b198f8c13707627c6;hp=6163aae607fbf56692413d93fd39adc7a47a9711;hpb=e0aaed6d65f160c328cb8b56d7c6552ee15d65e2;p=ardour.git diff --git a/libs/pbd/pbd/search_path.h b/libs/pbd/pbd/search_path.h index 6163aae607..74ac764dc0 100644 --- a/libs/pbd/pbd/search_path.h +++ b/libs/pbd/pbd/search_path.h @@ -17,38 +17,37 @@ */ -#ifndef PBD_SEARCH_PATH_INCLUDED -#define PBD_SEARCH_PATH_INCLUDED +#ifndef __libpbd_search_path_h__ +#define __libpbd_search_path_h__ #include #include -#include "pbd/filesystem.h" +#include "pbd/libpbd_visibility.h" namespace PBD { -using std::string; -using std::vector; - /** - * @class The SearchPath class is a helper class for getting a + * @class Searchpath + * + * 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 vector +class LIBPBD_TEMPLATE_API Searchpath : public std::vector { public: /** - * Create an empty SearchPath. + * Create an empty Searchpath. */ - SearchPath (); + LIBPBD_TEMPLATE_MEMBER_API 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. @@ -58,22 +57,17 @@ public: * * @param search_path A path string. */ - SearchPath (const string& search_path); - - /** - * Initialize SearchPath from a sys::path. - * - * @param directory_path A directory path. - */ - SearchPath (const sys::path& directory_path); + LIBPBD_TEMPLATE_MEMBER_API 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 path A path. + * @param paths A vector of paths. */ - SearchPath (const vector& paths); + LIBPBD_TEMPLATE_MEMBER_API Searchpath (const std::vector& paths); + + LIBPBD_TEMPLATE_MEMBER_API ~Searchpath () {}; /** * @return a search path string. @@ -81,40 +75,56 @@ public: * The string that is returned contains the platform specific * path separator. */ - const string to_string () const; + LIBPBD_TEMPLATE_MEMBER_API const std::string to_string () const; /** * Add all the directories in path to this. */ - SearchPath& operator+= (const SearchPath& spath); + LIBPBD_TEMPLATE_MEMBER_API Searchpath& operator+= (const Searchpath& spath); /** * Add another directory path to the search path. */ - SearchPath& operator+= (const sys::path& directory_path); + LIBPBD_TEMPLATE_MEMBER_API Searchpath& operator+= (const std::string& directory_path); /** - * Concatenate another SearchPath onto this. + * Concatenate another Searchpath onto this. */ - SearchPath& operator+ (const SearchPath& other); + LIBPBD_TEMPLATE_MEMBER_API const Searchpath operator+ (const Searchpath& other); /** * Add another path to the search path. */ - SearchPath& operator+ (const sys::path& directory_path); + LIBPBD_TEMPLATE_MEMBER_API const Searchpath operator+ (const std::string& directory_path); + + /** + * Remove all the directories in path from this. + */ + LIBPBD_TEMPLATE_MEMBER_API Searchpath& operator-= (const Searchpath& spath); + + /** + * Remove a directory path from the search path. + */ + LIBPBD_TEMPLATE_MEMBER_API 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 string& subdir); + LIBPBD_TEMPLATE_MEMBER_API Searchpath& add_subdirectory_to_paths (const std::string& subdir); protected: - void add_directory (const sys::path& directory_path); - void add_directories (const vector& paths); + + LIBPBD_TEMPLATE_MEMBER_API void add_directory (const std::string& directory_path); + LIBPBD_TEMPLATE_MEMBER_API void add_directories (const std::vector& paths); + LIBPBD_TEMPLATE_MEMBER_API void remove_directory (const std::string& directory_path); + LIBPBD_TEMPLATE_MEMBER_API void remove_directories (const std::vector& paths); }; +LIBPBD_API void export_search_path (const std::string& base_dir, const char* varname, const char* dir); + + } // namespace PBD -#endif +#endif /* __libpbd_search_path_h__ */