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

@@ -25,20 +25,20 @@ int main(int argc, char* argv[]) {
args::ValueFlag<unsigned long> expiresValue(p, "expires", "Expires date, will use 'now' otherwise", {'e'});
args::ValueFlag<unsigned long> modifiedValue(p, "modified", "Modified date, will use 'now' otherwise", {'m'});
std::unordered_map<std::string, mbgl::Resource::Kind> typeMap{{"glyphs", mbgl::Resource::Glyphs},
{"image", mbgl::Resource::Image},
{"source", mbgl::Resource::Source},
{"sprite-image", mbgl::Resource::SpriteImage},
{"sprite-json", mbgl::Resource::SpriteJSON},
{"style", mbgl::Resource::Style},
{"tile", mbgl::Resource::Tile}};
std::unordered_map<std::string, mln::Resource::Kind> typeMap{{"glyphs", mln::Resource::Glyphs},
{"image", mln::Resource::Image},
{"source", mln::Resource::Source},
{"sprite-image", mln::Resource::SpriteImage},
{"sprite-json", mln::Resource::SpriteJSON},
{"style", mln::Resource::Style},
{"tile", mln::Resource::Tile}};
std::string typeHelp("One of the following (required):");
for (const auto& key : typeMap) {
typeHelp += " " + key.first;
}
args::MapFlag<std::string, mbgl::Resource::Kind> typeFlag(
args::MapFlag<std::string, mln::Resource::Kind> typeFlag(
p, "type", typeHelp, {"type"}, typeMap, args::Options::Required);
args::Group tileIdGroup(p, "Coordinates (required for 'tile')", args::Group::Validators::AllOrNone);
@@ -67,15 +67,15 @@ int main(int argc, char* argv[]) {
exit(3);
}
mbgl::Response response;
mln::Response response;
response.data = std::make_shared<std::string>(*file);
response.etag = etagValue ? args::get(etagValue) : std::string();
response.expires = expiresValue ? mbgl::Timestamp(mbgl::Seconds(args::get(expiresValue))) : mbgl::util::now();
response.modified = modifiedValue ? mbgl::Timestamp(mbgl::Seconds(args::get(modifiedValue))) : mbgl::util::now();
response.expires = expiresValue ? mln::Timestamp(mln::Seconds(args::get(expiresValue))) : mln::util::now();
response.modified = modifiedValue ? mln::Timestamp(mln::Seconds(args::get(modifiedValue))) : mln::util::now();
mbgl::Resource resource(args::get(typeFlag), args::get(urlValue));
mln::Resource resource(args::get(typeFlag), args::get(urlValue));
if (args::get(typeFlag) == mbgl::Resource::Tile) {
if (args::get(typeFlag) == mln::Resource::Tile) {
if (!xValueFlag || !yValueFlag || !zValueFlag) {
std::cerr << "Error: -x, -y and -z must be provided for tiles" << '\n';
exit(1);
@@ -88,9 +88,9 @@ int main(int argc, char* argv[]) {
.z = static_cast<int8_t>(args::get(zValueFlag))}};
}
mbgl::util::RunLoop loop;
std::shared_ptr<mbgl::FileSource> dbfs = mbgl::FileSourceManager::get()->getFileSource(
mbgl::FileSourceType::Database, mbgl::ResourceOptions().withCachePath(args::get(cacheValue)));
mln::util::RunLoop loop;
std::shared_ptr<mln::FileSource> dbfs = mln::FileSourceManager::get()->getFileSource(
mln::FileSourceType::Database, mln::ResourceOptions().withCachePath(args::get(cacheValue)));
dbfs->forward(resource, response, [&loop] { loop.stop(); });
loop.run();
return 0;

View File

@@ -51,19 +51,19 @@ mapbox::geometry::geometry<double> parseGeometry(const std::string& json) {
});
}
std::ostream& operator<<(std::ostream& os, mbgl::Response::Error::Reason r) {
std::ostream& operator<<(std::ostream& os, mln::Response::Error::Reason r) {
switch (r) {
case mbgl::Response::Error::Reason::Success:
case mln::Response::Error::Reason::Success:
return os << "Response::Error::Reason::Success";
case mbgl::Response::Error::Reason::NotFound:
case mln::Response::Error::Reason::NotFound:
return os << "Response::Error::Reason::NotFound";
case mbgl::Response::Error::Reason::Server:
case mln::Response::Error::Reason::Server:
return os << "Response::Error::Reason::Server";
case mbgl::Response::Error::Reason::Connection:
case mln::Response::Error::Reason::Connection:
return os << "Response::Error::Reason::Connection";
case mbgl::Response::Error::Reason::RateLimit:
case mln::Response::Error::Reason::RateLimit:
return os << "Response::Error::Reason::RateLimit";
case mbgl::Response::Error::Reason::Other:
case mln::Response::Error::Reason::Other:
return os << "Response::Error::Reason::Other";
}
@@ -122,7 +122,7 @@ int main(int argc, char* argv[]) {
exit(2);
}
auto mapTilerConfiguration = mbgl::TileServerOptions::MapTilerConfiguration();
auto mapTilerConfiguration = mln::TileServerOptions::MapTilerConfiguration();
std::string style = styleValue ? args::get(styleValue) : mapTilerConfiguration.defaultStyles().at(0).getUrl();
std::cout << " Style: " << style << std::endl;
@@ -138,7 +138,7 @@ int main(int argc, char* argv[]) {
const bool includeIdeographs = includeIdeographsValue ? args::get(includeIdeographsValue) : false;
const std::string output = outputValue ? args::get(outputValue) : "offline.db";
using namespace mbgl;
using namespace mln;
OfflineRegionDefinition definition = [&]() {
if (geometryValue) {
@@ -185,7 +185,7 @@ int main(int argc, char* argv[]) {
int retCode = 0;
std::cout << "Start Merge" << std::endl;
inputSource.mergeOfflineRegions(
*mergePath, [&](mbgl::expected<std::vector<OfflineRegion>, std::exception_ptr> result) {
*mergePath, [&](mln::expected<std::vector<OfflineRegion>, std::exception_ptr> result) {
if (!result) {
std::cerr << "Error merging database: " << util::toString(result.error()) << std::endl;
retCode = 1;
@@ -264,7 +264,7 @@ int main(int argc, char* argv[]) {
std::signal(SIGINT, [](int) { stop(); });
fileSource->createOfflineRegion(
definition, metadata, [&](mbgl::expected<OfflineRegion, std::exception_ptr> region_) {
definition, metadata, [&](mln::expected<OfflineRegion, std::exception_ptr> region_) {
if (!region_) {
std::cerr << "Error creating region: " << util::toString(region_.error()) << std::endl;
loop.stop();

View File

@@ -69,7 +69,7 @@ int main(int argc, char* argv[]) {
const double lon = lonValue ? args::get(lonValue) : 0;
const double alt = altValue ? args::get(altValue) : 0;
const double zoom = zoomValue ? args::get(zoomValue) : 0;
const double fov = fovValue ? args::get(fovValue) : mbgl::util::rad2deg(mbgl::util::DEFAULT_FOV);
const double fov = fovValue ? args::get(fovValue) : mln::util::rad2deg(mln::util::DEFAULT_FOV);
const double bearing = bearingValue ? args::get(bearingValue) : 0;
const double pitch = pitchValue ? args::get(pitchValue) : 0;
const double roll = rollValue ? args::get(rollValue) : 0;
@@ -87,9 +87,9 @@ int main(int argc, char* argv[]) {
const bool debug = debugFlag ? args::get(debugFlag) : false;
using namespace mbgl;
using namespace mln;
auto mapTilerConfiguration = mbgl::TileServerOptions::MapTilerConfiguration();
auto mapTilerConfiguration = mln::TileServerOptions::MapTilerConfiguration();
std::string style = styleValue ? args::get(styleValue) : mapTilerConfiguration.defaultStyles().at(0).getUrl();
util::RunLoop loop;
@@ -136,8 +136,8 @@ int main(int argc, char* argv[]) {
}
if (debug) {
map.setDebug(debug ? mbgl::MapDebugOptions::TileBorders | mbgl::MapDebugOptions::ParseStatus
: mbgl::MapDebugOptions::NoDebug);
map.setDebug(debug ? mln::MapDebugOptions::TileBorders | mln::MapDebugOptions::ParseStatus
: mln::MapDebugOptions::NoDebug);
}
try {