Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined (octave_regex_match_h)
00024 #define octave_regex_match_h 1
00025
00026 #include <string>
00027
00028 #if defined (HAVE_REGEX)
00029 #if defined (__MINGW32__)
00030 #define __restrict
00031 #endif
00032 #include <sys/types.h>
00033 #include <regex.h>
00034 #endif
00035
00036 #include "Array.h"
00037 #include "str-vec.h"
00038
00039 class
00040 OCTAVE_API
00041 regex_match
00042 {
00043 public:
00044
00045 regex_match (const std::string& p, bool insen = false)
00046 : pat (p), case_insen (insen)
00047 #if HAVE_REGEX
00048 , compiled (0)
00049 #endif
00050 {
00051 init ();
00052 }
00053
00054 regex_match (const string_vector& p = string_vector (), bool insen = false)
00055 : pat (p), case_insen (insen)
00056 #if HAVE_REGEX
00057 , compiled (0)
00058 #endif
00059 {
00060 init ();
00061 }
00062
00063 regex_match (const regex_match& gm)
00064 : pat (gm.pat), case_insen (gm.case_insen)
00065 #if HAVE_REGEX
00066 , compiled (0)
00067 #endif
00068 {
00069 init ();
00070 }
00071
00072 regex_match& operator = (const regex_match& gm);
00073
00074 ~regex_match (void);
00075
00076 void set_pattern (const std::string& p);
00077
00078 void set_pattern (const string_vector& p);
00079
00080 bool match (const std::string&);
00081
00082 Array<bool> match (const string_vector&);
00083
00084 private:
00085
00086 void init (void);
00087
00088
00089 string_vector pat;
00090
00091
00092 bool case_insen;
00093
00094 #if HAVE_REGEX
00095 regex_t *compiled;
00096 #endif
00097 };
00098
00099 #endif