Use std::optional instead of mbgl::optional (#911)
This commit is contained in:
@@ -13,10 +13,10 @@
|
||||
#include <cstdio>
|
||||
#include <chrono>
|
||||
#include <limits>
|
||||
#include <optional>
|
||||
|
||||
#include <mbgl/util/chrono.hpp>
|
||||
#include <mbgl/util/logging.hpp>
|
||||
#include <mbgl/util/optional.hpp>
|
||||
#include <mbgl/util/string.hpp>
|
||||
#include <mbgl/util/traits.hpp>
|
||||
|
||||
@@ -80,9 +80,6 @@ public:
|
||||
int64_t changes = 0;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using optional = std::experimental::optional<T>;
|
||||
|
||||
mapbox::util::variant<Database, Exception> Database::tryOpen(const std::string &filename, int flags) {
|
||||
if (!QSqlDatabase::drivers().contains("QSQLITE")) {
|
||||
return Exception { ResultCode::CantOpen, "SQLite driver not found." };
|
||||
@@ -274,7 +271,7 @@ void Query::bind(int offset, mbgl::Timestamp value) {
|
||||
}
|
||||
|
||||
template <>
|
||||
void Query::bind(int offset, optional<std::string> value) {
|
||||
void Query::bind(int offset, std::optional<std::string> value) {
|
||||
if (value) {
|
||||
bind(offset, *value);
|
||||
} else {
|
||||
@@ -283,7 +280,7 @@ void Query::bind(int offset, optional<std::string> value) {
|
||||
}
|
||||
|
||||
template <>
|
||||
void Query::bind(int offset, optional<mbgl::Timestamp> value) {
|
||||
void Query::bind(int offset, std::optional<mbgl::Timestamp> value) {
|
||||
if (value) {
|
||||
bind(offset, *value);
|
||||
} else {
|
||||
@@ -373,7 +370,7 @@ template <> mbgl::Timestamp Query::get(int offset) {
|
||||
std::chrono::system_clock::from_time_t(value.value<::time_t>()));
|
||||
}
|
||||
|
||||
template <> optional<int64_t> Query::get(int offset) {
|
||||
template <> std::optional<int64_t> Query::get(int offset) {
|
||||
assert(stmt.impl && stmt.impl->query.isValid());
|
||||
QVariant value = stmt.impl->query.value(offset);
|
||||
checkQueryError(stmt.impl->query);
|
||||
@@ -382,7 +379,7 @@ template <> optional<int64_t> Query::get(int offset) {
|
||||
return { value.value<int64_t>() };
|
||||
}
|
||||
|
||||
template <> optional<double> Query::get(int offset) {
|
||||
template <> std::optional<double> Query::get(int offset) {
|
||||
assert(stmt.impl && stmt.impl->query.isValid());
|
||||
QVariant value = stmt.impl->query.value(offset);
|
||||
checkQueryError(stmt.impl->query);
|
||||
@@ -398,7 +395,7 @@ template <> std::string Query::get(int offset) {
|
||||
return std::string(value.constData(), value.size());
|
||||
}
|
||||
|
||||
template <> optional<std::string> Query::get(int offset) {
|
||||
template <> std::optional<std::string> Query::get(int offset) {
|
||||
assert(stmt.impl && stmt.impl->query.isValid());
|
||||
QByteArray value = stmt.impl->query.value(offset).toByteArray();
|
||||
checkQueryError(stmt.impl->query);
|
||||
@@ -407,7 +404,7 @@ template <> optional<std::string> Query::get(int offset) {
|
||||
return { std::string(value.constData(), value.size()) };
|
||||
}
|
||||
|
||||
template <> optional<mbgl::Timestamp> Query::get(int offset) {
|
||||
template <> std::optional<mbgl::Timestamp> Query::get(int offset) {
|
||||
assert(stmt.impl && stmt.impl->query.isValid());
|
||||
QVariant value = stmt.impl->query.value(offset);
|
||||
checkQueryError(stmt.impl->query);
|
||||
|
||||
Reference in New Issue
Block a user