ADBC
Arrow Database Connectivity
Loading...
Searching...
No Matches
adbc::driver::Option Class Reference

A typed option value wrapper. It currently does not attempt conversion (i.e., getting a double option as a string). More...

#include <base_driver.h>

Classes

struct  Unset
 The option is unset. More...

Public Types

using Value = std::variant<Unset, std::string, std::vector<uint8_t>, int64_t, double>
 The possible values of an option.

Public Member Functions

 Option (const char *value)
 Construct an option from a C string. NULL strings are treated as unset.
 Option (std::string value)
 Option (std::vector< uint8_t > value)
 Option (double value)
 Option (int64_t value)
const Valuevalue () const &
Valuevalue () &&
bool has_value () const
 Check whether this option is set.
Result< bool > AsBool () const
 Try to parse a string value as a boolean.
Result< int64_t > AsInt () const
 Try to parse a string or integer value as an integer.
Result< std::string_view > AsString () const
 Get the value if it is a string.
std::string Format () const
 Provide a human-readable summary of the value.

Private Member Functions

AdbcStatusCode CGet (char *out, size_t *length, AdbcError *error) const
AdbcStatusCode CGet (uint8_t *out, size_t *length, AdbcError *error) const
AdbcStatusCode CGet (int64_t *out, AdbcError *error) const
AdbcStatusCode CGet (double *out, AdbcError *error) const

Private Attributes

Value value_

Friends

class ObjectBase

Detailed Description

A typed option value wrapper. It currently does not attempt conversion (i.e., getting a double option as a string).

Member Typedef Documentation

◆ Value

using adbc::driver::Option::Value = std::variant<Unset, std::string, std::vector<uint8_t>, int64_t, double>

The possible values of an option.

Constructor & Destructor Documentation

◆ Option()

adbc::driver::Option::Option ( const char * value)
inlineexplicit

Construct an option from a C string. NULL strings are treated as unset.

Member Function Documentation

◆ AsBool()

Result< bool > adbc::driver::Option::AsBool ( ) const
inline

Try to parse a string value as a boolean.

◆ AsInt()

Result< int64_t > adbc::driver::Option::AsInt ( ) const
inline

Try to parse a string or integer value as an integer.

◆ AsString()

Result< std::string_view > adbc::driver::Option::AsString ( ) const
inline

Get the value if it is a string.

◆ Format()

std::string adbc::driver::Option::Format ( ) const
inline

Provide a human-readable summary of the value.

◆ has_value()

bool adbc::driver::Option::has_value ( ) const
inline

Check whether this option is set.


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