main/writerfilter/source/dmapper/DomainMapper_Impl.cxx
/*-- 19.09.2006 10:01:20---------------------------------------------------
extract a parameter (with or without quotes) between the command and the following backslash
  -----------------------------------------------------------------------*/
19.09.2006 10:01:20
extract a parameter (with or without quotes) between the command and the following backslash
19 . 09 . 2006 10 : 01 : 20 extract a parameter ( with or without quotes ) between the command and the following backslash
::rtl::OUString lcl_ExtractParameter(const ::rtl::OUString& rCommand, sal_Int32 nCommandLength )
{
    sal_Int32 nStartIndex = nCommandLength;
    sal_Int32 nEndIndex = 0;
    sal_Int32 nQuoteIndex = rCommand.indexOf( '\"', nStartIndex);
    if( nQuoteIndex >= 0)
    {
        nStartIndex = nQuoteIndex + 1;
        nEndIndex = rCommand.indexOf( '\"', nStartIndex + 1) - 1;
    }
    else
    {
        nEndIndex = rCommand.indexOf( ::rtl::OUString::createFromAscii(" \\"), nStartIndex);
    }
    ::rtl::OUString sRet;
    if( nEndIndex > nStartIndex + 1 )
    {
        if(nQuoteIndex <= 0)
        {
            const sal_Unicode* pCommandStr = rCommand.getStr();
            while( nStartIndex < nEndIndex && pCommandStr[nStartIndex] == ' ')
                    ++nStartIndex;
            while( nEndIndex > nStartIndex && pCommandStr[nEndIndex] == ' ')
                    --nEndIndex;
        }
        sRet = rCommand.copy( nStartIndex, nEndIndex - nStartIndex + 1);
    }
    return sRet;
}
:: rtl :: OUString lcl_ExtractParameter ( const :: rtl :: OUString & rCommand , sal_Int32 nCommandLength ) { sal_Int32 nStartIndex = nCommandLength ; sal_Int32 nEndIndex = 0 ; sal_Int32 nQuoteIndex = rCommand . indexOf ( ' \" ' , nStartIndex ) ; if ( nQuoteIndex >= 0 ) { nStartIndex = nQuoteIndex + 1 ; nEndIndex = rCommand . indexOf ( ' \" ' , nStartIndex + 1 ) - 1 ; } else { nEndIndex = rCommand . indexOf ( :: rtl :: OUString :: createFromAscii ( " \\ " ) , nStartIndex ) ; } :: rtl :: OUString sRet ; if ( nEndIndex > nStartIndex + 1 ) { if ( nQuoteIndex <= 0 ) { const sal_Unicode * pCommandStr = rCommand . getStr ( ) ; while ( nStartIndex < nEndIndex && pCommandStr [ nStartIndex ] == ' ' ) ++ nStartIndex ; while ( nEndIndex > nStartIndex && pCommandStr [ nEndIndex ] == ' ' ) -- nEndIndex ; } sRet = rCommand . copy ( nStartIndex , nEndIndex - nStartIndex + 1 ) ; } return sRet ; }
19.09.2006 10:01:20
extract a parameter (with or without quotes) between the command and the following backslash
19 . 09 . 2006 10 : 01 : 20 extract a parameter ( with or without quotes ) between the command and the following backslash
//remove spaces at start and end of the result