00001 /* 00002 00003 Copyright (C) 1996, 1997 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 2, or (at your option) any 00010 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, write to the Free 00019 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 00021 */ 00022 00023 #if !defined (octave_glob_match_h) 00024 #define octave_glob_match_h 1 00025 00026 #include <string> 00027 00028 #include "Array.h" 00029 #include "str-vec.h" 00030 00031 class 00032 glob_match 00033 { 00034 public: 00035 00036 enum opts 00037 { 00038 pathname = 1, // No wildcard can ever match `/'. 00039 noescape = 2, // Backslashes don't quote special chars. 00040 period = 4 // Leading `.' is matched only explicitly. 00041 }; 00042 00043 glob_match (const std::string& p = std::string (), 00044 unsigned int f = pathname|noescape|period) 00045 : pat (p), flags (f) { } 00046 00047 glob_match (const string_vector& p = string_vector (), 00048 unsigned int f = pathname|noescape|period) 00049 : pat (p), flags (f) { } 00050 00051 glob_match (const glob_match& gm) : pat (gm.pat), flags (gm.flags) { } 00052 00053 glob_match& operator = (const glob_match& gm) 00054 { 00055 if (this != &gm) 00056 { 00057 pat = gm.pat; 00058 flags = gm.flags; 00059 } 00060 return *this; 00061 } 00062 00063 ~glob_match (void) { } 00064 00065 void set_pattern (const std::string& p) { pat = p; } 00066 00067 void set_pattern (const string_vector& p) { pat = p; } 00068 00069 bool match (const std::string&); 00070 00071 Array<bool> match (const string_vector&); 00072 00073 string_vector glob (void); 00074 00075 private: 00076 00077 // Globbing pattern(s). 00078 string_vector pat; 00079 00080 // Option flags. 00081 unsigned int flags; 00082 }; 00083 00084 #endif 00085 00086 /* 00087 ;;; Local Variables: *** 00088 ;;; mode: C++ *** 00089 ;;; End: *** 00090 */
SEO | [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送 | ||