From ec05778d5718a7912e506764d443a78d6a6179e3 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 5 Nov 2012 22:41:51 +0000 Subject: Converted tabs to spaces with tabconv. --- src/experimental/regex.cpp | 94 +++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'src/experimental/regex.cpp') diff --git a/src/experimental/regex.cpp b/src/experimental/regex.cpp index de24935..dbe0e85 100644 --- a/src/experimental/regex.cpp +++ b/src/experimental/regex.cpp @@ -13,83 +13,83 @@ #define aSubStr ((regmatch_t *)paSubStr) Bu::RegEx::RegEx() : - pRegEx( NULL ), - bCompiled( false ), - paSubStr( NULL ) + pRegEx( NULL ), + bCompiled( false ), + paSubStr( NULL ) { } Bu::RegEx::RegEx( const Bu::String &sSrc ) : - pRegEx( NULL ), - bCompiled( false ), - paSubStr( NULL ) + pRegEx( NULL ), + bCompiled( false ), + paSubStr( NULL ) { - compile( sSrc ); + compile( sSrc ); } Bu::RegEx::~RegEx() { - if( bCompiled ) - { - regfree( re ); - delete re; - delete[] aSubStr; - } + if( bCompiled ) + { + regfree( re ); + delete re; + delete[] aSubStr; + } } void Bu::RegEx::compile( const Bu::String &sSrc ) { - if( bCompiled ) - { - regfree( re ); - delete re; - delete[] aSubStr; - bCompiled = false; - } - pRegEx = (void *)(new regex_t); + if( bCompiled ) + { + regfree( re ); + delete re; + delete[] aSubStr; + bCompiled = false; + } + pRegEx = (void *)(new regex_t); - int nErr = regcomp( re, sSrc.getStr(), REG_EXTENDED|REG_NEWLINE ); - if( nErr ) - { - size_t length = regerror( nErr, re, NULL, 0 ); - char *buffer = new char[length]; - (void) regerror( nErr, re, buffer, length ); - Bu::String s( buffer ); - delete[] buffer; - throw "???"; // BuildException( s.getStr() ); - } - bCompiled = true; - this->sSrc = sSrc; + int nErr = regcomp( re, sSrc.getStr(), REG_EXTENDED|REG_NEWLINE ); + if( nErr ) + { + size_t length = regerror( nErr, re, NULL, 0 ); + char *buffer = new char[length]; + (void) regerror( nErr, re, buffer, length ); + Bu::String s( buffer ); + delete[] buffer; + throw "???"; // BuildException( s.getStr() ); + } + bCompiled = true; + this->sSrc = sSrc; - nSubStr = re->re_nsub+1; - paSubStr = (void *)(new regmatch_t[nSubStr]); + nSubStr = re->re_nsub+1; + paSubStr = (void *)(new regmatch_t[nSubStr]); } int Bu::RegEx::getNumSubStrings() { - return nSubStr; + return nSubStr; } bool Bu::RegEx::execute( const Bu::String &sSrc ) { - sTest = sSrc; - if( regexec( re, sSrc.getStr(), nSubStr, aSubStr, 0 ) ) - return false; - return true; + sTest = sSrc; + if( regexec( re, sSrc.getStr(), nSubStr, aSubStr, 0 ) ) + return false; + return true; } void Bu::RegEx::getSubStringRange( int nIndex, int &iStart, int &iEnd ) { - iStart = aSubStr[nIndex].rm_so; - iEnd = aSubStr[nIndex].rm_eo; + iStart = aSubStr[nIndex].rm_so; + iEnd = aSubStr[nIndex].rm_eo; } Bu::String Bu::RegEx::getSubString( int nIndex ) { -// regmatch_t *Subs = aSubStr; - return Bu::String( - sTest.getStr()+aSubStr[nIndex].rm_so, - aSubStr[nIndex].rm_eo - aSubStr[nIndex].rm_so - ); +// regmatch_t *Subs = aSubStr; + return Bu::String( + sTest.getStr()+aSubStr[nIndex].rm_so, + aSubStr[nIndex].rm_eo - aSubStr[nIndex].rm_so + ); } -- cgit v1.2.3