diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-05-08 11:56:28 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-05-08 11:56:28 +0200 |
commit | 79776356d9597f3c0e06f8e81019909bdbb1a560 (patch) | |
tree | a796093412477145d606ab9895994b658cbfeaf4 /vcl/unx/kde/UnxCommandThread.cxx | |
parent | 80743f11fcdb49f997b0a8ff08bee28a0f2cfce7 (diff) |
loplugin:staticmethods
Change-Id: Ie3629a14c7a15a0f5f93a4bfc663a2bb52a8735d
Diffstat (limited to 'vcl/unx/kde/UnxCommandThread.cxx')
-rw-r--r-- | vcl/unx/kde/UnxCommandThread.cxx | 72 |
1 files changed, 38 insertions, 34 deletions
diff --git a/vcl/unx/kde/UnxCommandThread.cxx b/vcl/unx/kde/UnxCommandThread.cxx index 84bc2d8a94c9..46ff51c54151 100644 --- a/vcl/unx/kde/UnxCommandThread.cxx +++ b/vcl/unx/kde/UnxCommandThread.cxx @@ -29,6 +29,44 @@ using namespace ::com::sun::star; +namespace { + +::std::list< OUString > tokenize( const OUString &rCommand ) +{ + ::std::list< OUString > aList; + OUStringBuffer aBuffer( 1024 ); + + const sal_Unicode *pUnicode = rCommand.getStr(); + const sal_Unicode *pEnd = pUnicode + rCommand.getLength(); + bool bQuoted = false; + + for ( ; pUnicode != pEnd; ++pUnicode ) + { + if ( *pUnicode == '\\' ) + { + ++pUnicode; + if ( pUnicode != pEnd ) + { + if ( *pUnicode == 'n' ) + aBuffer.appendAscii( "\n", 1 ); + else + aBuffer.append( *pUnicode ); + } + } + else if ( *pUnicode == '"' ) + bQuoted = !bQuoted; + else if ( *pUnicode == ' ' && !bQuoted ) + aList.push_back( aBuffer.makeStringAndClear() ); + else + aBuffer.append( *pUnicode ); + } + aList.push_back( aBuffer.makeStringAndClear() ); + + return aList; +} + +} + // UnxFilePickerCommandThread UnxFilePickerCommandThread::UnxFilePickerCommandThread( UnxFilePickerNotifyThread *pNotifyThread, int nReadFD ) @@ -268,38 +306,4 @@ void SAL_CALL UnxFilePickerCommandThread::handleCommand( const OUString &rComman } } -::std::list< OUString > SAL_CALL UnxFilePickerCommandThread::tokenize( const OUString &rCommand ) -{ - ::std::list< OUString > aList; - OUStringBuffer aBuffer( 1024 ); - - const sal_Unicode *pUnicode = rCommand.getStr(); - const sal_Unicode *pEnd = pUnicode + rCommand.getLength(); - bool bQuoted = false; - - for ( ; pUnicode != pEnd; ++pUnicode ) - { - if ( *pUnicode == '\\' ) - { - ++pUnicode; - if ( pUnicode != pEnd ) - { - if ( *pUnicode == 'n' ) - aBuffer.appendAscii( "\n", 1 ); - else - aBuffer.append( *pUnicode ); - } - } - else if ( *pUnicode == '"' ) - bQuoted = !bQuoted; - else if ( *pUnicode == ' ' && !bQuoted ) - aList.push_back( aBuffer.makeStringAndClear() ); - else - aBuffer.append( *pUnicode ); - } - aList.push_back( aBuffer.makeStringAndClear() ); - - return aList; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |