Mercurial > hg > octave-nkf
annotate liboctave/glob-match.cc @ 14101:ff5588774680 stable ss-3-5-91
snapshot 3.5.91
* configure.ac (AC_INIT): Version is now 3.5.91.
(OCTAVE_RELEASE_DATE): Now 2011-12-23.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 23 Dec 2011 19:24:41 -0500 |
parents | fd0a3ac60b0e |
children | 72c96de7a403 |
rev | line source |
---|---|
2924 | 1 /* |
2 | |
11523 | 3 Copyright (C) 1996-2011 John W. Eaton |
2924 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2924 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2924 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
27 #include <fnmatch.h> | |
28 | |
2926 | 29 #include "glob-match.h" |
10148 | 30 #include "oct-glob.h" |
31 | |
32 bool | |
33 glob_match::match (const std::string& str) const | |
34 { | |
35 return octave_fnmatch (pat, str, fnmatch_flags); | |
36 } | |
37 | |
38 string_vector | |
39 glob_match::glob (void) const | |
40 { | |
41 return octave_glob (pat); | |
42 } | |
2924 | 43 |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
9994
diff
changeset
|
44 int |
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
9994
diff
changeset
|
45 glob_match::opts_to_fnmatch_flags (unsigned int xopts) const |
2924 | 46 { |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
9994
diff
changeset
|
47 int retval = 0; |
2924 | 48 |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
9994
diff
changeset
|
49 if (xopts & pathname) |
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
9994
diff
changeset
|
50 retval |= FNM_PATHNAME; |
2924 | 51 |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
9994
diff
changeset
|
52 if (xopts & noescape) |
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
9994
diff
changeset
|
53 retval |= FNM_NOESCAPE; |
2924 | 54 |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
9994
diff
changeset
|
55 if (xopts & period) |
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
9994
diff
changeset
|
56 retval |= FNM_PERIOD; |
2924 | 57 |
58 return retval; | |
59 } |