add a stripStart, can replace EraseLeadingChars

This commit is contained in:
Caolán McNamara
2011-11-22 17:17:53 +00:00
parent a22ce3e448
commit 20153742d2
20 changed files with 215 additions and 129 deletions

View File

@@ -220,6 +220,27 @@ COMPHELPER_DLLPUBLIC rtl::OString remove(const rtl::OString &rIn,
COMPHELPER_DLLPUBLIC rtl::OUString remove(const rtl::OUString &rIn, COMPHELPER_DLLPUBLIC rtl::OUString remove(const rtl::OUString &rIn,
sal_Unicode c); sal_Unicode c);
/** Strips occurrences of a character from the start of the source string
@param rIn The input OString
@param c The character to be stripped from the beginning
@return The resulting OString
*/
COMPHELPER_DLLPUBLIC rtl::OString stripStart(const rtl::OString &rIn,
sal_Char c);
/** Strips occurrences of a character from the start of the source string
@param rIn The input OUString
@param c The character to be stripped from the beginning
@return The resulting OUString
*/
COMPHELPER_DLLPUBLIC rtl::OUString stripStart(const rtl::OUString &rIn,
sal_Unicode c);
/** Returns a token in the OString /** Returns a token in the OString
@param token the number of the token to return @param token the number of the token to return

View File

@@ -49,6 +49,7 @@ public:
void testNatural(); void testNatural();
void testReplace(); void testReplace();
void testRemove(); void testRemove();
void testStripStart();
void testToken(); void testToken();
void testDecimalStringToNumber(); void testDecimalStringToNumber();
void testIsdigitAsciiString(); void testIsdigitAsciiString();
@@ -62,6 +63,7 @@ public:
CPPUNIT_TEST(testNatural); CPPUNIT_TEST(testNatural);
CPPUNIT_TEST(testReplace); CPPUNIT_TEST(testReplace);
CPPUNIT_TEST(testRemove); CPPUNIT_TEST(testRemove);
CPPUNIT_TEST(testStripStart);
CPPUNIT_TEST(testToken); CPPUNIT_TEST(testToken);
CPPUNIT_TEST(testDecimalStringToNumber); CPPUNIT_TEST(testDecimalStringToNumber);
CPPUNIT_TEST(testIsdigitAsciiString); CPPUNIT_TEST(testIsdigitAsciiString);
@@ -430,6 +432,26 @@ void TestString::testRemove()
CPPUNIT_ASSERT(aOut.isEmpty()); CPPUNIT_ASSERT(aOut.isEmpty());
} }
void TestString::testStripStart()
{
::rtl::OString aIn(RTL_CONSTASCII_STRINGPARAM("abc"));
::rtl::OString aOut;
aOut = ::comphelper::string::stripStart(aIn, 'b');
CPPUNIT_ASSERT(aOut.equalsL(RTL_CONSTASCII_STRINGPARAM("abc")));
aOut = ::comphelper::string::stripStart(aIn, 'a');
CPPUNIT_ASSERT(aOut.equalsL(RTL_CONSTASCII_STRINGPARAM("bc")));
aIn = rtl::OString(RTL_CONSTASCII_STRINGPARAM("aaa"));
aOut = ::comphelper::string::stripStart(aIn, 'a');
CPPUNIT_ASSERT(aOut.isEmpty());
aIn = rtl::OString(RTL_CONSTASCII_STRINGPARAM("aba"));
aOut = ::comphelper::string::stripStart(aIn, 'a');
CPPUNIT_ASSERT(aOut.equalsL(RTL_CONSTASCII_STRINGPARAM("ba")));
}
void TestString::testToken() void TestString::testToken()
{ {
::rtl::OString aIn(RTL_CONSTASCII_STRINGPARAM("10.11.12")); ::rtl::OString aIn(RTL_CONSTASCII_STRINGPARAM("10.11.12"));

View File

@@ -169,6 +169,37 @@ rtl::OUString remove(const rtl::OUString &rIn, sal_Unicode c)
return tmpl_remove<rtl::OUString, sal_Unicode, rtl::OUStringBuffer>(rIn, c); return tmpl_remove<rtl::OUString, sal_Unicode, rtl::OUStringBuffer>(rIn, c);
} }
namespace
{
template <typename T, typename C> T tmpl_stripStart(const T &rIn,
const C cRemove)
{
if (rIn.isEmpty())
return rIn;
sal_Int32 i = 0;
while (i < rIn.getLength())
{
if (rIn[i] != cRemove)
break;
++i;
}
return rIn.copy(i);
}
}
rtl::OString stripStart(const rtl::OString &rIn, sal_Char c)
{
return tmpl_stripStart<rtl::OString, sal_Char>(rIn, c);
}
rtl::OUString stripStart(const rtl::OUString &rIn, sal_Unicode c)
{
return tmpl_stripStart<rtl::OUString, sal_Unicode>(rIn, c);
}
sal_uInt32 decimalStringToNumber( sal_uInt32 decimalStringToNumber(
::rtl::OUString const & str ) ::rtl::OUString const & str )
{ {

View File

@@ -1281,7 +1281,7 @@ ByteString Export::GetPairedListID( const ByteString& sText ){
sIdent.ToUpperAscii(); sIdent.ToUpperAscii();
while( sIdent.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {}; while( sIdent.SearchAndReplace( "\t", " " ) != STRING_NOTFOUND ) {};
sIdent.EraseTrailingChars( ' ' ); sIdent.EraseTrailingChars( ' ' );
sIdent.EraseLeadingChars( ' ' ); sIdent = comphelper::string::stripStart(sIdent, ' ');
return sIdent; return sIdent;
} }
ByteString Export::GetPairedListString( const ByteString& sText ){ ByteString Export::GetPairedListString( const ByteString& sText ){
@@ -1292,7 +1292,7 @@ ByteString Export::GetPairedListString( const ByteString& sText ){
ByteString s1 = sString.Copy( sString.Search( '\"' )+1 ); ByteString s1 = sString.Copy( sString.Search( '\"' )+1 );
sString = s1.Copy( 0 , s1.SearchBackward( '\"' ) ); sString = s1.Copy( 0 , s1.SearchBackward( '\"' ) );
sString.EraseTrailingChars( ' ' ); sString.EraseTrailingChars( ' ' );
sString.EraseLeadingChars( ' ' ); sString = comphelper::string::stripStart(sString, ' ');
return sString; return sString;
} }
ByteString Export::StripList( const ByteString& sText ){ ByteString Export::StripList( const ByteString& sText ){
@@ -1547,7 +1547,7 @@ ByteString Export::GetText( const ByteString &rSource, int nToken )
STRING_NOTFOUND ) {}; STRING_NOTFOUND ) {};
while( sToken.SearchAndReplace( " ", " " ) != while( sToken.SearchAndReplace( " ", " " ) !=
STRING_NOTFOUND ) {}; STRING_NOTFOUND ) {};
sToken.EraseLeadingChars( ' ' ); sToken = comphelper::string::stripStart(sToken, ' ');
sToken.EraseTrailingChars( ' ' ); sToken.EraseTrailingChars( ' ' );
if ( sToken.Len()) { if ( sToken.Len()) {
sReturn += "\\\" "; sReturn += "\\\" ";

View File

@@ -394,7 +394,7 @@ void GSIBlock::PrintList( ParserMessageList *pList, ByteString aPrefix,
else else
aContext = pLine->Copy( pMsg->GetTagBegin()-150, 300 ); aContext = pLine->Copy( pMsg->GetTagBegin()-150, 300 );
aContext.EraseTrailingChars(' '); aContext.EraseTrailingChars(' ');
aContext.EraseLeadingChars(' '); aContext = comphelper::string::stripStart(aContext, ' ');
} }
PrintMessage( pMsg->Prefix(), pMsg->GetErrorText(), aPrefix, aContext, pLine->GetLineNumber(), pLine->GetUniqId() ); PrintMessage( pMsg->Prefix(), pMsg->GetErrorText(), aPrefix, aContext, pLine->GetLineNumber(), pLine->GetUniqId() );

View File

@@ -512,8 +512,8 @@ ByteString HelpParser::GetOutpath( const ByteString& rPathX , const ByteString&
testpath += sCur; testpath += sCur;
testpath += sDelimiter; testpath += sDelimiter;
ByteString sRelativePath( rPathY ); ByteString sRelativePath( rPathY );
sRelativePath.EraseLeadingChars( '/' ); sRelativePath = comphelper::string::stripStart(sRelativePath, '/');
sRelativePath.EraseLeadingChars( '\\' ); sRelativePath = comphelper::string::stripStart(sRelativePath, '\\');
testpath += sRelativePath; testpath += sRelativePath;
testpath += sDelimiter; testpath += sDelimiter;
return testpath; return testpath;

View File

@@ -142,54 +142,59 @@ sal_Bool LngParser::CreateSDF(
return true; return true;
} }
void LngParser::WriteSDF( SvFileStream &aSDFStream , ByteStringHashMap &rText_inout , void LngParser::WriteSDF( SvFileStream &aSDFStream , ByteStringHashMap &rText_inout ,
const ByteString &rPrj , const ByteString &rRoot , const ByteString &rPrj , const ByteString &rRoot ,
const ByteString &sActFileName , const ByteString &sID ) const ByteString &sActFileName , const ByteString &sID )
{ {
sal_Bool bExport = true; sal_Bool bExport = true;
if ( bExport ) { if ( bExport ) {
ByteString sTimeStamp( Export::GetTimeStamp()); ByteString sTimeStamp( Export::GetTimeStamp());
ByteString sCur; ByteString sCur;
for( unsigned int n = 0; n < aLanguages.size(); n++ ){ for( unsigned int n = 0; n < aLanguages.size(); n++ ){
sCur = aLanguages[ n ]; sCur = aLanguages[ n ];
ByteString sAct = rText_inout[ sCur ]; ByteString sAct = rText_inout[ sCur ];
if ( !sAct.Len() && sCur.Len() ) if ( !sAct.Len() && sCur.Len() )
sAct = rText_inout[ ByteString("en-US") ]; sAct = rText_inout[ ByteString("en-US") ];
ByteString sOutput( rPrj ); sOutput += "\t"; ByteString sOutput( rPrj ); sOutput += "\t";
if ( rRoot.Len()) if ( rRoot.Len())
sOutput += sActFileName; sOutput += sActFileName;
sOutput += "\t0\t"; sOutput += "\t0\t";
sOutput += "LngText\t"; sOutput += "LngText\t";
sOutput += sID; sOutput += "\t\t\t\t0\t"; sOutput += sID; sOutput += "\t\t\t\t0\t";
sOutput += sCur; sOutput += "\t"; sOutput += sCur; sOutput += "\t";
sOutput += sAct; sOutput += "\t\t\t\t"; sOutput += sAct; sOutput += "\t\t\t\t";
sOutput += sTimeStamp; sOutput += sTimeStamp;
aSDFStream.WriteLine( sOutput ); aSDFStream.WriteLine( sOutput );
} }
} }
} }
bool LngParser::isNextGroup( ByteString &sGroup_out , ByteString &sLine_in ){
sLine_in.EraseLeadingChars( ' ' ); bool LngParser::isNextGroup( ByteString &sGroup_out , ByteString &sLine_in )
{
sLine_in = comphelper::string::stripStart(sLine_in, ' ');
sLine_in.EraseTrailingChars( ' ' ); sLine_in.EraseTrailingChars( ' ' );
if (( sLine_in.GetChar( 0 ) == '[' ) && 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 = getToken(getToken(sLine_in, 1, '['), 0, ']');
sGroup_out.EraseLeadingChars( ' ' ); sGroup_out = comphelper::string::stripStart(sGroup_out, ' ');
sGroup_out.EraseTrailingChars( ' ' ); sGroup_out.EraseTrailingChars( ' ' );
return true; return true;
} }
return false; return false;
} }
void LngParser::ReadLine( const ByteString &sLine_in , ByteStringHashMap &rText_inout){
ByteString sLang = getToken(sLine_in, 0, '='); void LngParser::ReadLine( const ByteString &sLine_in , ByteStringHashMap &rText_inout)
sLang.EraseLeadingChars( ' ' ); {
sLang.EraseTrailingChars( ' ' ); rtl::OString sLang = getToken(sLine_in, 0, '=');
ByteString sText = getToken(getToken(sLine_in, 1, '\"'), 0, '\"'); sLang = comphelper::string::stripStart(sLang, ' ');
if( sLang.Len() ) sLang = comphelper::string::stripStart(sLang, ' ');
rText_inout[ sLang ] = sText; rtl::OString sText = getToken(getToken(sLine_in, 1, '\"'), 0, '\"');
} if (!sLang.isEmpty())
rText_inout[ sLang ] = sText;
}
/*****************************************************************************/ /*****************************************************************************/
sal_Bool LngParser::Merge( sal_Bool LngParser::Merge(
@@ -217,15 +222,16 @@ sal_Bool LngParser::Merge(
ByteString sGroup; ByteString sGroup;
// seek to next group // seek to next group
while ( nPos < pLines->size() && !bGroup ) { while ( nPos < pLines->size() && !bGroup )
{
ByteString sLine( *(*pLines)[ nPos ] ); ByteString sLine( *(*pLines)[ nPos ] );
sLine.EraseLeadingChars( ' ' ); sLine = comphelper::string::stripStart(sLine, ' ');
sLine.EraseTrailingChars( ' ' ); sLine.EraseTrailingChars( ' ' );
if (( sLine.GetChar( 0 ) == '[' ) && if (( sLine.GetChar( 0 ) == '[' ) &&
( sLine.GetChar( sLine.Len() - 1 ) == ']' )) ( sLine.GetChar( sLine.Len() - 1 ) == ']' ))
{ {
sGroup = getToken(getToken(sLine, 1, '['), 0, ']'); sGroup = getToken(getToken(sLine, 1, '['), 0, ']');
sGroup.EraseLeadingChars( ' ' ); sGroup = comphelper::string::stripStart(sGroup, ' ');
sGroup.EraseTrailingChars( ' ' ); sGroup.EraseTrailingChars( ' ' );
bGroup = sal_True; bGroup = sal_True;
} }
@@ -245,23 +251,25 @@ sal_Bool LngParser::Merge(
ByteString sLanguagesDone; ByteString sLanguagesDone;
while ( nPos < pLines->size() && !bGroup ) { while ( nPos < pLines->size() && !bGroup )
{
ByteString sLine( *(*pLines)[ nPos ] ); ByteString sLine( *(*pLines)[ nPos ] );
sLine.EraseLeadingChars( ' ' ); sLine = comphelper::string::stripStart(sLine, ' ');
sLine.EraseTrailingChars( ' ' ); sLine.EraseTrailingChars( ' ' );
if (( sLine.GetChar( 0 ) == '[' ) && if (( sLine.GetChar( 0 ) == '[' ) &&
( sLine.GetChar( sLine.Len() - 1 ) == ']' )) ( sLine.GetChar( sLine.Len() - 1 ) == ']' ))
{ {
sGroup = getToken(getToken(sLine, 1, '['), 0, ']'); sGroup = getToken(getToken(sLine, 1, '['), 0, ']');
sGroup.EraseLeadingChars( ' ' ); sGroup = comphelper::string::stripStart(sGroup, ' ');
sGroup.EraseTrailingChars( ' ' ); sGroup.EraseTrailingChars( ' ' );
bGroup = sal_True; bGroup = sal_True;
nPos ++; nPos ++;
sLanguagesDone = ""; sLanguagesDone = "";
} }
else if ( sLine.GetTokenCount( '=' ) > 1 ) { else if ( sLine.GetTokenCount( '=' ) > 1 )
{
ByteString sLang = getToken(sLine, 0, '='); ByteString sLang = getToken(sLine, 0, '=');
sLang.EraseLeadingChars( ' ' ); sLang = comphelper::string::stripStart(sLang, ' ');
sLang.EraseTrailingChars( ' ' ); sLang.EraseTrailingChars( ' ' );
ByteString sSearch( ";" ); ByteString sSearch( ";" );

View File

@@ -279,7 +279,7 @@ const ByteString SourceTreeLocalizer::GetProjectRootRel()
DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US ); DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US );
sCur.SearchAndReplaceAll( sDelimiter, "/" ); sCur.SearchAndReplaceAll( sDelimiter, "/" );
sCur.EraseLeadingChars( '/' ); sCur = comphelper::string::stripStart(sCur, '/');
sal_uLong nCount = sCur.GetTokenCount( '/' ); sal_uLong nCount = sCur.GetTokenCount( '/' );
ByteString sProjectRootRel; ByteString sProjectRootRel;

View File

@@ -440,8 +440,8 @@ void XRMResParser::ConvertStringToDBFormat( ByteString &rString )
ByteString sResult; ByteString sResult;
do { do {
sResult = rString; sResult = rString;
rString.EraseLeadingChars( _LF ); rString = comphelper::string::stripStart(rString, _LF);
rString.EraseLeadingChars( '\t' ); rString = comphelper::string::stripStart(rString, '\t');
rString.EraseTrailingChars( '\t' ); rString.EraseTrailingChars( '\t' );
} while ( sResult != rString ); } while ( sResult != rString );

View File

@@ -1196,8 +1196,8 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile,
if( !aIStm.ReadLine( aLine ) ) if( !aIStm.ReadLine( aLine ) )
break; break;
aLine.EraseLeadingChars( ' ' ); aLine = comphelper::string::stripStart(aLine, ' ');
aLine.EraseLeadingChars( '\t' ); aLine = comphelper::string::stripStart(aLine, '\t');
aLine = comphelper::string::remove(aLine, ';'); aLine = comphelper::string::remove(aLine, ';');
if (comphelper::string::isdigitAsciiString(aLine)) if (comphelper::string::isdigitAsciiString(aLine))

View File

@@ -39,6 +39,7 @@ $(eval $(call gb_Library_add_api,scd,\
)) ))
$(eval $(call gb_Library_add_linked_libs,scd,\ $(eval $(call gb_Library_add_linked_libs,scd,\
comphelper \
cppu \ cppu \
cppuhelper \ cppuhelper \
sal \ sal \

View File

@@ -41,6 +41,7 @@
#include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XInputStream.hpp>
@@ -729,7 +730,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream )
} }
else if ( bIsXLS && bMaybeText ) else if ( bIsXLS && bMaybeText )
{ {
aHeader.EraseLeadingChars(); aHeader = comphelper::string::stripStart(aHeader, ' ');
if( aHeader.CompareTo( "<?xml", 5 ) == COMPARE_EQUAL ) if( aHeader.CompareTo( "<?xml", 5 ) == COMPARE_EQUAL )
pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilter2003XML) ); pFilter = aMatcher.GetFilter4FilterName( String::CreateFromAscii(pFilter2003XML) );
else else

View File

@@ -28,9 +28,9 @@
#ifndef _NEWSTYLE_HXX #ifndef _NEWSTYLE_HXX
#define _NEWSTYLE_HXX #define _NEWSTYLE_HXX
#include "sal/config.h" #include <comphelper/string.hxx>
#include "sfx2/dllapi.h" #include <sal/config.h>
#include <sfx2/dllapi.h>
#include <vcl/button.hxx> #include <vcl/button.hxx>
#include <vcl/msgbox.hxx> #include <vcl/msgbox.hxx>
#include <vcl/combobox.hxx> #include <vcl/combobox.hxx>
@@ -57,7 +57,7 @@ public:
SfxNewStyleDlg( Window* pParent, SfxStyleSheetBasePool& ); SfxNewStyleDlg( Window* pParent, SfxStyleSheetBasePool& );
~SfxNewStyleDlg(); ~SfxNewStyleDlg();
String GetName() const { return aColBox.GetText().EraseLeadingChars(); } String GetName() const { return comphelper::string::stripStart(aColBox.GetText(), ' '); }
}; };
#endif #endif

View File

@@ -130,8 +130,8 @@ void BmpCreator::ImplCreate( const ::std::vector< DirEntry >& rInDirs,
if( !pSRS->ReadLine( aLine ) ) if( !pSRS->ReadLine( aLine ) )
break; break;
aLine.EraseLeadingChars( ' ' ); aLine = comphelper::string::stripStart(aLine, ' ');
aLine.EraseLeadingChars( '\t' ); aLine = comphelper::string::stripStart(aLine, '\t');
aLine = comphelper::string::remove(aLine, ';'); aLine = comphelper::string::remove(aLine, ';');
if (comphelper::string::isdigitAsciiString(aLine)) if (comphelper::string::isdigitAsciiString(aLine))

View File

@@ -265,8 +265,8 @@ void ImageMap::ImpReadCERNLine( const rtl::OString& rLine, const String& rBaseUR
{ {
ByteString aStr( rLine ); ByteString aStr( rLine );
aStr.EraseLeadingChars( ' ' ); aStr = comphelper::string::stripStart(aStr, ' ');
aStr.EraseLeadingChars( '\t' ); aStr = comphelper::string::stripStart(aStr, '\t');
aStr = comphelper::string::remove(aStr, ';'); aStr = comphelper::string::remove(aStr, ';');
aStr.ToLowerAscii(); aStr.ToLowerAscii();
@@ -408,8 +408,8 @@ void ImageMap::ImpReadNCSALine( const rtl::OString& rLine, const String& rBaseUR
{ {
ByteString aStr( rLine ); ByteString aStr( rLine );
aStr.EraseLeadingChars( ' ' ); aStr = comphelper::string::stripStart(aStr, ' ');
aStr.EraseLeadingChars( '\t' ); aStr = comphelper::string::stripStart(aStr, '\t');
aStr = comphelper::string::remove(aStr, ';'); aStr = comphelper::string::remove(aStr, ';');
aStr.ToLowerAscii(); aStr.ToLowerAscii();

View File

@@ -72,7 +72,7 @@ rtl::OString SimpleConfig::getNext()
#pragma warning (pop) #pragma warning (pop)
#endif #endif
aStringBuffer.EraseLeadingChars( '\t' ); aStringBuffer = comphelper::string::stripStart(aStringBuffer, '\t');
return aString; return aString;
} }

View File

@@ -157,8 +157,8 @@ public:
/** The way input strings that represent (parts of) URIs are interpreted /** The way input strings that represent (parts of) URIs are interpreted
in set-methods. in set-methods.
@descr Most set-methods accept either a ByteString or a rtl::OUString @descr Most set-methods accept either a rtl::OString or a rtl::OUString
as input. Using a ByteString, octets in the range 0x80--0xFF are as input. Using a rtl::OString, octets in the range 0x80--0xFF are
replaced by single escape sequences. Using a rtl::OUString , UTF-32 replaced by single escape sequences. Using a rtl::OUString , UTF-32
characters in the range 0x80--0x10FFFF are replaced by sequences of characters in the range 0x80--0x10FFFF are replaced by sequences of
escape sequences, representing the UTF-8 coded characters. escape sequences, representing the UTF-8 coded characters.
@@ -271,7 +271,7 @@ public:
//======================================================================== //========================================================================
// Strict Parsing: // Strict Parsing:
inline INetURLObject(ByteString const & rTheAbsURIRef, inline INetURLObject(const rtl::OString& rTheAbsURIRef,
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
@@ -279,7 +279,7 @@ public:
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
inline bool SetURL(ByteString const & rTheAbsURIRef, inline bool SetURL(const rtl::OString& rTheAbsURIRef,
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
@@ -404,7 +404,7 @@ public:
{ m_eSmartScheme = eTheSmartScheme; } { m_eSmartScheme = eTheSmartScheme; }
inline bool inline bool
SetSmartURL(ByteString const & rTheAbsURIRef, SetSmartURL(const rtl::OString& rTheAbsURIRef,
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
FSysStyle eStyle = FSYS_DETECT); FSysStyle eStyle = FSYS_DETECT);
@@ -416,7 +416,7 @@ public:
FSysStyle eStyle = FSYS_DETECT); FSysStyle eStyle = FSYS_DETECT);
inline INetURLObject inline INetURLObject
smartRel2Abs(ByteString const & rTheRelURIRef, smartRel2Abs(const rtl::OString& rTheRelURIRef,
bool & rWasAbsolute, bool & rWasAbsolute,
bool bIgnoreFragment = false, bool bIgnoreFragment = false,
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
@@ -437,7 +437,7 @@ public:
// Relative URLs: // Relative URLs:
inline bool inline bool
GetNewAbsURL(ByteString const & rTheRelURIRef, GetNewAbsURL(const rtl::OString& rTheRelURIRef,
INetURLObject * pTheAbsURIRef, INetURLObject * pTheAbsURIRef,
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
@@ -469,8 +469,8 @@ public:
FSysStyle eStyle = FSYS_DETECT); FSysStyle eStyle = FSYS_DETECT);
static inline rtl::OUString static inline rtl::OUString
GetRelURL(ByteString const & rTheBaseURIRef, GetRelURL(const rtl::OString& rTheBaseURIRef,
ByteString const & rTheAbsURIRef, const rtl::OString& rTheAbsURIRef,
EncodeMechanism eEncodeMechanism = WAS_ENCODED, EncodeMechanism eEncodeMechanism = WAS_ENCODED,
DecodeMechanism eDecodeMechanism = DECODE_TO_IURI, DecodeMechanism eDecodeMechanism = DECODE_TO_IURI,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8, rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8,
@@ -491,7 +491,7 @@ public:
rtl_TextEncoding eCharset rtl_TextEncoding eCharset
= RTL_TEXTENCODING_UTF8) const; = RTL_TEXTENCODING_UTF8) const;
static inline bool translateToExternal(ByteString const & rTheIntURIRef, static inline bool translateToExternal(const rtl::OString& rTheIntURIRef,
rtl::OUString & rTheExtURIRef, rtl::OUString & rTheExtURIRef,
DecodeMechanism eDecodeMechanism DecodeMechanism eDecodeMechanism
= DECODE_TO_IURI, = DECODE_TO_IURI,
@@ -505,7 +505,7 @@ public:
rtl_TextEncoding eCharset rtl_TextEncoding eCharset
= RTL_TEXTENCODING_UTF8); = RTL_TEXTENCODING_UTF8);
static inline bool translateToInternal(ByteString const & rTheExtURIRef, static inline bool translateToInternal(const rtl::OString& rTheExtURIRef,
rtl::OUString & rTheIntURIRef, rtl::OUString & rTheIntURIRef,
DecodeMechanism eDecodeMechanism DecodeMechanism eDecodeMechanism
= DECODE_TO_IURI, = DECODE_TO_IURI,
@@ -534,7 +534,7 @@ public:
*/ */
static rtl::OUString GetScheme(INetProtocol eTheScheme); static rtl::OUString GetScheme(INetProtocol eTheScheme);
static inline INetProtocol CompareProtocolScheme(ByteString const & static inline INetProtocol CompareProtocolScheme(const rtl::OString&
rTheAbsURIRef) rTheAbsURIRef)
{ return CompareProtocolScheme(extend(rTheAbsURIRef)); } { return CompareProtocolScheme(extend(rTheAbsURIRef)); }
@@ -559,7 +559,7 @@ public:
= RTL_TEXTENCODING_UTF8) const = RTL_TEXTENCODING_UTF8) const
{ return decode(m_aAuth, getEscapePrefix(), eMechanism, eCharset); } { return decode(m_aAuth, getEscapePrefix(), eMechanism, eCharset); }
inline bool SetUser(ByteString const & rTheUser, inline bool SetUser(const rtl::OString& rTheUser,
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
{ return setUser(extend(rTheUser), true, eMechanism, eCharset); } { return setUser(extend(rTheUser), true, eMechanism, eCharset); }
@@ -569,7 +569,7 @@ public:
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
{ return setUser(rTheUser, false, eMechanism, eCharset); } { return setUser(rTheUser, false, eMechanism, eCharset); }
inline bool SetPass(ByteString const & rThePassword, inline bool SetPass(const rtl::OString& rThePassword,
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
@@ -577,8 +577,8 @@ public:
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
inline bool SetUserAndPass(ByteString const & rTheUser, inline bool SetUserAndPass(const rtl::OString& rTheUser,
ByteString const & rThePassword, const rtl:OString& rThePassword,
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset rtl_TextEncoding eCharset
= RTL_TEXTENCODING_UTF8); = RTL_TEXTENCODING_UTF8);
@@ -604,7 +604,7 @@ public:
sal_uInt32 GetPort() const; sal_uInt32 GetPort() const;
inline bool SetHost(ByteString const & rTheHost, inline bool SetHost(const rtl::OString& rTheHost,
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
{ return setHost(extend(rTheHost), true, eMechanism, eCharset); } { return setHost(extend(rTheHost), true, eMechanism, eCharset); }
@@ -626,7 +626,7 @@ public:
= RTL_TEXTENCODING_UTF8) const = RTL_TEXTENCODING_UTF8) const
{ return decode(m_aPath, getEscapePrefix(), eMechanism, eCharset); } { return decode(m_aPath, getEscapePrefix(), eMechanism, eCharset); }
inline bool SetURLPath(ByteString const & rThePath, inline bool SetURLPath(const rtl::OString& rThePath,
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
{ return setPath(extend(rThePath), true, eMechanism, eCharset); } { return setPath(extend(rThePath), true, eMechanism, eCharset); }
@@ -933,7 +933,7 @@ public:
= RTL_TEXTENCODING_UTF8) const = RTL_TEXTENCODING_UTF8) const
{ return decode(m_aQuery, getEscapePrefix(), eMechanism, eCharset); } { return decode(m_aQuery, getEscapePrefix(), eMechanism, eCharset); }
inline bool SetParam(ByteString const & rTheQuery, inline bool SetParam(const rtl::OString& rTheQuery,
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
@@ -951,7 +951,7 @@ public:
= RTL_TEXTENCODING_UTF8) const = RTL_TEXTENCODING_UTF8) const
{ return decode(m_aFragment, getEscapePrefix(), eMechanism, eCharset); } { return decode(m_aFragment, getEscapePrefix(), eMechanism, eCharset); }
inline bool SetMark(ByteString const & rTheFragment, inline bool SetMark(const rtl::OString& rTheFragment,
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8);
@@ -1073,7 +1073,7 @@ public:
@return The encoded representation of the text ('forbidden' @return The encoded representation of the text ('forbidden'
characters replaced by escape sequences). characters replaced by escape sequences).
*/ */
static inline rtl::OUString encode(ByteString const & rText, Part ePart, static inline rtl::OUString encode(const rtl::OString& rText, Part ePart,
sal_Char cEscapePrefix, sal_Char cEscapePrefix,
EncodeMechanism eMechanism, EncodeMechanism eMechanism,
rtl_TextEncoding eCharset rtl_TextEncoding eCharset
@@ -1190,7 +1190,7 @@ public:
rtl_TextEncoding eCharset rtl_TextEncoding eCharset
= RTL_TEXTENCODING_UTF8) const; = RTL_TEXTENCODING_UTF8) const;
inline bool Append(ByteString const & rTheSegment, inline bool Append(const rtl::OString& rTheSegment,
EncodeMechanism eMechanism = WAS_ENCODED, EncodeMechanism eMechanism = WAS_ENCODED,
rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8)
{ return appendSegment(extend(rTheSegment), true, eMechanism, eCharset); } { return appendSegment(extend(rTheSegment), true, eMechanism, eCharset); }
@@ -1426,7 +1426,7 @@ private:
// Coding: // Coding:
static inline rtl::OUString extend(ByteString const & rOctets) static inline rtl::OUString extend(const rtl::OString& rOctets)
{ {
return rtl::OUString(rOctets.GetBuffer(), rOctets.Len(), return rtl::OUString(rOctets.GetBuffer(), rOctets.Len(),
RTL_TEXTENCODING_ISO_8859_1); RTL_TEXTENCODING_ISO_8859_1);
@@ -1495,7 +1495,7 @@ inline rtl::OUString INetURLObject::decode(SubString const & rSubString,
rtl::OUString(); rtl::OUString();
} }
inline INetURLObject::INetURLObject(ByteString const & rTheAbsURIRef, inline INetURLObject::INetURLObject(const rtl::OString& rTheAbsURIRef,
EncodeMechanism eMechanism, EncodeMechanism eMechanism,
rtl_TextEncoding eCharset): rtl_TextEncoding eCharset):
m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(INET_PROT_HTTP) m_eScheme(INET_PROT_NOT_VALID), m_eSmartScheme(INET_PROT_HTTP)
@@ -1513,7 +1513,7 @@ inline INetURLObject::INetURLObject(rtl::OUString const & rTheAbsURIRef,
FSysStyle(0)); FSysStyle(0));
} }
inline bool INetURLObject::SetURL(ByteString const & rTheAbsURIRef, inline bool INetURLObject::SetURL(const rtl::OString& rTheAbsURIRef,
EncodeMechanism eMechanism, EncodeMechanism eMechanism,
rtl_TextEncoding eCharset) rtl_TextEncoding eCharset)
{ {
@@ -1539,7 +1539,7 @@ inline INetURLObject::INetURLObject(rtl::OUString const & rTheAbsURIRef,
setAbsURIRef(rTheAbsURIRef, false, eMechanism, eCharset, true, eStyle); setAbsURIRef(rTheAbsURIRef, false, eMechanism, eCharset, true, eStyle);
} }
inline bool INetURLObject::SetSmartURL(ByteString const & rTheAbsURIRef, inline bool INetURLObject::SetSmartURL(const rtl::OString& rTheAbsURIRef,
EncodeMechanism eMechanism, EncodeMechanism eMechanism,
rtl_TextEncoding eCharset, rtl_TextEncoding eCharset,
FSysStyle eStyle) FSysStyle eStyle)
@@ -1558,7 +1558,7 @@ inline bool INetURLObject::SetSmartURL(rtl::OUString const & rTheAbsURIRef,
} }
inline INetURLObject inline INetURLObject
INetURLObject::smartRel2Abs(ByteString const & rTheRelURIRef, INetURLObject::smartRel2Abs(const rtl::OString& rTheRelURIRef,
bool & rWasAbsolute, bool & rWasAbsolute,
bool bIgnoreFragment, bool bIgnoreFragment,
EncodeMechanism eMechanism, EncodeMechanism eMechanism,
@@ -1589,7 +1589,7 @@ INetURLObject::smartRel2Abs(rtl::OUString const & rTheRelURIRef,
return aTheAbsURIRef; return aTheAbsURIRef;
} }
inline bool INetURLObject::GetNewAbsURL(ByteString const & rTheRelURIRef, inline bool INetURLObject::GetNewAbsURL(const rtl::OString& rTheRelURIRef,
INetURLObject * pTheAbsURIRef, INetURLObject * pTheAbsURIRef,
EncodeMechanism eMechanism, EncodeMechanism eMechanism,
rtl_TextEncoding eCharset, rtl_TextEncoding eCharset,
@@ -1626,8 +1626,8 @@ inline bool INetURLObject::GetNewAbsURL(rtl::OUString const & rTheRelURIRef,
} }
// static // static
inline rtl::OUString INetURLObject::GetRelURL(ByteString const & rTheBaseURIRef, inline rtl::OUString INetURLObject::GetRelURL(const rtl::OString& rTheBaseURIRef,
ByteString const & rTheAbsURIRef, const rtl::OString& rTheAbsURIRef,
EncodeMechanism eEncodeMechanism, EncodeMechanism eEncodeMechanism,
DecodeMechanism eDecodeMechanism, DecodeMechanism eDecodeMechanism,
rtl_TextEncoding eCharset, rtl_TextEncoding eCharset,
@@ -1656,8 +1656,7 @@ inline rtl::OUString INetURLObject::GetRelURL(rtl::OUString const & rTheBaseURIR
} }
// static // static
inline bool INetURLObject::translateToExternal(ByteString const & inline bool INetURLObject::translateToExternal(const rtl::OString& rTheIntURIRef,
rTheIntURIRef,
rtl::OUString & rTheExtURIRef, rtl::OUString & rTheExtURIRef,
DecodeMechanism DecodeMechanism
eDecodeMechanism, eDecodeMechanism,
@@ -1683,7 +1682,7 @@ inline bool INetURLObject::translateToExternal(rtl::OUString const &
} }
// static // static
inline bool INetURLObject::translateToInternal(ByteString const & inline bool INetURLObject::translateToInternal(const rtl::OString&
rTheExtURIRef, rTheExtURIRef,
rtl::OUString & rTheIntURIRef, rtl::OUString & rTheIntURIRef,
DecodeMechanism DecodeMechanism
@@ -1709,11 +1708,11 @@ inline bool INetURLObject::translateToInternal(rtl::OUString const &
eDecodeMechanism, eCharset); eDecodeMechanism, eCharset);
} }
inline bool INetURLObject::SetPass(ByteString const & rThePassword, inline bool INetURLObject::SetPass(const rtl::OString& rThePassword,
EncodeMechanism eMechanism, EncodeMechanism eMechanism,
rtl_TextEncoding eCharset) rtl_TextEncoding eCharset)
{ {
return rThePassword.Len() == 0 ? return rThePassword.isEmpty() ?
clearPassword() : clearPassword() :
setPassword(extend(rThePassword), true, eMechanism, eCharset); setPassword(extend(rThePassword), true, eMechanism, eCharset);
} }
@@ -1722,18 +1721,18 @@ inline bool INetURLObject::SetPass(rtl::OUString const & rThePassword,
EncodeMechanism eMechanism, EncodeMechanism eMechanism,
rtl_TextEncoding eCharset) rtl_TextEncoding eCharset)
{ {
return rThePassword.getLength() == 0 ? return rThePassword.isEmpty() ?
clearPassword() : clearPassword() :
setPassword(rThePassword, false, eMechanism, eCharset); setPassword(rThePassword, false, eMechanism, eCharset);
} }
inline bool INetURLObject::SetUserAndPass(ByteString const & rTheUser, inline bool INetURLObject::SetUserAndPass(const rtl::OString& rTheUser,
ByteString const & rThePassword, const rtl::OString& rThePassword,
EncodeMechanism eMechanism, EncodeMechanism eMechanism,
rtl_TextEncoding eCharset) rtl_TextEncoding eCharset)
{ {
return setUser(extend(rTheUser), true, eMechanism, eCharset) return setUser(extend(rTheUser), true, eMechanism, eCharset)
&& (rThePassword.Len() == 0 ? && (rThePassword.isEmpty() ?
clearPassword() : clearPassword() :
setPassword(extend(rThePassword), true, eMechanism, setPassword(extend(rThePassword), true, eMechanism,
eCharset)); eCharset));
@@ -1745,7 +1744,7 @@ inline bool INetURLObject::SetUserAndPass(rtl::OUString const & rTheUser,
rtl_TextEncoding eCharset) rtl_TextEncoding eCharset)
{ {
return setUser(rTheUser, false, eMechanism, eCharset) return setUser(rTheUser, false, eMechanism, eCharset)
&& (rThePassword.getLength() == 0 ? && (rThePassword.isEmpty() ?
clearPassword() : clearPassword() :
setPassword(rThePassword, false, eMechanism, eCharset)); setPassword(rThePassword, false, eMechanism, eCharset));
} }
@@ -1761,11 +1760,11 @@ inline bool INetURLObject::insertName(rtl::OUString const & rTheName,
bIgnoreFinalSlash, eMechanism, eCharset); bIgnoreFinalSlash, eMechanism, eCharset);
} }
inline bool INetURLObject::SetParam(ByteString const & rTheQuery, inline bool INetURLObject::SetParam(const rtl::OString& rTheQuery,
EncodeMechanism eMechanism, EncodeMechanism eMechanism,
rtl_TextEncoding eCharset) rtl_TextEncoding eCharset)
{ {
return rTheQuery.Len() == 0 ? return rTheQuery.isEmpty() ?
clearQuery() : clearQuery() :
setQuery(extend(rTheQuery), true, eMechanism, eCharset); setQuery(extend(rTheQuery), true, eMechanism, eCharset);
} }
@@ -1774,16 +1773,16 @@ inline bool INetURLObject::SetParam(rtl::OUString const & rTheQuery,
EncodeMechanism eMechanism, EncodeMechanism eMechanism,
rtl_TextEncoding eCharset) rtl_TextEncoding eCharset)
{ {
return rTheQuery.getLength() == 0 ? return rTheQuery.isEmpty() ?
clearQuery() : clearQuery() :
setQuery(rTheQuery, false, eMechanism, eCharset); setQuery(rTheQuery, false, eMechanism, eCharset);
} }
inline bool INetURLObject::SetMark(ByteString const & rTheFragment, inline bool INetURLObject::SetMark(const rtl::OString& rTheFragment,
EncodeMechanism eMechanism, EncodeMechanism eMechanism,
rtl_TextEncoding eCharset) rtl_TextEncoding eCharset)
{ {
return rTheFragment.Len() == 0 ? return rTheFragment.isEmpty() ?
clearFragment() : clearFragment() :
setFragment(extend(rTheFragment), true, eMechanism, eCharset); setFragment(extend(rTheFragment), true, eMechanism, eCharset);
} }
@@ -1792,7 +1791,7 @@ inline bool INetURLObject::SetMark(rtl::OUString const & rTheFragment,
EncodeMechanism eMechanism, EncodeMechanism eMechanism,
rtl_TextEncoding eCharset) rtl_TextEncoding eCharset)
{ {
return rTheFragment.getLength() == 0 ? return rTheFragment.isEmpty() ?
clearFragment() : clearFragment() :
setFragment(rTheFragment, false, eMechanism, eCharset); setFragment(rTheFragment, false, eMechanism, eCharset);
} }
@@ -1805,7 +1804,7 @@ inline INetURLObject::INetURLObject(rtl::OUString const & rFSysPath,
} }
// static // static
inline rtl::OUString INetURLObject::encode(ByteString const & rText, Part ePart, inline rtl::OUString INetURLObject::encode(const rtl::OString& rText, Part ePart,
sal_Char cEscapePrefix, sal_Char cEscapePrefix,
EncodeMechanism eMechanism, EncodeMechanism eMechanism,
rtl_TextEncoding eCharset) rtl_TextEncoding eCharset)

View File

@@ -28,6 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove // MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_tools.hxx" #include "precompiled_tools.hxx"
#include <comphelper/string.hxx>
#include <sal/types.h> #include <sal/types.h>
#include <rtl/memory.h> #include <rtl/memory.h>
#include <rtl/strbuf.hxx> #include <rtl/strbuf.hxx>
@@ -510,7 +511,7 @@ int INetMessageOStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize)
aField.Copy (0, nPos)); aField.Copy (0, nPos));
ByteString aValue ( ByteString aValue (
aField.Copy (nPos + 1, aField.Len() - nPos + 1)); aField.Copy (nPos + 1, aField.Len() - nPos + 1));
aValue.EraseLeadingChars (' '); aValue = comphelper::string::stripStart(aValue, ' ');
pTargetMsg->SetHeaderField ( pTargetMsg->SetHeaderField (
INetMessageHeader (aName, aValue)); INetMessageHeader (aName, aValue));
@@ -1298,8 +1299,8 @@ INetMIMEMessageStream::GetMsgEncoding (const String& rContentType)
if (rContentType.GetTokenCount ('=') > 1) if (rContentType.GetTokenCount ('=') > 1)
{ {
String aCharset (rContentType.GetToken (1, '=')); String aCharset (rContentType.GetToken (1, '='));
aCharset.EraseLeadingChars (' '); aCharset = comphelper::string::stripStart(aCharset, ' ');
aCharset.EraseLeadingChars ('"'); aCharset = comphelper::string::stripStart(aCharset, '"');
if (aCharset.CompareIgnoreCaseToAscii ("us-ascii", 8) == 0) if (aCharset.CompareIgnoreCaseToAscii ("us-ascii", 8) == 0)
return INETMSG_ENCODING_7BIT; return INETMSG_ENCODING_7BIT;

View File

@@ -83,7 +83,8 @@
#include <valgrind/callgrind.h> #include <valgrind/callgrind.h>
#endif #endif
#include "comphelper/processfactory.hxx" #include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include "com/sun/star/beans/XMaterialHolder.hpp" #include "com/sun/star/beans/XMaterialHolder.hpp"
#include "com/sun/star/beans/NamedValue.hpp" #include "com/sun/star/beans/NamedValue.hpp"
@@ -2085,9 +2086,9 @@ void PrintFontManager::initFontsAlias()
ByteString aMap = GetCommandLineToken( 1, aLine ); ByteString aMap = GetCommandLineToken( 1, aLine );
// remove eventual quotes // remove eventual quotes
aAlias.EraseLeadingChars( '"' ); aAlias = comphelper::string::stripStart(aAlias, '"');
aAlias.EraseTrailingChars( '"' ); aAlias.EraseTrailingChars( '"' );
aMap.EraseLeadingChars( '"' ); aMap = comphelper::string::stripStart(aMap, '"');
aMap.EraseTrailingChars( '"' ); aMap.EraseTrailingChars( '"' );
XLFDEntry aAliasEntry, aMapEntry; XLFDEntry aAliasEntry, aMapEntry;

View File

@@ -34,6 +34,7 @@
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#include <comphelper/string.hxx>
#include "vcl/ppdparser.hxx" #include "vcl/ppdparser.hxx"
#include "vcl/strhelper.hxx" #include "vcl/strhelper.hxx"
#include "vcl/helper.hxx" #include "vcl/helper.hxx"
@@ -604,13 +605,13 @@ String PPDParser::getPPDPrinterName( const String& rFile )
if( aCurLine.CompareIgnoreCaseToAscii( "*include:", 9 ) == COMPARE_EQUAL ) if( aCurLine.CompareIgnoreCaseToAscii( "*include:", 9 ) == COMPARE_EQUAL )
{ {
aCurLine.Erase( 0, 9 ); aCurLine.Erase( 0, 9 );
aCurLine.EraseLeadingChars( ' ' ); aCurLine = comphelper::string::stripStart(aCurLine, ' ');
aCurLine.EraseTrailingChars( ' ' ); aCurLine.EraseTrailingChars( ' ' );
aCurLine.EraseLeadingChars( '\t' ); aCurLine = comphelper::string::stripStart(aCurLine, '\t');
aCurLine.EraseTrailingChars( '\t' ); aCurLine.EraseTrailingChars( '\t' );
aCurLine.EraseTrailingChars( '\r' ); aCurLine.EraseTrailingChars( '\r' );
aCurLine.EraseTrailingChars( '\n' ); aCurLine.EraseTrailingChars( '\n' );
aCurLine.EraseLeadingChars( '"' ); aCurLine = comphelper::string::stripStart(aCurLine, '"');
aCurLine.EraseTrailingChars( '"' ); aCurLine.EraseTrailingChars( '"' );
aStream.Close(); aStream.Close();
aStream.Open( getPPDFile( aCurLine ) ); aStream.Open( getPPDFile( aCurLine ) );
@@ -703,13 +704,13 @@ PPDParser::PPDParser( const String& rFile ) :
if( aCurLine.CompareIgnoreCaseToAscii( "*include:", 9 ) == COMPARE_EQUAL ) if( aCurLine.CompareIgnoreCaseToAscii( "*include:", 9 ) == COMPARE_EQUAL )
{ {
aCurLine.Erase( 0, 9 ); aCurLine.Erase( 0, 9 );
aCurLine.EraseLeadingChars( ' ' ); aCurLine = comphelper::string::stripStart(aCurLine, ' ');
aCurLine.EraseTrailingChars( ' ' ); aCurLine.EraseTrailingChars( ' ' );
aCurLine.EraseLeadingChars( '\t' ); aCurLine = comphelper::string::stripStart(aCurLine, '\t');
aCurLine.EraseTrailingChars( '\t' ); aCurLine.EraseTrailingChars( '\t' );
aCurLine.EraseTrailingChars( '\r' ); aCurLine.EraseTrailingChars( '\r' );
aCurLine.EraseTrailingChars( '\n' ); aCurLine.EraseTrailingChars( '\n' );
aCurLine.EraseLeadingChars( '"' ); aCurLine = comphelper::string::stripStart(aCurLine, '"');
aCurLine.EraseTrailingChars( '"' ); aCurLine.EraseTrailingChars( '"' );
aStream.Close(); aStream.Close();
aStream.Open( getPPDFile( String( aCurLine, m_aFileEncoding ) ) ); aStream.Open( getPPDFile( String( aCurLine, m_aFileEncoding ) ) );