diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-15 00:22:23 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-15 09:21:49 +0100 |
commit | 061ebc34468c37d27524352de56faaf9df742556 (patch) | |
tree | 96d924d1f23690029ba13598290858881bdb2495 /connectivity | |
parent | 90fe8dadaaad07aee2ec513eab1ad75bbf306cb3 (diff) |
add a getToken wrapper for extracting a single token painlessly
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/hsqldb/HDriver.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx b/connectivity/source/drivers/hsqldb/HDriver.cxx index fcb3408a3c52..3973cf5833b1 100644 --- a/connectivity/source/drivers/hsqldb/HDriver.cxx +++ b/connectivity/source/drivers/hsqldb/HDriver.cxx @@ -53,6 +53,7 @@ #include <osl/process.h> #include <connectivity/dbexception.hxx> #include <comphelper/namedvaluecollection.hxx> +#include <comphelper/string.hxx> #include <unotools/confignode.hxx> #include <unotools/ucbstreamhelper.hxx> #include "resource/hsqldb_res.hrc" @@ -278,7 +279,7 @@ namespace connectivity if ( pStream.get() ) { ByteString sLine; - ByteString sVersionString; + rtl::OString sVersionString; while ( pStream->ReadLine(sLine) ) { if ( sLine.Len() == 0 ) @@ -292,18 +293,19 @@ namespace connectivity else { if ( sIniKey.Equals( "version" ) - && ( sVersionString.Len() == 0 ) + && ( sVersionString.isEmpty() ) ) { sVersionString = sValue; } } } - if ( sVersionString.Len() ) + if (!sVersionString.isEmpty()) { - const sal_Int32 nMajor = sVersionString.GetToken(0,'.').ToInt32(); - const sal_Int32 nMinor = sVersionString.GetToken(1,'.').ToInt32(); - const sal_Int32 nMicro = sVersionString.GetToken(2,'.').ToInt32(); + using comphelper::string::getToken; + const sal_Int32 nMajor = getToken(sVersionString, 0, '.').toInt32(); + const sal_Int32 nMinor = getToken(sVersionString, 1, '.').toInt32(); + const sal_Int32 nMicro = getToken(sVersionString, 2, '.').toInt32(); if ( nMajor > 1 || ( nMajor == 1 && nMinor > 8 ) || ( nMajor == 1 && nMinor == 8 && nMicro > 0 ) ) |