libpqxx
The C++ client library for PostgreSQL
pqxx::internal::connection_string_parser Class Referencefinal

Parse a connection string into option keys and their values. More...

#include <connection-string.hxx>

Public Member Functions

 connection_string_parser (char const connection_string[], sl=sl::current())
 
 connection_string_parser ()=delete
 
 connection_string_parser (connection_string_parser const &)=delete
 
 connection_string_parser (connection_string_parser &&)=default
 
connection_string_parseroperator= (connection_string_parser const &)=delete
 
connection_string_parseroperator= (connection_string_parser &&)=default
 
 ~connection_string_parser () noexcept
 
std::array< std::vector< char const * >, 2u > parse () const
 Parse the string, return matching vectors of option names & values. More...
 

Detailed Description

Parse a connection string into option keys and their values.

This is a class and not a function for just one reason: the outputs contain pointers to storage that needs to be held in memory.

Constructor & Destructor Documentation

◆ connection_string_parser() [1/4]

pqxx::internal::connection_string_parser::connection_string_parser ( char const  connection_string[],
sl  loc = sl::current() 
)
explicit

◆ connection_string_parser() [2/4]

pqxx::internal::connection_string_parser::connection_string_parser ( )
delete

◆ connection_string_parser() [3/4]

pqxx::internal::connection_string_parser::connection_string_parser ( connection_string_parser const &  )
delete

◆ connection_string_parser() [4/4]

pqxx::internal::connection_string_parser::connection_string_parser ( connection_string_parser &&  )
default

◆ ~connection_string_parser()

pqxx::internal::connection_string_parser::~connection_string_parser ( )
defaultnoexcept

Member Function Documentation

◆ operator=() [1/2]

connection_string_parser& pqxx::internal::connection_string_parser::operator= ( connection_string_parser &&  )
default

◆ operator=() [2/2]

connection_string_parser& pqxx::internal::connection_string_parser::operator= ( connection_string_parser const &  )
delete

◆ parse()

std::array< std::vector< char const * >, 2u > pqxx::internal::connection_string_parser::parse ( ) const

Parse the string, return matching vectors of option names & values.

The two vectors are of equal length. The first holds the option names and the second their respective values.

The outputs remain valid only for as long as the whole connection_string_parser does. You can call parse() as many times as you like. The calls will produce distinct outputs but the ultimate string pointers will be the same, and in the same order.

The vectors will only contain values that were actually specified (as opposed to ones that were left to their defaults), but they will have enough room reserved to specify all possible options, plus a terminating null that we may need to add.


The documentation for this class was generated from the following files: