X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fpbd%2Fsearch_path.h;h=74ac764dc0b6febba25590a14947b4f6b710e933;hb=ea32eecf3d2fa22c87350a3b198f8c13707627c6;hp=5e1bce9aa3545b5ee0fb6733ec7138687b4af7d3;hpb=5cf1f7f3b28abd36f9390014016def94f4e1468d;p=ardour.git diff --git a/libs/pbd/pbd/search_path.h b/libs/pbd/pbd/search_path.h index 5e1bce9aa3..74ac764dc0 100644 --- a/libs/pbd/pbd/search_path.h +++ b/libs/pbd/pbd/search_path.h @@ -17,12 +17,14 @@ */ -#ifndef PBD_SEARCH_PATH_INCLUDED -#define PBD_SEARCH_PATH_INCLUDED +#ifndef __libpbd_search_path_h__ +#define __libpbd_search_path_h__ #include #include +#include "pbd/libpbd_visibility.h" + namespace PBD { /** @@ -36,13 +38,13 @@ namespace PBD { * The Searchpath class does not test whether the paths exist * or are directories. It is basically just a container. */ -class Searchpath : public std::vector +class LIBPBD_TEMPLATE_API Searchpath : public std::vector { public: /** * Create an empty Searchpath. */ - Searchpath (); + LIBPBD_TEMPLATE_MEMBER_API Searchpath (); /** * Initialize Searchpath from a string where the string contains @@ -55,7 +57,7 @@ public: * * @param search_path A path string. */ - Searchpath (const std::string& search_path); + LIBPBD_TEMPLATE_MEMBER_API Searchpath (const std::string& search_path); /** * Initialize Searchpath from a vector of paths that may or may @@ -63,7 +65,9 @@ public: * * @param paths A vector of paths. */ - Searchpath (const std::vector& paths); + LIBPBD_TEMPLATE_MEMBER_API Searchpath (const std::vector& paths); + + LIBPBD_TEMPLATE_MEMBER_API ~Searchpath () {}; /** * @return a search path string. @@ -71,41 +75,56 @@ public: * The string that is returned contains the platform specific * path separator. */ - const std::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 std::string& directory_path); + LIBPBD_TEMPLATE_MEMBER_API Searchpath& operator+= (const std::string& directory_path); /** * 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 std::string& 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 std::string& subdir); + LIBPBD_TEMPLATE_MEMBER_API Searchpath& add_subdirectory_to_paths (const std::string& subdir); protected: - void add_directory (const std::string& directory_path); - void add_directories (const std::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__ */