ThinSQLite++
A thin, safe and convenient modern C++ wrapper for the SQLite API.
Toggle main menu visibility
Loading...
Searching...
No Matches
impl
string_param.hpp
1
/*
2
Copyright 2019 Eugene Gershnik
3
4
Use of this source code is governed by a BSD-style
5
license that can be found in the LICENSE file or at
6
https://github.com/gershnik/thinsqlitepp/blob/master/LICENSE
7
*/
8
9
#ifndef HEADER_SQLITEPP_STRING_PARAM_IFACE_INCLUDED
10
#define HEADER_SQLITEPP_STRING_PARAM_IFACE_INCLUDED
11
12
#include "config.hpp"
13
14
#include <
string
>
15
#include <
memory
>
16
17
namespace
thinsqlitepp
18
{
23
35
SQLITEPP_EXPORTED
36
template
<
class
T>
37
class
basic_string_param
38
{
39
public
:
41
basic_string_param
(
const
T * str) noexcept : _str(str)
42
{}
43
44
basic_string_param
(
const
std::basic_string<T>
& str) noexcept : _str(str.c_str())
45
{}
46
47
basic_string_param
(
std::nullptr_t
) noexcept : _str(
nullptr
)
48
{}
49
51
const
T *
c_str
() const noexcept
52
{
return
_str; }
53
private
:
54
const
T * _str;
55
};
56
58
SQLITEPP_EXPORTED
using
string_param
=
basic_string_param<char>
;
59
60
#if __cpp_char8_t >= 201811
61
63
SQLITEPP_EXPORTED
using
u8string_param
=
basic_string_param<char8_t>
;
64
65
#endif
66
68
}
69
70
#endif
71
72
73
std::basic_string
thinsqlitepp::basic_string_param
A reference to a null terminated string.
Definition
string_param.hpp:38
thinsqlitepp::basic_string_param::c_str
const T * c_str() const noexcept
Returns the stored pointer.
Definition
string_param.hpp:51
thinsqlitepp::basic_string_param::basic_string_param
basic_string_param(const std::basic_string< T > &str) noexcept
Construct an instance from std::basic_string<T>::c_str().
Definition
string_param.hpp:44
thinsqlitepp::basic_string_param::basic_string_param
basic_string_param(std::nullptr_t) noexcept
Construct an instance from a nullptr.
Definition
string_param.hpp:47
thinsqlitepp::basic_string_param::basic_string_param
basic_string_param(const T *str) noexcept
Construct an instance from a raw pointer.
Definition
string_param.hpp:41
thinsqlitepp::string_param
basic_string_param< char > string_param
Convenience typedef.
Definition
string_param.hpp:58
thinsqlitepp::u8string_param
basic_string_param< char8_t > u8string_param
Convenience typedef. Only available if you compiler/library supports char8_t.
Definition
string_param.hpp:63
memory
thinsqlitepp
ThinSQLite++ namespace.
Definition
backup_iface.hpp:17
std::nullptr_t
string
Generated by
1.17.0