[Libreoffice-commits] .: 2 commits - vcl/inc vcl/source vcl/unx
Caolán McNamara
caolan at kemper.freedesktop.org
Fri Jun 24 04:52:46 PDT 2011
vcl/inc/vcl/ppdparser.hxx | 10 +++----
vcl/inc/vcl/strhelper.hxx | 8 +++---
vcl/source/helper/strhelper.cxx | 29 ++++++++++-----------
vcl/unx/generic/printer/ppdparser.cxx | 45 ++++++++++++++++++----------------
4 files changed, 47 insertions(+), 45 deletions(-)
New commits:
commit 350113412bcc530e65d8d4bed10d79a19e935e2b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jun 24 00:18:15 2011 +0100
rtl::ByteString->rtl::OString
diff --git a/vcl/inc/vcl/ppdparser.hxx b/vcl/inc/vcl/ppdparser.hxx
index 8f65b64..853985d 100644
--- a/vcl/inc/vcl/ppdparser.hxx
+++ b/vcl/inc/vcl/ppdparser.hxx
@@ -187,11 +187,11 @@ private:
~PPDParser();
void parseOrderDependency(const rtl::OString& rLine);
- void parseOpenUI( const ByteString& rLine );
- void parseConstraint( const ByteString& rLine );
- void parse( std::list< ByteString >& rLines );
+ void parseOpenUI(const rtl::OString& rLine);
+ void parseConstraint(const rtl::OString& rLine);
+ void parse( std::list< rtl::OString >& rLines );
- String handleTranslation( const ByteString& i_rString, bool i_bIsGlobalized );
+ String handleTranslation(const rtl::OString& i_rString, bool i_bIsGlobalized);
static void scanPPDDir( const String& rDir );
static void initPPDFiles();
diff --git a/vcl/inc/vcl/strhelper.hxx b/vcl/inc/vcl/strhelper.hxx
index 69c33f7..984c226 100644
--- a/vcl/inc/vcl/strhelper.hxx
+++ b/vcl/inc/vcl/strhelper.hxx
@@ -38,17 +38,17 @@
namespace psp {
String VCL_DLLPUBLIC GetCommandLineToken( int, const String& );
-ByteString VCL_DLLPUBLIC GetCommandLineToken( int, const ByteString& );
+rtl::OString VCL_DLLPUBLIC GetCommandLineToken(int, const rtl::OString&);
// gets one token of a unix command line style string
// doublequote, singlequote and singleleftquote protect their respective
// contents
int VCL_DLLPUBLIC GetCommandLineTokenCount( const String& );
-int VCL_DLLPUBLIC GetCommandLineTokenCount( const ByteString& );
+int VCL_DLLPUBLIC GetCommandLineTokenCount(const rtl::OString&);
// returns number of tokens (zero if empty or whitespace only)
String VCL_DLLPUBLIC WhitespaceToSpace( const String&, sal_Bool bProtect = sal_True );
-ByteString VCL_DLLPUBLIC WhitespaceToSpace( const ByteString&, sal_Bool bProtect = sal_True );
+rtl::OString VCL_DLLPUBLIC WhitespaceToSpace(const rtl::OString&, sal_Bool bProtect = sal_True);
// returns a string with multiple adjacent occurrences of whitespace
// converted to a single space. if bProtect is sal_True (nonzero), then
// doublequote, singlequote and singleleftquote protect their respective
@@ -61,7 +61,7 @@ inline double VCL_DLLPUBLIC StringToDouble( const String& rStr )
return rtl::math::stringToDouble(rStr, sal_Unicode('.'), sal_Unicode(0));
}
-inline double VCL_DLLPUBLIC StringToDouble( const ByteString& rStr )
+inline double VCL_DLLPUBLIC StringToDouble(const rtl::OString& rStr)
{
return rtl::math::stringToDouble(rStr, '.', static_cast<sal_Char>(0));
}
diff --git a/vcl/source/helper/strhelper.cxx b/vcl/source/helper/strhelper.cxx
index 6cb14e2..fc564b2 100644
--- a/vcl/source/helper/strhelper.cxx
+++ b/vcl/source/helper/strhelper.cxx
@@ -173,15 +173,15 @@ String GetCommandLineToken( int nToken, const String& rLine )
return aRet;
}
-ByteString GetCommandLineToken( int nToken, const ByteString& rLine )
+rtl::OString GetCommandLineToken(int nToken, const rtl::OString& rLine)
{
- int nLen = rLine.Len();
- if( ! nLen )
- return ByteString();
+ sal_Int32 nLen = rLine.getLength();
+ if (!nLen)
+ return rLine;
int nActualToken = 0;
char* pBuffer = (char*)alloca( nLen + 1 );
- const char* pRun = rLine.GetBuffer();
+ const char* pRun = rLine.getStr();
char* pLeap = NULL;
while( *pRun && nActualToken <= nToken )
@@ -275,13 +275,13 @@ int GetCommandLineTokenCount( const String& rLine )
return nTokenCount;
}
-int GetCommandLineTokenCount( const ByteString& rLine )
+int GetCommandLineTokenCount(const rtl::OString& rLine)
{
- if( ! rLine.Len() )
+ if (rLine.isEmpty())
return 0;
int nTokenCount = 0;
- const char *pRun = rLine.GetBuffer();
+ const char *pRun = rLine.getStr();
while( *pRun )
@@ -383,14 +383,14 @@ String WhitespaceToSpace( const String& rLine, sal_Bool bProtect )
return aRet;
}
-ByteString WhitespaceToSpace( const ByteString& rLine, sal_Bool bProtect )
+rtl::OString WhitespaceToSpace(const rtl::OString& rLine, sal_Bool bProtect)
{
- int nLen = rLine.Len();
- if( ! nLen )
- return ByteString();
+ sal_Int32 nLen = rLine.getLength();
+ if (!nLen)
+ return rLine;
char *pBuffer = (char*)alloca( nLen + 1 );
- const char *pRun = rLine.GetBuffer();
+ const char *pRun = rLine.getStr();
char *pLeap = pBuffer;
while( *pRun )
@@ -436,8 +436,7 @@ ByteString WhitespaceToSpace( const ByteString& rLine, sal_Bool bProtect )
if( *pLeap == ' ' )
*pLeap = 0;
- ByteString aRet( *pBuffer == ' ' ? pBuffer+1 : pBuffer );
- return aRet;
+ return rtl::OString(*pBuffer == ' ' ? pBuffer+1 : pBuffer);
}
} // namespace
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 8d6b9c3..91643d6 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -696,7 +696,7 @@ PPDParser::PPDParser( const String& rFile ) :
m_pTranslator( new PPDTranslator() )
{
// read in the file
- std::list< ByteString > aLines;
+ std::list< rtl::OString > aLines;
PPDDecompressStream aStream( m_aFile );
bool bLanguageEncoding = false;
if( aStream.IsOpen() )
@@ -897,11 +897,11 @@ static sal_uInt8 getNibble( sal_Char cChar )
return nRet;
}
-String PPDParser::handleTranslation( const ByteString& i_rString, bool bIsGlobalized )
+String PPDParser::handleTranslation(const rtl::OString& i_rString, bool bIsGlobalized)
{
- int nOrigLen = i_rString.Len();
+ sal_Int32 nOrigLen = i_rString.getLength();
OStringBuffer aTrans( nOrigLen );
- const sal_Char* pStr = i_rString.GetBuffer();
+ const sal_Char* pStr = i_rString.getStr();
const sal_Char* pEnd = pStr + nOrigLen;
while( pStr < pEnd )
{
@@ -923,9 +923,9 @@ String PPDParser::handleTranslation( const ByteString& i_rString, bool bIsGlobal
return OStringToOUString( aTrans.makeStringAndClear(), bIsGlobalized ? RTL_TEXTENCODING_UTF8 : m_aFileEncoding );
}
-void PPDParser::parse( ::std::list< ByteString >& rLines )
+void PPDParser::parse( ::std::list< rtl::OString >& rLines )
{
- std::list< ByteString >::iterator line = rLines.begin();
+ std::list< rtl::OString >::iterator line = rLines.begin();
PPDParser::hash_type::const_iterator keyit;
while( line != rLines.end() )
{
@@ -1027,7 +1027,7 @@ void PPDParser::parse( ::std::list< ByteString >& rLines )
{
// copy the newlines also
aLine += '\n';
- aLine += *line;
+ aLine += ByteString(*line);
++line;
}
}
@@ -1142,7 +1142,9 @@ void PPDParser::parse( ::std::list< ByteString >& rLines )
if( nPos != STRING_NOTFOUND )
{
aKey.Erase( nPos );
- String aOption( WhitespaceToSpace( aLine.Copy( nPos+9 ) ), RTL_TEXTENCODING_MS_1252 );
+ rtl::OUString aOption(rtl::OStringToOUString(
+ WhitespaceToSpace(aLine.Copy(nPos+9)),
+ RTL_TEXTENCODING_MS_1252));
keyit = m_aKeys.find( aKey );
if( keyit != m_aKeys.end() )
{
@@ -1171,7 +1173,7 @@ void PPDParser::parse( ::std::list< ByteString >& rLines )
}
}
-void PPDParser::parseOpenUI( const ByteString& rLine )
+void PPDParser::parseOpenUI(const rtl::OString& rLine)
{
String aTranslation;
ByteString aKey = rLine;
@@ -1202,7 +1204,8 @@ void PPDParser::parseOpenUI( const ByteString& rLine )
pKey->m_bUIOption = true;
m_pTranslator->insertKey( pKey->getKey(), aTranslation );
- ByteString aValue = WhitespaceToSpace( rLine.GetToken( 1, ':' ) );
+ sal_Int32 nIndex = 0;
+ ByteString aValue = WhitespaceToSpace( rLine.getToken( 1, ':', nIndex ) );
if( aValue.CompareIgnoreCaseToAscii( "boolean" ) == COMPARE_EQUAL )
pKey->m_eUIType = PPDKey::Boolean;
else if( aValue.CompareIgnoreCaseToAscii( "pickmany" ) == COMPARE_EQUAL )
@@ -1218,9 +1221,9 @@ void PPDParser::parseOrderDependency(const rtl::OString& rLine)
if( nPos != -1 )
aLine = aLine.copy( nPos+1 );
- int nOrder = GetCommandLineToken( 0, aLine ).ToInt32();
+ sal_Int32 nOrder = GetCommandLineToken( 0, aLine ).toInt32();
ByteString aSetup = GetCommandLineToken( 1, aLine );
- String aKey( GetCommandLineToken( 2, aLine ), RTL_TEXTENCODING_MS_1252 );
+ String aKey(rtl::OStringToOUString(GetCommandLineToken(2, aLine), RTL_TEXTENCODING_MS_1252));
if( aKey.GetChar( 0 ) != '*' )
return; // invalid order depency
aKey.Erase( 0, 1 );
@@ -1250,12 +1253,12 @@ void PPDParser::parseOrderDependency(const rtl::OString& rLine)
pKey->m_eSetupType = PPDKey::AnySetup;
}
-void PPDParser::parseConstraint( const ByteString& rLine )
+void PPDParser::parseConstraint( const rtl::OString& rLine )
{
bool bFailed = false;
- String aLine( rLine, RTL_TEXTENCODING_MS_1252 );
- aLine.Erase( 0, rLine.Search( ':' )+1 );
+ String aLine(rtl::OStringToOUString(rLine, RTL_TEXTENCODING_MS_1252));
+ aLine.Erase(0, rLine.indexOf(':') + 1);
PPDConstraint aConstraint;
int nTokens = GetCommandLineTokenCount( aLine );
for( int i = 0; i < nTokens; i++ )
@@ -1291,7 +1294,7 @@ void PPDParser::parseConstraint( const ByteString& rLine )
if( ! aConstraint.m_pKey1 || ! aConstraint.m_pKey2 || bFailed )
{
#ifdef __DEBUG
- fprintf( stderr, "Warning: constraint \"%s\" is invalid\n", rLine.GetStr() );
+ fprintf( stderr, "Warning: constraint \"%s\" is invalid\n", rLine.getStr() );
#endif
}
else
commit 0c3f267b97d51dfc34b7e643a2618526b92629af
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Jun 23 23:41:54 2011 +0100
rtl::ByteString->rtl::OString
diff --git a/vcl/inc/vcl/ppdparser.hxx b/vcl/inc/vcl/ppdparser.hxx
index 6dd1126..8f65b64 100644
--- a/vcl/inc/vcl/ppdparser.hxx
+++ b/vcl/inc/vcl/ppdparser.hxx
@@ -186,7 +186,7 @@ private:
PPDParser( const String& rFile );
~PPDParser();
- void parseOrderDependency( const ByteString& rLine );
+ void parseOrderDependency(const rtl::OString& rLine);
void parseOpenUI( const ByteString& rLine );
void parseConstraint( const ByteString& rLine );
void parse( std::list< ByteString >& rLines );
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 3246e18..8d6b9c3 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -1211,12 +1211,12 @@ void PPDParser::parseOpenUI( const ByteString& rLine )
pKey->m_eUIType = PPDKey::PickOne;
}
-void PPDParser::parseOrderDependency( const ByteString& rLine )
+void PPDParser::parseOrderDependency(const rtl::OString& rLine)
{
- ByteString aLine( rLine );
- int nPos = aLine.Search( ':' );
- if( nPos != STRING_NOTFOUND )
- aLine.Erase( 0, nPos+1 );
+ rtl::OString aLine(rLine);
+ sal_Int32 nPos = aLine.indexOf(':');
+ if( nPos != -1 )
+ aLine = aLine.copy( nPos+1 );
int nOrder = GetCommandLineToken( 0, aLine ).ToInt32();
ByteString aSetup = GetCommandLineToken( 1, aLine );
More information about the Libreoffice-commits
mailing list