summaryrefslogtreecommitdiff
path: root/src/regex.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-01-20 18:09:04 +0000
committerMike Buland <eichlan@xagasoft.com>2011-01-20 18:09:04 +0000
commit393f1b414746a7f1977971dd7659dd2b47092b11 (patch)
tree81d0ca1ee70ab86a7d79c1991abe5c387b655fb2 /src/regex.cpp
parentc259f95bd0e58b247940a339bb9b4b401b4e9438 (diff)
parent7e25a863325dc3e9762397e700030969e093b087 (diff)
downloadlibbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.gz
libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.bz2
libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.xz
libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.zip
Wow! Merged the branch, streams are updated, and there's no more FString, run
the fixstrings.sh script in the support directory to (hopefully) automatically update your projects.
Diffstat (limited to 'src/regex.cpp')
-rw-r--r--src/regex.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/regex.cpp b/src/regex.cpp
index e634639..af0d364 100644
--- a/src/regex.cpp
+++ b/src/regex.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2010 Xagasoft, All rights reserved. 2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 * 3 *
4 * This file is part of the libbu++ library and is released under the 4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
@@ -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 );