00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 2 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * This program is distributed in the hope that it will be useful, 00008 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 * GNU General Public License for more details. 00011 * 00012 * You should have received a copy of the GNU General Public License 00013 * along with this program; if not, write to the Free Software 00014 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00015 * 00016 * (c)Copyright 2006 Hewlett-Packard Development Company, LP. 00017 * 00018 */ 00019 00020 #ifndef _C_REGEXP_H_ 00021 #define _C_REGEXP_H_ 00022 00023 #include "types_t.hpp" 00024 #include <regex.h> 00025 00026 00027 class C_RegExp { 00028 00029 public: 00030 00031 C_RegExp(char* P_RegularExpression, 00032 int *P_error_code, 00033 int P_nb_match = 1, // number of match expected (needed if sub expressions) 00034 int P_sub_match = 0, // index of the sub matched expression needed 00035 // 0 = no sub expression 00036 int P_line = -1 // apply the matching process to the line number P_line 00037 // -1 = apply to all the buffer P_buffer 00038 ); 00039 ~C_RegExp(); 00040 00041 char* execute(char* P_buffer) ; 00042 int execute(char* P_buffer, int *P_start, int *P_end); 00043 char* execute(char* P_buffer, int *P_size); 00044 00045 00046 private: 00047 00048 char* m_regularExpression; 00049 regex_t m_internalRegExp; 00050 int m_nb_match ; 00051 int m_sub_match ; 00052 int m_line ; 00053 00054 char* setSubString(char* P_source, int P_start, int P_stop); 00055 00056 }; 00057 00058 00059 00060 #endif // _C_REGEXP_H_ 00061 00062