Move member functions from PathScanner to functions in pbd/file_utils.h
[ardour.git] / libs / pbd / pbd / pathscanner.h
1 /*
2     Copyright (C) 2000-2007 Paul Davis 
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 __libmisc_pathscanner_h__
21 #define __libmisc_pathscanner_h__
22
23 #include <vector>
24 #include <string>
25 #ifdef COMPILER_MSVC
26 #include <ardourext/misc.h>
27 #else
28 #include <regex.h>
29 #endif
30
31 #include "pbd/libpbd_visibility.h"
32
33 #include "pbd/file_utils.h"
34
35 class LIBPBD_API PathScanner
36
37 {
38   public:
39         std::vector<std::string> operator() (const std::string &dirpath,
40                                              bool (*filter)(const std::string &, void *arg),
41                                              void *arg,
42                                              bool match_fullpath = true,
43                                              bool return_fullpath = true,
44                                              long limit = -1,
45                                              bool recurse = false) {
46                 std::vector<std::string> result;
47                 PBD::find_files_matching_filter (result, dirpath,
48                                                  filter, arg,
49                                                  match_fullpath, return_fullpath,
50                                                  limit, recurse);
51                 return result;
52         }
53
54         std::vector<std::string> operator() (const std::string &dirpath,
55                                              const std::string &regexp,
56                                              bool match_fullpath = true,
57                                              bool return_fullpath = true,
58                                              long limit = -1,
59                                              bool recurse = false)
60         {
61                 std::vector<std::string> result;
62
63                 PBD::find_files_matching_regex (result,
64                                                 dirpath,
65                                                 regexp,
66                                                 match_fullpath,
67                                                 return_fullpath,
68                                                 limit, recurse);
69
70                 return result;
71         }
72 };
73
74 #endif // __libmisc_pathscanner_h__