ardour
search_path.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2007 Tim Mayberry
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #ifndef __libpbd_search_path_h__
21 #define __libpbd_search_path_h__
22 
23 #include <string>
24 #include <vector>
25 
26 #include "pbd/libpbd_visibility.h"
27 
28 namespace PBD {
29 
41 class LIBPBD_TEMPLATE_API Searchpath : public std::vector<std::string>
42 {
43 public:
48 
60  LIBPBD_TEMPLATE_MEMBER_API Searchpath (const std::string& search_path);
61 
68  LIBPBD_TEMPLATE_MEMBER_API Searchpath (const std::vector<std::string>& paths);
69 
71 
78  LIBPBD_TEMPLATE_MEMBER_API const std::string to_string () const;
79 
83  LIBPBD_TEMPLATE_MEMBER_API Searchpath& operator+= (const Searchpath& spath);
84 
88  LIBPBD_TEMPLATE_MEMBER_API Searchpath& operator+= (const std::string& directory_path);
89 
93  LIBPBD_TEMPLATE_MEMBER_API Searchpath& operator+ (const Searchpath& other);
94 
98  LIBPBD_TEMPLATE_MEMBER_API Searchpath& operator+ (const std::string& directory_path);
99 
103  LIBPBD_TEMPLATE_MEMBER_API Searchpath& operator-= (const Searchpath& spath);
104 
108  LIBPBD_TEMPLATE_MEMBER_API Searchpath& operator-= (const std::string& directory_path);
109 
115  LIBPBD_TEMPLATE_MEMBER_API Searchpath& add_subdirectory_to_paths (const std::string& subdir);
116 
117 protected:
118 
119  LIBPBD_TEMPLATE_MEMBER_API void add_directory (const std::string& directory_path);
120  LIBPBD_TEMPLATE_MEMBER_API void add_directories (const std::vector<std::string>& paths);
121  LIBPBD_TEMPLATE_MEMBER_API void remove_directory (const std::string& directory_path);
122  LIBPBD_TEMPLATE_MEMBER_API void remove_directories (const std::vector<std::string>& paths);
123 };
124 
125 LIBPBD_API void export_search_path (const std::string& base_dir, const char* varname, const char* dir);
126 
127 
128 } // namespace PBD
129 
130 #endif /* __libpbd_search_path_h__ */
std::string to_string(T t, std::ios_base &(*f)(std::ios_base &))
Definition: convert.h:53
#define LIBPBD_API
void remove_directory(const std::string &dir)
Definition: file_utils.cc:465
#define LIBPBD_TEMPLATE_MEMBER_API
LIBPBD_TEMPLATE_MEMBER_API ~Searchpath()
Definition: search_path.h:70
LIBPBD_API void export_search_path(const std::string &base_dir, const char *varname, const char *dir)
#define LIBPBD_TEMPLATE_API
Definition: debug.h:30