mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-07-01 06:05:17 +02:00
update rapidcsv header
This commit is contained in:
parent
f27018912c
commit
48955ab120
1 changed files with 32 additions and 7 deletions
|
@ -2,9 +2,9 @@
|
||||||
* rapidcsv.h
|
* rapidcsv.h
|
||||||
*
|
*
|
||||||
* URL: https://github.com/d99kris/rapidcsv
|
* URL: https://github.com/d99kris/rapidcsv
|
||||||
* Version: 8.80
|
* Version: 8.84
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017-2023 Kristofer Berggren
|
* Copyright (C) 2017-2024 Kristofer Berggren
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* rapidcsv is distributed under the BSD 3-Clause license, see LICENSE for details.
|
* rapidcsv is distributed under the BSD 3-Clause license, see LICENSE for details.
|
||||||
|
@ -1588,6 +1588,15 @@ namespace rapidcsv
|
||||||
{
|
{
|
||||||
quoted = !quoted;
|
quoted = !quoted;
|
||||||
}
|
}
|
||||||
|
else if (mSeparatorParams.mTrim)
|
||||||
|
{
|
||||||
|
// allow whitespace before first mQuoteChar
|
||||||
|
const auto firstQuote = std::find(cell.begin(), cell.end(), mSeparatorParams.mQuoteChar);
|
||||||
|
if (std::all_of(cell.begin(), firstQuote, [](int ch) { return isspace(ch); }))
|
||||||
|
{
|
||||||
|
quoted = !quoted;
|
||||||
|
}
|
||||||
|
}
|
||||||
cell += buffer[i];
|
cell += buffer[i];
|
||||||
}
|
}
|
||||||
else if (buffer[i] == mSeparatorParams.mSeparator)
|
else if (buffer[i] == mSeparatorParams.mSeparator)
|
||||||
|
@ -1654,13 +1663,28 @@ namespace rapidcsv
|
||||||
p_FileLength -= readLength;
|
p_FileLength -= readLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle last line without linebreak
|
// Handle last row / cell without linebreak
|
||||||
if (!cell.empty() || !row.empty())
|
if (row.empty() && cell.empty())
|
||||||
|
{
|
||||||
|
// skip empty trailing line
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
row.push_back(Unquote(Trim(cell)));
|
row.push_back(Unquote(Trim(cell)));
|
||||||
cell.clear();
|
|
||||||
|
if (mLineReaderParams.mSkipCommentLines && !row.at(0).empty() &&
|
||||||
|
(row.at(0)[0] == mLineReaderParams.mCommentPrefix))
|
||||||
|
{
|
||||||
|
// skip comment line
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
mData.push_back(row);
|
mData.push_back(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
cell.clear();
|
||||||
row.clear();
|
row.clear();
|
||||||
|
quoted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assume CR/LF if at least half the linebreaks have CR
|
// Assume CR/LF if at least half the linebreaks have CR
|
||||||
|
@ -1725,7 +1749,8 @@ namespace rapidcsv
|
||||||
{
|
{
|
||||||
if (mSeparatorParams.mAutoQuote &&
|
if (mSeparatorParams.mAutoQuote &&
|
||||||
((itc->find(mSeparatorParams.mSeparator) != std::string::npos) ||
|
((itc->find(mSeparatorParams.mSeparator) != std::string::npos) ||
|
||||||
(itc->find(' ') != std::string::npos)))
|
(itc->find(' ') != std::string::npos) ||
|
||||||
|
(itc->find('\n') != std::string::npos)))
|
||||||
{
|
{
|
||||||
// escape quotes in string
|
// escape quotes in string
|
||||||
std::string str = *itc;
|
std::string str = *itc;
|
||||||
|
|
Loading…
Add table
Reference in a new issue