libpqxx  7.7.0
array.hxx
1 /* Handling of SQL arrays.
2  *
3  * DO NOT INCLUDE THIS FILE DIRECTLY; include pqxx/field instead.
4  *
5  * Copyright (c) 2000-2022, Jeroen T. Vermeulen.
6  *
7  * See COPYING for copyright license. If you did not receive a file called
8  * COPYING with this source code, please notify the distributor of this
9  * mistake, or contact the author.
10  */
11 #ifndef PQXX_H_ARRAY
12 #define PQXX_H_ARRAY
13 
14 #include "pqxx/internal/encoding_group.hxx"
15 #include "pqxx/internal/encodings.hxx"
16 
17 #include <stdexcept>
18 #include <string>
19 #include <utility>
20 
21 
22 namespace pqxx
23 {
25 
43 class PQXX_LIBEXPORT array_parser
44 {
45 public:
47  enum class juncture
48  {
50  row_start,
52  row_end,
54  null_value,
56  string_value,
58  done,
59  };
60 
62  explicit array_parser(
63  std::string_view input,
64  internal::encoding_group = internal::encoding_group::MONOBYTE);
65 
67 
73  std::pair<juncture, std::string> get_next();
74 
75 private:
76  std::string_view m_input;
77  internal::glyph_scanner_func *const m_scan;
78 
80  std::string::size_type m_pos = 0u;
81 
82  std::string::size_type scan_single_quoted_string() const;
83  std::string parse_single_quoted_string(std::string::size_type end) const;
84  std::string::size_type scan_double_quoted_string() const;
85  std::string parse_double_quoted_string(std::string::size_type end) const;
86  std::string::size_type scan_unquoted_string() const;
87  std::string parse_unquoted_string(std::string::size_type end) const;
88 
89  std::string::size_type scan_glyph(std::string::size_type pos) const;
90  std::string::size_type
91  scan_glyph(std::string::size_type pos, std::string::size_type end) const;
92 };
93 } // namespace pqxx
94 #endif
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:23
Low-level array parser.
Definition: array.hxx:44
juncture
What's the latest thing found in the array?
Definition: array.hxx:48