src/third_party/icu/source/i18n/units_converter.cpp
/**
 * Checks if the source unit and the target unit are simple. For example celsius or fahrenheit. But not
 * square-celsius or square-fahrenheit.
 *
 * NOTE:
 *  Empty unit means simple unit.
 */
Checks if the source unit and the target unit are simple. For example celsius or fahrenheit. But not
square-celsius or square-fahrenheit.

Empty unit means simple unit.
Checks if the source unit and the target unit are simple . For example celsius or fahrenheit . But not square - celsius or square - fahrenheit . Empty unit means simple unit .
UBool checkSimpleUnit(const MeasureUnitImpl &unit, UErrorCode &status) {
    if (U_FAILURE(status)) return false;
    if (unit.complexity != UMEASURE_UNIT_SINGLE) {
        return false;
    }
    if (unit.units.length() == 0) {
        return true;
    }
    auto singleUnit = *(unit.units[0]);
    if (singleUnit.dimensionality != 1 || singleUnit.siPrefix != UMEASURE_SI_PREFIX_ONE) {
        return false;
    }
    return true;
}
UBool checkSimpleUnit ( const MeasureUnitImpl & unit , UErrorCode & status ) { if ( U_FAILURE ( status ) ) return false ; if ( unit . complexity != UMEASURE_UNIT_SINGLE ) { return false ; } if ( unit . units . length ( ) == 0 ) { return true ; } auto singleUnit = * ( unit . units [ 0 ] ) ; if ( singleUnit . dimensionality != 1 || singleUnit . siPrefix != UMEASURE_SI_PREFIX_ONE ) { return false ; } return true ; }
Checks if the source unit and the target unit are simple.
Checks if the source unit and the target unit are simple .
// Empty units means simple unit.