diff options
Diffstat (limited to 'tools/source')
-rw-r--r-- | tools/source/stream/stream.cxx | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 8c0efb66c6f2..fea6025e5263 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1019,93 +1019,6 @@ sal_Bool SvStream::StartReadingUnicodeText( rtl_TextEncoding eReadBomCharSet ) /************************************************************************* |* -|* Stream::ReadCsvLine() -|* -*************************************************************************/ - -// Precondition: pStr is guaranteed to be non-NULL and points to a 0-terminated -// array. -inline const sal_Unicode* lcl_UnicodeStrChr( const sal_Unicode* pStr, - sal_Unicode c ) -{ - while (*pStr) - { - if (*pStr == c) - return pStr; - ++pStr; - } - return 0; -} - -void SvStream::ReadCsvLine( String& rStr, sal_Bool bEmbeddedLineBreak, - const String& rFieldSeparators, sal_Unicode cFieldQuote, - sal_Bool bAllowBackslashEscape) -{ - ReadUniOrByteStringLine(rStr, GetStreamCharSet()); - - if (bEmbeddedLineBreak) - { - const sal_Unicode* pSeps = rFieldSeparators.GetBuffer(); - - // See if the separator(s) include tab. - bool bTabSep = lcl_UnicodeStrChr(pSeps, '\t') != NULL; - - xub_StrLen nLastOffset = 0; - xub_StrLen nQuotes = 0; - while (!IsEof() && rStr.Len() < STRING_MAXLEN) - { - bool bBackslashEscaped = false; - const sal_Unicode *p, *pStart; - p = pStart = rStr.GetBuffer(); - p += nLastOffset; - while (*p) - { - if (nQuotes) - { - if (bTabSep && *p == '\t' && (nQuotes % 2) != 0) - { - // When tab-delimited, tab char ends quoted sequence - // even if we haven't reached the end quote. Doing - // this helps keep mal-formed rows from damaging - // other, well-formed rows. - nQuotes = 0; - break; - } - - if (*p == cFieldQuote && !bBackslashEscaped) - ++nQuotes; - else if (bAllowBackslashEscape) - { - if (*p == '\\') - bBackslashEscaped = !bBackslashEscaped; - else - bBackslashEscaped = false; - } - } - else if (*p == cFieldQuote && (p == pStart || - lcl_UnicodeStrChr( pSeps, p[-1]))) - nQuotes = 1; - // A quote character inside a field content does not start - // a quote. - ++p; - } - - if (nQuotes % 2 == 0) - break; - else - { - nLastOffset = rStr.Len(); - String aNext; - ReadUniOrByteStringLine(aNext, GetStreamCharSet()); - rStr += sal_Unicode(_LF); - rStr += aNext; - } - } - } -} - -/************************************************************************* -|* |* Stream::SeekRel() |* *************************************************************************/ |