Logo Search packages:      
Sourcecode: icu version File versions  Download package

dtrule.cpp

/*
*******************************************************************************
* Copyright (C) 2007, International Business Machines Corporation and         *
* others. All Rights Reserved.                                                *
*******************************************************************************
*/

#include "unicode/utypes.h"

#if !UCONFIG_NO_FORMATTING

#include "unicode/dtrule.h"

U_NAMESPACE_BEGIN

UOBJECT_DEFINE_RTTI_IMPLEMENTATION(DateTimeRule)

00018 DateTimeRule::DateTimeRule(int32_t month,
                           int32_t dayOfMonth,
                           int32_t millisInDay,
                           TimeRuleType timeType)
: fMonth(month), fDayOfMonth(dayOfMonth), fDayOfWeek(0), fWeekInMonth(0), fMillisInDay(millisInDay),
  fDateRuleType(DateTimeRule::DOM), fTimeRuleType(timeType) {
}

00026 DateTimeRule::DateTimeRule(int32_t month,
                           int32_t weekInMonth,
                           int32_t dayOfWeek,
                           int32_t millisInDay,
                           TimeRuleType timeType)
: fMonth(month), fDayOfMonth(0), fDayOfWeek(dayOfWeek), fWeekInMonth(weekInMonth), fMillisInDay(millisInDay),
  fDateRuleType(DateTimeRule::DOW), fTimeRuleType(timeType) {
}

00035 DateTimeRule::DateTimeRule(int32_t month,
                           int32_t dayOfMonth,
                           int32_t dayOfWeek,
                           UBool after,
                           int32_t millisInDay,
                           TimeRuleType timeType)
: UObject(),
  fMonth(month), fDayOfMonth(dayOfMonth), fDayOfWeek(dayOfWeek), fWeekInMonth(0), fMillisInDay(millisInDay),
  fTimeRuleType(timeType) {
    if (after) {
        fDateRuleType = DateTimeRule::DOW_GEQ_DOM;
    } else {
        fDateRuleType = DateTimeRule::DOW_LEQ_DOM;
    }
}

00051 DateTimeRule::DateTimeRule(const DateTimeRule& source)
: UObject(source),
  fMonth(source.fMonth), fDayOfMonth(source.fDayOfMonth), fDayOfWeek(source.fDayOfWeek),
  fWeekInMonth(source.fWeekInMonth), fMillisInDay(source.fMillisInDay),
  fDateRuleType(source.fDateRuleType), fTimeRuleType(source.fTimeRuleType) {
}

00058 DateTimeRule::~DateTimeRule() {
}

DateTimeRule*
00062 DateTimeRule::clone() const {
    return new DateTimeRule(*this);
}

DateTimeRule&
00067 DateTimeRule::operator=(const DateTimeRule& right) {
    if (this != &right) {
        fMonth = right.fMonth;
        fDayOfMonth = right.fDayOfMonth;
        fDayOfWeek = right.fDayOfWeek;
        fWeekInMonth = right.fWeekInMonth;
        fMillisInDay = right.fMillisInDay;
        fDateRuleType = right.fDateRuleType;
        fTimeRuleType = right.fTimeRuleType;
    }
    return *this;
}

UBool
00081 DateTimeRule::operator==(const DateTimeRule& that) const {
    return ((this == &that) ||
            (getDynamicClassID() == that.getDynamicClassID() &&
            fMonth == that.fMonth &&
            fDayOfMonth == that.fDayOfMonth &&
            fDayOfWeek == that.fDayOfWeek &&
            fWeekInMonth == that.fWeekInMonth &&
            fMillisInDay == that.fMillisInDay &&
            fDateRuleType == that.fDateRuleType &&
            fTimeRuleType == that.fTimeRuleType));
}

UBool
00094 DateTimeRule::operator!=(const DateTimeRule& that) const {
    return !operator==(that);
}

DateTimeRule::DateRuleType
00099 DateTimeRule::getDateRuleType(void) const {
    return fDateRuleType;
}

DateTimeRule::TimeRuleType
00104 DateTimeRule::getTimeRuleType(void) const {
    return fTimeRuleType;
}

int32_t
00109 DateTimeRule::getRuleMonth(void) const {
    return fMonth;
}

int32_t
00114 DateTimeRule::getRuleDayOfMonth(void) const {
    return fDayOfMonth;
}

int32_t
00119 DateTimeRule::getRuleDayOfWeek(void) const {
    return fDayOfWeek;
}

int32_t
00124 DateTimeRule::getRuleWeekInMonth(void) const {
    return fWeekInMonth;
}

int32_t
00129 DateTimeRule::getRuleMillisInDay(void) const {
    return fMillisInDay;
}

U_NAMESPACE_END

#endif /* #if !UCONFIG_NO_FORMATTING */

//eof

Generated by  Doxygen 1.6.0   Back to index