diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-08-18 09:15:26 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-08-18 09:16:29 +0100 |
commit | da019635438cc145de28aaa0864c324bb2219c2b (patch) | |
tree | eb890ee9a8727a468f7fadb342c2c74581e2e6cc /tools | |
parent | 139029d6f64bf1eb38ab7851b0379b19f802fe75 (diff) |
ByteString->rtl::OString
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inc/tools/config.hxx | 2 | ||||
-rw-r--r-- | tools/source/generic/config.cxx | 45 |
2 files changed, 23 insertions, 24 deletions
diff --git a/tools/inc/tools/config.hxx b/tools/inc/tools/config.hxx index fdb00529b312..5c739407a66f 100644 --- a/tools/inc/tools/config.hxx +++ b/tools/inc/tools/config.hxx @@ -73,7 +73,7 @@ public: ByteString ReadKey( const ByteString& rKey ) const; UniString ReadKey( const ByteString& rKey, rtl_TextEncoding eEncoding ) const; ByteString ReadKey( const ByteString& rKey, const ByteString& rDefault ) const; - void WriteKey( const ByteString& rKey, const ByteString& rValue ); + void WriteKey(const rtl::OString& rKey, const rtl::OString& rValue); void DeleteKey( const ByteString& rKey ); ByteString GetKeyName( sal_uInt16 nKey ) const; ByteString ReadKey( sal_uInt16 nKey ) const; diff --git a/tools/source/generic/config.cxx b/tools/source/generic/config.cxx index 1cf709464903..201578d81f7f 100644 --- a/tools/source/generic/config.cxx +++ b/tools/source/generic/config.cxx @@ -56,8 +56,8 @@ struct ImplKeyData { ImplKeyData* mpNext; - ByteString maKey; - ByteString maValue; + rtl::OString maKey; + rtl::OString maValue; sal_Bool mbIsComment; }; @@ -493,11 +493,11 @@ static sal_uInt8* ImplGetConfigBuffer( const ImplConfigData* pData, sal_uIntPtr& pKey = pGroup->mpFirstKey; while ( pKey ) { - nValueLen = pKey->maValue.Len(); + nValueLen = pKey->maValue.getLength(); if ( pKey->mbIsComment ) nBufLen += nValueLen + nLineEndLen; else - nBufLen += pKey->maKey.Len() + nValueLen + nLineEndLen + 1; + nBufLen += pKey->maKey.getLength() + nValueLen + nLineEndLen + 1; pKey = pKey->mpNext; } @@ -552,12 +552,12 @@ static sal_uInt8* ImplGetConfigBuffer( const ImplConfigData* pData, sal_uIntPtr& pKey = pGroup->mpFirstKey; while ( pKey ) { - nValueLen = pKey->maValue.Len(); + nValueLen = pKey->maValue.getLength(); if ( pKey->mbIsComment ) { if ( nValueLen ) { - memcpy( pBuf, pKey->maValue.GetBuffer(), nValueLen ); + memcpy( pBuf, pKey->maValue.getStr(), nValueLen ); pBuf += nValueLen; } *pBuf = aLineEndBuf[0]; pBuf++; @@ -568,11 +568,11 @@ static sal_uInt8* ImplGetConfigBuffer( const ImplConfigData* pData, sal_uIntPtr& } else { - nKeyLen = pKey->maKey.Len(); - memcpy( pBuf, pKey->maKey.GetBuffer(), nKeyLen ); + nKeyLen = pKey->maKey.getLength(); + memcpy( pBuf, pKey->maKey.getStr(), nKeyLen ); pBuf += nKeyLen; *pBuf = '='; pBuf++; - memcpy( pBuf, pKey->maValue.GetBuffer(), nValueLen ); + memcpy( pBuf, pKey->maValue.getStr(), nValueLen ); pBuf += nValueLen; *pBuf = aLineEndBuf[0]; pBuf++; if ( nLineEndLen == 2 ) @@ -998,7 +998,7 @@ ByteString Config::ReadKey( const ByteString& rKey, const ByteString& rDefault ) ImplKeyData* pKey = pGroup->mpFirstKey; while ( pKey ) { - if ( !pKey->mbIsComment && pKey->maKey.EqualsIgnoreCaseAscii( rKey ) ) + if ( !pKey->mbIsComment && pKey->maKey.equalsIgnoreAsciiCase(rKey) ) return pKey->maValue; pKey = pKey->mpNext; @@ -1010,19 +1010,18 @@ ByteString Config::ReadKey( const ByteString& rKey, const ByteString& rDefault ) // ----------------------------------------------------------------------- -void Config::WriteKey( const ByteString& rKey, const ByteString& rStr ) +void Config::WriteKey(const rtl::OString& rKey, const rtl::OString& rStr) { #ifdef DBG_UTIL - ByteString aTraceStr( "Config::WriteKey( " ); - aTraceStr += rKey; - aTraceStr += ", "; - aTraceStr += rStr; - aTraceStr += " ) to "; - aTraceStr += GetGroup(); - aTraceStr += " in "; - aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); - DBG_ASSERTWARNING( rStr != ReadKey( rKey ), "Config::WriteKey() with the same Value" ); + rtl::OStringBuffer aTraceStr(RTL_CONSTASCII_STRINGPARAM("Config::WriteKey( ")); + aTraceStr.append(rKey); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(", ")); + aTraceStr.append(rStr); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" ) to ")); + aTraceStr.append(GetGroup()); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" in ")); + aTraceStr.append(rtl::OUStringToOString(maFileName, RTL_TEXTENCODING_UTF8)); + OSL_TRACE("%s", aTraceStr.getStr()); #endif // Config-Daten evt. updaten @@ -1040,7 +1039,7 @@ void Config::WriteKey( const ByteString& rKey, const ByteString& rStr ) ImplKeyData* pKey = pGroup->mpFirstKey; while ( pKey ) { - if ( !pKey->mbIsComment && pKey->maKey.EqualsIgnoreCaseAscii( rKey ) ) + if ( !pKey->mbIsComment && pKey->maKey.equalsIgnoreAsciiCase(rKey) ) break; pPrevKey = pKey; @@ -1096,7 +1095,7 @@ void Config::DeleteKey( const ByteString& rKey ) ImplKeyData* pKey = pGroup->mpFirstKey; while ( pKey ) { - if ( !pKey->mbIsComment && pKey->maKey.EqualsIgnoreCaseAscii( rKey ) ) + if ( !pKey->mbIsComment && pKey->maKey.equalsIgnoreAsciiCase(rKey) ) break; pPrevKey = pKey; |