Kaydet (Commit) d7e7319d authored tarafından Noel Grandin's avatar Noel Grandin

convert svtools/source/svrtf/* from String to OUString

Change-Id: I92282495b076f4e7d9c3d73e84e572f13508b565
üst 641cf5ed
...@@ -97,23 +97,21 @@ int SvRTFParser::_GetNextToken() ...@@ -97,23 +97,21 @@ int SvRTFParser::_GetNextToken()
{ {
aToken = "\\"; aToken = "\\";
{ {
String aStrBuffer; OUStringBuffer aStrBuffer;
sal_Unicode* pStr = aStrBuffer.AllocBuffer( aStrBuffer.setLength( MAX_TOKEN_LEN );
MAX_TOKEN_LEN ); sal_Int32 nStrLen = 0;
xub_StrLen nStrLen = 0;
do { do {
*(pStr + nStrLen++) = nNextCh; aStrBuffer[nStrLen++] = nNextCh;
if( MAX_TOKEN_LEN == nStrLen ) if( MAX_TOKEN_LEN == nStrLen )
{ {
aToken += aStrBuffer; aToken += aStrBuffer.toString();
nStrLen = 0; nStrLen = 0;
} }
nNextCh = GetNextChar(); nNextCh = GetNextChar();
} while( RTF_ISALPHA( nNextCh ) ); } while( RTF_ISALPHA( nNextCh ) );
if( nStrLen ) if( nStrLen )
{ {
aStrBuffer.ReleaseBufferAccess( nStrLen ); aToken += aStrBuffer.makeStringAndClear();
aToken += aStrBuffer;
} }
} }
...@@ -305,9 +303,9 @@ sal_Unicode SvRTFParser::GetHexValue() ...@@ -305,9 +303,9 @@ sal_Unicode SvRTFParser::GetHexValue()
void SvRTFParser::ScanText( const sal_Unicode cBreak ) void SvRTFParser::ScanText( const sal_Unicode cBreak )
{ {
String aStrBuffer; OUStringBuffer aStrBuffer;
int bWeiter = true; int bWeiter = true;
while( bWeiter && IsParserWorking() && aStrBuffer.Len() < MAX_STRING_LEN) while( bWeiter && IsParserWorking() && aStrBuffer.getLength() < MAX_STRING_LEN)
{ {
int bNextCh = true; int bNextCh = true;
switch( nNextCh ) switch( nNextCh )
...@@ -338,8 +336,8 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak ) ...@@ -338,8 +336,8 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
if (__next>0xFF) // fix for #i43933# and #i35653# if (__next>0xFF) // fix for #i43933# and #i35653#
{ {
if (!aByteString.isEmpty()) if (!aByteString.isEmpty())
aStrBuffer.Append(String(OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()))); aStrBuffer.append( OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()) );
aStrBuffer.Append((sal_Unicode)__next); aStrBuffer.append((sal_Unicode)__next);
continue; continue;
} }
...@@ -373,23 +371,23 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak ) ...@@ -373,23 +371,23 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
bNextCh = false; bNextCh = false;
if (!aByteString.isEmpty()) if (!aByteString.isEmpty())
aStrBuffer.Append(String(OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()))); aStrBuffer.append( OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()) );
} }
break; break;
case '\\': case '\\':
case '}': case '}':
case '{': case '{':
case '+': // habe ich in einem RTF-File gefunden case '+': // habe ich in einem RTF-File gefunden
aStrBuffer.Append(nNextCh); aStrBuffer.append(nNextCh);
break; break;
case '~': // nonbreaking space case '~': // nonbreaking space
aStrBuffer.Append(static_cast< sal_Unicode >(0xA0)); aStrBuffer.append(static_cast< sal_Unicode >(0xA0));
break; break;
case '-': // optional hyphen case '-': // optional hyphen
aStrBuffer.Append(static_cast< sal_Unicode >(0xAD)); aStrBuffer.append(static_cast< sal_Unicode >(0xAD));
break; break;
case '_': // nonbreaking hyphen case '_': // nonbreaking hyphen
aStrBuffer.Append(static_cast< sal_Unicode >(0x2011)); aStrBuffer.append(static_cast< sal_Unicode >(0x2011));
break; break;
case 'u': case 'u':
...@@ -402,7 +400,7 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak ) ...@@ -402,7 +400,7 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
{ {
bRTF_InTextRead = true; bRTF_InTextRead = true;
String sSave( aToken ); OUString sSave( aToken );
nNextCh = '\\'; nNextCh = '\\';
#ifdef DBG_UTIL #ifdef DBG_UTIL
int nToken = int nToken =
...@@ -410,8 +408,7 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak ) ...@@ -410,8 +408,7 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
_GetNextToken(); _GetNextToken();
DBG_ASSERT( RTF_U == nToken, "doch kein UNI-Code Zeichen" ); DBG_ASSERT( RTF_U == nToken, "doch kein UNI-Code Zeichen" );
// dont convert symbol chars // dont convert symbol chars
aStrBuffer.Append( aStrBuffer.append(static_cast< sal_Unicode >(nTokenValue));
static_cast< sal_Unicode >(nTokenValue));
// overread the next n "RTF" characters. This // overread the next n "RTF" characters. This
// can be also \{, \}, \'88 // can be also \{, \}, \'88
...@@ -463,24 +460,24 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak ) ...@@ -463,24 +460,24 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
break; break;
default: default:
if( nNextCh == cBreak || aStrBuffer.Len() >= MAX_STRING_LEN) if( nNextCh == cBreak || aStrBuffer.getLength() >= MAX_STRING_LEN)
bWeiter = false; bWeiter = false;
else else
{ {
do { do {
// alle anderen Zeichen kommen in den Text // alle anderen Zeichen kommen in den Text
aStrBuffer.Append(nNextCh); aStrBuffer.append(nNextCh);
if (sal_Unicode(EOF) == (nNextCh = GetNextChar())) if (sal_Unicode(EOF) == (nNextCh = GetNextChar()))
{ {
if (aStrBuffer.Len()) if (!aStrBuffer.isEmpty())
aToken += aStrBuffer; aToken += aStrBuffer.toString();
return; return;
} }
} while } while
( (
(RTF_ISALPHA(nNextCh) || RTF_ISDIGIT(nNextCh)) && (RTF_ISALPHA(nNextCh) || RTF_ISDIGIT(nNextCh)) &&
(aStrBuffer.Len() < MAX_STRING_LEN) (aStrBuffer.getLength() < MAX_STRING_LEN)
); );
bNextCh = false; bNextCh = false;
} }
...@@ -490,8 +487,8 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak ) ...@@ -490,8 +487,8 @@ void SvRTFParser::ScanText( const sal_Unicode cBreak )
nNextCh = GetNextChar(); nNextCh = GetNextChar();
} }
if (aStrBuffer.Len()) if (!aStrBuffer.isEmpty())
aToken += aStrBuffer; aToken += aStrBuffer.makeStringAndClear();
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
// Struktur, um sich die akt. Daten zumerken // Struktur, um sich die akt. Daten zumerken
struct SvParser_Impl struct SvParser_Impl
{ {
String aToken; // gescanntes Token OUString aToken; // gescanntes Token
sal_uLong nFilePos; // akt. Position im Stream sal_uLong nFilePos; // akt. Position im Stream
sal_uLong nlLineNr; // akt. Zeilen Nummer sal_uLong nlLineNr; // akt. Zeilen Nummer
sal_uLong nlLinePos; // akt. Spalten Nummer sal_uLong nlLinePos; // akt. Spalten Nummer
......
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