core: rename mbgl namespace to mln (#4487)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Bart Louwers
2026-08-14 23:25:20 +02:00
committed by GitHub
parent 836b862984
commit 550f64be22
1970 changed files with 8931 additions and 8967 deletions

View File

@@ -1,5 +1,5 @@
#include <mbgl/benchmark.hpp>
int main(int argc, char* argv[]) {
return mbgl::runBenchmark(argc, argv);
return mln::runBenchmark(argc, argv);
}

View File

@@ -1,12 +1,12 @@
#include <mbgl/gfx/headless_backend.hpp>
namespace mbgl {
namespace mln {
namespace gfx {
bool Backend::enableGPUExpressionEval = false;
HeadlessBackend::HeadlessBackend(Size size_)
: mbgl::gfx::Renderable(size_, nullptr) {}
: mln::gfx::Renderable(size_, nullptr) {}
void HeadlessBackend::setSize(Size size_) {
size = size_;
@@ -14,4 +14,4 @@ void HeadlessBackend::setSize(Size size_) {
}
} // namespace gfx
} // namespace mbgl
} // namespace mln

View File

@@ -9,7 +9,7 @@
#include <mbgl/util/monotonic_timer.hpp>
#include <mbgl/util/run_loop.hpp>
namespace mbgl {
namespace mln {
HeadlessFrontend::HeadlessFrontend(float pixelRatio_,
gfx::HeadlessBackend::SwapBehaviour swapBehavior,
@@ -163,7 +163,7 @@ void HeadlessFrontend::renderOnce(Map&) {
void HeadlessFrontend::renderFrame() {
if (renderer && updateParameters) {
auto startTime = mbgl::util::MonotonicTimer::now();
auto startTime = mln::util::MonotonicTimer::now();
gfx::BackendScope guard{*getBackend()};
// onStyleImageMissing might be called during a render. The user
@@ -174,7 +174,7 @@ void HeadlessFrontend::renderFrame() {
auto updateParameters_ = updateParameters;
renderer->render(updateParameters_);
auto endTime = mbgl::util::MonotonicTimer::now();
auto endTime = mln::util::MonotonicTimer::now();
frameTime = (endTime - startTime).count();
}
}
@@ -187,4 +187,4 @@ std::optional<TransformState> HeadlessFrontend::getTransformState() const {
}
}
} // namespace mbgl
} // namespace mln

View File

@@ -8,7 +8,7 @@
#include <stdexcept>
#include <type_traits>
namespace mbgl {
namespace mln {
namespace gl {
class HeadlessRenderableResource final : public gl::RenderableResource {
@@ -44,8 +44,8 @@ public:
HeadlessBackend::HeadlessBackend(const Size size_,
gfx::HeadlessBackend::SwapBehaviour swapBehaviour_,
const gfx::ContextMode contextMode_)
: mbgl::gl::RendererBackend(contextMode_),
mbgl::gfx::HeadlessBackend(size_),
: mln::gl::RendererBackend(contextMode_),
mln::gfx::HeadlessBackend(size_),
swapBehaviour(swapBehaviour_) {}
HeadlessBackend::~HeadlessBackend() {
@@ -135,4 +135,4 @@ std::unique_ptr<gfx::HeadlessBackend> Backend::Create<gfx::Backend::Type::OpenGL
}
} // namespace gfx
} // namespace mbgl
} // namespace mln

View File

@@ -46,7 +46,7 @@ std::string unaccent(const std::string& str) {
}
} // namespace
namespace mbgl {
namespace mln {
namespace platform {
class Collator::Impl {
@@ -94,4 +94,4 @@ Collator::Collator(bool caseSensitive, bool diacriticSensitive, const std::optio
: impl(std::make_shared<Impl>(caseSensitive, diacriticSensitive, locale)) {}
} // namespace platform
} // namespace mbgl
} // namespace mln

View File

@@ -7,7 +7,7 @@
#include <string>
namespace mbgl {
namespace mln {
namespace platform {
#if !defined(MBGL_USE_BUILTIN_ICU)
@@ -45,4 +45,4 @@ std::string formatNumber(double number, const std::string&, const std::string&,
#endif
} // namespace platform
} // namespace mbgl
} // namespace mln

View File

@@ -19,7 +19,7 @@
#include <memory>
#include <vector>
namespace mbgl {
namespace mln {
class LayerManagerDefault final : public LayerManager {
public:
@@ -32,7 +32,7 @@ public:
* in order to save binary size (the corresponding SDK layer wrappers
* should be excluded from the project build).
*/
void addLayerTypeCoreOnly(std::unique_ptr<mbgl::LayerFactory>) override;
void addLayerTypeCoreOnly(std::unique_ptr<mln::LayerFactory>) override;
private:
void addLayerType(std::unique_ptr<LayerFactory>);
@@ -44,7 +44,7 @@ private:
std::map<std::string, LayerFactory*> typeToFactory;
};
void LayerManagerDefault::addLayerTypeCoreOnly(std::unique_ptr<mbgl::LayerFactory> layerFactory) {
void LayerManagerDefault::addLayerTypeCoreOnly(std::unique_ptr<mln::LayerFactory> layerFactory) {
addLayerType(std::move(layerFactory));
}
@@ -104,7 +104,7 @@ void LayerManagerDefault::addLayerType(std::unique_ptr<LayerFactory> factory) {
factories.emplace_back(std::move(factory));
}
LayerFactory* LayerManagerDefault::getFactory(const mbgl::style::LayerTypeInfo* typeInfo) noexcept {
LayerFactory* LayerManagerDefault::getFactory(const mln::style::LayerTypeInfo* typeInfo) noexcept {
assert(typeInfo);
for (const auto& factory : factories) {
if (layerTypeInfoEquals(factory->getTypeInfo(), typeInfo)) {
@@ -133,4 +133,4 @@ const bool LayerManager::annotationsEnabled = false;
const bool LayerManager::annotationsEnabled = true;
#endif
} // namespace mbgl
} // namespace mln

View File

@@ -16,7 +16,7 @@
#include <mbgl/util/thread.hpp>
#include <utility>
namespace mbgl {
namespace mln {
// static
MapSnapshotterObserver& MapSnapshotterObserver::nullObserver() {
@@ -173,7 +173,7 @@ public:
PremultipliedImage takeImage() { return renderer->actor().ask(&SnapshotterRenderer::takeImage).get(); }
const mbgl::TaggedScheduler& getThreadPool() const override {
const mln::TaggedScheduler& getThreadPool() const override {
return renderer->actor().ask(&SnapshotterRenderer::getThreadPool).get();
}
@@ -206,7 +206,7 @@ public:
map.jumpTo(map.cameraForLatLngs(latLngs, regionInsets));
}
void setPadding(const mbgl::EdgeInsets& insets) {
void setPadding(const mln::EdgeInsets& insets) {
regionInsets = insets;
if (!region.isEmpty()) {
std::vector<LatLng> latLngs = {region.southwest(), region.northeast()};
@@ -214,7 +214,7 @@ public:
}
}
mbgl::EdgeInsets getPadding() const { return regionInsets; }
mln::EdgeInsets getPadding() const { return regionInsets; }
void addAnnotationImage(std::unique_ptr<style::Image> image) { map.addAnnotationImage(std::move(image)); }
@@ -302,7 +302,7 @@ private:
SnapshotterRendererFrontend frontend;
Map map;
LatLngBounds region;
mbgl::EdgeInsets regionInsets;
mln::EdgeInsets regionInsets;
};
MapSnapshotter::MapSnapshotter(Size size,
@@ -368,11 +368,11 @@ LatLngBounds MapSnapshotter::getRegion() const {
return impl->getMap().latLngBoundsForCamera(impl->getMap().getCameraOptions(getPadding()));
}
void MapSnapshotter::setPadding(const mbgl::EdgeInsets& insets) {
void MapSnapshotter::setPadding(const mln::EdgeInsets& insets) {
impl->setPadding(insets);
}
mbgl::EdgeInsets MapSnapshotter::getPadding() const {
mln::EdgeInsets MapSnapshotter::getPadding() const {
return impl->getPadding();
}
@@ -400,4 +400,4 @@ void MapSnapshotter::cancel() {
impl->cancel();
}
} // namespace mbgl
} // namespace mln

View File

@@ -11,7 +11,7 @@
#include <stdexcept>
#include <type_traits>
namespace mbgl {
namespace mln {
namespace mtl {
class HeadlessRenderableResource final : public mtl::RenderableResource {
@@ -56,8 +56,8 @@ public:
HeadlessBackend::HeadlessBackend(const Size size_,
gfx::HeadlessBackend::SwapBehaviour swapBehaviour_,
const gfx::ContextMode contextMode_)
: mbgl::mtl::RendererBackend(contextMode_),
mbgl::gfx::HeadlessBackend(size_),
: mln::mtl::RendererBackend(contextMode_),
mln::gfx::HeadlessBackend(size_),
swapBehaviour(swapBehaviour_) {}
HeadlessBackend::~HeadlessBackend() {
@@ -119,4 +119,4 @@ std::unique_ptr<gfx::HeadlessBackend> Backend::Create<gfx::Backend::Type::Metal>
}
} // namespace gfx
} // namespace mbgl
} // namespace mln

View File

@@ -1,6 +1,6 @@
#include <chrono>
namespace mbgl {
namespace mln {
namespace platform {
std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds> now() {
@@ -8,4 +8,4 @@ std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds> now() {
}
} // namespace platform
} // namespace mbgl
} // namespace mln

View File

@@ -12,7 +12,7 @@ int main(int argc, char* argv[]) {
#ifdef IS_IOS
try {
#endif
return mbgl::runRenderTests(argc, argv, [](mbgl::TestStatus) {});
return mln::runRenderTests(argc, argv, [](mln::TestStatus) {});
#ifdef IS_IOS
} catch (std::exception const& e) {
std::cerr << "Caught an exception while running tests\n" << e.what() << '\n';

View File

@@ -13,11 +13,11 @@
namespace {
bool acceptsURL(const std::string& url) {
return url.starts_with(mbgl::util::ASSET_PROTOCOL);
return url.starts_with(mln::util::ASSET_PROTOCOL);
}
} // namespace
namespace mbgl {
namespace mln {
class AssetFileSource::Impl {
public:
@@ -36,7 +36,7 @@ public:
// Cut off the protocol and prefix with path.
const auto path = root + "/" +
mbgl::util::percentDecode(
mln::util::percentDecode(
resource.url.substr(std::char_traits<char>::length(util::ASSET_PROTOCOL)));
requestLocalFile(path, req, resource.dataRange);
}
@@ -114,4 +114,4 @@ ClientOptions AssetFileSource::getClientOptions() {
return impl->actor().ask(&Impl::getClientOptions).get();
}
} // namespace mbgl
} // namespace mln

View File

@@ -15,7 +15,7 @@
#include <map>
#include <utility>
namespace mbgl {
namespace mln {
class DatabaseFileSourceThread {
public:
DatabaseFileSourceThread(std::shared_ptr<FileSource> onlineFileSource_, const std::string& cachePath)
@@ -229,8 +229,8 @@ void DatabaseFileSource::forward(const Resource& res, const Response& response,
bool DatabaseFileSource::canRequest(const Resource& resource) const {
return resource.hasLoadingMethod(Resource::LoadingMethod::Cache) &&
resource.url.rfind(mbgl::util::ASSET_PROTOCOL, 0) == std::string::npos &&
resource.url.rfind(mbgl::util::FILE_PROTOCOL, 0) == std::string::npos;
resource.url.rfind(mln::util::ASSET_PROTOCOL, 0) == std::string::npos &&
resource.url.rfind(mln::util::FILE_PROTOCOL, 0) == std::string::npos;
}
void DatabaseFileSource::setDatabasePath(const std::string& path, std::function<void()> callback) {
@@ -356,4 +356,4 @@ ClientOptions DatabaseFileSource::getClientOptions() {
return impl->getClientOptions();
}
} // namespace mbgl
} // namespace mln

View File

@@ -8,7 +8,7 @@
#include <mbgl/storage/pmtiles_file_source.hpp>
#include <mbgl/storage/resource_options.hpp>
namespace mbgl {
namespace mln {
class DefaultFileSourceManagerImpl final : public FileSourceManager {
public:
@@ -55,4 +55,4 @@ FileSourceManager* FileSourceManager::get() noexcept {
return &instance;
}
} // namespace mbgl
} // namespace mln

View File

@@ -3,7 +3,7 @@
#include <mbgl/actor/mailbox.hpp>
#include <mbgl/actor/scheduler.hpp>
namespace mbgl {
namespace mln {
FileSourceRequest::FileSourceRequest(FileSource::Callback&& callback)
: responseCallback(callback),
@@ -33,4 +33,4 @@ ActorRef<FileSourceRequest> FileSourceRequest::actor() {
return ActorRef<FileSourceRequest>(*this, mailbox);
}
} // namespace mbgl
} // namespace mln

View File

@@ -35,7 +35,7 @@ void handleError(CURLcode code) {
}
} // namespace
namespace mbgl {
namespace mln {
class HTTPFileSource::Impl {
public:
@@ -238,7 +238,7 @@ int HTTPFileSource::Impl::startTimeout(CURLM * /* multi */, long timeout_ms, voi
timeout_ms = std::max<long>(timeout_ms, 0);
context->timeout.stop();
context->timeout.start(mbgl::Milliseconds(timeout_ms), Duration::zero(), std::bind(&Impl::onTimeout, context));
context->timeout.start(mln::Milliseconds(timeout_ms), Duration::zero(), std::bind(&Impl::onTimeout, context));
return 0;
}
@@ -311,7 +311,7 @@ HTTPRequest::HTTPRequest(HTTPFileSource::Impl *context_, Resource resource_, Fil
HTTPRequest::~HTTPRequest() {
if (curl_multi_remove_handle(context->multi, handle) != CURLM_OK) {
mbgl::Log::Error(mbgl::Event::HttpRequest, "Error removing curl multi handle");
mln::Log::Error(mln::Event::HttpRequest, "Error removing curl multi handle");
}
context->returnHandle(handle);
@@ -479,4 +479,4 @@ ClientOptions HTTPFileSource::getClientOptions() {
return impl->getClientOptions();
}
} // namespace mbgl
} // namespace mln

View File

@@ -9,7 +9,7 @@
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
namespace mbgl {
namespace mln {
void requestLocalFile(const std::string& path,
const ActorRef<FileSourceRequest>& req,
@@ -35,4 +35,4 @@ void requestLocalFile(const std::string& path,
req.invoke(&FileSourceRequest::setResponse, response);
}
} // namespace mbgl
} // namespace mln

View File

@@ -13,11 +13,11 @@
namespace {
bool acceptsURL(const std::string& url) {
return url.starts_with(mbgl::util::FILE_PROTOCOL);
return url.starts_with(mln::util::FILE_PROTOCOL);
}
} // namespace
namespace mbgl {
namespace mln {
class LocalFileSource::Impl {
public:
@@ -34,7 +34,7 @@ public:
}
// Cut off the protocol and prefix with path.
const auto path = mbgl::util::percentDecode(
const auto path = mln::util::percentDecode(
resource.url.substr(std::char_traits<char>::length(util::FILE_PROTOCOL)));
requestLocalFile(path, req, resource.dataRange);
}
@@ -111,4 +111,4 @@ ClientOptions LocalFileSource::getClientOptions() {
return impl->actor().ask(&Impl::getClientOptions).get();
}
} // namespace mbgl
} // namespace mln

View File

@@ -13,7 +13,7 @@
#include <cassert>
#include <map>
namespace mbgl {
namespace mln {
class MainResourceLoaderThread {
public:
@@ -290,4 +290,4 @@ ClientOptions MainResourceLoader::getClientOptions() {
return impl->getClientOptions();
}
} // namespace mbgl
} // namespace mln

View File

@@ -29,15 +29,15 @@
namespace {
bool acceptsURL(const std::string &url) {
return url.starts_with(mbgl::util::MBTILES_PROTOCOL);
return url.starts_with(mln::util::MBTILES_PROTOCOL);
}
std::string url_to_path(const std::string &url) {
return mbgl::util::percentDecode(url.substr(std::char_traits<char>::length(mbgl::util::MBTILES_PROTOCOL)));
return mln::util::percentDecode(url.substr(std::char_traits<char>::length(mln::util::MBTILES_PROTOCOL)));
}
} // namespace
namespace mbgl {
namespace mln {
using namespace rapidjson;
class MBTilesFileSource::Impl {
@@ -338,4 +338,4 @@ ClientOptions MBTilesFileSource::getClientOptions() {
return thread->actor().ask(&Impl::getClientOptions).get();
}
} // namespace mbgl
} // namespace mln

View File

@@ -13,7 +13,7 @@
#include <cmath>
#include <utility>
namespace mbgl {
namespace mln {
// OfflineTilePyramidRegionDefinition
@@ -170,4 +170,4 @@ const OfflineRegionMetadata& OfflineRegion::getMetadata() const {
int64_t OfflineRegion::getID() const {
return id;
}
} // namespace mbgl
} // namespace mln

View File

@@ -11,7 +11,7 @@
#include <mbgl/storage/offline_schema.hpp>
#include <mbgl/storage/merge_sideloaded.hpp>
namespace mbgl {
namespace mln {
// Single-point transformer for offline storage keys. For sources where the URL is
// not enough to guarantee uniqueness (eg. PMTiles where all requests resolve to
@@ -1528,4 +1528,4 @@ void OfflineDatabase::updateAmbientCacheSize(DatabaseSizeChangeStats& stats) {
}
}
} // namespace mbgl
} // namespace mln

View File

@@ -28,7 +28,7 @@ const size_t kMarkBatchSize = 200;
} // namespace
namespace mbgl {
namespace mln {
using namespace style;
@@ -444,7 +444,7 @@ void OfflineDownload::queueResource(Resource&& resource) {
resource.setPriority(Resource::Priority::Low);
resource.setUsage(Resource::Usage::Offline);
status.requiredResourceCount++;
if (resource.kind == mbgl::Resource::Kind::Tile) {
if (resource.kind == mln::Resource::Kind::Tile) {
status.requiredTileCount++;
}
resourcesRemaining.push_front(std::move(resource));
@@ -562,4 +562,4 @@ void OfflineDownload::onMapboxTileCountLimitExceeded() {
setState(OfflineRegionDownloadState::Inactive);
}
} // namespace mbgl
} // namespace mln

View File

@@ -29,7 +29,7 @@
#include <map>
#include <utility>
namespace mbgl {
namespace mln {
// For testing only
constexpr const char* ONLINE_STATUS_KEY = "online-status";
@@ -626,7 +626,7 @@ std::unique_ptr<AsyncRequest> OnlineFileSource::request(const Resource& resource
break;
case Resource::Kind::Style:
res.url = mbgl::util::mapbox::normalizeStyleURL(options, resource.url, impl->getApiKey());
res.url = mln::util::mapbox::normalizeStyleURL(options, resource.url, impl->getApiKey());
break;
case Resource::Kind::Source:
@@ -655,8 +655,8 @@ std::unique_ptr<AsyncRequest> OnlineFileSource::request(const Resource& resource
bool OnlineFileSource::canRequest(const Resource& resource) const {
return resource.hasLoadingMethod(Resource::LoadingMethod::Network) &&
resource.url.rfind(mbgl::util::ASSET_PROTOCOL, 0) == std::string::npos &&
resource.url.rfind(mbgl::util::FILE_PROTOCOL, 0) == std::string::npos;
resource.url.rfind(mln::util::ASSET_PROTOCOL, 0) == std::string::npos &&
resource.url.rfind(mln::util::FILE_PROTOCOL, 0) == std::string::npos;
}
void OnlineFileSource::pause() {
@@ -718,4 +718,4 @@ ClientOptions OnlineFileSource::getClientOptions() {
return impl->getClientOptions();
}
} // namespace mbgl
} // namespace mln

View File

@@ -39,11 +39,11 @@ constexpr int pmtilesHeaderLength = 127;
constexpr int MAX_DIRECTORY_CACHE_ENTRIES = 100;
bool acceptsURL(const std::string& url) {
return url.starts_with(mbgl::util::PMTILES_PROTOCOL);
return url.starts_with(mln::util::PMTILES_PROTOCOL);
}
std::string extract_url(const std::string& url) {
return url.substr(std::char_traits<char>::length(mbgl::util::PMTILES_PROTOCOL));
return url.substr(std::char_traits<char>::length(mln::util::PMTILES_PROTOCOL));
}
} // namespace
@@ -52,7 +52,7 @@ namespace pmtiles {
const uint8_t TILETYPE_MLT = 0x6;
} // namespace pmtiles
namespace mbgl {
namespace mln {
using namespace rapidjson;
using AsyncCallback = std::function<void(std::unique_ptr<Response::Error>)>;
@@ -259,9 +259,9 @@ private:
if (response.error->message.empty() &&
response.error->reason == Response::Error::Reason::NotFound) {
if (url.starts_with(mbgl::util::FILE_PROTOCOL)) {
if (url.starts_with(mln::util::FILE_PROTOCOL)) {
message += "path not found: " +
url.substr(std::char_traits<char>::length(mbgl::util::FILE_PROTOCOL));
url.substr(std::char_traits<char>::length(mln::util::FILE_PROTOCOL));
} else {
message += "url not found: " + url;
}
@@ -670,4 +670,4 @@ ClientOptions PMTilesFileSource::getClientOptions() {
return thread->actor().ask(&Impl::getClientOptions).get();
}
} // namespace mbgl
} // namespace mln

View File

@@ -3,7 +3,7 @@
#include <mbgl/storage/resource.hpp>
#include <mbgl/util/async_request.hpp>
namespace mbgl {
namespace mln {
class PMTilesFileSource::Impl {
public:
@@ -35,4 +35,4 @@ ClientOptions PMTilesFileSource::getClientOptions() {
return {};
}
} // namespace mbgl
} // namespace mln

View File

@@ -24,31 +24,31 @@
namespace mapbox {
namespace sqlite {
static_assert(mbgl::underlying_type(ResultCode::OK) == SQLITE_OK, "error");
static_assert(mbgl::underlying_type(ResultCode::Error) == SQLITE_ERROR, "error");
static_assert(mbgl::underlying_type(ResultCode::Internal) == SQLITE_INTERNAL, "error");
static_assert(mbgl::underlying_type(ResultCode::Perm) == SQLITE_PERM, "error");
static_assert(mbgl::underlying_type(ResultCode::Abort) == SQLITE_ABORT, "error");
static_assert(mbgl::underlying_type(ResultCode::Busy) == SQLITE_BUSY, "error");
static_assert(mbgl::underlying_type(ResultCode::Locked) == SQLITE_LOCKED, "error");
static_assert(mbgl::underlying_type(ResultCode::NoMem) == SQLITE_NOMEM, "error");
static_assert(mbgl::underlying_type(ResultCode::ReadOnly) == SQLITE_READONLY, "error");
static_assert(mbgl::underlying_type(ResultCode::Interrupt) == SQLITE_INTERRUPT, "error");
static_assert(mbgl::underlying_type(ResultCode::IOErr) == SQLITE_IOERR, "error");
static_assert(mbgl::underlying_type(ResultCode::Corrupt) == SQLITE_CORRUPT, "error");
static_assert(mbgl::underlying_type(ResultCode::NotFound) == SQLITE_NOTFOUND, "error");
static_assert(mbgl::underlying_type(ResultCode::Full) == SQLITE_FULL, "error");
static_assert(mbgl::underlying_type(ResultCode::CantOpen) == SQLITE_CANTOPEN, "error");
static_assert(mbgl::underlying_type(ResultCode::Protocol) == SQLITE_PROTOCOL, "error");
static_assert(mbgl::underlying_type(ResultCode::Schema) == SQLITE_SCHEMA, "error");
static_assert(mbgl::underlying_type(ResultCode::TooBig) == SQLITE_TOOBIG, "error");
static_assert(mbgl::underlying_type(ResultCode::Constraint) == SQLITE_CONSTRAINT, "error");
static_assert(mbgl::underlying_type(ResultCode::Mismatch) == SQLITE_MISMATCH, "error");
static_assert(mbgl::underlying_type(ResultCode::Misuse) == SQLITE_MISUSE, "error");
static_assert(mbgl::underlying_type(ResultCode::NoLFS) == SQLITE_NOLFS, "error");
static_assert(mbgl::underlying_type(ResultCode::Auth) == SQLITE_AUTH, "error");
static_assert(mbgl::underlying_type(ResultCode::Range) == SQLITE_RANGE, "error");
static_assert(mbgl::underlying_type(ResultCode::NotADB) == SQLITE_NOTADB, "error");
static_assert(mln::underlying_type(ResultCode::OK) == SQLITE_OK, "error");
static_assert(mln::underlying_type(ResultCode::Error) == SQLITE_ERROR, "error");
static_assert(mln::underlying_type(ResultCode::Internal) == SQLITE_INTERNAL, "error");
static_assert(mln::underlying_type(ResultCode::Perm) == SQLITE_PERM, "error");
static_assert(mln::underlying_type(ResultCode::Abort) == SQLITE_ABORT, "error");
static_assert(mln::underlying_type(ResultCode::Busy) == SQLITE_BUSY, "error");
static_assert(mln::underlying_type(ResultCode::Locked) == SQLITE_LOCKED, "error");
static_assert(mln::underlying_type(ResultCode::NoMem) == SQLITE_NOMEM, "error");
static_assert(mln::underlying_type(ResultCode::ReadOnly) == SQLITE_READONLY, "error");
static_assert(mln::underlying_type(ResultCode::Interrupt) == SQLITE_INTERRUPT, "error");
static_assert(mln::underlying_type(ResultCode::IOErr) == SQLITE_IOERR, "error");
static_assert(mln::underlying_type(ResultCode::Corrupt) == SQLITE_CORRUPT, "error");
static_assert(mln::underlying_type(ResultCode::NotFound) == SQLITE_NOTFOUND, "error");
static_assert(mln::underlying_type(ResultCode::Full) == SQLITE_FULL, "error");
static_assert(mln::underlying_type(ResultCode::CantOpen) == SQLITE_CANTOPEN, "error");
static_assert(mln::underlying_type(ResultCode::Protocol) == SQLITE_PROTOCOL, "error");
static_assert(mln::underlying_type(ResultCode::Schema) == SQLITE_SCHEMA, "error");
static_assert(mln::underlying_type(ResultCode::TooBig) == SQLITE_TOOBIG, "error");
static_assert(mln::underlying_type(ResultCode::Constraint) == SQLITE_CONSTRAINT, "error");
static_assert(mln::underlying_type(ResultCode::Mismatch) == SQLITE_MISMATCH, "error");
static_assert(mln::underlying_type(ResultCode::Misuse) == SQLITE_MISUSE, "error");
static_assert(mln::underlying_type(ResultCode::NoLFS) == SQLITE_NOLFS, "error");
static_assert(mln::underlying_type(ResultCode::Auth) == SQLITE_AUTH, "error");
static_assert(mln::underlying_type(ResultCode::Range) == SQLITE_RANGE, "error");
static_assert(mln::underlying_type(ResultCode::NotADB) == SQLITE_NOTADB, "error");
void setTempPath(const std::string& path) {
sqlite3_temp_directory = sqlite3_mprintf("%s", path.c_str());
@@ -60,17 +60,17 @@ public:
: db(db_) {
const int error = sqlite3_extended_result_codes(db, true);
if (error != SQLITE_OK) {
mbgl::Log::Warning(mbgl::Event::Database,
error,
std::string("Failed to enable extended result codes: ") + sqlite3_errmsg(db));
mln::Log::Warning(mln::Event::Database,
error,
std::string("Failed to enable extended result codes: ") + sqlite3_errmsg(db));
}
}
~DatabaseImpl() {
const int error = sqlite3_close(db);
if (error != SQLITE_OK) {
mbgl::Log::Error(
mbgl::Event::Database, error, std::string("Failed to close database: ") + sqlite3_errmsg(db));
mln::Log::Error(
mln::Event::Database, error, std::string("Failed to close database: ") + sqlite3_errmsg(db));
}
}
@@ -109,7 +109,7 @@ public:
#ifndef NDEBUG
void logSqlMessage(void*, const int err, const char* msg) {
mbgl::Log::Record(mbgl::EventSeverity::Debug, mbgl::Event::Database, std::to_string(err) + msg);
mln::Log::Record(mln::EventSeverity::Debug, mln::Event::Database, std::to_string(err) + msg);
}
#endif

View File

@@ -24,5 +24,5 @@ int main(int argc, char *argv[]) {
}
#endif
return mbgl::runTests(argc, argv);
return mln::runTests(argc, argv);
}

View File

@@ -8,7 +8,7 @@
#include <stdexcept>
#include <utility>
namespace mbgl {
namespace mln {
class BiDiImpl {
public:
@@ -35,7 +35,7 @@ std::u16string applyArabicShaping(const std::u16string& input) {
UErrorCode errorCode = U_ZERO_ERROR;
const int32_t outputLength = u_shapeArabic(
mbgl::utf16char_cast<const UChar*>(input.c_str()),
mln::utf16char_cast<const UChar*>(input.c_str()),
static_cast<int32_t>(input.size()),
nullptr,
0,
@@ -48,9 +48,9 @@ std::u16string applyArabicShaping(const std::u16string& input) {
std::u16string outputText(outputLength, 0);
u_shapeArabic(
mbgl::utf16char_cast<const UChar*>(input.c_str()),
mln::utf16char_cast<const UChar*>(input.c_str()),
static_cast<int32_t>(input.size()),
mbgl::utf16char_cast<UChar*>(outputText.data()),
mln::utf16char_cast<UChar*>(outputText.data()),
outputLength,
(U_SHAPE_LETTERS_SHAPE & U_SHAPE_LETTERS_MASK) | (U_SHAPE_TEXT_DIRECTION_LOGICAL & U_SHAPE_TEXT_DIRECTION_MASK),
&errorCode);
@@ -101,7 +101,7 @@ std::vector<std::u16string> BiDi::processText(const std::u16string& input, std::
UErrorCode errorCode = U_ZERO_ERROR;
ubidi_setPara(impl->bidiText,
mbgl::utf16char_cast<const UChar*>(input.c_str()),
mln::utf16char_cast<const UChar*>(input.c_str()),
static_cast<int32_t>(input.size()),
UBIDI_DEFAULT_LTR,
nullptr,
@@ -122,7 +122,7 @@ std::vector<StyledText> BiDi::processStyledText(const StyledText& input, std::se
UErrorCode errorCode = U_ZERO_ERROR;
ubidi_setPara(impl->bidiText,
mbgl::utf16char_cast<const UChar*>(inputText.c_str()),
mln::utf16char_cast<const UChar*>(inputText.c_str()),
static_cast<int32_t>(inputText.size()),
UBIDI_DEFAULT_LTR,
nullptr,
@@ -210,9 +210,9 @@ std::u16string BiDi::writeReverse(const std::u16string& input, std::size_t logic
// parentheses UBIDI_REMOVE_BIDI_CONTROLS: Now that all the lines are set,
// remove control characters so that they don't show up on screen (some
// fonts have glyphs representing them)
int32_t outputLength = ubidi_writeReverse(mbgl::utf16char_cast<const UChar*>(&input[logicalStart]),
int32_t outputLength = ubidi_writeReverse(mln::utf16char_cast<const UChar*>(&input[logicalStart]),
logicalLength,
mbgl::utf16char_cast<UChar*>(outputText.data()),
mln::utf16char_cast<UChar*>(outputText.data()),
logicalLength + 1, // Extra room for null terminator, although we don't
// really need to have ICU write it for us
UBIDI_DO_MIRRORING | UBIDI_REMOVE_BIDI_CONTROLS,
@@ -247,7 +247,7 @@ std::u16string BiDi::getLine(std::size_t start, std::size_t end) {
// remove control characters so that they don't show up on screen (some
// fonts have glyphs representing them)
int32_t finalLength = ubidi_writeReordered(impl->bidiLine,
mbgl::utf16char_cast<UChar*>(outputText.data()),
mln::utf16char_cast<UChar*>(outputText.data()),
outputLength,
UBIDI_DO_MIRRORING | UBIDI_REMOVE_BIDI_CONTROLS,
&errorCode);
@@ -261,4 +261,4 @@ std::u16string BiDi::getLine(std::size_t start, std::size_t end) {
return outputText;
}
} // end namespace mbgl
} // end namespace mln

View File

@@ -1,6 +1,6 @@
#include <mbgl/text/local_glyph_rasterizer.hpp>
namespace mbgl {
namespace mln {
class LocalGlyphRasterizer::Impl {};
@@ -16,4 +16,4 @@ Glyph LocalGlyphRasterizer::rasterizeGlyph(const FontStack&, GlyphID) {
return Glyph();
}
} // namespace mbgl
} // namespace mln

View File

@@ -8,7 +8,7 @@
#include <uv.h>
namespace mbgl {
namespace mln {
namespace util {
class AsyncTask::Impl {
@@ -56,4 +56,4 @@ void AsyncTask::send() {
}
} // namespace util
} // namespace mbgl
} // namespace mln

View File

@@ -23,7 +23,7 @@
return true;
}();
namespace mbgl {
namespace mln {
namespace util {
// Needed when using a zlib compiled with -DZ_PREFIX
@@ -138,4 +138,4 @@ std::uint32_t crc32(const void *raw, size_t size) noexcept {
}
} // namespace util
} // namespace mbgl
} // namespace mln

View File

@@ -3,11 +3,11 @@
#if defined(USE_STD_FILESYSTEM)
#include <filesystem>
bool mbgl::util::is_absolute_path(std::string path) {
bool mln::util::is_absolute_path(std::string path) {
return std::filesystem::path(path).is_absolute();
}
#else
bool mbgl::util::is_absolute_path(std::string path) {
bool mln::util::is_absolute_path(std::string path) {
return path.at(0) == '/';
}
#endif

View File

@@ -2,7 +2,7 @@
#include <mbgl/util/string.hpp>
#include <mbgl/util/premultiply.hpp>
namespace mbgl {
namespace mln {
PremultipliedImage decodePNG(const uint8_t*, size_t);
PremultipliedImage decodeJPEG(const uint8_t*, size_t);
@@ -44,4 +44,4 @@ PremultipliedImage decodeImage(const std::string& string) {
throw std::runtime_error("unsupported image type");
}
} // namespace mbgl
} // namespace mln

View File

@@ -9,7 +9,7 @@ extern "C" {
#include <jpeglib.h>
}
namespace mbgl {
namespace mln {
const static unsigned BUF_SIZE = 4096;
@@ -144,4 +144,4 @@ PremultipliedImage decodeJPEG(const uint8_t* data, size_t size) {
return image;
}
} // namespace mbgl
} // namespace mln

View File

@@ -3,10 +3,10 @@
#include <iostream>
namespace mbgl {
namespace mln {
void Log::platformRecord(EventSeverity severity, const std::string &msg) {
std::cerr << "[" << Enum<EventSeverity>::toString(severity) << "] " << msg << '\n';
}
} // namespace mbgl
} // namespace mln

View File

@@ -3,7 +3,7 @@
#include <cassert>
#include <chrono>
namespace mbgl {
namespace mln {
namespace util {
// Prefer high resolution timer if it is monotonic
@@ -24,4 +24,4 @@ std::chrono::duration<double> MonotonicTimer::now() {
}
} // namespace util
} // namespace mbgl
} // namespace mln

View File

@@ -35,7 +35,7 @@ const static bool png_version_check [[maybe_unused]] = []() {
return true;
}();
namespace mbgl {
namespace mln {
namespace {
void user_error_fn(png_structp, png_const_charp error_msg) {
@@ -133,4 +133,4 @@ PremultipliedImage decodePNG(const uint8_t* data, size_t size) {
return util::premultiply(std::move(image));
}
} // namespace mbgl
} // namespace mln

View File

@@ -31,7 +31,7 @@ void addChunk(std::string& png, const char* type, const char* data = "", const u
} // namespace
namespace mbgl {
namespace mln {
// Encode PNGs without libpng.
std::string encodePNG(const PremultipliedImage& pre) {
@@ -72,4 +72,4 @@ std::string encodePNG(const PremultipliedImage& pre) {
return png;
}
} // namespace mbgl
} // namespace mln

View File

@@ -17,7 +17,7 @@ void dummyCallback(uv_async_t*) {}
} // namespace
namespace mbgl {
namespace mln {
namespace util {
struct Watch {
@@ -157,7 +157,7 @@ void RunLoop::updateTime() {
uv_update_time(impl->loop);
}
void RunLoop::waitForEmpty([[maybe_unused]] const mbgl::util::SimpleIdentity tag) {
void RunLoop::waitForEmpty([[maybe_unused]] const mln::util::SimpleIdentity tag) {
while (true) {
std::size_t remaining;
{
@@ -243,4 +243,4 @@ void RunLoop::removeWatch(int fd) {
}
} // namespace util
} // namespace mbgl
} // namespace mln

View File

@@ -3,7 +3,7 @@
#include <cstring>
#include <sstream>
namespace mbgl {
namespace mln {
namespace platform {
std::string uppercase(const std::string &str) {
@@ -59,4 +59,4 @@ std::string lowercase(const std::string &str) {
}
} // namespace platform
} // namespace mbgl
} // namespace mln

View File

@@ -8,7 +8,7 @@
#include <sched.h>
#include <sys/resource.h>
namespace mbgl {
namespace mln {
namespace platform {
std::string getCurrentThreadName() {
@@ -60,4 +60,4 @@ void attachThread() {}
void detachThread() {}
} // namespace platform
} // namespace mbgl
} // namespace mln

View File

@@ -6,7 +6,7 @@
#include <pthread.h>
namespace mbgl {
namespace mln {
namespace util {
namespace impl {
@@ -43,4 +43,4 @@ void ThreadLocalBase::set(void* ptr) {
} // namespace impl
} // namespace util
} // namespace mbgl
} // namespace mln

View File

@@ -7,7 +7,7 @@
#include <stdexcept>
namespace mbgl {
namespace mln {
namespace util {
class Timer::Impl {
@@ -75,4 +75,4 @@ void Timer::stop() {
}
} // namespace util
} // namespace mbgl
} // namespace mln

View File

@@ -3,7 +3,7 @@
#include <locale>
#include <codecvt>
namespace mbgl {
namespace mln {
namespace util {
std::u16string convertUTF8ToUTF16(const std::string& str) {
@@ -21,4 +21,4 @@ std::string convertUTF16ToUTF8(const std::u16string& str) {
}
} // namespace util
} // namespace mbgl
} // namespace mln

View File

@@ -5,7 +5,7 @@
#include <webp/types.h>
#include <webp/decode.h>
namespace mbgl {
namespace mln {
PremultipliedImage decodeWEBP(const uint8_t* data, size_t size) {
int32_t width, height;
@@ -23,4 +23,4 @@ PremultipliedImage decodeWEBP(const uint8_t* data, size_t size) {
return util::premultiply(std::move(img));
}
} // namespace mbgl
} // namespace mln

View File

@@ -8,7 +8,7 @@
#include <stdexcept>
#include <type_traits>
namespace mbgl {
namespace mln {
namespace vulkan {
class HeadlessRenderableResource final : public vulkan::SurfaceRenderableResource {
@@ -34,8 +34,8 @@ public:
HeadlessBackend::HeadlessBackend(const Size size_,
gfx::HeadlessBackend::SwapBehaviour,
const gfx::ContextMode contextMode_)
: mbgl::vulkan::RendererBackend(contextMode_),
mbgl::gfx::HeadlessBackend(size_) {
: mln::vulkan::RendererBackend(contextMode_),
mln::gfx::HeadlessBackend(size_) {
init();
}
@@ -104,4 +104,4 @@ std::unique_ptr<gfx::HeadlessBackend> Backend::Create<gfx::Backend::Type::Vulkan
}
} // namespace gfx
} // namespace mbgl
} // namespace mln