Use std::optional instead of mbgl::optional (#911)

This commit is contained in:
Bart Louwers
2023-03-17 12:51:59 +01:00
committed by GitHub
parent 36846439c6
commit 15ad65dd3d
482 changed files with 2605 additions and 2652 deletions

View File

@@ -19,8 +19,8 @@ SymbolInstance makeSymbolInstance(float x, float y, std::u16string key) {
auto sharedData = std::make_shared<SymbolInstanceSharedData>(std::move(line),
shaping,
nullopt,
nullopt,
std::nullopt,
std::nullopt,
layout_,
placementType,
textOffset,
@@ -29,7 +29,7 @@ SymbolInstance makeSymbolInstance(float x, float y, std::u16string key) {
SymbolContent::IconSDF,
false,
false);
return SymbolInstance(anchor, std::move(sharedData), shaping, nullopt, nullopt, 0, 0, placementType, textOffset, 0, 0, iconOffset, subfeature, 0, 0, key, 0.0f, 0.0f, 0.0f, variableTextOffset, false);
return SymbolInstance(anchor, std::move(sharedData), shaping, std::nullopt, std::nullopt, 0, 0, placementType, textOffset, 0, 0, iconOffset, subfeature, 0, 0, key, 0.0f, 0.0f, 0.0f, variableTextOffset, false);
}

View File

@@ -1,7 +1,6 @@
#include <mbgl/style/expression/formatted.hpp>
#include <mbgl/test/util.hpp>
#include <mbgl/util/optional.hpp>
using namespace mbgl;
using namespace mbgl::style::expression;
@@ -19,7 +18,7 @@ TEST(Formatted, Empty) {
Formatted emptyFormatted{""};
EXPECT_TRUE(emptyFormatted.empty());
auto emptyText = FormattedSection{"", nullopt, nullopt, nullopt};
auto emptyText = FormattedSection{"", std::nullopt, std::nullopt, std::nullopt};
auto emptyImage = FormattedSection{style::expression::Image()};
Formatted multipleEmptySections{std::vector<FormattedSection>{emptyText, emptyText, emptyText}};
EXPECT_TRUE(multipleEmptySections.empty());
@@ -27,7 +26,7 @@ TEST(Formatted, Empty) {
Formatted multipleEmptySectionsWithImage{std::vector<FormattedSection>{emptyText, emptyImage, emptyText}};
EXPECT_TRUE(multipleEmptySectionsWithImage.empty());
auto text = FormattedSection{"Formatted", nullopt, nullopt, nullopt};
auto text = FormattedSection{"Formatted", std::nullopt, std::nullopt, std::nullopt};
auto image = FormattedSection{style::expression::Image("Image")};
Formatted multipleSections{std::vector<FormattedSection>{emptyText, text, emptyText}};
@@ -41,7 +40,7 @@ TEST(Formatted, ToString) {
Formatted emptyFormatted{""};
EXPECT_EQ(emptyFormatted.toString(), "");
auto text = FormattedSection{"Formatted", nullopt, nullopt, nullopt};
auto text = FormattedSection{"Formatted", std::nullopt, std::nullopt, std::nullopt};
Formatted multipleSections{std::vector<FormattedSection>{text, text}};
EXPECT_EQ(multipleSections.toString(), "FormattedFormatted");

View File

@@ -194,7 +194,7 @@ TEST(GlyphManager, LoadingCancel) {
test.fileSource.glyphsResponse = [&] (const Resource&) {
test.end();
return optional<Response>();
return std::optional<Response>();
};
test.observer.glyphsLoaded = [&] (const FontStack&, const GlyphRange&) {
@@ -214,7 +214,7 @@ TEST(GlyphManager, LoadLocalCJKGlyph) {
test.fileSource.glyphsResponse = [&] (const Resource&) {
glyphResponses++;
return optional<Response>();
return std::optional<Response>();
};
test.observer.glyphsLoaded = [&] (const FontStack&, const GlyphRange&) {

View File

@@ -32,7 +32,7 @@ namespace {
class LocalGlyphRasterizerTest {
public:
LocalGlyphRasterizerTest(const optional<std::string> fontFamily)
LocalGlyphRasterizerTest(const std::optional<std::string> fontFamily)
: frontend(1, gfx::HeadlessBackend::SwapBehaviour::NoFlush, gfx::ContextMode::Unique, fontFamily) {}
util::RunLoop loop;

View File

@@ -50,7 +50,7 @@ TEST(getIconQuads, style) {
// shapedText.positionedGlyphs.emplace_back(PositionedGlyph(32, 0.0f, 0.0f, false, 0, 1.0));
shapedText.positionedLines.emplace_back();
shapedText.positionedLines.back().positionedGlyphs.emplace_back(
PositionedGlyph(32, 0.0f, 0.0f, false, 0, 1.0, /*texRect*/ {}, /*metrics*/ {}, /*imageID*/ nullopt));
PositionedGlyph(32, 0.0f, 0.0f, false, 0, 1.0, /*texRect*/ {}, /*metrics*/ {}, /*imageID*/ std::nullopt));
// none
{