libpqxx  7.7.1
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 #if !defined(PQXX_HEADER_PRE)
15 # error "Include libpqxx headers as <pqxx/header>, not <pqxx/header.hxx>."
16 #endif
17 
18 #include <stdexcept>
19 #include <string>
20 #include <utility>
21 
22 #include "pqxx/internal/encoding_group.hxx"
23 #include "pqxx/internal/encodings.hxx"
24 
25 
26 namespace pqxx
27 {
29 
47 class PQXX_LIBEXPORT array_parser
48 {
49 public:
51  enum class juncture
52  {
54  row_start,
56  row_end,
58  null_value,
60  string_value,
62  done,
63  };
64 
65  // TODO: constexpr noexcept. Breaks ABI.
67 
71  explicit array_parser(
72  std::string_view input,
73  internal::encoding_group = internal::encoding_group::MONOBYTE);
74 
76 
82  std::pair<juncture, std::string> get_next();
83 
84 private:
85  std::string_view m_input;
86  internal::glyph_scanner_func *const m_scan;
87 
89  std::string::size_type m_pos = 0u;
90 
91  std::string::size_type scan_single_quoted_string() const;
92  std::string parse_single_quoted_string(std::string::size_type end) const;
93  std::string::size_type scan_double_quoted_string() const;
94  std::string parse_double_quoted_string(std::string::size_type end) const;
95  std::string::size_type scan_unquoted_string() const;
96  std::string parse_unquoted_string(std::string::size_type end) const;
97 
98  std::string::size_type scan_glyph(std::string::size_type pos) const;
99  std::string::size_type
100  scan_glyph(std::string::size_type pos, std::string::size_type end) const;
101 };
102 } // namespace pqxx
103 #endif
Low-level array parser.
Definition: array.hxx:47
The home of all libpqxx classes, functions, templates, etc.
Definition: array.hxx:26
juncture
What&#39;s the latest thing found in the array?
Definition: array.hxx:51