convert tools::Config to rtl::OString

This commit is contained in:
Caolán McNamara
2011-08-18 22:30:22 +01:00
parent 2add3f0e5a
commit d1fb13adf9
13 changed files with 77 additions and 81 deletions

View File

@@ -216,17 +216,17 @@ sal_uLong RemoteControlCommunicationManager::GetPort()
aConf.WriteKey( aNoTesttoolKey, "something" ); aConf.WriteKey( aNoTesttoolKey, "something" );
} }
nPortIs = aConf.ReadKey("TTPort","0").ToInt32(); nPortIs = aConf.ReadKey("TTPort","0").toInt32();
// noch pr<70>fen ob dieses Office getestet werden soll. // noch pr<70>fen ob dieses Office getestet werden soll.
if ( !bAutomate || aConf.ReadKey( aNoTesttoolKey, "" ) != "" ) if ( !bAutomate || aConf.ReadKey( aNoTesttoolKey, "" ) != "" )
nPortIs = 0; nPortIs = 0;
nComm = (sal_uInt16)aConf.ReadKey("Comm","0").ToInt32(); nComm = (sal_uInt16)aConf.ReadKey("Comm","0").toInt32();
if ( nComm ) if ( nComm )
aConf.DeleteKey("Comm"); aConf.DeleteKey("Comm");
bQuiet = ( aConf.ReadKey("Quiet","no").CompareIgnoreCaseToAscii("yes") == COMPARE_EQUAL ); bQuiet = aConf.ReadKey("Quiet","no").equalsIgnoreAsciiCase("yes");
} }
return nPortIs; return nPortIs;
} }

View File

@@ -362,11 +362,11 @@ void TestToolObj::LoadIniFile() // Laden der IniEinstellungen, die d
aVar = UniString( __##aVar##__, RTL_TEXTENCODING_UTF8 );\ aVar = UniString( __##aVar##__, RTL_TEXTENCODING_UTF8 );\
} }
#define NEWOLD( NewKey, OldKey ) \ #define NEWOLD( NewKey, OldKey ) \
{ \ { \
ByteString aValue; \ rtl::OString aValue; \
if ( ( (aValue = aConf.ReadKey( OldKey )).Len() ) && !aConf.ReadKey( NewKey ).Len() ) \ if ( ( (aValue = aConf.ReadKey( OldKey )).getLength() ) && !aConf.ReadKey( NewKey ).getLength() ) \
aConf.WriteKey( NewKey, aValue ); \ aConf.WriteKey( NewKey, aValue ); \
} }
@@ -381,8 +381,8 @@ void TestToolObj::LoadIniFile() // Laden der IniEinstellungen, die d
pImpl->aFileBase = DirEntry(aFB); pImpl->aFileBase = DirEntry(aFB);
// remove old keys // remove old keys
if ( aConf.ReadKey("KeyCodes + Classes").Len() != 0 || if ( aConf.ReadKey("KeyCodes + Classes").getLength() != 0 ||
aConf.ReadKey("KeyCodes + Classes + Res_Type").Len() != 0 ) aConf.ReadKey("KeyCodes + Classes + Res_Type").getLength() != 0 )
{ {
aConf.DeleteKey("KeyCodes + Classes + Res_Type"); aConf.DeleteKey("KeyCodes + Classes + Res_Type");
aConf.DeleteKey("KeyCodes + Classes"); aConf.DeleteKey("KeyCodes + Classes");

View File

@@ -604,8 +604,8 @@ void BasicFrame::LoadIniFile()
for ( i = 0 ; i < aConf.GetGroupCount() ; i++ ) for ( i = 0 ; i < aConf.GetGroupCount() ; i++ )
{ {
aConf.SetGroup( ByteString( aConf.GetGroupName( i ) ) ); aConf.SetGroup( ByteString( aConf.GetGroupName( i ) ) );
if ( ( aConf.ReadKey( "Aktuell" ).Len() || aConf.ReadKey( "Alle" ).Len() ) if ( ( aConf.ReadKey( "Aktuell" ).getLength() || aConf.ReadKey( "Alle" ).getLength() )
&&( !aConf.ReadKey( "Current" ).Len() && !aConf.ReadKey( "All" ).Len() ) ) &&( !aConf.ReadKey( "Current" ).getLength() && !aConf.ReadKey( "All" ).getLength() ) )
{ {
aConf.WriteKey( "Current", aConf.ReadKey( "Aktuell" ) ); aConf.WriteKey( "Current", aConf.ReadKey( "Aktuell" ) );
aConf.WriteKey( "All", aConf.ReadKey( "Alle" ) ); aConf.WriteKey( "All", aConf.ReadKey( "Alle" ) );
@@ -1061,13 +1061,13 @@ void BasicFrame::AddToLRU(String const& aFile)
PopupMenu *pPopup = GetMenuBar()->GetPopupMenu(RID_APPFILE); PopupMenu *pPopup = GetMenuBar()->GetPopupMenu(RID_APPFILE);
aConfig.SetGroup("LRU"); aConfig.SetGroup("LRU");
sal_uInt16 nMaxLRU = (sal_uInt16)aConfig.ReadKey("MaxLRU","4").ToInt32(); sal_uInt16 nMaxLRU = (sal_uInt16)aConfig.ReadKey("MaxLRU","4").toInt32();
DirEntry aFileEntry( aFile ); DirEntry aFileEntry( aFile );
sal_uInt16 i,nLastMove = nMaxLRU; sal_uInt16 i,nLastMove = nMaxLRU;
for ( i = 1 ; i<nMaxLRU && nLastMove == nMaxLRU ; i++ ) for ( i = 1 ; i<nMaxLRU && nLastMove == nMaxLRU ; i++ )
{ {
if ( DirEntry( UniString( aConfig.ReadKey(LRUNr(i),""), RTL_TEXTENCODING_UTF8 ) ) == aFileEntry ) if ( DirEntry( rtl::OStringToOUString(aConfig.ReadKey(LRUNr(i),""), RTL_TEXTENCODING_UTF8) ) == aFileEntry )
nLastMove = i; nLastMove = i;
} }
@@ -1075,7 +1075,7 @@ void BasicFrame::AddToLRU(String const& aFile)
pPopup->InsertSeparator(); pPopup->InsertSeparator();
for ( i = nLastMove ; i>1 ; i-- ) for ( i = nLastMove ; i>1 ; i-- )
{ {
if ( aConfig.ReadKey(LRUNr(i-1),"").Len() ) if ( aConfig.ReadKey(LRUNr(i-1),"").getLength() )
{ {
aConfig.WriteKey(LRUNr(i), aConfig.ReadKey(LRUNr(i-1),"")); aConfig.WriteKey(LRUNr(i), aConfig.ReadKey(LRUNr(i-1),""));
if ( pPopup->GetItemPos( IDM_FILE_LRU1 + i-1 ) == MENU_ITEM_NOTFOUND ) if ( pPopup->GetItemPos( IDM_FILE_LRU1 + i-1 ) == MENU_ITEM_NOTFOUND )
@@ -1098,7 +1098,7 @@ void BasicFrame::LoadLRU()
sal_Bool bAddSep = sal_True; sal_Bool bAddSep = sal_True;
aConfig.SetGroup("LRU"); aConfig.SetGroup("LRU");
sal_uInt16 nMaxLRU = (sal_uInt16)aConfig.ReadKey("MaxLRU","4").ToInt32(); sal_uInt16 nMaxLRU = (sal_uInt16)aConfig.ReadKey("MaxLRU","4").toInt32();
if ( pPopup ) if ( pPopup )
bAddSep = pPopup->GetItemPos( IDM_FILE_LRU1 ) == MENU_ITEM_NOTFOUND; bAddSep = pPopup->GetItemPos( IDM_FILE_LRU1 ) == MENU_ITEM_NOTFOUND;
@@ -1106,7 +1106,7 @@ void BasicFrame::LoadLRU()
sal_uInt16 i; sal_uInt16 i;
for ( i = 1; i <= nMaxLRU && pPopup != NULL; i++) for ( i = 1; i <= nMaxLRU && pPopup != NULL; i++)
{ {
String aFile = UniString( aConfig.ReadKey(LRUNr(i)), RTL_TEXTENCODING_UTF8 ); String aFile = rtl::OStringToOUString(aConfig.ReadKey(LRUNr(i)), RTL_TEXTENCODING_UTF8);
if (aFile.Len() != 0) if (aFile.Len() != 0)
{ {
@@ -1698,7 +1698,7 @@ void NewFileDialog::FilterSelect()
aConf.SetGroup( "Misc" ); aConf.SetGroup( "Misc" );
ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" );
aConf.SetGroup( aCurrentProfile ); aConf.SetGroup( aCurrentProfile );
aLastPath = UniString( aConf.ReadKey( aFilterType, aConf.ReadKey( "BaseDir" ) ), RTL_TEXTENCODING_UTF8 ); aLastPath = rtl::OStringToOUString(aConf.ReadKey(aFilterType, aConf.ReadKey( "BaseDir")), RTL_TEXTENCODING_UTF8);
SetPath( aLastPath ); SetPath( aLastPath );
} }

View File

@@ -85,9 +85,9 @@ void AppEdit::LoadIniFile()
FontList aFontList( pFrame ); // Just some Window is needed FontList aFontList( pFrame ); // Just some Window is needed
Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
aConf.SetGroup("Misc"); aConf.SetGroup("Misc");
String aFontName = String( aConf.ReadKey( "ScriptFontName", "Courier" ), RTL_TEXTENCODING_UTF8 ); String aFontName = rtl::OStringToOUString(aConf.ReadKey( "ScriptFontName", "Courier" ), RTL_TEXTENCODING_UTF8);
String aFontStyle = String( aConf.ReadKey( "ScriptFontStyle", "normal" ), RTL_TEXTENCODING_UTF8 ); String aFontStyle = rtl::OStringToOUString(aConf.ReadKey( "ScriptFontStyle", "normal" ), RTL_TEXTENCODING_UTF8);
String aFontSize = String( aConf.ReadKey( "ScriptFontSize", "12" ), RTL_TEXTENCODING_UTF8 ); String aFontSize = rtl::OStringToOUString(aConf.ReadKey( "ScriptFontSize", "12" ), RTL_TEXTENCODING_UTF8);
Font aFont = aFontList.Get( aFontName, aFontStyle ); Font aFont = aFontList.Get( aFontName, aFontStyle );
sal_uIntPtr nFontSize = aFontSize.ToInt32(); sal_uIntPtr nFontSize = aFontSize.ToInt32();
aFont.SetHeight( nFontSize ); aFont.SetHeight( nFontSize );

View File

@@ -88,16 +88,16 @@ void AppError::LoadIniFile()
{ {
Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") )); Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
aConf.SetGroup("Misc"); aConf.SetGroup("Misc");
ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); rtl::OString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" );
aConf.SetGroup( aCurrentProfile ); aConf.SetGroup( aCurrentProfile );
aBaseDir = DirEntry( aConf.ReadKey("BaseDir") ); aBaseDir = DirEntry( aConf.ReadKey("BaseDir") );
FontList aFontList( pFrame ); // Just some Window is needed FontList aFontList( pFrame ); // Just some Window is needed
aConf.SetGroup("Misc"); aConf.SetGroup("Misc");
String aFontName = String( aConf.ReadKey( "ScriptFontName", "Courier" ), RTL_TEXTENCODING_UTF8 ); String aFontName = rtl::OStringToOUString(aConf.ReadKey( "ScriptFontName", "Courier" ), RTL_TEXTENCODING_UTF8);
String aFontStyle = String( aConf.ReadKey( "ScriptFontStyle", "normal" ), RTL_TEXTENCODING_UTF8 ); String aFontStyle = rtl::OStringToOUString(aConf.ReadKey( "ScriptFontStyle", "normal" ), RTL_TEXTENCODING_UTF8);
String aFontSize = String( aConf.ReadKey( "ScriptFontSize", "12" ), RTL_TEXTENCODING_UTF8 ); String aFontSize = rtl::OStringToOUString(aConf.ReadKey( "ScriptFontSize", "12" ), RTL_TEXTENCODING_UTF8);
Font aFont = aFontList.Get( aFontName, aFontStyle ); Font aFont = aFontList.Get( aFontName, aFontStyle );
sal_uIntPtr nFontSize = aFontSize.ToInt32(); sal_uIntPtr nFontSize = aFontSize.ToInt32();
aFont.SetHeight( nFontSize ); aFont.SetHeight( nFontSize );

View File

@@ -146,7 +146,7 @@ void ConfEdit::Init( Config &aConf )
ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" );
aConf.SetGroup( aCurrentProfile ); aConf.SetGroup( aCurrentProfile );
String aTemp = UniString( aConf.ReadKey( aKeyName ), RTL_TEXTENCODING_UTF8 ); String aTemp = rtl::OStringToOUString(aConf.ReadKey(aKeyName), RTL_TEXTENCODING_UTF8);
aEdit.SetText( aTemp ); aEdit.SetText( aTemp );
} }
@@ -182,7 +182,7 @@ void ConfEdit::Reload( Config &aConf )
aConf.SetGroup("Misc"); aConf.SetGroup("Misc");
ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" ); ByteString aCurrentProfile = aConf.ReadKey( "CurrentProfile", "Path" );
aConf.SetGroup( aCurrentProfile ); aConf.SetGroup( aCurrentProfile );
String aValue = String( aConf.ReadKey( aKeyName ), RTL_TEXTENCODING_UTF8 ); String aValue = rtl::OStringToOUString(aConf.ReadKey(aKeyName), RTL_TEXTENCODING_UTF8);
aEdit.SetText( aValue ); aEdit.SetText( aValue );
} }
@@ -817,7 +817,7 @@ void GenericOptions::LoadData()
{ {
String* pGroup = pGroups->at( i ); String* pGroup = pGroups->at( i );
aConf.SetGroup( ByteString( *pGroup, RTL_TEXTENCODING_UTF8 ) ); aConf.SetGroup( ByteString( *pGroup, RTL_TEXTENCODING_UTF8 ) );
if ( aConf.ReadKey( C_KEY_AKTUELL ).Len() > 0 ) if ( aConf.ReadKey( C_KEY_AKTUELL ).getLength() > 0 )
aCbArea.InsertEntry( *pGroup ); aCbArea.InsertEntry( *pGroup );
delete pGroup; delete pGroup;
} }
@@ -882,7 +882,7 @@ IMPL_LINK( GenericOptions, MoveButtons, AutoTimer*, aTimer )
String GenericOptions::ReadKey( const ByteString &aGroup, const ByteString &aKey ) String GenericOptions::ReadKey( const ByteString &aGroup, const ByteString &aKey )
{ {
aConf.SetGroup( aGroup ); aConf.SetGroup( aGroup );
return UniString( aConf.ReadKey( aKey ), RTL_TEXTENCODING_UTF8 ); return rtl::OStringToOUString(aConf.ReadKey(aKey), RTL_TEXTENCODING_UTF8);
} }
IMPL_LINK( GenericOptions, LoadGroup, ComboBox*, EMPTYARG ) IMPL_LINK( GenericOptions, LoadGroup, ComboBox*, EMPTYARG )

View File

@@ -456,7 +456,7 @@ sal_Bool ODbaseIndex::DropImpl()
aKeyName = aInfFile.GetKeyName( nKey ); aKeyName = aInfFile.GetKeyName( nKey );
if (aKeyName.Copy(0,3) == "NDX") if (aKeyName.Copy(0,3) == "NDX")
{ {
if(sEntry == String(aInfFile.ReadKey(aKeyName),m_pTable->getConnection()->getTextEncoding())) if(sEntry == String(rtl::OStringToOUString(aInfFile.ReadKey(aKeyName),m_pTable->getConnection()->getTextEncoding())))
{ {
aInfFile.DeleteKey(aKeyName); aInfFile.DeleteKey(aKeyName);
break; break;

View File

@@ -395,7 +395,7 @@ void ODbaseIndexDialog::Init()
// yes -> add to the tables index list // yes -> add to the tables index list
if (aNDX == "NDX" ) if (aNDX == "NDX" )
{ {
aEntry = String(aInfFile.ReadKey(aKeyName), gsl_getSystemTextEncoding()); aEntry = rtl::OStringToOUString(aInfFile.ReadKey(aKeyName), gsl_getSystemTextEncoding());
rTabInfo.aIndexList.push_back( OTableIndex( aEntry ) ); rTabInfo.aIndexList.push_back( OTableIndex( aEntry ) );
// and remove it from the free index list // and remove it from the free index list

View File

@@ -376,7 +376,7 @@ FontImportDialog::FontImportDialog( Window* pParent ) :
Config& rPadminRC( getPadminRC() ); Config& rPadminRC( getPadminRC() );
rPadminRC.SetGroup( "FontImport" ); rPadminRC.SetGroup( "FontImport" );
m_aFromDirEdt.SetText( String( rPadminRC.ReadKey( "FromPath" ), RTL_TEXTENCODING_UTF8 ) ); m_aFromDirEdt.SetText( rtl::OStringToOUString(rPadminRC.ReadKey("FromPath"), RTL_TEXTENCODING_UTF8) );
RefreshTimeoutHdl( NULL ); RefreshTimeoutHdl( NULL );
} }

View File

@@ -76,7 +76,7 @@ PPDImportDialog::PPDImportDialog( Window* pParent ) :
Config& rConfig = getPadminRC(); Config& rConfig = getPadminRC();
rConfig.SetGroup( PPDIMPORT_GROUP ); rConfig.SetGroup( PPDIMPORT_GROUP );
m_aPathBox.SetText( String( rConfig.ReadKey( "LastDir" ), RTL_TEXTENCODING_UTF8 ) ); m_aPathBox.SetText( rtl::OStringToOUString(rConfig.ReadKey("LastDir"), RTL_TEXTENCODING_UTF8) );
for (sal_Int32 i = 0; i < 11; ++i) for (sal_Int32 i = 0; i < 11; ++i)
{ {
ByteString aEntry(rConfig.ReadKey(rtl::OString::valueOf(i))); ByteString aEntry(rConfig.ReadKey(rtl::OString::valueOf(i)));
@@ -117,7 +117,7 @@ void PPDImportDialog::Import()
break; break;
if( nEntries < 0 ) if( nEntries < 0 )
{ {
sal_Int32 nNextEntry = rConfig.ReadKey( "NextEntry" ).ToInt32(); sal_Int32 nNextEntry = rConfig.ReadKey("NextEntry").toInt32();
rConfig.WriteKey( rtl::OString::valueOf(nNextEntry), ByteString( aImportPath, RTL_TEXTENCODING_UTF8 ) ); rConfig.WriteKey( rtl::OString::valueOf(nNextEntry), ByteString( aImportPath, RTL_TEXTENCODING_UTF8 ) );
nNextEntry = nNextEntry < 10 ? nNextEntry+1 : 0; nNextEntry = nNextEntry < 10 ? nNextEntry+1 : 0;
rConfig.WriteKey( "NextEntry", rtl::OString::valueOf(nNextEntry) ); rConfig.WriteKey( "NextEntry", rtl::OString::valueOf(nNextEntry) );

View File

@@ -93,7 +93,7 @@ uno::Any PrivateProfileStringListener::getValueEvent()
// get key/value from a file // get key/value from a file
Config aCfg( maFileName ); Config aCfg( maFileName );
aCfg.SetGroup( maGroupName ); aCfg.SetGroup( maGroupName );
sValue = String( aCfg.ReadKey( maKey ), RTL_TEXTENCODING_DONTKNOW ); sValue = rtl::OStringToOUString(aCfg.ReadKey(maKey), RTL_TEXTENCODING_DONTKNOW);
} }
else else
{ {

View File

@@ -70,13 +70,13 @@ public:
sal_uInt16 GetGroupCount() const; sal_uInt16 GetGroupCount() const;
sal_Bool HasGroup(const rtl::OString& rGroup) const; sal_Bool HasGroup(const rtl::OString& rGroup) const;
ByteString ReadKey( const ByteString& rKey ) const; rtl::OString ReadKey(const rtl::OString& rKey) const;
UniString ReadKey( const ByteString& rKey, rtl_TextEncoding eEncoding ) const; UniString ReadKey(const rtl::OString& rKey, rtl_TextEncoding eEncoding) const;
ByteString ReadKey( const ByteString& rKey, const ByteString& rDefault ) const; rtl::OString ReadKey(const rtl::OString& rKey, const rtl::OString& rDefault) const;
void WriteKey(const rtl::OString& rKey, const rtl::OString& rValue); void WriteKey(const rtl::OString& rKey, const rtl::OString& rValue);
void DeleteKey( const ByteString& rKey ); void DeleteKey(const rtl::OString& rKey);
ByteString GetKeyName( sal_uInt16 nKey ) const; rtl::OString GetKeyName(sal_uInt16 nKey) const;
ByteString ReadKey( sal_uInt16 nKey ) const; rtl::OString ReadKey(sal_uInt16 nKey) const;
sal_uInt16 GetKeyCount() const; sal_uInt16 GetKeyCount() const;
sal_Bool IsLocked() const { return (mnLockCount != 0); } sal_Bool IsLocked() const { return (mnLockCount != 0); }

View File

@@ -84,14 +84,6 @@ struct ImplConfigData
// ======================================================================= // =======================================================================
static ByteString& getEmptyByteString()
{
static ByteString aEmpty;
return aEmpty;
}
// =======================================================================
static String toUncPath( const String& rPath ) static String toUncPath( const String& rPath )
{ {
::rtl::OUString aFileURL; ::rtl::OUString aFileURL;
@@ -261,17 +253,19 @@ static String ImplMakeConfigName( const XubString* pFileName,
namespace { namespace {
ByteString makeByteString(sal_uInt8 const * p, sal_uInt64 n) { rtl::OString makeOString(const sal_uInt8* p, sal_uInt64 n)
if (n > STRING_MAXLEN) { {
if (n > SAL_MAX_INT32)
{
#ifdef WNT #ifdef WNT
abort(); abort();
#else #else
::std::abort(); //TODO: handle this gracefully ::std::abort(); //TODO: handle this gracefully
#endif #endif
} }
return ByteString( return rtl::OString(
reinterpret_cast< char const * >(p), reinterpret_cast< char const * >(p),
sal::static_int_cast< xub_StrLen >(n)); sal::static_int_cast< sal_Int32 >(n));
} }
} }
@@ -286,8 +280,8 @@ static void ImplMakeConfigList( ImplConfigData* pData,
// Buffer parsen und Liste zusammenbauen // Buffer parsen und Liste zusammenbauen
sal_uInt64 nStart; sal_uInt64 nStart;
sal_uInt64 nLineLen; sal_uInt64 nLineLen;
xub_StrLen nNameLen; sal_uInt64 nNameLen;
xub_StrLen nKeyLen; sal_uInt64 nKeyLen;
sal_uInt64 i; sal_uInt64 i;
const sal_uInt8* pLine; const sal_uInt8* pLine;
ImplKeyData* pPrevKey = NULL; ImplKeyData* pPrevKey = NULL;
@@ -355,7 +349,7 @@ static void ImplMakeConfigList( ImplConfigData* pData,
while ( (pLine[nNameLen-1] == ' ') || (pLine[nNameLen-1] == '\t') ) while ( (pLine[nNameLen-1] == ' ') || (pLine[nNameLen-1] == '\t') )
nNameLen--; nNameLen--;
} }
pGroup->maGroupName = ByteString( (const sal_Char*)pLine, nNameLen ); pGroup->maGroupName = makeOString(pLine, nNameLen);
} }
else else
{ {
@@ -400,7 +394,7 @@ static void ImplMakeConfigList( ImplConfigData* pData,
pPrevKey = pKey; pPrevKey = pKey;
if ( pLine[0] == ';' ) if ( pLine[0] == ';' )
{ {
pKey->maValue = makeByteString(pLine, nLineLen); pKey->maValue = makeOString(pLine, nLineLen);
pKey->mbIsComment = sal_True; pKey->mbIsComment = sal_True;
} }
else else
@@ -416,7 +410,7 @@ static void ImplMakeConfigList( ImplConfigData* pData,
while ( (pLine[nNameLen-1] == ' ') || (pLine[nNameLen-1] == '\t') ) while ( (pLine[nNameLen-1] == ' ') || (pLine[nNameLen-1] == '\t') )
nNameLen--; nNameLen--;
} }
pKey->maKey = ByteString( (const sal_Char*)pLine, nNameLen ); pKey->maKey = makeOString(pLine, nNameLen);
nKeyLen++; nKeyLen++;
if ( nKeyLen < nLineLen ) if ( nKeyLen < nLineLen )
{ {
@@ -432,7 +426,7 @@ static void ImplMakeConfigList( ImplConfigData* pData,
{ {
while ( (pLine[nLineLen-1] == ' ') || (pLine[nLineLen-1] == '\t') ) while ( (pLine[nLineLen-1] == ' ') || (pLine[nLineLen-1] == '\t') )
nLineLen--; nLineLen--;
pKey->maValue = makeByteString(pLine, nLineLen); pKey->maValue = makeOString(pLine, nLineLen);
} }
} }
} }
@@ -636,7 +630,7 @@ static void ImplWriteConfig( ImplConfigData* pData )
{ {
if ( pData->mnTimeStamp != ImplSysGetConfigTimeStamp( pData->maFileName ) ) if ( pData->mnTimeStamp != ImplSysGetConfigTimeStamp( pData->maFileName ) )
{ {
OSL_TRACE( "Config overwrites modified configfile:\n %s", ByteString( pData->maFileName, RTL_TEXTENCODING_UTF8 ).GetBuffer() ); OSL_TRACE( "Config overwrites modified configfile:\n %s", rtl::OUStringToOString(pData->maFileName, RTL_TEXTENCODING_UTF8).getStr() );
} }
} }
#endif #endif
@@ -780,10 +774,11 @@ Config::Config( const XubString& rFileName )
mbPersistence = sal_True; mbPersistence = sal_True;
#ifdef DBG_UTIL #ifdef DBG_UTIL
ByteString aTraceStr( "Config::Config( " ); rtl::OStringBuffer aTraceStr(
aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); RTL_CONSTASCII_STRINGPARAM("Config::Config( "));
aTraceStr += " )"; aTraceStr.append(rtl::OUStringToOString(maFileName, RTL_TEXTENCODING_UTF8));
OSL_TRACE( "%s", aTraceStr.GetBuffer() ); aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" )"));
OSL_TRACE("%s", aTraceStr.getStr());
#endif #endif
} }
@@ -959,32 +954,33 @@ sal_Bool Config::HasGroup(const rtl::OString& rGroup) const
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
ByteString Config::ReadKey( const ByteString& rKey ) const rtl::OString Config::ReadKey(const rtl::OString& rKey) const
{ {
return ReadKey( rKey, getEmptyByteString() ); return ReadKey(rKey, rtl::OString());
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
UniString Config::ReadKey( const ByteString& rKey, rtl_TextEncoding eEncoding ) const UniString Config::ReadKey(const rtl::OString& rKey, rtl_TextEncoding eEncoding) const
{ {
if ( mpData->mbIsUTF8BOM ) if ( mpData->mbIsUTF8BOM )
eEncoding = RTL_TEXTENCODING_UTF8; eEncoding = RTL_TEXTENCODING_UTF8;
return UniString( ReadKey( rKey ), eEncoding ); return rtl::OStringToOUString(ReadKey(rKey), eEncoding);
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
ByteString Config::ReadKey( const ByteString& rKey, const ByteString& rDefault ) const rtl::OString Config::ReadKey(const rtl::OString& rKey, const rtl::OString& rDefault) const
{ {
#ifdef DBG_UTIL #ifdef DBG_UTIL
ByteString aTraceStr( "Config::ReadKey( " ); rtl::OStringBuffer aTraceStr(
aTraceStr += rKey; RTL_CONSTASCII_STRINGPARAM("Config::ReadKey( "));
aTraceStr += " ) from "; aTraceStr.append(rKey);
aTraceStr += ByteString(GetGroup()); aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" ) from "));
aTraceStr += " in "; aTraceStr.append(GetGroup());
aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" in "));
OSL_TRACE( "%s", aTraceStr.GetBuffer() ); aTraceStr.append(rtl::OUStringToOString(maFileName, RTL_TEXTENCODING_UTF8));
OSL_TRACE("%s", aTraceStr.getStr());
#endif #endif
// Config-Daten evt. updaten // Config-Daten evt. updaten
@@ -1078,7 +1074,7 @@ void Config::WriteKey(const rtl::OString& rKey, const rtl::OString& rStr)
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void Config::DeleteKey( const ByteString& rKey ) void Config::DeleteKey(const rtl::OString& rKey)
{ {
// Config-Daten evt. updaten // Config-Daten evt. updaten
if ( !mnLockCount || !mpData->mbRead ) if ( !mnLockCount || !mpData->mbRead )
@@ -1160,7 +1156,7 @@ sal_uInt16 Config::GetKeyCount() const
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
ByteString Config::GetKeyName( sal_uInt16 nKey ) const rtl::OString Config::GetKeyName(sal_uInt16 nKey) const
{ {
#ifdef DBG_UTIL #ifdef DBG_UTIL
rtl::OStringBuffer aTraceStr( rtl::OStringBuffer aTraceStr(
@@ -1192,12 +1188,12 @@ ByteString Config::GetKeyName( sal_uInt16 nKey ) const
} }
} }
return getEmptyByteString(); return rtl::OString();
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
ByteString Config::ReadKey( sal_uInt16 nKey ) const rtl::OString Config::ReadKey(sal_uInt16 nKey) const
{ {
#ifdef DBG_UTIL #ifdef DBG_UTIL
rtl::OStringBuffer aTraceStr( rtl::OStringBuffer aTraceStr(
@@ -1229,7 +1225,7 @@ ByteString Config::ReadKey( sal_uInt16 nKey ) const
} }
} }
return getEmptyByteString(); return rtl::OString();
} }
void Config::Flush() void Config::Flush()