diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-21 11:53:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-22 08:29:29 +0200 |
commit | 4af6c0948be47d7816eb1b6f2137b70aba639f0d (patch) | |
tree | 3965a1709f531229a6faaeef2e9d4026a30332b8 /i18npool/source/calendar | |
parent | Also handle OUString with non-RTL_TEXTENCODING_ASCII_US encoding (diff) | |
download | core-4af6c0948be47d7816eb1b6f2137b70aba639f0d.tar.gz core-4af6c0948be47d7816eb1b6f2137b70aba639f0d.zip |
loplugin:flatten in filter..i18npool
Change-Id: I9024b8b614a4de83a4d927e1918f6d4904a7fccb
Reviewed-on: https://gerrit.libreoffice.org/42592
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool/source/calendar')
-rw-r--r-- | i18npool/source/calendar/calendarImpl.cxx | 180 |
1 files changed, 77 insertions, 103 deletions
diff --git a/i18npool/source/calendar/calendarImpl.cxx b/i18npool/source/calendar/calendarImpl.cxx index 94b72e2bf70d..220a3a9fde78 100644 --- a/i18npool/source/calendar/calendarImpl.cxx +++ b/i18npool/source/calendar/calendarImpl.cxx @@ -83,10 +83,9 @@ CalendarImpl::loadCalendar(const OUString& uniqueID, const Locale& rLocale ) } } - if ( xI.is() ) - xCalendar.set(xI, UNO_QUERY); - else + if ( !xI.is() ) throw ERROR; + xCalendar.set(xI, UNO_QUERY); lookupTable.push_back( new lookupTableItem(uniqueID, xCalendar) ); } @@ -111,19 +110,17 @@ CalendarImpl::loadCalendar(const OUString& uniqueID, const Locale& rLocale ) Calendar2 SAL_CALL CalendarImpl::getLoadedCalendar2() { - if (xCalendar.is()) - return xCalendar->getLoadedCalendar2(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getLoadedCalendar2(); } Calendar SAL_CALL CalendarImpl::getLoadedCalendar() { - if (xCalendar.is()) - return xCalendar->getLoadedCalendar(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getLoadedCalendar(); } Sequence< OUString > SAL_CALL @@ -140,217 +137,194 @@ CalendarImpl::getAllCalendars( const Locale& rLocale ) void SAL_CALL CalendarImpl::setDateTime( double fTimeInDays ) { - if (xCalendar.is()) - xCalendar->setDateTime( fTimeInDays ); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + xCalendar->setDateTime( fTimeInDays ); } double SAL_CALL CalendarImpl::getDateTime() { - if (xCalendar.is()) - return xCalendar->getDateTime(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getDateTime(); } void SAL_CALL CalendarImpl::setLocalDateTime( double fTimeInDays ) { - if (xCalendar.is()) - xCalendar->setLocalDateTime( fTimeInDays ); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + xCalendar->setLocalDateTime( fTimeInDays ); } double SAL_CALL CalendarImpl::getLocalDateTime() { - if (xCalendar.is()) - return xCalendar->getLocalDateTime(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getLocalDateTime(); } OUString SAL_CALL CalendarImpl::getUniqueID() { - if (xCalendar.is()) - return xCalendar->getUniqueID(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getUniqueID(); } void SAL_CALL CalendarImpl::setValue( sal_Int16 fieldIndex, sal_Int16 value ) { - if (xCalendar.is()) - xCalendar->setValue( fieldIndex, value ); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + xCalendar->setValue( fieldIndex, value ); } sal_Int16 SAL_CALL CalendarImpl::getValue( sal_Int16 fieldIndex ) { - if (xCalendar.is()) - return xCalendar->getValue( fieldIndex ); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getValue( fieldIndex ); } void SAL_CALL CalendarImpl::addValue( sal_Int16 fieldIndex, sal_Int32 amount ) { - if (xCalendar.is()) - xCalendar->addValue( fieldIndex, amount); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + xCalendar->addValue( fieldIndex, amount); } sal_Int16 SAL_CALL CalendarImpl::getFirstDayOfWeek() { - if (xCalendar.is()) - return xCalendar->getFirstDayOfWeek(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getFirstDayOfWeek(); } void SAL_CALL CalendarImpl::setFirstDayOfWeek( sal_Int16 day ) { - if (xCalendar.is()) - xCalendar->setFirstDayOfWeek(day); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR ; xCalendar->setFirstDayOfWeek(day); + } void SAL_CALL CalendarImpl::setMinimumNumberOfDaysForFirstWeek( sal_Int16 days ) { - if (xCalendar.is()) - xCalendar->setMinimumNumberOfDaysForFirstWeek(days); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + xCalendar->setMinimumNumberOfDaysForFirstWeek(days); } sal_Int16 SAL_CALL CalendarImpl::getMinimumNumberOfDaysForFirstWeek() { - if (xCalendar.is()) - return xCalendar->getMinimumNumberOfDaysForFirstWeek(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getMinimumNumberOfDaysForFirstWeek(); } OUString SAL_CALL CalendarImpl::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_Int16 nameType ) { - if (xCalendar.is()) - return xCalendar->getDisplayName( displayIndex, idx, nameType ); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getDisplayName( displayIndex, idx, nameType ); } sal_Int16 SAL_CALL CalendarImpl::getNumberOfMonthsInYear() { - if (xCalendar.is()) - return xCalendar->getNumberOfMonthsInYear(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR ; return xCalendar->getNumberOfMonthsInYear(); + } sal_Int16 SAL_CALL CalendarImpl::getNumberOfDaysInWeek() { - if (xCalendar.is()) - return xCalendar->getNumberOfDaysInWeek(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getNumberOfDaysInWeek(); } Sequence< CalendarItem > SAL_CALL CalendarImpl::getDays() { - if (xCalendar.is()) - return xCalendar->getDays(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getDays(); } Sequence< CalendarItem > SAL_CALL CalendarImpl::getMonths() { - if (xCalendar.is()) - return xCalendar->getMonths(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR ; return xCalendar->getMonths(); + } Sequence< CalendarItem2 > SAL_CALL CalendarImpl::getDays2() { - if (xCalendar.is()) - return xCalendar->getDays2(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getDays2(); } Sequence< CalendarItem2 > SAL_CALL CalendarImpl::getMonths2() { - if (xCalendar.is()) - return xCalendar->getMonths2(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getMonths2(); } Sequence< CalendarItem2 > SAL_CALL CalendarImpl::getGenitiveMonths2() { - if (xCalendar.is()) - return xCalendar->getGenitiveMonths2(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getGenitiveMonths2(); } Sequence< CalendarItem2 > SAL_CALL CalendarImpl::getPartitiveMonths2() { - if (xCalendar.is()) - return xCalendar->getPartitiveMonths2(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getPartitiveMonths2(); } sal_Bool SAL_CALL CalendarImpl::isValid() { - if (xCalendar.is()) - return xCalendar->isValid(); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->isValid(); } OUString SAL_CALL CalendarImpl::getDisplayString( sal_Int32 nCalendarDisplayCode, sal_Int16 nNativeNumberMode ) { - if (xCalendar.is()) - return xCalendar->getDisplayString(nCalendarDisplayCode, nNativeNumberMode); - else - throw ERROR ; + if (!xCalendar.is()) + throw ERROR; + return xCalendar->getDisplayString(nCalendarDisplayCode, nNativeNumberMode); } OUString SAL_CALL |