Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

UCalendar Class Reference

Inheritance diagram for UCalendar:

ICU List of all members.

Public Types

typedef double UDate
enum  Type { Traditional, Gregorian }
enum  DateFields {
  Era, Year, Month, WeekOfYear,
  WeekOfMonth, Date, DayOfYear, DayOfWeek,
  DayOfWeekInMonth, AmPm, Hour, HourOfDay,
  Minute, Second, Millisecond, ZoneOffset,
  DstOffset, YearWoy, DowLocal, ExtendedYear,
  JulianDay, MillisecondsInDay, FieldCount, DayOfMonth = Date
}
enum  DaysOfWeek {
  Sunday = 1, Monday, Tuesday, Wednesday,
  Thursday, Friday, Saturday
}
enum  Months {
  January, February, March, April,
  May, June, July, August,
  September, October, November, December,
  UnDecimber
}
enum  AMPMs { AM, PM }
enum  DisplayNameType { Standard, ShortStandard, DST, ShortDST }
enum  Limit {
  Minimum, Maximum, GreatestMinimum, LeastMaximum,
  ActualMinimum, ActualMaximum
}

Public Member Functions

 this (inout UTimeZone zone, inout ULocale locale, Type type=Type.Traditional)
package this (Handle handle)
 ~this ()
void setTimeZone (inout UTimeZone zone)
void getTimeZoneName (UString s, inout ULocale locale, DisplayNameType type=DisplayNameType.Standard)
bool inDaylightTime ()
UDate getNow ()
UDate getMillis ()
void setMillis (UDate date)
void setDate (uint year, Months month, uint date)
void setDateTime (uint year, Months month, uint date, uint hour, uint minute, uint second)
bool isEquivalent (UCalendar when)
bool isEqual (UCalendar when)
bool isBefore (UCalendar when)
bool isAfter (UCalendar when)
void add (DateFields field, uint amount)
void roll (DateFields field, uint amount)
uint get (DateFields field)
void set (DateFields field, uint value)
bool isSet (DateFields field)
void clearField (DateFields field)
void clear ()
uint getLimit (DateFields field, Limit type)
uint getDaysInFirstWeek ()
uint getFirstDayOfWeek ()
void setDaysInFirstWeek (uint value)
void setFirstDayOfWeek (uint value)

Static Public Member Functions

static this ()
static ~this ()

Public Attributes

package Handle handle

Static Public Attributes

static FunctionLoader Bind[] targets

Private Types

enum  Attribute { Lenient, FirstDayOfWeek, MinimalDaysInFirstWeek }
typedef void * Handle
enum  Error { OK, BufferOverflow = 15 }

Static Private Member Functions

static bool isError (Error e)
static void testError (Error e, char[] msg)
static char * toString (char[] string)
static wchar * toString (wchar[] string)
static uint length (char *s)
static uint length (wchar *s)
static char[] toArray (char *s)
static wchar[] toArray (wchar *s)

Static Private Attributes

static void * library

Detailed Description

UCalendar is used for converting between a UDate object and a set of integer fields such as Year, Month, Day, Hour, and so on. (A UDate object represents a specific instant in time with millisecond precision. See UDate for information about the UDate)

Types of UCalendar interpret a UDate according to the rules of a specific calendar system. UCalendar supports Traditional & Gregorian.

A UCalendar object can produce all the time field values needed to implement the date-time formatting for a particular language and calendar style (for example, Japanese-Gregorian, Japanese-Traditional).

When computing a UDate from time fields, two special circumstances may arise: there may be insufficient information to compute the UDate (such as only year and month but no day in the month), or there may be inconsistent information (such as "Tuesday, July 15, 1996" -- July 15, 1996 is actually a Monday).

Insufficient information. The calendar will use default information to specify the missing fields. This may vary by calendar; for the Gregorian calendar, the default for a field is the same as that of the start of the epoch: i.e., Year = 1970, Month = January, Date = 1, etc.

Inconsistent information. If fields conflict, the calendar will give preference to fields set more recently. For example, when determining the day, the calendar will look for one of the following combinations of fields. The most recent combination, as determined by the most recently set single field, will be used.

See http://oss.software.ibm.com/icu/apiref/udat_8h.html for full details.

Definition at line 131 of file UCalendar.d.


Member Typedef Documentation

typedef double UDate
 

Definition at line 135 of file UCalendar.d.

typedef void* Handle [protected, inherited]
 

Use this for the primary argument-type to most ICU functions

Definition at line 112 of file ICU.d.


Member Enumeration Documentation

enum Type
 

Enumeration values:
Traditional 
Gregorian 

Definition at line 138 of file UCalendar.d.

enum DateFields
 

Enumeration values:
Era 
Year 
Month 
WeekOfYear 
WeekOfMonth 
Date 
DayOfYear 
DayOfWeek 
DayOfWeekInMonth 
AmPm 
Hour 
HourOfDay 
Minute 
Second 
Millisecond 
ZoneOffset 
DstOffset 
YearWoy 
DowLocal 
ExtendedYear 
JulianDay 
MillisecondsInDay 
FieldCount 
DayOfMonth 

Definition at line 145 of file UCalendar.d.

enum DaysOfWeek
 

Enumeration values:
Sunday 
Monday 
Tuesday 
Wednesday 
Thursday 
Friday 
Saturday 

Definition at line 174 of file UCalendar.d.

enum Months
 

Enumeration values:
January 
February 
March 
April 
May 
June 
July 
August 
September 
October 
November 
December 
UnDecimber 

Definition at line 186 of file UCalendar.d.

enum AMPMs
 

Enumeration values:
AM 
PM 

Definition at line 204 of file UCalendar.d.

enum DisplayNameType
 

Enumeration values:
Standard 
ShortStandard 
DST 
ShortDST 

Definition at line 211 of file UCalendar.d.

enum Limit
 

Enumeration values:
Minimum 
Maximum 
GreatestMinimum 
LeastMaximum 
ActualMinimum 
ActualMaximum 

Definition at line 220 of file UCalendar.d.

enum Attribute [private]
 

Enumeration values:
Lenient 
FirstDayOfWeek 
MinimalDaysInFirstWeek 

Definition at line 231 of file UCalendar.d.

enum Error [protected, inherited]
 

ICU error codes (the ones which are referenced)

Enumeration values:
OK 
BufferOverflow 

Definition at line 146 of file ICU.d.


Constructor & Destructor Documentation

~this  )  [inline]
 

Close this UCalendar

Definition at line 270 of file UCalendar.d.

static ~this  )  [inline, static]
 

Definition at line 661 of file UCalendar.d.


Member Function Documentation

this inout UTimeZone  zone,
inout ULocale  locale,
Type  type = Type.Traditional
[inline]
 

Open a UCalendar. A UCalendar may be used to convert a millisecond value to a year, month, and day

Definition at line 245 of file UCalendar.d.

References ICU::testError(), and type().

package this Handle  handle  )  [inline]
 

Internal only: Open a UCalendar with the given handle

Definition at line 259 of file UCalendar.d.

void setTimeZone inout UTimeZone  zone  )  [inline]
 

Set the TimeZone used by a UCalendar

Definition at line 281 of file UCalendar.d.

References ICU::testError().

void getTimeZoneName UString  s,
inout ULocale  locale,
DisplayNameType  type = DisplayNameType.Standard
[inline]
 

Get display name of the TimeZone used by this UCalendar

Definition at line 295 of file UCalendar.d.

References UString::format(), ICU::toString(), and type().

bool inDaylightTime  )  [inline]
 

Determine if a UCalendar is currently in daylight savings time

Definition at line 312 of file UCalendar.d.

References ICU::testError().

UDate getNow  )  [inline]
 

Get the current date and time

Definition at line 327 of file UCalendar.d.

UDate getMillis  )  [inline]
 

Get a UCalendar's current time in millis. The time is represented as milliseconds from the epoch

Definition at line 339 of file UCalendar.d.

References ICU::testError().

Referenced by isAfter(), isBefore(), and isEqual().

void setMillis UDate  date  )  [inline]
 

Set a UCalendar's current time in millis. The time is represented as milliseconds from the epoch

Definition at line 355 of file UCalendar.d.

References ICU::testError().

void setDate uint  year,
Months  month,
uint  date
[inline]
 

Set a UCalendar's current date

Definition at line 369 of file UCalendar.d.

References ICU::testError().

void setDateTime uint  year,
Months  month,
uint  date,
uint  hour,
uint  minute,
uint  second
[inline]
 

Set a UCalendar's current date

Definition at line 383 of file UCalendar.d.

References ICU::testError().

bool isEquivalent UCalendar  when  )  [inline]
 

Returns TRUE if the given Calendar object is equivalent to this one

Definition at line 398 of file UCalendar.d.

References handle.

bool isEqual UCalendar  when  )  [inline]
 

Compares the Calendar time

Definition at line 409 of file UCalendar.d.

References getMillis().

bool isBefore UCalendar  when  )  [inline]
 

Returns true if this Calendar's current time is before "when"'s current time

Definition at line 421 of file UCalendar.d.

References getMillis().

bool isAfter UCalendar  when  )  [inline]
 

Returns true if this Calendar's current time is after "when"'s current time

Definition at line 433 of file UCalendar.d.

References getMillis().

void add DateFields  field,
uint  amount
[inline]
 

Add a specified signed amount to a particular field in a UCalendar

Definition at line 445 of file UCalendar.d.

References ICU::testError().

void roll DateFields  field,
uint  amount
[inline]
 

Add a specified signed amount to a particular field in a UCalendar

Definition at line 460 of file UCalendar.d.

References ICU::testError().

uint get DateFields  field  )  [inline]
 

Get the current value of a field from a UCalendar

Definition at line 474 of file UCalendar.d.

References ICU::testError().

void set DateFields  field,
uint  value
[inline]
 

Set the value of a field in a UCalendar

Definition at line 489 of file UCalendar.d.

bool isSet DateFields  field  )  [inline]
 

Determine if a field in a UCalendar is set

Definition at line 500 of file UCalendar.d.

void clearField DateFields  field  )  [inline]
 

Clear a field in a UCalendar

Definition at line 511 of file UCalendar.d.

void clear  )  [inline]
 

Clear all fields in a UCalendar

Definition at line 522 of file UCalendar.d.

uint getLimit DateFields  field,
Limit  type
[inline]
 

Determine a limit for a field in a UCalendar. A limit is a maximum or minimum value for a field

Definition at line 534 of file UCalendar.d.

References ICU::testError(), and type().

uint getDaysInFirstWeek  )  [inline]
 

Definition at line 547 of file UCalendar.d.

uint getFirstDayOfWeek  )  [inline]
 

Definition at line 556 of file UCalendar.d.

void setDaysInFirstWeek uint  value  )  [inline]
 

Definition at line 565 of file UCalendar.d.

void setFirstDayOfWeek uint  value  )  [inline]
 

Definition at line 574 of file UCalendar.d.

static this  )  [inline, static]
 

Definition at line 652 of file UCalendar.d.

static bool isError Error  e  )  [inline, static, protected, inherited]
 

Definition at line 156 of file ICU.d.

Referenced by UCollator::getLocale().

static void testError Error  e,
char[]  msg
[inline, static, protected, inherited]
 

Definition at line 174 of file ICU.d.

Referenced by add(), USet::applyPattern(), UChar::charFromName(), UNormalize::check(), URegex::clone(), UNormalize::compare(), UDomainName::compare(), UText::compareFolded(), UConverter::UTranscoder::convert(), UEnumeration::count(), UConverter::decode(), UConverter::encode(), URegex::end(), UTransform::execute(), USearch::first(), UResourceBundle::get(), get(), UCollator::getAttribute(), UResourceBundle::getBinary(), UCollator::getBound(), UChar::getCharName(), UChar::getComment(), UCollator::getContractions(), URegex::getFlags(), UResourceBundle::getInt(), UResourceBundle::getIntVector(), getLimit(), UResourceBundle::getLocale(), getMillis(), UConverter::getName(), UResourceBundle::getNextString(), URegex::getPattern(), UCollator::getShortDefinitionString(), UResourceBundle::getString(), UCollator::getTailoredSet(), UDateFormat::getTwoDigitYearStart(), UCollator::getVariableTop(), URegex::groupCount(), inDaylightTime(), UNormalize::isNormalized(), USearch::last(), URegex::match(), USearch::next(), URegex::next(), UEnumeration::next(), UCollator::normalizeShortDefinitionString(), UDateFormat::parse(), USearch::previous(), URegex::probe(), URegex::replaceAll(), URegex::replaceFirst(), URegex::reset(), UEnumeration::reset(), roll(), UCollator::setAttribute(), USearch::setCollator(), setDate(), setDateTime(), UTransform::setFilter(), USearch::setIterator(), setMillis(), USearch::setOffset(), USearch::setPattern(), UDecimalFormat::setPattern(), UMessageFormat::setPattern(), USearch::setText(), URegex::setText(), UBreakIterator::setText(), setTimeZone(), UDateFormat::setTwoDigitYearStart(), UCollator::setVariableTop(), URegex::split(), URegex::start(), UTransform::this(), UStringPrep::this(), USet::this(), USearch::this(), UResourceBundle::this(), URegex::this(), UNumberFormat::this(), UMessageFormat::this(), UDateFormat::this(), UCollator::this(), this(), UBreakIterator::this(), URuleIterator::this(), and UText::toUtf8().

static char* toString char[]  string  )  [inline, static, protected, inherited]
 

Definition at line 184 of file ICU.d.

Referenced by UChar::charFromName(), UConverter::compareNames(), UCollator::getDisplayName(), UResourceBundle::getResource(), UCollator::getShortDefinitionString(), UResourceBundle::getString(), getTimeZoneName(), UCollator::normalizeShortDefinitionString(), UMessageFormat::setLocale(), UStringPrep::this(), UResourceBundle::this(), UDateFormat::this(), UCollator::this(), UBreakIterator::this(), UText::toLower(), and UText::toUpper().

static wchar* toString wchar[]  string  )  [inline, static, protected, inherited]
 

Definition at line 206 of file ICU.d.

static uint length char *  s  )  [inline, static, protected, inherited]
 

Definition at line 228 of file ICU.d.

References strlen().

Referenced by UConverter::UTranscoder::convert().

static uint length wchar *  s  )  [inline, static, protected, inherited]
 

Definition at line 237 of file ICU.d.

References wcslen().

static char [] toArray char *  s  )  [inline, static, protected, inherited]
 

Definition at line 246 of file ICU.d.

References strlen().

Referenced by UConverter::detectSignature(), UResourceBundle::getKey(), UResourceBundle::getLocale(), UMessageFormat::getLocale(), UCollator::getLocale(), UConverter::getName(), UChar::getPropertyName(), UChar::getPropertyValueName(), and UConverter::opApply().

static wchar [] toArray wchar *  s  )  [inline, static, protected, inherited]
 

Definition at line 257 of file ICU.d.

References wcslen().


Member Data Documentation

package Handle handle
 

Definition at line 133 of file UCalendar.d.

Referenced by isEquivalent(), and UDateFormat::setCalendar().

void* library [static, private]
 

Bind the ICU functions from a shared library. This is complicated by the issues regarding D and DLLs on the Windows platform

Definition at line 588 of file UCalendar.d.

FunctionLoader Bind [] targets [static]
 

Initial value:

 
                [
                {cast(void**) &ucal_open,               "ucal_open"}

Definition at line 623 of file UCalendar.d.


The documentation for this class was generated from the following file:
Generated on Sat Dec 24 17:28:42 2005 for Mango by  doxygen 1.4.0