Kaydet (Commit) b1f74de0 authored tarafından Caolán McNamara's avatar Caolán McNamara

ByteString->rtl::OString

üst d3c0bf6c
......@@ -647,7 +647,9 @@ SbError SbiStream::Read( ByteString& rBuf, sal_uInt16 n, bool bForceReadingPerBy
nExpandOnWriteTo = 0;
if( !bForceReadingPerByte && IsText() )
{
pStrm->ReadLine( rBuf );
rtl::OString aBuffer;
pStrm->ReadLine(aBuffer);
rBuf = aBuffer;
nLine++;
}
else
......
......@@ -1046,12 +1046,12 @@ int _cdecl main( int argc, char *argv[] )
}
ByteString sReferenceLine;
rtl::OString sReferenceLine;
GSILine* pReferenceLine = NULL;
ByteString aOldReferenceId("No Valid ID"); // just set to something which can never be an ID
sal_uLong nReferenceLine = 0;
ByteString sGSILine;
rtl::OString sGSILine;
GSILine* pGSILine = NULL;
ByteString aOldId("No Valid ID"); // just set to something which can never be an ID
GSIBlock *pBlock = NULL;
......
......@@ -371,13 +371,13 @@ void SourceTreeLocalizer::WorkOnFile(
nFileCnt++;
SvFileStream aSDFIn( aTemp.GetFull(), STREAM_READ );
ByteString sLine;
while ( aSDFIn.IsOpen() && !aSDFIn.IsEof()) {
rtl::OString sLine;
while ( aSDFIn.IsOpen() && !aSDFIn.IsEof())
{
aSDFIn.ReadLine( sLine );
if ( sLine.Len()) {
if (!sLine.isEmpty())
aSDF.WriteLine( sLine );
}
}
aSDFIn.Close();
aTemp.Kill();
......
......@@ -187,7 +187,7 @@ MergeDataFile::MergeDataFile(
{
SvFileStream aInputStream( String( rFileName, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_READ );
aInputStream.SetStreamCharSet( RTL_TEXTENCODING_MS_1252 );
ByteString sLine;
rtl::OString sLine;
const ByteString sHACK("HACK");
const ::rtl::OString sFileNormalized(lcl_NormalizeFilename(sFile));
const bool isFileEmpty = !sFileNormalized.isEmpty();
......@@ -208,17 +208,17 @@ MergeDataFile::MergeDataFile(
const ::rtl::OString filename = lcl_NormalizeFilename(getToken(sLine, 1 , '\t'));
if(isFileEmpty || sFileNormalized.equals("") || (!isFileEmpty && filename.equals(sFileNormalized)) )
{
xub_StrLen rIdx = 0;
const ByteString sTYP = sLine.GetToken( 3, '\t', rIdx );
const ByteString sGID = sLine.GetToken( 0, '\t', rIdx ); // 4
const ByteString sLID = sLine.GetToken( 0, '\t', rIdx ); // 5
ByteString sPFO = sLine.GetToken( 1, '\t', rIdx ); // 7
sal_Int32 rIdx = 0;
const ByteString sTYP = sLine.getToken( 3, '\t', rIdx );
const ByteString sGID = sLine.getToken( 0, '\t', rIdx ); // 4
const ByteString sLID = sLine.getToken( 0, '\t', rIdx ); // 5
ByteString sPFO = sLine.getToken( 1, '\t', rIdx ); // 7
sPFO = sHACK;
ByteString nLANG = sLine.GetToken( 1, '\t', rIdx ); // 9
ByteString nLANG = sLine.getToken( 1, '\t', rIdx ); // 9
nLANG = comphelper::string::strip(nLANG, ' ');
const ByteString sTEXT = sLine.GetToken( 0, '\t', rIdx ); // 10
const ByteString sQHTEXT = sLine.GetToken( 1, '\t', rIdx ); // 12
const ByteString sTITLE = sLine.GetToken( 0, '\t', rIdx ); // 13
const ByteString sTEXT = sLine.getToken( 0, '\t', rIdx ); // 10
const ByteString sQHTEXT = sLine.getToken( 1, '\t', rIdx ); // 12
const ByteString sTITLE = sLine.getToken( 0, '\t', rIdx ); // 13
if( !nLANG.EqualsIgnoreCaseAscii("en-US") )
......
......@@ -80,15 +80,16 @@ static const sal_Int16 DIC_VERSION_5 = 5;
static const sal_Int16 DIC_VERSION_6 = 6;
static const sal_Int16 DIC_VERSION_7 = 7;
static sal_Bool getTag(const ByteString &rLine,
const sal_Char *pTagName, ByteString &rTagValue)
static bool getTag(const rtl::OString &rLine, const sal_Char *pTagName,
rtl::OString &rTagValue)
{
xub_StrLen nPos = rLine.Search( pTagName );
if (nPos == STRING_NOTFOUND)
return sal_False;
sal_Int32 nPos = rLine.indexOf(pTagName);
if (nPos == -1)
return false;
rTagValue = comphelper::string::strip(rLine.Copy(nPos + sal::static_int_cast< xub_StrLen >(strlen( pTagName ))), ' ');
return sal_True;
rTagValue = comphelper::string::strip(rLine.copy(nPos + rtl_str_getLength(pTagName)),
' ');
return true;
}
......@@ -111,7 +112,7 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, sal_Bool &bNe
!strcmp(pMagicHeader, pVerOOo7))
{
sal_Bool bSuccess;
ByteString aLine;
rtl::OString aLine;
nDicVersion = DIC_VERSION_7;
......@@ -121,31 +122,31 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, sal_Bool &bNe
// 2nd line: language all | en-US | pt-BR ...
while (sal_True == (bSuccess = rpStream->ReadLine(aLine)))
{
ByteString aTagValue;
rtl::OString aTagValue;
if (aLine.GetChar(0) == '#') // skip comments
if (aLine[0] == '#') // skip comments
continue;
// lang: field
if (getTag(aLine, "lang: ", aTagValue))
{
if (aTagValue == "<none>")
if (aTagValue.equalsL(RTL_CONSTASCII_STRINGPARAM("<none>")))
nLng = LANGUAGE_NONE;
else
nLng = MsLangId::convertIsoStringToLanguage(OUString(aTagValue.GetBuffer(),
aTagValue.Len(), RTL_TEXTENCODING_ASCII_US));
nLng = MsLangId::convertIsoStringToLanguage(rtl::OStringToOUString(
aTagValue, RTL_TEXTENCODING_ASCII_US));
}
// type: negative / positive
if (getTag(aLine, "type: ", aTagValue))
{
if (aTagValue == "negative")
if (aTagValue.equalsL(RTL_CONSTASCII_STRINGPARAM("negative")))
bNeg = sal_True;
else
bNeg = sal_False;
}
if (aLine.Search ("---") != STRING_NOTFOUND) // end of header
if (comphelper::string::indexOfL(aLine, RTL_CONSTASCII_STRINGPARAM("---")) != -1) // end of header
break;
}
if (!bSuccess)
......@@ -369,14 +370,14 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL)
else if (DIC_VERSION_7 == nDicVersion)
{
sal_Bool bSuccess;
ByteString aLine;
rtl::OString aLine;
// remaining lines - stock strings (a [==] b)
while (sal_True == (bSuccess = pStream->ReadLine(aLine)))
{
if (aLine.GetChar(0) == '#') // skip comments
if (aLine[0] == '#') // skip comments
continue;
rtl::OUString aText = rtl::OStringToOUString (aLine, RTL_TEXTENCODING_UTF8);
rtl::OUString aText = rtl::OStringToOUString(aLine, RTL_TEXTENCODING_UTF8);
uno::Reference< XDictionaryEntry > xEntry =
new DicEntry( aText, eDicType == DictionaryType_NEGATIVE );
addEntry_Impl( xEntry , sal_True ); //! don't launch events here
......
......@@ -75,6 +75,7 @@ using ::rtl::OStringBuffer;
using ::rtl::OStringToOUString;
using comphelper::string::getToken;
using comphelper::string::getTokenCount;
using comphelper::string::indexOfL;
/*************** F o r w a r d s *****************************************/
/*************** G l o b a l e V a r i a b l e n **********************/
......@@ -1149,7 +1150,7 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile,
if( !aIStm.GetError() && !aOStm.GetError() )
{
ByteString aLine;
rtl::OString aLine;
rtl::OString aFilePath;
while( aIStm.ReadLine( aLine ) )
......@@ -1160,43 +1161,47 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile,
rtl::OString aBaseFileName( getToken(getToken(aLine, 1, '"'), 0, '.') );
if( GetImageFilePath( rOutputFile, rContext, aBaseFileName, aFilePath, pSysListFile ) )
( ( aLine = "File = \"" ) += aFilePath ) += "\";";
{
aLine = rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("File = \"")).
append(aFilePath).append(RTL_CONSTASCII_STRINGPARAM("\";")).
makeStringAndClear();
}
else
aMissingImages.push_back( aBaseFileName );
aOStm.WriteLine( aLine );
aOStm.WriteLine(aLine);
}
else if( aLine.Search( "ImageList" ) != STRING_NOTFOUND )
else if (indexOfL(aLine, RTL_CONSTASCII_STRINGPARAM("ImageList")) != -1)
{
::std::vector< ::std::pair< rtl::OString, sal_Int32 > > aEntryVector;
aOStm.WriteLine( aLine );
aOStm.WriteLine(aLine);
if( aLine.Search( ';' ) == STRING_NOTFOUND )
if (aLine.indexOf(';') == -1)
{
const sal_uInt32 nImgListStartPos = aIStm.Tell();
do
{
if( !aIStm.ReadLine( aLine ) )
if( !aIStm.ReadLine(aLine) )
break;
}
while( aLine.Search( "Prefix" ) == STRING_NOTFOUND );
while (indexOfL(aLine, RTL_CONSTASCII_STRINGPARAM("Prefix")) == -1);
const rtl::OString aPrefix( getToken(aLine, 1, '"') );
aIStm.Seek( nImgListStartPos );
do
{
if (!aIStm.ReadLine( aLine ) )
if (!aIStm.ReadLine(aLine) )
break;
}
while( aLine.Search( "IdList" ) == STRING_NOTFOUND );
while (indexOfL(aLine, RTL_CONSTASCII_STRINGPARAM("IdList")) == -1);
// scan all ids and collect images
while( aLine.Search( '}' ) == STRING_NOTFOUND )
while (aLine.indexOf('}') == -1)
{
if( !aIStm.ReadLine( aLine ) )
if( !aIStm.ReadLine(aLine) )
break;
aLine = comphelper::string::stripStart(aLine, ' ');
......@@ -1205,7 +1210,7 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile,
if (comphelper::string::isdigitAsciiString(aLine))
{
sal_Int32 nNumber = atoi( aLine.GetBuffer() );
sal_Int32 nNumber = atoi(aLine.getStr());
rtl::OStringBuffer aBuf(aPrefix);
if( nNumber < 10000 )
......@@ -1226,13 +1231,13 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile,
{
aIStm.ReadLine( aLine );
if( aLine.Search( "IdList" ) != STRING_NOTFOUND )
if (indexOfL(aLine, RTL_CONSTASCII_STRINGPARAM("IdList")) != -1)
{
while( aLine.Search( '}' ) == STRING_NOTFOUND )
aIStm.ReadLine( aLine );
while (aLine.indexOf('}') == -1)
aIStm.ReadLine(aLine);
}
else
aOStm.WriteLine( aLine );
aOStm.WriteLine(aLine);
}
aOStm.WriteLine(rtl::OString(RTL_CONSTASCII_STRINGPARAM("FileList = {")));
......@@ -1253,10 +1258,10 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile,
aOStm.WriteLine(rtl::OString(RTL_CONSTASCII_STRINGPARAM("};")));
}
else
aOStm.WriteLine( aLine );
aOStm.WriteLine(aLine);
}
else
aOStm.WriteLine( aLine );
aOStm.WriteLine(aLine);
}
}
......
......@@ -93,7 +93,7 @@ void BmpCreator::ImplCreate( const ::std::vector< DirEntry >& rInDirs,
if( !rInDirs.empty() )
{
ByteString aLine;
rtl::OString aLine;
String aInfo, aPrefix, aName( rName ), aString;
SvFileStream aOutStream;
BitmapEx aTotalBmpEx;
......@@ -123,7 +123,7 @@ void BmpCreator::ImplCreate( const ::std::vector< DirEntry >& rInDirs,
aOutFile += DirEntry( aName );
// get number of bitmaps
while( aLine.Search( '}' ) == STRING_NOTFOUND )
while( aLine.indexOf('}') == -1 )
{
if( !pSRS->ReadLine( aLine ) )
break;
......@@ -136,11 +136,11 @@ void BmpCreator::ImplCreate( const ::std::vector< DirEntry >& rInDirs,
{
aString = aPrefix;
if( atoi( aLine.GetBuffer() ) < 10000 )
if( atoi( aLine.getStr() ) < 10000 )
aString += String::CreateFromInt32( 0 );
// search for pngs by default
String aPngString( aString += String( aLine.GetBuffer(), RTL_TEXTENCODING_UTF8 ) );
String aPngString( aString += rtl::OStringToOUString(aLine, RTL_TEXTENCODING_UTF8) );
aNameVector.push_back( aPngString += String( RTL_CONSTASCII_USTRINGPARAM( ".png" ) ) );
}
}
......@@ -361,9 +361,11 @@ void BmpCreator::Create( const String& rSRSName,
else
{
String aText;
ByteString aByteText;
rtl::OString aByteText;
sal_Bool bLangDep = sal_False;
using comphelper::string::indexOfL;
do
{
do
......@@ -371,24 +373,24 @@ void BmpCreator::Create( const String& rSRSName,
if (!pSRS->ReadLine(aByteText))
break;
}
while ( aByteText.Search( "ImageList" ) == STRING_NOTFOUND );
while ( indexOfL(aByteText, RTL_CONSTASCII_STRINGPARAM("ImageList")) == -1 );
do
{
if (!pSRS->ReadLine( aByteText ) )
break;
}
while ( aByteText.Search( "File" ) == STRING_NOTFOUND );
aText = String::CreateFromAscii( aByteText.GetBuffer() );
while ( indexOfL(aByteText, RTL_CONSTASCII_STRINGPARAM("File")) == -1 );
aText = rtl::OStringToOUString(aByteText, RTL_TEXTENCODING_ASCII_US);
const String aName( aText.GetToken( 1, '"' ) );
do
{
if( !bLangDep &&
aByteText.Search( "File" ) != STRING_NOTFOUND &&
aByteText.Search( '[' ) != STRING_NOTFOUND &&
aByteText.Search( ']' ) != STRING_NOTFOUND )
indexOfL(aByteText, RTL_CONSTASCII_STRINGPARAM("File")) != -1 &&
aByteText.indexOf('[') != -1 &&
aByteText.indexOf(']') != -1 )
{
bLangDep = sal_True;
}
......@@ -396,8 +398,8 @@ void BmpCreator::Create( const String& rSRSName,
if (!pSRS->ReadLine(aByteText))
break;
}
while (aByteText.Search( "IdList" ) == STRING_NOTFOUND );
aText = String::CreateFromAscii( aByteText.GetBuffer() );
while (indexOfL(aByteText, RTL_CONSTASCII_STRINGPARAM("IdList")) == -1);
aText = rtl::OStringToOUString(aByteText, RTL_TEXTENCODING_ASCII_US);
// if image list is not language dependent, don't do anything for languages except german
if( aText.Len() )
......
......@@ -297,15 +297,15 @@ void BmpSum::ProcessFileList( const String& rInFileList,
if( aIStm.IsOpen() && aOStm.IsOpen() )
{
ByteString aReadLine;
rtl::OString aReadLine;
::std::set< ByteString > aFileNameSet;
while( aIStm.ReadLine( aReadLine ) )
{
if( aReadLine.Len() )
if( !aReadLine.isEmpty() )
aFileNameSet.insert( aReadLine );
if( aReadLine.Search( "enus" ) != STRING_NOTFOUND )
if( comphelper::string::indexOfL(aReadLine, RTL_CONSTASCII_STRINGPARAM("enus") ) != -1 )
{
static const char* aLanguages[] =
{
......@@ -340,7 +340,7 @@ void BmpSum::ProcessFileList( const String& rInFileList,
}
}
aReadLine.Erase();
aReadLine = rtl::OString();
}
aIStm.Close();
......
......@@ -101,13 +101,11 @@ void XBMReader::InitTable()
// ------------------------------------------------------------------------
ByteString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1,
rtl::OString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1,
const char* pTok2, const char* pTok3 )
{
ByteString aRet;
long nPos1;
long nPos2;
long nPos3;
rtl::OString aRet;
sal_Int32 nPos1, nPos2, nPos3;
bStatus = sal_False;
......@@ -118,7 +116,7 @@ ByteString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1,
if( pTok1 )
{
if( ( nPos1 = aRet.Search( pTok1 ) ) != STRING_NOTFOUND )
if( ( nPos1 = aRet.indexOf( pTok1 ) ) != -1 )
{
bStatus = sal_True;
......@@ -126,7 +124,7 @@ ByteString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1,
{
bStatus = sal_False;
if( ( ( nPos2 = aRet.Search( pTok2 ) ) != STRING_NOTFOUND ) &&
if( ( ( nPos2 = aRet.indexOf( pTok2 ) ) != -1 ) &&
( nPos2 > nPos1 ) )
{
bStatus = sal_True;
......@@ -135,7 +133,7 @@ ByteString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1,
{
bStatus = sal_False;
if( ( ( nPos3 = aRet.Search( pTok3 ) ) != STRING_NOTFOUND ) && ( nPos3 > nPos2 ) )
if( ( ( nPos3 = aRet.indexOf( pTok3 ) ) != -1 ) && ( nPos3 > nPos2 ) )
bStatus = sal_True;
}
}
......@@ -201,7 +199,7 @@ long XBMReader::ParseDefine( const sal_Char* pDefine )
sal_Bool XBMReader::ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFormat eFormat )
{
ByteString aLine;
rtl::OString aLine;
long nRow = 0;
long nCol = 0;
long nBits = ( eFormat == XBM10 ) ? 16 : 8;
......@@ -214,18 +212,18 @@ sal_Bool XBMReader::ParseData( SvStream* pInStm, const ByteString& aLastLine, XB
{
if( bFirstLine )
{
xub_StrLen nPos;
sal_Int32 nPos;
// einfuehrende geschweifte Klammer loeschen
if( (nPos = ( aLine = aLastLine ).Search( '{' ) ) != STRING_NOTFOUND )
aLine.Erase( 0, nPos + 1 );
if( (nPos = ( aLine = aLastLine ).indexOf('{') ) != -1 )
aLine = aLine.copy(nPos + 1);
bFirstLine = sal_False;
}
else if( !pInStm->ReadLine( aLine ) )
break;
if( aLine.Len() )
if (!aLine.isEmpty())
{
const sal_Int32 nCount = comphelper::string::getTokenCount(aLine, ',');
......
......@@ -69,7 +69,7 @@ class XBMReader : public GraphicReader
sal_Bool bStatus;
void InitTable();
ByteString FindTokenLine( SvStream* pInStm, const char* pTok1,
rtl::OString FindTokenLine( SvStream* pInStm, const char* pTok1,
const char* pTok2 = NULL, const char* pTok3 = NULL );
long ParseDefine( const sal_Char* pDefine );
sal_Bool ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFormat eFormat );
......
......@@ -654,7 +654,7 @@ sal_Bool SvStream::ReadByteStringLine( String& rStr, rtl_TextEncoding eSrcCharSe
return bRet;
}
sal_Bool SvStream::ReadLine( ByteString& rStr )
sal_Bool SvStream::ReadLine(rtl::OString& rStr)
{
sal_Char buf[256+1];
sal_Bool bEnd = sal_False;
......@@ -722,9 +722,9 @@ sal_Bool SvStream::ReadLine( ByteString& rStr )
return bEnd;
}
sal_Bool SvStream::ReadLine( rtl::OString& rStr )
sal_Bool SvStream::ReadLine( ByteString& rStr )
{
ByteString aFoo;
rtl::OString aFoo;
sal_Bool ret = ReadLine(aFoo);
rStr = aFoo;
return ret;
......
......@@ -296,7 +296,7 @@ class PPDDecompressStream
bool IsOpen() const;
bool IsEof() const;
void ReadLine( ByteString& o_rLine);
rtl::OString ReadLine();
void Open( const rtl::OUString& i_rFile );
void Close();
const rtl::OUString& GetFileName() const { return maFileName; }
......@@ -378,12 +378,14 @@ bool PPDDecompressStream::IsEof() const
return ( mpMemStream ? mpMemStream->IsEof() : ( mpFileStream ? mpFileStream->IsEof() : true ) );
}
void PPDDecompressStream::ReadLine( ByteString& o_rLine )
rtl::OString PPDDecompressStream::ReadLine()
{
rtl::OString o_rLine;
if( mpMemStream )
mpMemStream->ReadLine( o_rLine );
else if( mpFileStream )
mpFileStream->ReadLine( o_rLine );
return o_rLine;
}
static osl::FileBase::RC resolveLink( const rtl::OUString& i_rURL, rtl::OUString& o_rResolvedURL, rtl::OUString& o_rBaseName, osl::FileStatus::Type& o_rType, int nLinkLevel = 10 )
......@@ -565,8 +567,7 @@ String PPDParser::getPPDFile( const String& rFile )
String aRet;
if( aStream.IsOpen() )
{
ByteString aLine;
aStream.ReadLine( aLine );
ByteString aLine = aStream.ReadLine();
if( aLine.Search( "*PPD-Adobe" ) == 0 )
aRet = aStream.GetFileName();
else
......@@ -575,7 +576,7 @@ String PPDParser::getPPDFile( const String& rFile )
// with *PPD-Adobe, so try some lines for *Include
int nLines = 10;
while( aLine.Search( "*Include" ) != 0 && --nLines )
aStream.ReadLine( aLine );
aLine = aStream.ReadLine();
if( nLines )
aRet = aStream.GetFileName();
}
......@@ -596,9 +597,8 @@ String PPDParser::getPPDPrinterName( const String& rFile )
String aCurLine;
while( ! aStream.IsEof() && aStream.IsOpen() )
{
ByteString aByteLine;
aStream.ReadLine( aByteLine );
aCurLine = String( aByteLine, RTL_TEXTENCODING_MS_1252 );
rtl::OString aByteLine = aStream.ReadLine();
aCurLine = rtl::OStringToOUString(aByteLine, RTL_TEXTENCODING_MS_1252);
if( aCurLine.CompareIgnoreCaseToAscii( "*include:", 9 ) == COMPARE_EQUAL )
{
aCurLine.Erase( 0, 9 );
......@@ -694,10 +694,9 @@ PPDParser::PPDParser( const String& rFile ) :
bool bLanguageEncoding = false;
if( aStream.IsOpen() )
{
ByteString aCurLine;
while( ! aStream.IsEof() )
{
aStream.ReadLine( aCurLine );
ByteString aCurLine = aStream.ReadLine();
if( aCurLine.GetChar( 0 ) == '*' )
{
if( aCurLine.CompareIgnoreCaseToAscii( "*include:", 9 ) == COMPARE_EQUAL )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment