diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-11-26 10:44:02 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-11-28 09:55:02 +0000 |
commit | 48221d6a2bf4c327b6cadcdc65169997f7d7408d (patch) | |
tree | c55de0fd2abb2e2729540d98a02f87dd38b7a526 /l10ntools | |
parent | afb548ba6962c74ae99350bad0bd2c72c9ddd998 (diff) |
ByteString::GetToken->comphelper::string::getToken
Diffstat (limited to 'l10ntools')
-rw-r--r-- | l10ntools/source/cfgmerge.cxx | 22 | ||||
-rw-r--r-- | l10ntools/source/gsicheck.cxx | 16 | ||||
-rw-r--r-- | l10ntools/source/xrmmerge.cxx | 5 |
3 files changed, 24 insertions, 19 deletions
diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx index 123d5b9b6cb7..9d513af9d878 100644 --- a/l10ntools/source/cfgmerge.cxx +++ b/l10ntools/source/cfgmerge.cxx @@ -27,6 +27,7 @@ ************************************************************************/ #include <stdio.h> +#include <comphelper/string.hxx> #include <tools/string.hxx> #include <tools/fsys.hxx> @@ -35,6 +36,8 @@ #include "cfgmerge.hxx" #include "tokens.h" +using comphelper::string::getToken; + extern "C" { int yyerror( char * ); } extern "C" { int YYWarning( char * ); } @@ -405,7 +408,7 @@ int CfgParser::ExecuteAnalyzedToken( int nToken, char *pToken ) case ANYTOKEN: case CFG_TEXT_START: { - sTokenName = sToken.GetToken( 1, '<' ).GetToken( 0, '>' ).GetToken( 0, ' ' ); + sTokenName = getToken(getToken(getToken(sToken, 1, '<'), 0, '>'), 0, ' '); if ( !IsTokenClosed( sToken )) { ByteString sSearch; @@ -441,7 +444,7 @@ int CfgParser::ExecuteAnalyzedToken( int nToken, char *pToken ) sCurrentResTyp = sTokenName; ByteString sTemp = sToken.Copy( sToken.Search( "xml:lang=" )); - sCurrentIsoLang = sTemp.GetToken( 1, '\"' ).GetToken( 0, '\"' ); + sCurrentIsoLang = getToken(getToken(sTemp, 1, '\"'), 0, '\"'); if ( sCurrentIsoLang == NO_TRANSLATE_ISO ) bLocalize = sal_False; @@ -452,9 +455,10 @@ int CfgParser::ExecuteAnalyzedToken( int nToken, char *pToken ) } break; } - if ( sSearch.Len()) { - ByteString sTemp = sToken.Copy( sToken.Search( sSearch )); - sTokenId = sTemp.GetToken( 1, '\"' ).GetToken( 0, '\"' ); + if ( sSearch.Len()) + { + rtl::OString sTemp = sToken.Copy( sToken.Search( sSearch )); + sTokenId = getToken(getToken(sTemp, 1, '\"'), 0, '\"'); } pStackData = aStack.Push( sTokenName, sTokenId ); @@ -479,7 +483,7 @@ int CfgParser::ExecuteAnalyzedToken( int nToken, char *pToken ) } break; case CFG_CLOSETAG: - sTokenName = sToken.GetToken( 1, '/' ).GetToken( 0, '>' ).GetToken( 0, ' ' ); + sTokenName = getToken(getToken(getToken(sToken, 1, '/'), 0, '>'), 0, ' '); if ( aStack.GetStackData() && ( aStack.GetStackData()->GetTagType() == sTokenName )) { if ( ! sCurrentText.Len()) WorkOnRessourceEnd(); @@ -804,12 +808,12 @@ void CfgMerge::WorkOnRessourceEnd() ByteString sTextTag = pStackData->sTextTag; ByteString sTemp = sTextTag.Copy( sTextTag.Search( "xml:lang=" )); - ByteString sSearch = sTemp.GetToken( 0, '\"' ); + ByteString sSearch = getToken(sTemp, 0, '\"'); sSearch += "\""; - sSearch += sTemp.GetToken( 1, '\"' ); + sSearch += getToken(sTemp, 1, '\"'); sSearch += "\""; - ByteString sReplace = sTemp.GetToken( 0, '\"' ); + ByteString sReplace = getToken(sTemp, 0, '\"'); sReplace += "\""; sReplace += sCur; sReplace += "\""; diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx index 0bee6d257937..17b3d52ff940 100644 --- a/l10ntools/source/gsicheck.cxx +++ b/l10ntools/source/gsicheck.cxx @@ -148,17 +148,17 @@ GSILine::GSILine( const ByteString &rLine, sal_uLong nLine ) { aFormat = FORMAT_SDF; aUniqId = getToken(rLine, 0, '\t'); - aUniqId.Append("/").Append( rLine.GetToken( 1, '\t' ) ).Append("/").Append( rLine.GetToken( 3, '\t' ) ).Append("/").Append( rLine.GetToken( 4, '\t' ) ).Append("/").Append( rLine.GetToken( 5, '\t' ) ).Append("/").Append( rLine.GetToken( 6, '\t' ) ).Append("/").Append( rLine.GetToken( 7, '\t' ) ); + aUniqId.Append("/").Append( getToken(rLine, 1, '\t') ).Append("/").Append( getToken(rLine, 3, '\t') ).Append("/").Append( getToken(rLine, 4, '\t') ).Append("/").Append( getToken(rLine, 5, '\t') ).Append("/").Append( getToken(rLine, 6, '\t') ).Append("/").Append( getToken(rLine, 7, '\t') ); aLineType = ""; - aLangId = rLine.GetToken( 9, '\t' ); - aText = rLine.GetToken( 10, '\t' ); - aQuickHelpText = rLine.GetToken( 12, '\t' ); - aTitle = rLine.GetToken( 13, '\t' ); + aLangId = getToken(rLine, 9, '\t'); + aText = getToken(rLine, 10, '\t'); + aQuickHelpText = getToken(rLine, 12, '\t'); + aTitle = getToken(rLine, 13, '\t'); // do some more format checks here - if (!comphelper::string::isdigitAsciiString(rLine.GetToken(8, '\t'))) + if (!comphelper::string::isdigitAsciiString(getToken(rLine, 8, '\t'))) { - PrintError( "The length field does not contain a number!", "Line format", rLine.GetToken( 8, '\t' ), sal_True, GetLineNumber(), GetUniqId() ); + PrintError( "The length field does not contain a number!", "Line format", getToken(rLine, 8, '\t'), sal_True, GetLineNumber(), GetUniqId() ); NotOK(); } if ( !LanguageOK( aLangId ) ) @@ -167,7 +167,7 @@ GSILine::GSILine( const ByteString &rLine, sal_uLong nLine ) NotOK(); } // limit GID and LID to MAX_GID_LID_LEN chars each for database conformity, see #137575# - if ( rLine.GetToken( 4, '\t' ).Len() > MAX_GID_LID_LEN || rLine.GetToken( 5, '\t' ).Len() > MAX_GID_LID_LEN ) + if ( getToken(rLine, 4, '\t').getLength() > MAX_GID_LID_LEN || getToken(rLine, 5, '\t').getLength() > MAX_GID_LID_LEN ) { PrintError(rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("GID and LID may only be ")) .append(static_cast<sal_Int32>(MAX_GID_LID_LEN)) diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx index 2f7246d73330..fbc0017b92f8 100644 --- a/l10ntools/source/xrmmerge.cxx +++ b/l10ntools/source/xrmmerge.cxx @@ -415,9 +415,10 @@ ByteString XRMResParser::GetAttribute( const ByteString &rToken, const ByteStrin sSearch += "="; sal_uInt16 nPos = sTmp.Search( sSearch ); - if ( nPos != STRING_NOTFOUND ) { + if ( nPos != STRING_NOTFOUND ) + { sTmp = sTmp.Copy( nPos ); - ByteString sId = sTmp.GetToken( 1, '\"' ); + ByteString sId = comphelper::string::getToken(sTmp, 1, '\"'); return sId; } return ""; |