summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-11-22 17:17:53 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-11-23 10:10:08 +0000
commit20153742d2dee2df022275a07cc958b1759b9b72 (patch)
treea91d3d42faa559783d407bb1fe08f4070d945762 /l10ntools
parenta22ce3e4483f6fe462eaba8826a91355957e3676 (diff)
add a stripStart, can replace EraseLeadingChars
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/source/export.cxx6
-rw-r--r--l10ntools/source/gsicheck.cxx2
-rw-r--r--l10ntools/source/helpmerge.cxx4
-rw-r--r--l10ntools/source/lngmerge.cxx106
-rw-r--r--l10ntools/source/localize.cxx2
-rw-r--r--l10ntools/source/xrmmerge.cxx4
6 files changed, 66 insertions, 58 deletions
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index 7ad52f670b9b..2234125a420f 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -1281,7 +1281,7 @@ ByteString Export::GetPairedListID( const ByteString& sText ){
sIdent.ToUpperAscii();
while( sIdent.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
sIdent.EraseTrailingChars( ' ' );
- sIdent.EraseLeadingChars( ' ' );
+ sIdent = comphelper::string::stripStart(sIdent, ' ');
return sIdent;
}
ByteString Export::GetPairedListString( const ByteString& sText ){
@@ -1292,7 +1292,7 @@ ByteString Export::GetPairedListString( const ByteString& sText ){
ByteString s1 = sString.Copy( sString.Search( '\"' )+1 );
sString = s1.Copy( 0 , s1.SearchBackward( '\"' ) );
sString.EraseTrailingChars( ' ' );
- sString.EraseLeadingChars( ' ' );
+ sString = comphelper::string::stripStart(sString, ' ');
return sString;
}
ByteString Export::StripList( const ByteString& sText ){
@@ -1547,7 +1547,7 @@ ByteString Export::GetText( const ByteString &rSource, int nToken )
STRING_NOTFOUND ) {};
while( sToken.SearchAndReplace( " ", " " ) !=
STRING_NOTFOUND ) {};
- sToken.EraseLeadingChars( ' ' );
+ sToken = comphelper::string::stripStart(sToken, ' ');
sToken.EraseTrailingChars( ' ' );
if ( sToken.Len()) {
sReturn += "\\\" ";
diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx
index 9f1485b6d1c1..036edafb0601 100644
--- a/l10ntools/source/gsicheck.cxx
+++ b/l10ntools/source/gsicheck.cxx
@@ -394,7 +394,7 @@ void GSIBlock::PrintList( ParserMessageList *pList, ByteString aPrefix,
else
aContext = pLine->Copy( pMsg->GetTagBegin()-150, 300 );
aContext.EraseTrailingChars(' ');
- aContext.EraseLeadingChars(' ');
+ aContext = comphelper::string::stripStart(aContext, ' ');
}
PrintMessage( pMsg->Prefix(), pMsg->GetErrorText(), aPrefix, aContext, pLine->GetLineNumber(), pLine->GetUniqId() );
diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx
index 214105c25c79..efa5c0cef529 100644
--- a/l10ntools/source/helpmerge.cxx
+++ b/l10ntools/source/helpmerge.cxx
@@ -512,8 +512,8 @@ ByteString HelpParser::GetOutpath( const ByteString& rPathX , const ByteString&
testpath += sCur;
testpath += sDelimiter;
ByteString sRelativePath( rPathY );
- sRelativePath.EraseLeadingChars( '/' );
- sRelativePath.EraseLeadingChars( '\\' );
+ sRelativePath = comphelper::string::stripStart(sRelativePath, '/');
+ sRelativePath = comphelper::string::stripStart(sRelativePath, '\\');
testpath += sRelativePath;
testpath += sDelimiter;
return testpath;
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index 7592d4979160..57216afc6f74 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -142,54 +142,59 @@ sal_Bool LngParser::CreateSDF(
return true;
}
- void LngParser::WriteSDF( SvFileStream &aSDFStream , ByteStringHashMap &rText_inout ,
- const ByteString &rPrj , const ByteString &rRoot ,
- const ByteString &sActFileName , const ByteString &sID )
- {
-
- sal_Bool bExport = true;
- if ( bExport ) {
- ByteString sTimeStamp( Export::GetTimeStamp());
- ByteString sCur;
- for( unsigned int n = 0; n < aLanguages.size(); n++ ){
- sCur = aLanguages[ n ];
- ByteString sAct = rText_inout[ sCur ];
- if ( !sAct.Len() && sCur.Len() )
- sAct = rText_inout[ ByteString("en-US") ];
-
- ByteString sOutput( rPrj ); sOutput += "\t";
- if ( rRoot.Len())
- sOutput += sActFileName;
- sOutput += "\t0\t";
- sOutput += "LngText\t";
- sOutput += sID; sOutput += "\t\t\t\t0\t";
- sOutput += sCur; sOutput += "\t";
- sOutput += sAct; sOutput += "\t\t\t\t";
- sOutput += sTimeStamp;
- aSDFStream.WriteLine( sOutput );
- }
- }
- }
- bool LngParser::isNextGroup( ByteString &sGroup_out , ByteString &sLine_in ){
- sLine_in.EraseLeadingChars( ' ' );
+void LngParser::WriteSDF( SvFileStream &aSDFStream , ByteStringHashMap &rText_inout ,
+ const ByteString &rPrj , const ByteString &rRoot ,
+ const ByteString &sActFileName , const ByteString &sID )
+{
+
+ sal_Bool bExport = true;
+ if ( bExport ) {
+ ByteString sTimeStamp( Export::GetTimeStamp());
+ ByteString sCur;
+ for( unsigned int n = 0; n < aLanguages.size(); n++ ){
+ sCur = aLanguages[ n ];
+ ByteString sAct = rText_inout[ sCur ];
+ if ( !sAct.Len() && sCur.Len() )
+ sAct = rText_inout[ ByteString("en-US") ];
+
+ ByteString sOutput( rPrj ); sOutput += "\t";
+ if ( rRoot.Len())
+ sOutput += sActFileName;
+ sOutput += "\t0\t";
+ sOutput += "LngText\t";
+ sOutput += sID; sOutput += "\t\t\t\t0\t";
+ sOutput += sCur; sOutput += "\t";
+ sOutput += sAct; sOutput += "\t\t\t\t";
+ sOutput += sTimeStamp;
+ aSDFStream.WriteLine( sOutput );
+ }
+ }
+}
+
+bool LngParser::isNextGroup( ByteString &sGroup_out , ByteString &sLine_in )
+{
+ sLine_in = comphelper::string::stripStart(sLine_in, ' ');
sLine_in.EraseTrailingChars( ' ' );
if (( sLine_in.GetChar( 0 ) == '[' ) &&
- ( sLine_in.GetChar( sLine_in.Len() - 1 ) == ']' )){
+ ( sLine_in.GetChar( sLine_in.Len() - 1 ) == ']' ))
+ {
sGroup_out = getToken(getToken(sLine_in, 1, '['), 0, ']');
- sGroup_out.EraseLeadingChars( ' ' );
+ sGroup_out = comphelper::string::stripStart(sGroup_out, ' ');
sGroup_out.EraseTrailingChars( ' ' );
return true;
}
return false;
- }
- void LngParser::ReadLine( const ByteString &sLine_in , ByteStringHashMap &rText_inout){
- ByteString sLang = getToken(sLine_in, 0, '=');
- sLang.EraseLeadingChars( ' ' );
- sLang.EraseTrailingChars( ' ' );
- ByteString sText = getToken(getToken(sLine_in, 1, '\"'), 0, '\"');
- if( sLang.Len() )
- rText_inout[ sLang ] = sText;
- }
+}
+
+void LngParser::ReadLine( const ByteString &sLine_in , ByteStringHashMap &rText_inout)
+{
+ rtl::OString sLang = getToken(sLine_in, 0, '=');
+ sLang = comphelper::string::stripStart(sLang, ' ');
+ sLang = comphelper::string::stripStart(sLang, ' ');
+ rtl::OString sText = getToken(getToken(sLine_in, 1, '\"'), 0, '\"');
+ if (!sLang.isEmpty())
+ rText_inout[ sLang ] = sText;
+}
/*****************************************************************************/
sal_Bool LngParser::Merge(
@@ -217,15 +222,16 @@ sal_Bool LngParser::Merge(
ByteString sGroup;
// seek to next group
- while ( nPos < pLines->size() && !bGroup ) {
+ while ( nPos < pLines->size() && !bGroup )
+ {
ByteString sLine( *(*pLines)[ nPos ] );
- sLine.EraseLeadingChars( ' ' );
+ sLine = comphelper::string::stripStart(sLine, ' ');
sLine.EraseTrailingChars( ' ' );
if (( sLine.GetChar( 0 ) == '[' ) &&
( sLine.GetChar( sLine.Len() - 1 ) == ']' ))
{
sGroup = getToken(getToken(sLine, 1, '['), 0, ']');
- sGroup.EraseLeadingChars( ' ' );
+ sGroup = comphelper::string::stripStart(sGroup, ' ');
sGroup.EraseTrailingChars( ' ' );
bGroup = sal_True;
}
@@ -245,23 +251,25 @@ sal_Bool LngParser::Merge(
ByteString sLanguagesDone;
- while ( nPos < pLines->size() && !bGroup ) {
+ while ( nPos < pLines->size() && !bGroup )
+ {
ByteString sLine( *(*pLines)[ nPos ] );
- sLine.EraseLeadingChars( ' ' );
+ sLine = comphelper::string::stripStart(sLine, ' ');
sLine.EraseTrailingChars( ' ' );
if (( sLine.GetChar( 0 ) == '[' ) &&
( sLine.GetChar( sLine.Len() - 1 ) == ']' ))
{
sGroup = getToken(getToken(sLine, 1, '['), 0, ']');
- sGroup.EraseLeadingChars( ' ' );
+ sGroup = comphelper::string::stripStart(sGroup, ' ');
sGroup.EraseTrailingChars( ' ' );
bGroup = sal_True;
nPos ++;
sLanguagesDone = "";
}
- else if ( sLine.GetTokenCount( '=' ) > 1 ) {
+ else if ( sLine.GetTokenCount( '=' ) > 1 )
+ {
ByteString sLang = getToken(sLine, 0, '=');
- sLang.EraseLeadingChars( ' ' );
+ sLang = comphelper::string::stripStart(sLang, ' ');
sLang.EraseTrailingChars( ' ' );
ByteString sSearch( ";" );
diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx
index 609e344a9ade..4bbdf2eadf5c 100644
--- a/l10ntools/source/localize.cxx
+++ b/l10ntools/source/localize.cxx
@@ -279,7 +279,7 @@ const ByteString SourceTreeLocalizer::GetProjectRootRel()
DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US );
sCur.SearchAndReplaceAll( sDelimiter, "/" );
- sCur.EraseLeadingChars( '/' );
+ sCur = comphelper::string::stripStart(sCur, '/');
sal_uLong nCount = sCur.GetTokenCount( '/' );
ByteString sProjectRootRel;
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index 166d35598cfe..0d49e84e1545 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -440,8 +440,8 @@ void XRMResParser::ConvertStringToDBFormat( ByteString &rString )
ByteString sResult;
do {
sResult = rString;
- rString.EraseLeadingChars( _LF );
- rString.EraseLeadingChars( '\t' );
+ rString = comphelper::string::stripStart(rString, _LF);
+ rString = comphelper::string::stripStart(rString, '\t');
rString.EraseTrailingChars( '\t' );
} while ( sResult != rString );