From ed71f2e56f6f2958becb1c5136039b95f85f7ab5 Mon Sep 17 00:00:00 2001 From: Hugo van der Merwe <17109322+hugovdm@users.noreply.github.com> Date: Thu, 19 Mar 2020 13:44:32 +0100 Subject: [PATCH] Remove namespace hacks. Trust code review will deal with 'work in progress'. --- icu4c/source/i18n/unitsrouter.cpp | 5 --- icu4c/source/i18n/unitsrouter.h | 44 ++++++++++-------------- icu4c/source/test/intltest/unitstest.cpp | 5 ++- 3 files changed, 21 insertions(+), 33 deletions(-) diff --git a/icu4c/source/i18n/unitsrouter.cpp b/icu4c/source/i18n/unitsrouter.cpp index a4506be8b9e..592989e9ffd 100644 --- a/icu4c/source/i18n/unitsrouter.cpp +++ b/icu4c/source/i18n/unitsrouter.cpp @@ -46,7 +46,6 @@ namespace { // return result; // } -using namespace ::hugovdm_wip; using icu::number::impl::DecimalQuantity; class ConvertUnitsSink : public ResourceSink { @@ -199,8 +198,6 @@ void putUnitPref(UResourceBundle *usageData, MaybeStackVector<UnitPreference> &o } // namespace -namespace hugovdm_wip { - /** * Fetches required data FIXME. * @@ -294,8 +291,6 @@ void getUnitsData(const char *outputRegion, const char *usage, const MeasureUnit } } -} // namespace hugovdm_wip - UnitsRouter::UnitsRouter(MeasureUnit inputUnit, StringPiece locale, StringPiece usage, UErrorCode &status) { // StringPiece unitCategory = extractUnitCategory(inputUnit); diff --git a/icu4c/source/i18n/unitsrouter.h b/icu4c/source/i18n/unitsrouter.h index 01645289e38..a8438e2cdfe 100644 --- a/icu4c/source/i18n/unitsrouter.h +++ b/icu4c/source/i18n/unitsrouter.h @@ -17,30 +17,6 @@ U_NAMESPACE_BEGIN -struct ConverterPreference { - ComplexUnitsConverter converter; - double limit; - - ConverterPreference(MeasureUnit source, MeasureUnit complexTarget, double limit, UErrorCode &status) - : converter(source, complexTarget, status), limit(limit) {} -}; - -class U_I18N_API UnitsRouter { - public: - UnitsRouter(MeasureUnit inputUnit, StringPiece locale, StringPiece usage, UErrorCode &status); - - MaybeStackVector<Measure> route(double quantity, UErrorCode &status); - - private: - MaybeStackVector<ConverterPreference> converterPreferences_; -}; - -U_NAMESPACE_END - -namespace hugovdm_wip { -// This namespace contains code from hugovdm that hasn't been reviewed by sffc -// yet. It still needs thorough review and a "final resting place". - using icu::CharString; using icu::MaybeStackVector; using icu::MeasureUnit; @@ -59,12 +35,30 @@ struct UnitPreference { CharString skeleton; }; +struct ConverterPreference { + ComplexUnitsConverter converter; + double limit; + + ConverterPreference(MeasureUnit source, MeasureUnit complexTarget, double limit, UErrorCode &status) + : converter(source, complexTarget, status), limit(limit) {} +}; + +class U_I18N_API UnitsRouter { + public: + UnitsRouter(MeasureUnit inputUnit, StringPiece locale, StringPiece usage, UErrorCode &status); + + MaybeStackVector<Measure> route(double quantity, UErrorCode &status); + + private: + MaybeStackVector<ConverterPreference> converterPreferences_; +}; + void getUnitsData(const char *outputRegion, const char *usage, const MeasureUnit &inputUnit, CharString &category, MeasureUnit &baseUnit, MaybeStackVector<ConversionRateInfo> &conversionInfo, MaybeStackVector<UnitPreference> &unitPreferences, UErrorCode &status); -} // namespace hugo_wip +U_NAMESPACE_END #endif //__UNITSROUTER_H__ diff --git a/icu4c/source/test/intltest/unitstest.cpp b/icu4c/source/test/intltest/unitstest.cpp index b2da82d107d..d8b8e54d18d 100644 --- a/icu4c/source/test/intltest/unitstest.cpp +++ b/icu4c/source/test/intltest/unitstest.cpp @@ -26,7 +26,6 @@ struct UnitConversionTestCase { }; using icu::number::impl::DecimalQuantity; -using namespace ::hugovdm_wip; class UnitsTest : public IntlTest { public: @@ -808,8 +807,8 @@ void UnitsTest::testGetUnitsData() { MeasureUnit baseUnit; MaybeStackVector<ConversionRateInfo> conversionInfo; MaybeStackVector<UnitPreference> unitPreferences; - hugovdm_wip::getUnitsData(t.outputRegion, t.usage, inputUnit, category, baseUnit, conversionInfo, - unitPreferences, status); + getUnitsData(t.outputRegion, t.usage, inputUnit, category, baseUnit, conversionInfo, + unitPreferences, status); if (status.errIfFailureAndReset("getUnitsData(\"%s\", \"%s\", \"%s\", ...)", t.outputRegion, t.usage, t.inputUnit)) { continue; } -- 2.40.0