Orcus
csv_parser_base.hpp
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6  */
7 
8 #ifndef CSV_PARSER_BASE_HPP
9 #define CSV_PARSER_BASE_HPP
10 
11 #include "env.hpp"
12 #include "cell_buffer.hpp"
13 #include "parser_global.hpp"
14 #include "parser_base.hpp"
15 
16 #include <cstdlib>
17 #include <cstring>
18 #include <exception>
19 #include <string>
20 #include <cassert>
21 #include <sstream>
22 
23 #define ORCUS_DEBUG_CSV 0
24 
25 #if ORCUS_DEBUG_CSV
26 #include <iostream>
27 using std::cout;
28 using std::endl;
29 #endif
30 
31 namespace orcus { namespace csv {
32 
36 struct ORCUS_PSR_DLLPUBLIC parser_config
37 {
41  std::string delimiters;
42 
47 
53 
54  parser_config();
55 };
56 
57 class ORCUS_PSR_DLLPUBLIC parser_base : public ::orcus::parser_base
58 {
59 protected:
60  const csv::parser_config& m_config;
61  cell_buffer m_cell_buf;
62 
63 protected:
64  parser_base(std::string_view content, const parser_config& config);
65 
70  bool is_blank(char c) const;
71  bool is_delim(char c) const;
72  bool is_text_qualifier(char c) const;
73 
74  void skip_blanks();
75 };
76 
77 }}
78 
79 #endif
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: cell_buffer.hpp:22
Definition: csv_parser_base.hpp:58
bool is_blank(char c) const
Definition: parser_base.hpp:23
Definition: config.hpp:20
Definition: csv_parser_base.hpp:37
std::string delimiters
Definition: csv_parser_base.hpp:41
char text_qualifier
Definition: csv_parser_base.hpp:46
bool trim_cell_value
Definition: csv_parser_base.hpp:52