diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-02-07 22:14:06 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-02-08 10:14:20 +0100 |
commit | ccc2b4ec0e51af180b30a1f2198d5a44fba3e778 (patch) | |
tree | c865a9612bb93f69c82ba8708c27aba238bff36f | |
parent | 40035bbbbc4b81a285905fb26eeb5e68640ef508 (diff) |
Use OUStringLiteral
Change-Id: I15580bd0395145f9554cd3a155c4825ba95005b3
-rw-r--r-- | extensions/source/logging/loggerconfig.cxx | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/extensions/source/logging/loggerconfig.cxx b/extensions/source/logging/loggerconfig.cxx index cdf6df55488e..8bb8fdbd1379 100644 --- a/extensions/source/logging/loggerconfig.cxx +++ b/extensions/source/logging/loggerconfig.cxx @@ -79,19 +79,8 @@ namespace logging { struct Variable { - const sal_Char* pVariablePattern; - const sal_Int32 nPatternLength; - rtl_TextEncoding eEncoding; - const OUString sVariableValue; - - Variable( const sal_Char* _pVariablePattern, const sal_Int32 _nPatternLength, rtl_TextEncoding _eEncoding, - const OUString& _rVariableValue ) - :pVariablePattern( _pVariablePattern ) - ,nPatternLength( _nPatternLength ) - ,eEncoding( _eEncoding ) - ,sVariableValue( _rVariableValue ) - { - } + OUStringLiteral pVariablePattern; + OUString sVariableValue; }; OUString sLoggerName; @@ -132,22 +121,21 @@ namespace logging aProcessId = info.Ident; rtl::OUString aPID = OUString::number( aProcessId ); - Variable aVariables[] = + Variable const aVariables[] = { - Variable( RTL_CONSTASCII_USTRINGPARAM( "$(loggername)" ), sLoggerName ), - Variable( RTL_CONSTASCII_USTRINGPARAM( "$(date)" ), sDate ), - Variable( RTL_CONSTASCII_USTRINGPARAM( "$(time)" ), sTime ), - Variable( RTL_CONSTASCII_USTRINGPARAM( "$(datetime)" ), sDateTime ), - Variable( RTL_CONSTASCII_USTRINGPARAM( "$(pid)" ), aPID ) + {"$(loggername)", sLoggerName}, + {"$(date)", sDate}, + {"$(time)", sTime}, + {"$(datetime)", sDateTime}, + {"$(pid)", aPID} }; - for (Variable & aVariable : aVariables) + for (Variable const & aVariable : aVariables) { - OUString sPattern( aVariable.pVariablePattern, aVariable.nPatternLength, aVariable.eEncoding ); - sal_Int32 nVariableIndex = _inout_rFileURL.indexOf( sPattern ); + sal_Int32 nVariableIndex = _inout_rFileURL.indexOf( aVariable.pVariablePattern ); if (nVariableIndex >= 0) { - _inout_rFileURL = _inout_rFileURL.replaceAt( nVariableIndex, sPattern.getLength(), aVariable.sVariableValue ); + _inout_rFileURL = _inout_rFileURL.replaceAt( nVariableIndex, aVariable.pVariablePattern.size, aVariable.sVariableValue ); } } } |