ICU-65 add constructors from mem-mapped data

X-SVN-Rev: 304
This commit is contained in:
Alan Liu 1999-12-05 06:09:24 +00:00
parent 2ef5f8fb72
commit 041f11b2bd
2 changed files with 42 additions and 1 deletions

View file

@ -23,7 +23,7 @@
#include "simpletz.h"
#include "gregocal.h"
#include "tzdat.h"
char SimpleTimeZone::fgClassID = 0; // Value is irrelevant
@ -107,6 +107,36 @@ SimpleTimeZone::SimpleTimeZone(int32_t rawOffset, const UnicodeString& ID,
dstSavings, status);
}
/**
* Construct from memory-mapped data. For private use by TimeZone.
*/
SimpleTimeZone::SimpleTimeZone(const StandardZone& stdZone,
const UnicodeString& id) {
UErrorCode status = U_ZERO_ERROR;
construct(stdZone.gmtOffset, id,
0, 0, 0, 0, WALL_TIME,
0, 0, 0, 0, WALL_TIME,
0, status);
}
/**
* Construct from memory-mapped data. For private use by TimeZone.
*/
SimpleTimeZone::SimpleTimeZone(const DSTZone& dstZone,
const UnicodeString& id) {
UErrorCode status = U_ZERO_ERROR;
construct(dstZone.gmtOffset, id,
dstZone.onsetRule.month, dstZone.onsetRule.dowim,
dstZone.onsetRule.dow,
dstZone.onsetRule.time * (int32_t)60000,
(TimeMode)dstZone.onsetRule.mode,
dstZone.ceaseRule.month, dstZone.ceaseRule.dowim,
dstZone.ceaseRule.dow,
dstZone.ceaseRule.time * (int32_t)60000,
(TimeMode)dstZone.ceaseRule.mode,
dstZone.dstSavings * (int32_t)60000, status);
}
/**
* Internal construction method.
*/

View file

@ -25,6 +25,9 @@
#include "timezone.h"
struct StandardZone;
struct DSTZone;
/**
* <code>SimpleTimeZone</code> is a concrete subclass of <code>TimeZone</code>
* that represents a time zone for use with a Gregorian calendar. This
@ -475,6 +478,14 @@ private:
DOW_LE_DOM_MODE
};
friend class TimeZone; // for access to these 2 constructors:
/**
* Construct from memory-mapped data.
*/
SimpleTimeZone(const StandardZone& stdZone, const UnicodeString& id);
SimpleTimeZone(const DSTZone& dstZone, const UnicodeString& id);
/**
* Internal construction method.
*/