nregex.h

00001 // LICENSE: (Please see the file COPYING for details)
00002 //
00003 // NUS - Nemesis Utilities System: A C++ application development framework 
00004 // Copyright (C) 2006, 2008 Otavio Rodolfo Piske
00005 //
00006 //  This file is part of NUS
00007 //
00008 //  This library is free software; you can redistribute it and/or
00009 //  modify it under the terms of the GNU Lesser General Public
00010 //  License as published by the Free Software Foundation version 2.1
00011 //  of the License.
00012 //
00013 //  This library is distributed in the hope that it will be useful,
00014 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 //  Lesser General Public License for more details.
00017 //
00018 //  You should have received a copy of the GNU Lesser General Public
00019 //  License along with this library; if not, write to the Free Software
00020 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00021 //
00022 #ifndef NREGEX_H
00023 #define NREGEX_H
00024 
00025 #include "nstring.h"
00026 #include "noutput.h"
00027 #include "nexception.h"
00028 #include "nlist.h"
00029 
00030 #include <sys/types.h>
00031 #include <regex.h>
00032 
00042 class DllDeclSpec NRegex {
00043       public:
00047             typedef struct MatchOffset_t { 
00048                   nint32 start;     
00049                   nint32 end; 
00050             } MatchOffset;
00051 
00057             NRegex(const NString &reg, const NString &str);
00058 
00063             bool match();
00064             //NList<MatchOffset> pos();
00065             
00066             static const nint32 NO_MATCH; 
00067             static const nint32 MATCH_COUNT_MAX; 
00069       private:
00070             NRegex(const NRegex &);
00071             NRegex &operator=(const NRegex &);
00072 
00073             regex_t m_reg;
00074             NString m_str;
00075             NList<NRegex::MatchOffset> m_offsets;
00076             
00077 
00078             NString getError(int ret);
00079             NString getDetailedError(int ret);
00080 
00081 };
00082 
00083 #endif // NREGEX_H

Generated on Wed Mar 5 23:10:35 2008 for NemesisUtilitiesSystem by  doxygen 1.5.4