diff --git a/src/core/numericformats/qgsbasicnumericformat.cpp b/src/core/numericformats/qgsbasicnumericformat.cpp index e2f59d38c51..ae76e2bbda9 100644 --- a/src/core/numericformats/qgsbasicnumericformat.cpp +++ b/src/core/numericformats/qgsbasicnumericformat.cpp @@ -21,21 +21,24 @@ #include #include -struct formatter : std::numpunct +namespace QgsBasicNumericFormat_ns { - formatter( QChar thousands, bool showThousands, QChar decimal ) - : mThousands( thousands.unicode() ) - , mDecimal( decimal.unicode() ) - , mShowThousands( showThousands ) - {} - wchar_t do_decimal_point() const override { return mDecimal; } - wchar_t do_thousands_sep() const override { return mThousands; } - std::string do_grouping() const override { return mShowThousands ? "\3" : "\0"; } + struct formatter : std::numpunct + { + formatter( QChar thousands, bool showThousands, QChar decimal ) + : mThousands( thousands.unicode() ) + , mDecimal( decimal.unicode() ) + , mShowThousands( showThousands ) + {} + wchar_t do_decimal_point() const override { return mDecimal; } + wchar_t do_thousands_sep() const override { return mThousands; } + std::string do_grouping() const override { return mShowThousands ? "\3" : "\0"; } - wchar_t mThousands; - wchar_t mDecimal; - bool mShowThousands = true; -}; + wchar_t mThousands; + wchar_t mDecimal; + bool mShowThousands = true; + }; +} QgsBasicNumericFormat::QgsBasicNumericFormat() { @@ -60,7 +63,7 @@ QString QgsBasicNumericFormat::formatDouble( double value, const QgsNumericForma { const QChar decimal = mDecimalSeparator.isNull() ? context.decimalSeparator() : mDecimalSeparator; std::basic_stringstream os; - os.imbue( std::locale( os.getloc(), new formatter( mThousandsSeparator.isNull() ? context.thousandsSeparator() : mThousandsSeparator, + os.imbue( std::locale( os.getloc(), new QgsBasicNumericFormat_ns::formatter( mThousandsSeparator.isNull() ? context.thousandsSeparator() : mThousandsSeparator, mShowThousandsSeparator, decimal ) ) ); diff --git a/src/core/numericformats/qgscoordinatenumericformat.cpp b/src/core/numericformats/qgscoordinatenumericformat.cpp index 632036764e7..389d19e88cb 100644 --- a/src/core/numericformats/qgscoordinatenumericformat.cpp +++ b/src/core/numericformats/qgscoordinatenumericformat.cpp @@ -24,21 +24,24 @@ #include ///@cond PRIVATE -struct formatter : std::numpunct +namespace QgsGeographicCoordinateNumericFormat_ns { - formatter( QChar thousands, bool showThousands, QChar decimal ) - : mThousands( thousands.unicode() ) - , mDecimal( decimal.unicode() ) - , mShowThousands( showThousands ) - {} - wchar_t do_decimal_point() const override { return mDecimal; } - wchar_t do_thousands_sep() const override { return mThousands; } - std::string do_grouping() const override { return mShowThousands ? "\3" : "\0"; } + struct formatter : std::numpunct + { + formatter( QChar thousands, bool showThousands, QChar decimal ) + : mThousands( thousands.unicode() ) + , mDecimal( decimal.unicode() ) + , mShowThousands( showThousands ) + {} + wchar_t do_decimal_point() const override { return mDecimal; } + wchar_t do_thousands_sep() const override { return mThousands; } + std::string do_grouping() const override { return mShowThousands ? "\3" : "\0"; } - wchar_t mThousands; - wchar_t mDecimal; - bool mShowThousands = true; -}; + wchar_t mThousands; + wchar_t mDecimal; + bool mShowThousands = true; + }; +} ///@endcond QgsGeographicCoordinateNumericFormat::QgsGeographicCoordinateNumericFormat() @@ -69,7 +72,7 @@ QString QgsGeographicCoordinateNumericFormat::formatDouble( double value, const { const QChar decimal = decimalSeparator().isNull() ? context.decimalSeparator() : decimalSeparator(); std::basic_stringstream os; - os.imbue( std::locale( os.getloc(), new formatter( thousandsSeparator().isNull() ? context.thousandsSeparator() : thousandsSeparator(), + os.imbue( std::locale( os.getloc(), new QgsGeographicCoordinateNumericFormat_ns::formatter( thousandsSeparator().isNull() ? context.thousandsSeparator() : thousandsSeparator(), false, decimal ) ) );