[Libreoffice-commits] .: sc/inc
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Sep 13 19:00:37 PDT 2011
sc/inc/orcus/csv_parser.hpp | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
New commits:
commit 32ca2cb020b35b85ff3ddd5fe5bac9af9f1eebcc
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date: Tue Sep 13 21:59:36 2011 -0400
Updated csv_parser from orcus.
diff --git a/sc/inc/orcus/csv_parser.hpp b/sc/inc/orcus/csv_parser.hpp
index 828a8b6..c5adc17 100644
--- a/sc/inc/orcus/csv_parser.hpp
+++ b/sc/inc/orcus/csv_parser.hpp
@@ -86,6 +86,8 @@ private:
void cell();
void quoted_cell();
+ void skip_blanks();
+
/**
* Push cell value to the handler.
*/
@@ -179,6 +181,7 @@ void csv_parser<_Handler>::row()
assert(is_delim(c));
next();
+ skip_blanks();
}
}
@@ -228,8 +231,9 @@ void csv_parser<_Handler>::quoted_cell()
assert(is_text_qualifier(c));
next(); // Skip the closing quote.
+ skip_blanks();
c = cur_char();
- if (!is_delim(c))
+ if (!is_delim(c) && c != '\n')
{
std::ostringstream os;
os << "A quoted cell value must be immediately followed by a delimiter. ";
@@ -244,6 +248,16 @@ void csv_parser<_Handler>::quoted_cell()
}
template<typename _Handler>
+void csv_parser<_Handler>::skip_blanks()
+{
+ for (; has_char(); next())
+ {
+ if (!is_blank(*mp_char))
+ break;
+ }
+}
+
+template<typename _Handler>
void csv_parser<_Handler>::push_cell_value(const char* p, size_t n)
{
size_t len = n;
More information about the Libreoffice-commits
mailing list