glob-match.cc

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 1996-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026 
00027 #include <fnmatch.h>
00028 
00029 #include "glob-match.h"
00030 #include "oct-glob.h"
00031 
00032 bool
00033 glob_match::match (const std::string& str) const
00034 {
00035   return octave_fnmatch (pat, str, fnmatch_flags);
00036 }
00037 
00038 string_vector
00039 glob_match::glob (void) const
00040 {
00041   return octave_glob (pat);
00042 }
00043 
00044 int
00045 glob_match::opts_to_fnmatch_flags (unsigned int xopts) const
00046 {
00047   int retval = 0;
00048 
00049   if (xopts & pathname)
00050     retval |= FNM_PATHNAME;
00051 
00052   if (xopts & noescape)
00053     retval |= FNM_NOESCAPE;
00054 
00055   if (xopts & period)
00056     retval |= FNM_PERIOD;
00057 
00058   return retval;
00059 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines