ByteString, shrink api

This commit is contained in:
Caolán McNamara
2011-08-12 10:17:16 +01:00
parent 7bd0fb7d7c
commit 58ee09b87b
7 changed files with 23 additions and 38 deletions

View File

@@ -445,8 +445,8 @@ void TestToolObj::LoadIniFile() // Laden der IniEinstellungen, die d
if (i >= 0)
{
sPath = sPath.copy(0, i);
ByteString bsPath( sPath.getStr(), sPath.getLength(),
RTL_TEXTENCODING_UTF8 );
ByteString bsPath( rtl::OUStringToOString(sPath,
RTL_TEXTENCODING_UTF8) );
aConf.SetGroup( "OOoProgramDir" );
String aOPD;

View File

@@ -40,6 +40,7 @@
#include "dbustrings.hrc"
#include "dbu_reghelper.hxx"
#include <tools/diagnose_ex.h>
#include <rtl/strbuf.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::sdb;
@@ -211,11 +212,9 @@ void SAL_CALL SbaExternalSourceBrowser::dispatch(const ::com::sun::star::util::U
if (xNewColProperties->hasPropertyByName(pControlProps->Name))
xNewCol->setPropertyValue(pControlProps->Name, pControlProps->Value);
}
catch(Exception&)
catch (const Exception&)
{
OSL_FAIL(( ByteString("SbaExternalSourceBrowser::dispatch : could not set a column property (")
+= ByteString(pControlProps->Name.getStr(), (sal_uInt16)pControlProps->Name.getLength(), RTL_TEXTENCODING_ASCII_US)
+= ByteString(")!")).GetBuffer());
OSL_FAIL(rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("SbaExternalSourceBrowser::dispatch : could not set a column property (")).append(rtl::OUStringToOString(pControlProps->Name, RTL_TEXTENCODING_ASCII_US)).append(RTL_CONSTASCII_STRINGPARAM(")!")).getStr());
}
}
}

View File

@@ -2189,9 +2189,9 @@ void lcl_dispatch(const Reference< XFrame >& xFrame,const Reference<XURLTransfor
aArgs.getArray()[0].Value <<= aReferer;
// build a sequence from the to-be-submitted string
ByteString a8BitData(aData.getStr(), (sal_uInt16)aData.getLength(), _eEncoding);
rtl::OString a8BitData(rtl::OUStringToOString(aData, _eEncoding));
// always ANSI #58641
Sequence< sal_Int8 > aPostData((sal_Int8*)a8BitData.GetBuffer(), a8BitData.Len());
Sequence< sal_Int8 > aPostData((const sal_Int8*)a8BitData.getStr(), a8BitData.getLength());
Reference< XInputStream > xPostData = new SequenceInputStream(aPostData);
aArgs.getArray()[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PostData") );

View File

@@ -177,8 +177,8 @@ void XclExpString::AppendByte( sal_Unicode cChar, rtl_TextEncoding eTextEnc )
}
else
{
ByteString aByteStr( &cChar, 1, eTextEnc ); // length may be >1
BuildAppend( aByteStr.GetBuffer(), aByteStr.Len() );
rtl::OString aByteStr( &cChar, 1, eTextEnc ); // length may be >1
BuildAppend( aByteStr.getStr(), aByteStr.getLength() );
}
}

View File

@@ -167,6 +167,12 @@ private:
ByteString( const int* pDummy ); // not implemented: to prevent ByteString( NULL )
ByteString(int); // not implemented; to detect misuses
// of ByteString(sal_Char);
ByteString( const UniString& rUniStr, xub_StrLen nPos, xub_StrLen nLen,
rtl_TextEncoding eTextEncoding,
sal_uInt32 nCvtFlags = UNISTRING_TO_BYTESTRING_CVTFLAGS );
ByteString( const sal_Unicode* pUniStr, xub_StrLen nLen,
rtl_TextEncoding eTextEncoding,
sal_uInt32 nCvtFlags = UNISTRING_TO_BYTESTRING_CVTFLAGS );
void Assign(int); // not implemented; to detect misuses of
// Assign(sal_Char)
void operator =(int); // not implemented; to detect misuses
@@ -186,9 +192,6 @@ public:
ByteString( const UniString& rUniStr,
rtl_TextEncoding eTextEncoding,
sal_uInt32 nCvtFlags = UNISTRING_TO_BYTESTRING_CVTFLAGS );
ByteString( const sal_Unicode* pUniStr, xub_StrLen nLen,
rtl_TextEncoding eTextEncoding,
sal_uInt32 nCvtFlags = UNISTRING_TO_BYTESTRING_CVTFLAGS );
~ByteString();
operator rtl::OString () const

View File

@@ -1118,8 +1118,8 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
}
if (p == pAttributeBegin)
break;
ByteString aAttribute = ByteString(
pAttributeBegin, static_cast< xub_StrLen >(p - pAttributeBegin),
ByteString aAttribute = rtl::OString(
pAttributeBegin, p - pAttributeBegin,
RTL_TEXTENCODING_ASCII_US);
if (bDowncaseAttribute)
aAttribute.ToLowerAscii();
@@ -1170,9 +1170,9 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
break;
if (pParameters)
{
aCharset = ByteString(
aCharset = rtl::OString(
pCharsetBegin,
static_cast< xub_StrLen >(p - pCharsetBegin),
p - pCharsetBegin,
RTL_TEXTENCODING_ASCII_US);
if (bDowncaseCharset)
aCharset.ToLowerAscii();
@@ -1205,9 +1205,9 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
break;
if (pParameters)
{
aLanguage = ByteString(
aLanguage = rtl::OString(
pLanguageBegin,
static_cast< xub_StrLen >(p - pLanguageBegin),
p - pLanguageBegin,
RTL_TEXTENCODING_ASCII_US);
if (bDowncaseLanguage)
aLanguage.ToLowerAscii();
@@ -1301,8 +1301,8 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
if (p == pTokenBegin)
break;
if (pParameters)
aValue = ByteString(
pTokenBegin, static_cast< xub_StrLen >(p - pTokenBegin),
aValue = rtl::OString(
pTokenBegin, p - pTokenBegin,
RTL_TEXTENCODING_UTF8);
}

View File

@@ -55,23 +55,6 @@ ByteString::ByteString( const UniString& rUniStr, rtl_TextEncoding eTextEncoding
eTextEncoding, nCvtFlags );
}
// -----------------------------------------------------------------------
ByteString::ByteString( const sal_Unicode* pUniStr, xub_StrLen nLen,
rtl_TextEncoding eTextEncoding, sal_uInt32 nCvtFlags )
{
DBG_CTOR( ByteString, DbgCheckByteString );
DBG_ASSERT( pUniStr, "ByteString::ByteString() - pUniStr is NULL" );
if ( nLen == STRING_LEN )
nLen = ImplStringLen( pUniStr );
mpData = NULL;
rtl_uString2String( (rtl_String **)(&mpData),
pUniStr, nLen,
eTextEncoding, nCvtFlags );
}
// =======================================================================
static sal_uChar aImplByteTab[256] =