summaryrefslogtreecommitdiff
path: root/l10ntools/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-09-20 15:25:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-09-20 16:54:54 +0100
commitd2dff83fc33da53fb0e49e45dd10d892ae5a3309 (patch)
tree2b522838256c6ebc9ed07c5750efc2d4dac2342f /l10ntools/source
parent2c0831ebbf940833c3fecc66abd1ce0f3a29cd10 (diff)
ByteString->rtl::OString[Buffer]
Diffstat (limited to 'l10ntools/source')
-rw-r--r--l10ntools/source/export2.cxx60
-rw-r--r--l10ntools/source/xmlparse.cxx21
2 files changed, 44 insertions, 37 deletions
diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx
index 64379d463752..1150d3ee56b6 100644
--- a/l10ntools/source/export2.cxx
+++ b/l10ntools/source/export2.cxx
@@ -145,52 +145,52 @@ std::vector<ByteString> Export::aForcedLanguages = std::vector<ByteString>();
void Export::QuotHTML( ByteString &rString )
/*****************************************************************************/
{
- ByteString sReturn;
+ rtl::OStringBuffer sReturn;
for ( sal_uInt16 i = 0; i < rString.Len(); i++ ) {
ByteString sTemp = rString.Copy( i );
if ( sTemp.Search( "<Arg n=" ) == 0 ) {
while ( i < rString.Len() && rString.GetChar( i ) != '>' ) {
- sReturn += rString.GetChar( i );
+ sReturn.append(rString.GetChar(i));
i++;
}
if ( rString.GetChar( i ) == '>' ) {
- sReturn += ">";
+ sReturn.append('>');
i++;
}
}
if ( i < rString.Len()) {
switch ( rString.GetChar( i )) {
case '<':
- sReturn += "&lt;";
+ sReturn.append("&lt;");
break;
case '>':
- sReturn += "&gt;";
+ sReturn.append("&gt;");
break;
case '\"':
- sReturn += "&quot;";
+ sReturn.append("&quot;");
break;
case '\'':
- sReturn += "&apos;";
+ sReturn.append("&apos;");
break;
case '&':
if ((( i + 4 ) < rString.Len()) &&
( rString.Copy( i, 5 ) == "&amp;" ))
- sReturn += rString.GetChar( i );
+ sReturn.append(rString.GetChar(i));
else
- sReturn += "&amp;";
+ sReturn.append("&amp;");
break;
default:
- sReturn += rString.GetChar( i );
+ sReturn.append(rString.GetChar(i));
break;
}
}
}
- rString = sReturn;
+ rString = sReturn.makeStringAndClear();
}
void Export::RemoveUTF8ByteOrderMarker( ByteString &rString ){
@@ -298,34 +298,42 @@ bool Export::CopyFile( const ByteString& source , const ByteString& dest )
void Export::UnquotHTML( ByteString &rString )
/*****************************************************************************/
{
- ByteString sReturn;
- while ( rString.Len()) {
- if ( rString.Copy( 0, 5 ) == "&amp;" ) {
- sReturn += "&";
+ rtl::OStringBuffer sReturn;
+
+ while ( rString.Len())
+ {
+ if ( rString.Copy( 0, 5 ) == "&amp;" )
+ {
+ sReturn.append('&');
rString.Erase( 0, 5 );
}
- else if ( rString.Copy( 0, 4 ) == "&lt;" ) {
- sReturn += "<";
+ else if ( rString.Copy( 0, 4 ) == "&lt;" )
+ {
+ sReturn.append('<');
rString.Erase( 0, 4 );
}
- else if ( rString.Copy( 0, 4 ) == "&gt;" ) {
- sReturn += ">";
+ else if ( rString.Copy( 0, 4 ) == "&gt;" )
+ {
+ sReturn.append('>');
rString.Erase( 0, 4 );
}
- else if ( rString.Copy( 0, 6 ) == "&quot;" ) {
- sReturn += "\"";
+ else if ( rString.Copy( 0, 6 ) == "&quot;" )
+ {
+ sReturn.append('\"');;
rString.Erase( 0, 6 );
}
- else if ( rString.Copy( 0, 6 ) == "&apos;" ) {
- sReturn += "\'";
+ else if ( rString.Copy( 0, 6 ) == "&apos;" )
+ {
+ sReturn.append('\'');
rString.Erase( 0, 6 );
}
- else {
- sReturn += rString.GetChar( 0 );
+ else
+ {
+ sReturn.append(rString.GetChar(0));
rString.Erase( 0, 1 );
}
}
- rString = sReturn;
+ rString = sReturn.makeStringAndClear();
}
bool Export::isSourceLanguage( const ByteString &sLanguage )
{
diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx
index 7b0b11817687..f7d8018ae9de 100644
--- a/l10ntools/source/xmlparse.cxx
+++ b/l10ntools/source/xmlparse.cxx
@@ -38,6 +38,7 @@
#include <iostream>
#include <osl/mutex.hxx>
#include <osl/thread.hxx>
+#include <rtl/strbuf.hxx>
using namespace std;
using namespace osl;
@@ -1377,41 +1378,39 @@ void XMLUtil::UnQuotHTML( String &rString ){
}
void XMLUtil::UnQuotData( String &rString_in ){
- ByteString sReturn;
+ rtl::OStringBuffer sReturn;
ByteString sString( rString_in , RTL_TEXTENCODING_UTF8 );
while ( sString.Len()) {
if ( sString.Copy( 0, 1 ) == "\\" ) {
- sReturn += "\\\\";
+ sReturn.append("\\\\");
sString.Erase( 0, 1 );
}
else if ( sString.Copy( 0, 5 ) == "&amp;" ) {
- sReturn += "&";
+ sReturn.append('&');
sString.Erase( 0, 5 );
}
else if ( sString.Copy( 0, 4 ) == "&lt;" ) {
- sReturn += "<";
+ sReturn.append('<');
sString.Erase( 0, 4 );
}
else if ( sString.Copy( 0, 4 ) == "&gt;" ) {
- sReturn += ">";
+ sReturn.append('>');
sString.Erase( 0, 4 );
}
else if ( sString.Copy( 0, 6 ) == "&quot;" ) {
- sReturn += "\"";
+ sReturn.append('\"');
sString.Erase( 0, 6 );
}
else if ( sString.Copy( 0, 6 ) == "&apos;" ) {
- sReturn += "\'";
+ sReturn.append('\'');
sString.Erase( 0, 6 );
}
else {
- sReturn += sString.GetChar( 0 );
+ sReturn.append(sString.GetChar(0));
sString.Erase( 0, 1 );
}
}
- rString_in = String(sReturn , RTL_TEXTENCODING_UTF8 );
-
-
+ rString_in = rtl::OStringToOUString(sReturn.makeStringAndClear(), RTL_TEXTENCODING_UTF8);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */