aboutsummaryrefslogtreecommitdiff
path: root/src/regex.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-01-20 02:14:08 +0000
committerMike Buland <eichlan@xagasoft.com>2011-01-20 02:14:08 +0000
commitf5aca1a1b402bd7ebc944dc6e6fe65828d863365 (patch)
tree4a0fdd8e166d5c4b03543279d332b9a858ef62df /src/regex.cpp
parent10c557562e1d67c55314c212371ea9cb7f802863 (diff)
downloadlibbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.tar.gz
libbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.tar.bz2
libbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.tar.xz
libbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.zip
Bu::FString is now String, and there's a shell script to fix any other programs
that were using fstring, I hope.
Diffstat (limited to 'src/regex.cpp')
-rw-r--r--src/regex.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/regex.cpp b/src/regex.cpp
index e634639..8c28333 100644
--- a/src/regex.cpp
+++ b/src/regex.cpp
@@ -19,7 +19,7 @@ Bu::RegEx::RegEx() :
19{ 19{
20} 20}
21 21
22Bu::RegEx::RegEx( const Bu::FString &sSrc ) : 22Bu::RegEx::RegEx( const Bu::String &sSrc ) :
23 pRegEx( NULL ), 23 pRegEx( NULL ),
24 bCompiled( false ), 24 bCompiled( false ),
25 paSubStr( NULL ) 25 paSubStr( NULL )
@@ -37,7 +37,7 @@ Bu::RegEx::~RegEx()
37 } 37 }
38} 38}
39 39
40void Bu::RegEx::compile( const Bu::FString &sSrc ) 40void Bu::RegEx::compile( const Bu::String &sSrc )
41{ 41{
42 if( bCompiled ) 42 if( bCompiled )
43 { 43 {
@@ -54,7 +54,7 @@ void Bu::RegEx::compile( const Bu::FString &sSrc )
54 size_t length = regerror( nErr, re, NULL, 0 ); 54 size_t length = regerror( nErr, re, NULL, 0 );
55 char *buffer = new char[length]; 55 char *buffer = new char[length];
56 (void) regerror( nErr, re, buffer, length ); 56 (void) regerror( nErr, re, buffer, length );
57 Bu::FString s( buffer ); 57 Bu::String s( buffer );
58 delete[] buffer; 58 delete[] buffer;
59 throw "???"; // BuildException( s.getStr() ); 59 throw "???"; // BuildException( s.getStr() );
60 } 60 }
@@ -70,7 +70,7 @@ int Bu::RegEx::getNumSubStrings()
70 return nSubStr; 70 return nSubStr;
71} 71}
72 72
73bool Bu::RegEx::execute( const Bu::FString &sSrc ) 73bool Bu::RegEx::execute( const Bu::String &sSrc )
74{ 74{
75 sTest = sSrc; 75 sTest = sSrc;
76 if( regexec( re, sSrc.getStr(), nSubStr, aSubStr, 0 ) ) 76 if( regexec( re, sSrc.getStr(), nSubStr, aSubStr, 0 ) )
@@ -84,10 +84,10 @@ void Bu::RegEx::getSubStringRange( int nIndex, int &iStart, int &iEnd )
84 iEnd = aSubStr[nIndex].rm_eo; 84 iEnd = aSubStr[nIndex].rm_eo;
85} 85}
86 86
87Bu::FString Bu::RegEx::getSubString( int nIndex ) 87Bu::String Bu::RegEx::getSubString( int nIndex )
88{ 88{
89// regmatch_t *Subs = aSubStr; 89// regmatch_t *Subs = aSubStr;
90 return Bu::FString( 90 return Bu::String(
91 sTest.getStr()+aSubStr[nIndex].rm_so, 91 sTest.getStr()+aSubStr[nIndex].rm_so,
92 aSubStr[nIndex].rm_eo - aSubStr[nIndex].rm_so 92 aSubStr[nIndex].rm_eo - aSubStr[nIndex].rm_so
93 ); 93 );