LibreOffice Module scaddins (master) 1
|
Helper class for date calculation for various financial functions. More...
#include <analysishelper.hxx>
Public Member Functions | |
ScaDate () | |
ScaDate (sal_Int32 nNullDate, sal_Int32 nDate, sal_Int32 nBase) | |
ScaDate (const ScaDate &rCopy) | |
ScaDate & | operator= (const ScaDate &rCopy) |
sal_uInt16 | getMonth () const |
sal_uInt16 | getYear () const |
void | addMonths (sal_Int32 nMonthCount) |
adds/subtracts the given count of months, adjusts day More... | |
void | setYear (sal_uInt16 nNewYear) |
sets the given year, adjusts day More... | |
void | addYears (sal_Int32 nYearCount) |
adds/subtracts the given count of years, adjusts day More... | |
sal_Int32 | getDate (sal_Int32 nNullDate) const |
bool | operator< (const ScaDate &rCmp) const |
bool | operator<= (const ScaDate &rCmp) const |
bool | operator> (const ScaDate &rCmp) const |
bool | operator>= (const ScaDate &rCmp) const |
Static Public Member Functions | |
static sal_Int32 | getDiff (const ScaDate &rFrom, const ScaDate &rTo) |
Private Member Functions | |
void | setDay () |
is true, if the US method of 30-day-calculations is used. More... | |
sal_uInt16 | getDaysInMonth () const |
sal_uInt16 | getDaysInMonth (sal_uInt16 _nMon) const |
sal_Int32 | getDaysInMonthRange (sal_uInt16 nFrom, sal_uInt16 nTo) const |
@ return count of days in the given month range More... | |
sal_Int32 | getDaysInYearRange (sal_uInt16 nFrom, sal_uInt16 nTo) const |
@ return count of days in the given year range More... | |
void | doAddYears (sal_Int32 nYearCount) |
Adds/subtracts the given count of years, does not adjust day. More... | |
Private Attributes | |
sal_uInt16 | nOrigDay |
sal_uInt16 | nDay |
is the day of the original date. More... | |
sal_uInt16 | nMonth |
is the calculated day depending on the current month/year. More... | |
sal_uInt16 | nYear |
is the current month (one-based). More... | |
bool | bLastDayMode: 1 |
is the current year. More... | |
bool | bLastDay: 1 |
if true, recalculate nDay after every calculation. More... | |
bool | b30Days: 1 |
is true, if original date was the last day in month. More... | |
bool | bUSMode: 1 |
is true, if every month has 30 days in calculations. More... | |
Helper class for date calculation for various financial functions.
Definition at line 726 of file analysishelper.hxx.
sca::analysis::ScaDate::ScaDate | ( | ) |
Definition at line 2473 of file analysishelper.cxx.
sca::analysis::ScaDate::ScaDate | ( | sal_Int32 | nNullDate, |
sal_Int32 | nDate, | ||
sal_Int32 | nBase | ||
) |
nBase | date handling mode (days in month / days in year): 0 = 30 days / 360 days (US NASD) 1 = exact / exact 2 = exact / 360 3 = exact / 365 4 = 30 days / 360 days (Europe) 5 = exact / exact (no last day adjustment) |
Definition at line 2485 of file analysishelper.cxx.
References b30Days, bLastDay, bLastDayMode, bUSMode, sca::analysis::DaysInMonth(), sca::analysis::DaysToDate(), nMonth, nOrigDay, nYear, and setDay().
sca::analysis::ScaDate::ScaDate | ( | const ScaDate & | rCopy | ) |
Definition at line 2495 of file analysishelper.cxx.
void sca::analysis::ScaDate::addMonths | ( | sal_Int32 | nMonthCount | ) |
adds/subtracts the given count of months, adjusts day
css::lang::IllegalArgumentException |
Definition at line 2572 of file analysishelper.cxx.
References doAddYears(), nMonth, and setDay().
Referenced by sca::analysis::GetCoupdays(), AnalysisAddIn::getEdate(), sca::analysis::lcl_GetCoupncd(), and sca::analysis::lcl_GetCouppcd().
|
inline |
adds/subtracts the given count of years, adjusts day
css::lang::IllegalArgumentException |
Definition at line 816 of file analysishelper.hxx.
References doAddYears(), and setDay().
Referenced by sca::analysis::lcl_GetCoupncd(), and sca::analysis::lcl_GetCouppcd().
|
private |
Adds/subtracts the given count of years, does not adjust day.
css::lang::IllegalArgumentException |
Definition at line 2564 of file analysishelper.cxx.
References nYear.
Referenced by addMonths(), and addYears().
sal_Int32 sca::analysis::ScaDate::getDate | ( | sal_Int32 | nNullDate | ) | const |
Definition at line 2591 of file analysishelper.cxx.
References bLastDay, bLastDayMode, sca::analysis::DaysInMonth(), nMonth, nOrigDay, and nYear.
Referenced by sca::analysis::GetCoupncd(), sca::analysis::GetCouppcd(), and AnalysisAddIn::getEdate().
|
inlineprivate |
Definition at line 800 of file analysishelper.hxx.
References getDaysInMonth(), and nMonth.
Referenced by getDaysInMonth(), and getDaysInMonthRange().
|
inlineprivate |
Definition at line 805 of file analysishelper.hxx.
References b30Days, sca::analysis::DaysInMonth(), and nYear.
|
private |
@ return count of days in the given month range
Definition at line 2540 of file analysishelper.cxx.
References b30Days, and getDaysInMonth().
|
private |
@ return count of days in the given year range
Definition at line 2556 of file analysishelper.cxx.
References b30Days, and sca::analysis::GetDaysInYears().
css::lang::IllegalArgumentException |
Definition at line 2598 of file analysishelper.cxx.
References aFrom, aTo, b30Days, bUSMode, sca::analysis::DaysInMonth(), getDiff(), nDay, and nMonth.
Referenced by sca::analysis::GetCoupdaybs(), sca::analysis::GetCoupdays(), sca::analysis::GetCoupdaysnc(), and getDiff().
|
inline |
Definition at line 771 of file analysishelper.hxx.
References nMonth.
Referenced by sca::analysis::GetCoupnum().
|
inline |
Definition at line 773 of file analysishelper.hxx.
References nYear.
Referenced by sca::analysis::GetCoupnum(), sca::analysis::lcl_GetCoupncd(), and sca::analysis::lcl_GetCouppcd().
bool sca::analysis::ScaDate::operator< | ( | const ScaDate & | rCmp | ) | const |
|
inline |
Definition at line 795 of file analysishelper.hxx.
Definition at line 2507 of file analysishelper.cxx.
References b30Days, bLastDay, bLastDayMode, bUSMode, nDay, nMonth, nOrigDay, and nYear.
|
inline |
Definition at line 796 of file analysishelper.hxx.
|
inline |
Definition at line 797 of file analysishelper.hxx.
|
private |
is true, if the US method of 30-day-calculations is used.
Calculates nDay from nOrigDay and current date.
Definition at line 2523 of file analysishelper.cxx.
References b30Days, bLastDay, sca::analysis::DaysInMonth(), nDay, nMonth, nOrigDay, and nYear.
Referenced by addMonths(), addYears(), ScaDate(), and setYear().
|
inline |
sets the given year, adjusts day
Definition at line 810 of file analysishelper.hxx.
References nYear, and setDay().
Referenced by sca::analysis::lcl_GetCoupncd(), and sca::analysis::lcl_GetCouppcd().
|
private |
is true, if original date was the last day in month.
Definition at line 735 of file analysishelper.hxx.
Referenced by getDaysInMonth(), getDaysInMonthRange(), getDaysInYearRange(), getDiff(), operator=(), ScaDate(), and setDay().
|
private |
if true, recalculate nDay after every calculation.
Definition at line 734 of file analysishelper.hxx.
Referenced by getDate(), operator<(), operator=(), ScaDate(), and setDay().
|
private |
is the current year.
Definition at line 733 of file analysishelper.hxx.
Referenced by getDate(), operator=(), and ScaDate().
|
private |
is true, if every month has 30 days in calculations.
Definition at line 736 of file analysishelper.hxx.
Referenced by getDiff(), operator=(), and ScaDate().
|
private |
is the day of the original date.
Definition at line 730 of file analysishelper.hxx.
Referenced by getDiff(), operator<(), operator=(), and setDay().
|
private |
is the calculated day depending on the current month/year.
Definition at line 731 of file analysishelper.hxx.
Referenced by addMonths(), getDate(), getDaysInMonth(), getDiff(), getMonth(), operator<(), operator=(), ScaDate(), and setDay().
|
private |
Definition at line 729 of file analysishelper.hxx.
Referenced by getDate(), operator<(), operator=(), ScaDate(), and setDay().
|
private |
is the current month (one-based).
Definition at line 732 of file analysishelper.hxx.
Referenced by doAddYears(), getDate(), getDaysInMonth(), getYear(), operator<(), operator=(), ScaDate(), setDay(), and setYear().