mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-20 08:58:00 +02:00
Removed 'internal' protection - it's all about [Friend] now
This commit is contained in:
parent
81af04a1ce
commit
14ac27c977
119 changed files with 1339 additions and 1388 deletions
|
@ -31,62 +31,62 @@ namespace System.Globalization {
|
|||
{
|
||||
|
||||
// Number of 100ns (10E-7 second) ticks per time unit
|
||||
internal const int64 TicksPerMillisecond = 10000;
|
||||
internal const int64 TicksPerSecond = TicksPerMillisecond * 1000;
|
||||
internal const int64 TicksPerMinute = TicksPerSecond * 60;
|
||||
internal const int64 TicksPerHour = TicksPerMinute * 60;
|
||||
internal const int64 TicksPerDay = TicksPerHour * 24;
|
||||
protected const int64 TicksPerMillisecond = 10000;
|
||||
protected const int64 TicksPerSecond = TicksPerMillisecond * 1000;
|
||||
protected const int64 TicksPerMinute = TicksPerSecond * 60;
|
||||
protected const int64 TicksPerHour = TicksPerMinute * 60;
|
||||
protected const int64 TicksPerDay = TicksPerHour * 24;
|
||||
|
||||
// Number of milliseconds per time unit
|
||||
internal const int MillisPerSecond = 1000;
|
||||
internal const int MillisPerMinute = MillisPerSecond * 60;
|
||||
internal const int MillisPerHour = MillisPerMinute * 60;
|
||||
internal const int MillisPerDay = MillisPerHour * 24;
|
||||
protected const int MillisPerSecond = 1000;
|
||||
protected const int MillisPerMinute = MillisPerSecond * 60;
|
||||
protected const int MillisPerHour = MillisPerMinute * 60;
|
||||
protected const int MillisPerDay = MillisPerHour * 24;
|
||||
|
||||
// Number of days in a non-leap year
|
||||
internal const int DaysPerYear = 365;
|
||||
protected const int DaysPerYear = 365;
|
||||
// Number of days in 4 years
|
||||
internal const int DaysPer4Years = DaysPerYear * 4 + 1;
|
||||
protected const int DaysPer4Years = DaysPerYear * 4 + 1;
|
||||
// Number of days in 100 years
|
||||
internal const int DaysPer100Years = DaysPer4Years * 25 - 1;
|
||||
protected const int DaysPer100Years = DaysPer4Years * 25 - 1;
|
||||
// Number of days in 400 years
|
||||
internal const int DaysPer400Years = DaysPer100Years * 4 + 1;
|
||||
protected const int DaysPer400Years = DaysPer100Years * 4 + 1;
|
||||
|
||||
// Number of days from 1/1/0001 to 1/1/10000
|
||||
internal const int DaysTo10000 = DaysPer400Years * 25 - 366;
|
||||
protected const int DaysTo10000 = DaysPer400Years * 25 - 366;
|
||||
|
||||
internal const int64 MaxMillis = (int64)DaysTo10000 * MillisPerDay;
|
||||
protected const int64 MaxMillis = (int64)DaysTo10000 * MillisPerDay;
|
||||
|
||||
//
|
||||
// Calendar ID Values. This is used to get data from calendar.nlp.
|
||||
// The order of calendar ID means the order of data items in the table.
|
||||
//
|
||||
|
||||
internal const int CAL_GREGORIAN = 1 ; // Gregorian (localized) calendar
|
||||
internal const int CAL_GREGORIAN_US = 2 ; // Gregorian (U.S.) calendar
|
||||
internal const int CAL_JAPAN = 3 ; // Japanese Emperor Era calendar
|
||||
internal const int CAL_TAIWAN = 4 ; // Taiwan Era calendar
|
||||
internal const int CAL_KOREA = 5 ; // Korean Tangun Era calendar
|
||||
internal const int CAL_HIJRI = 6 ; // Hijri (Arabic Lunar) calendar
|
||||
internal const int CAL_THAI = 7 ; // Thai calendar
|
||||
internal const int CAL_HEBREW = 8 ; // Hebrew (Lunar) calendar
|
||||
internal const int CAL_GREGORIAN_ME_FRENCH = 9 ; // Gregorian Middle East French calendar
|
||||
internal const int CAL_GREGORIAN_ARABIC = 10; // Gregorian Arabic calendar
|
||||
internal const int CAL_GREGORIAN_XLIT_ENGLISH = 11; // Gregorian Transliterated English calendar
|
||||
internal const int CAL_GREGORIAN_XLIT_FRENCH = 12;
|
||||
internal const int CAL_JULIAN = 13;
|
||||
internal const int CAL_JAPANESELUNISOLAR = 14;
|
||||
internal const int CAL_CHINESELUNISOLAR = 15;
|
||||
internal const int CAL_SAKA = 16; // reserved to match Office but not implemented in our code
|
||||
internal const int CAL_LUNAR_ETO_CHN = 17; // reserved to match Office but not implemented in our code
|
||||
internal const int CAL_LUNAR_ETO_KOR = 18; // reserved to match Office but not implemented in our code
|
||||
internal const int CAL_LUNAR_ETO_ROKUYOU = 19; // reserved to match Office but not implemented in our code
|
||||
internal const int CAL_KOREANLUNISOLAR = 20;
|
||||
internal const int CAL_TAIWANLUNISOLAR = 21;
|
||||
internal const int CAL_PERSIAN = 22;
|
||||
internal const int CAL_UMALQURA = 23;
|
||||
const int CAL_GREGORIAN = 1 ; // Gregorian (localized) calendar
|
||||
const int CAL_GREGORIAN_US = 2 ; // Gregorian (U.S.) calendar
|
||||
const int CAL_JAPAN = 3 ; // Japanese Emperor Era calendar
|
||||
const int CAL_TAIWAN = 4 ; // Taiwan Era calendar
|
||||
const int CAL_KOREA = 5 ; // Korean Tangun Era calendar
|
||||
const int CAL_HIJRI = 6 ; // Hijri (Arabic Lunar) calendar
|
||||
const int CAL_THAI = 7 ; // Thai calendar
|
||||
const int CAL_HEBREW = 8 ; // Hebrew (Lunar) calendar
|
||||
const int CAL_GREGORIAN_ME_FRENCH = 9 ; // Gregorian Middle East French calendar
|
||||
const int CAL_GREGORIAN_ARABIC = 10; // Gregorian Arabic calendar
|
||||
const int CAL_GREGORIAN_XLIT_ENGLISH = 11; // Gregorian Transliterated English calendar
|
||||
const int CAL_GREGORIAN_XLIT_FRENCH = 12;
|
||||
const int CAL_JULIAN = 13;
|
||||
const int CAL_JAPANESELUNISOLAR = 14;
|
||||
const int CAL_CHINESELUNISOLAR = 15;
|
||||
const int CAL_SAKA = 16; // reserved to match Office but not implemented in our code
|
||||
const int CAL_LUNAR_ETO_CHN = 17; // reserved to match Office but not implemented in our code
|
||||
const int CAL_LUNAR_ETO_KOR = 18; // reserved to match Office but not implemented in our code
|
||||
const int CAL_LUNAR_ETO_ROKUYOU = 19; // reserved to match Office but not implemented in our code
|
||||
const int CAL_KOREANLUNISOLAR = 20;
|
||||
const int CAL_TAIWANLUNISOLAR = 21;
|
||||
const int CAL_PERSIAN = 22;
|
||||
const int CAL_UMALQURA = 23;
|
||||
|
||||
internal int m_currentEraValue = -1;
|
||||
int m_currentEraValue = -1;
|
||||
|
||||
private bool m_isReadOnly = false;
|
||||
|
||||
|
@ -116,7 +116,7 @@ namespace System.Globalization {
|
|||
///
|
||||
// This can not be abstract, otherwise no one can create a subclass of Calendar.
|
||||
//
|
||||
internal virtual int ID {
|
||||
protected virtual int ID {
|
||||
get {
|
||||
return (-1);
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ namespace System.Globalization {
|
|||
// Return the Base calendar ID for calendars that didn't have defined data in calendarData
|
||||
//
|
||||
|
||||
internal virtual int BaseCalendarID
|
||||
protected virtual int BaseCalendarID
|
||||
{
|
||||
get { return ID; }
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ namespace System.Globalization {
|
|||
Runtime.NotImplemented();
|
||||
}
|
||||
|
||||
internal Result<void> VerifyWritable()
|
||||
Result<void> VerifyWritable()
|
||||
{
|
||||
if (m_isReadOnly)
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ namespace System.Globalization {
|
|||
return .Ok;
|
||||
}
|
||||
|
||||
internal void SetReadOnlyState(bool readOnly)
|
||||
void SetReadOnlyState(bool readOnly)
|
||||
{
|
||||
m_isReadOnly = readOnly;
|
||||
}
|
||||
|
@ -214,14 +214,14 @@ namespace System.Globalization {
|
|||
** The value is from calendar.nlp.
|
||||
============================================================================*/
|
||||
|
||||
internal virtual int CurrentEraValue
|
||||
protected virtual int CurrentEraValue
|
||||
{
|
||||
get
|
||||
{
|
||||
// The following code assumes that the current era value can not be -1.
|
||||
if (m_currentEraValue == -1) {
|
||||
Contract.Assert(BaseCalendarID > 0, "[Calendar.CurrentEraValue] Expected ID > 0");
|
||||
m_currentEraValue = CalendarData.GetCalendarData(BaseCalendarID).iCurrentEra;
|
||||
m_currentEraValue = CalendarData.[Friend]GetCalendarData(BaseCalendarID).[Friend]iCurrentEra;
|
||||
}
|
||||
return (m_currentEraValue);
|
||||
}
|
||||
|
@ -231,9 +231,9 @@ namespace System.Globalization {
|
|||
|
||||
public const int CurrentEra = 0;
|
||||
|
||||
internal int twoDigitYearMax = -1;
|
||||
protected int twoDigitYearMax = -1;
|
||||
|
||||
internal static Result<void> CheckAddResult(int64 ticks, DateTime minValue, DateTime maxValue) {
|
||||
static Result<void> CheckAddResult(int64 ticks, DateTime minValue, DateTime maxValue) {
|
||||
if (ticks < minValue.Ticks || ticks > maxValue.Ticks) {
|
||||
return .Err;
|
||||
/*throw new ArgumentException(
|
||||
|
@ -244,7 +244,7 @@ namespace System.Globalization {
|
|||
return .Ok;
|
||||
}
|
||||
|
||||
internal Result<DateTime> Add(DateTime time, double value, int scale) {
|
||||
Result<DateTime> Add(DateTime time, double value, int scale) {
|
||||
// From ECMA CLI spec, Partition III, section 3.27:
|
||||
//
|
||||
// If overflow occurs converting a floating-point type to an integer, or if the floating-point value
|
||||
|
@ -516,7 +516,7 @@ namespace System.Globalization {
|
|||
** So Week of year = (GetDayOfYear(time) + offset - 1) / 7 + 1
|
||||
============================================================================*/
|
||||
|
||||
internal Result<int> GetFirstDayWeekOfYear(DateTime time, int firstDayOfWeek) {
|
||||
Result<int> GetFirstDayWeekOfYear(DateTime time, int firstDayOfWeek) {
|
||||
int dayOfYear = Try!(GetDayOfYear(time)) - 1; // Make the day of year to be 0-based, so that 1/1 is day 0.
|
||||
// Calculate the day of week for the first day of the year.
|
||||
// dayOfWeek - (dayOfYear % 7) is the day of week for the first day of this year. Note that
|
||||
|
@ -755,7 +755,7 @@ namespace System.Globalization {
|
|||
|
||||
public abstract Result<DateTime> ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era);
|
||||
|
||||
internal virtual bool TryToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era, out DateTime result) {
|
||||
protected virtual bool TryToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era, out DateTime result) {
|
||||
result = DateTime.MinValue;
|
||||
switch (ToDateTime(year, month, day, hour, minute, second, millisecond, era))
|
||||
{
|
||||
|
@ -766,15 +766,15 @@ namespace System.Globalization {
|
|||
}
|
||||
}
|
||||
|
||||
internal virtual bool IsValidYear(int year, int era) {
|
||||
protected virtual bool IsValidYear(int year, int era) {
|
||||
return (year >= GetYear(MinSupportedDateTime).Get() && year <= GetYear(MaxSupportedDateTime).Get());
|
||||
}
|
||||
|
||||
internal virtual bool IsValidMonth(int year, int month, int era) {
|
||||
protected virtual bool IsValidMonth(int year, int month, int era) {
|
||||
return (IsValidYear(year, era) && month >= 1 && month <= GetMonthsInYear(year, era).Get());
|
||||
}
|
||||
|
||||
internal virtual bool IsValidDay(int year, int month, int day, int era)
|
||||
protected virtual bool IsValidDay(int year, int month, int day, int era)
|
||||
{
|
||||
return (IsValidMonth(year, month, era) && day >= 1 && day <= GetDaysInMonth(year, month, era).Get());
|
||||
}
|
||||
|
@ -822,7 +822,7 @@ namespace System.Globalization {
|
|||
|
||||
// Return the tick count corresponding to the given hour, minute, second.
|
||||
// Will check the if the parameters are valid.
|
||||
internal static Result<int64> TimeToTicks(int hour, int minute, int second, int millisecond)
|
||||
static Result<int64> TimeToTicks(int hour, int minute, int second, int millisecond)
|
||||
{
|
||||
if (hour >= 0 && hour < 24 && minute >= 0 && minute < 60 && second >=0 && second < 60)
|
||||
{
|
||||
|
@ -834,16 +834,16 @@ namespace System.Globalization {
|
|||
Environment.GetResourceString("ArgumentOutOfRange_Range"), 0, MillisPerSecond - 1));*/
|
||||
return .Err;
|
||||
}
|
||||
return Try!(TimeSpan.TimeToTicks(hour, minute, second)) + millisecond * TicksPerMillisecond;
|
||||
return Try!(TimeSpan.[Friend]TimeToTicks(hour, minute, second)) + millisecond * TicksPerMillisecond;
|
||||
}
|
||||
//throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("ArgumentOutOfRange_BadHourMinuteSecond"));
|
||||
return .Err;
|
||||
}
|
||||
|
||||
internal static int GetSystemTwoDigitYearSetting(int CalID, int defaultYearValue)
|
||||
protected static int GetSystemTwoDigitYearSetting(int CalID, int defaultYearValue)
|
||||
{
|
||||
// Call nativeGetTwoDigitYearMax
|
||||
int twoDigitYearMax = CalendarData.nativeGetTwoDigitYearMax(CalID);
|
||||
int twoDigitYearMax = CalendarData.[Friend]nativeGetTwoDigitYearMax(CalID);
|
||||
if (twoDigitYearMax < 0)
|
||||
{
|
||||
twoDigitYearMax = defaultYearValue;
|
||||
|
|
|
@ -29,42 +29,42 @@ namespace System.Globalization
|
|||
// WARNING: The type loader will rearrange class member offsets so the mscorwks!CalendarDataBaseObject
|
||||
// WARNING: must be manually structured to match the true loaded class layout
|
||||
//
|
||||
internal class CalendarData
|
||||
class CalendarData
|
||||
{
|
||||
// Max calendars
|
||||
internal const int MAX_CALENDARS = 23;
|
||||
const int MAX_CALENDARS = 23;
|
||||
|
||||
// Identity
|
||||
internal String sNativeName ~ delete _; // Calendar Name for the locale
|
||||
String sNativeName ~ delete _; // Calendar Name for the locale
|
||||
|
||||
// Formats
|
||||
internal String[] saShortDates ~ DeleteContainerAndItems!(_); // Short Data format, default first
|
||||
internal String[] saYearMonths ~ DeleteContainerAndItems!(_); // Year/Month Data format, default first
|
||||
internal String[] saLongDates ~ DeleteContainerAndItems!(_); // Long Data format, default first
|
||||
internal String sMonthDay ~ delete _; // Month/Day format
|
||||
String[] saShortDates ~ DeleteContainerAndItems!(_); // Short Data format, default first
|
||||
String[] saYearMonths ~ DeleteContainerAndItems!(_); // Year/Month Data format, default first
|
||||
String[] saLongDates ~ DeleteContainerAndItems!(_); // Long Data format, default first
|
||||
String sMonthDay ~ delete _; // Month/Day format
|
||||
|
||||
// Calendar Parts Names
|
||||
internal String[] saEraNames ~ DeleteContainerAndItems!(_); // Names of Eras
|
||||
internal String[] saAbbrevEraNames ~ DeleteContainerAndItems!(_); // Abbreviated Era Names
|
||||
internal String[] saAbbrevEnglishEraNames ~ DeleteContainerAndItems!(_); // Abbreviated Era Names in English
|
||||
internal String[] saDayNames ~ DeleteContainerAndItems!(_); // Day Names, null to use locale data, starts on Sunday
|
||||
internal String[] saAbbrevDayNames ~ DeleteContainerAndItems!(_); // Abbrev Day Names, null to use locale data, starts on Sunday
|
||||
internal String[] saSuperShortDayNames ~ DeleteContainerAndItems!(_); // Super short Day of week names
|
||||
internal String[] saMonthNames ~ DeleteContainerAndItems!(_); // Month Names (13)
|
||||
internal String[] saAbbrevMonthNames ~ DeleteContainerAndItems!(_); // Abbrev Month Names (13)
|
||||
internal String[] saMonthGenitiveNames ~ DeleteContainerAndItems!(_); // Genitive Month Names (13)
|
||||
internal String[] saAbbrevMonthGenitiveNames~ DeleteContainerAndItems!(_); // Genitive Abbrev Month Names (13)
|
||||
internal String[] saLeapYearMonthNames ~ DeleteContainerAndItems!(_); // Multiple strings for the month names in a leap year.
|
||||
String[] saEraNames ~ DeleteContainerAndItems!(_); // Names of Eras
|
||||
String[] saAbbrevEraNames ~ DeleteContainerAndItems!(_); // Abbreviated Era Names
|
||||
String[] saAbbrevEnglishEraNames ~ DeleteContainerAndItems!(_); // Abbreviated Era Names in English
|
||||
String[] saDayNames ~ DeleteContainerAndItems!(_); // Day Names, null to use locale data, starts on Sunday
|
||||
String[] saAbbrevDayNames ~ DeleteContainerAndItems!(_); // Abbrev Day Names, null to use locale data, starts on Sunday
|
||||
String[] saSuperShortDayNames ~ DeleteContainerAndItems!(_); // Super short Day of week names
|
||||
String[] saMonthNames ~ DeleteContainerAndItems!(_); // Month Names (13)
|
||||
String[] saAbbrevMonthNames ~ DeleteContainerAndItems!(_); // Abbrev Month Names (13)
|
||||
String[] saMonthGenitiveNames ~ DeleteContainerAndItems!(_); // Genitive Month Names (13)
|
||||
String[] saAbbrevMonthGenitiveNames~ DeleteContainerAndItems!(_); // Genitive Abbrev Month Names (13)
|
||||
String[] saLeapYearMonthNames ~ DeleteContainerAndItems!(_); // Multiple strings for the month names in a leap year.
|
||||
|
||||
// Integers at end to make marshaller happier
|
||||
internal int iTwoDigitYearMax=2029 ; // Max 2 digit year (for Y2K bug data entry)
|
||||
internal int iCurrentEra=0 ; // current era # (usually 1)
|
||||
int iTwoDigitYearMax=2029 ; // Max 2 digit year (for Y2K bug data entry)
|
||||
int iCurrentEra=0 ; // current era # (usually 1)
|
||||
|
||||
// Use overrides?
|
||||
internal bool bUseUserOverrides ; // True if we want user overrides.
|
||||
bool bUseUserOverrides ; // True if we want user overrides.
|
||||
|
||||
// Static invariant for the invariant locale
|
||||
internal static CalendarData Invariant ~ delete _;
|
||||
static CalendarData Invariant ~ delete _;
|
||||
|
||||
// Private constructor
|
||||
private this() {}
|
||||
|
@ -128,7 +128,7 @@ namespace System.Globalization
|
|||
//
|
||||
// Get a bunch of data for a calendar
|
||||
//
|
||||
internal this(String localeName, int calendarId, bool bUseUserOverrides)
|
||||
public this(String localeName, int calendarId, bool bUseUserOverrides)
|
||||
{
|
||||
String[] Clone(String[] strs)
|
||||
{
|
||||
|
@ -169,16 +169,16 @@ namespace System.Globalization
|
|||
|
||||
// Clean up the escaping of the formats
|
||||
|
||||
CultureData.ReescapeWin32Strings(this.saShortDates);
|
||||
CultureData.ReescapeWin32Strings(this.saLongDates);
|
||||
CultureData.ReescapeWin32Strings(this.saYearMonths);
|
||||
CultureData.ReescapeWin32String(this.sMonthDay);
|
||||
CultureData.[Friend]ReescapeWin32Strings(this.saShortDates);
|
||||
CultureData.[Friend]ReescapeWin32Strings(this.saLongDates);
|
||||
CultureData.[Friend]ReescapeWin32Strings(this.saYearMonths);
|
||||
CultureData.[Friend]ReescapeWin32String(this.sMonthDay);
|
||||
|
||||
if ((CalendarId)calendarId == CalendarId.TAIWAN)
|
||||
{
|
||||
// for Geo----al reasons, the ----ese native name should only be returned when
|
||||
// for ----ese SKU
|
||||
if (CultureInfo.IsTaiwanSku)
|
||||
if (CultureInfo.[Friend]IsTaiwanSku)
|
||||
{
|
||||
// We got the month/day names from the OS (same as gregorian), but the native name is wrong
|
||||
this.sNativeName = "\x4e2d\x83ef\x6c11\x570b\x66c6";
|
||||
|
@ -273,7 +273,7 @@ namespace System.Globalization
|
|||
// for Geo----al reasons, the ----ese native name should only be returned when
|
||||
// for ----ese SKU
|
||||
DeleteContainerAndItems!(this.saEraNames);
|
||||
if (CultureInfo.IsTaiwanSku)
|
||||
if (CultureInfo.[Friend]IsTaiwanSku)
|
||||
{
|
||||
//
|
||||
this.saEraNames = AllocStrings("\x4e2d\x83ef\x6c11\x570b");
|
||||
|
@ -381,7 +381,7 @@ namespace System.Globalization
|
|||
}
|
||||
}
|
||||
|
||||
internal static CalendarData GetCalendarData(int calendarId)
|
||||
static CalendarData GetCalendarData(int calendarId)
|
||||
{
|
||||
/*//
|
||||
// Get a calendar.
|
||||
|
@ -406,34 +406,34 @@ namespace System.Globalization
|
|||
{
|
||||
switch (calendarId)
|
||||
{
|
||||
case Calendar.CAL_GREGORIAN_US:
|
||||
case Calendar.[Friend]CAL_GREGORIAN_US:
|
||||
return "fa-IR"; // "fa-IR" Iran
|
||||
|
||||
case Calendar.CAL_JAPAN:
|
||||
case Calendar.[Friend]CAL_JAPAN:
|
||||
return "ja-JP"; // "ja-JP" Japan
|
||||
|
||||
case Calendar.CAL_TAIWAN:
|
||||
case Calendar.[Friend]CAL_TAIWAN:
|
||||
return "zh-TW"; // zh-TW Taiwan
|
||||
|
||||
case Calendar.CAL_KOREA:
|
||||
case Calendar.[Friend]CAL_KOREA:
|
||||
return "ko-KR"; // "ko-KR" Korea
|
||||
|
||||
case Calendar.CAL_HIJRI:
|
||||
case Calendar.CAL_GREGORIAN_ARABIC:
|
||||
case Calendar.CAL_UMALQURA:
|
||||
case Calendar.[Friend]CAL_HIJRI:
|
||||
case Calendar.[Friend]CAL_GREGORIAN_ARABIC:
|
||||
case Calendar.[Friend]CAL_UMALQURA:
|
||||
return "ar-SA"; // "ar-SA" Saudi Arabia
|
||||
|
||||
case Calendar.CAL_THAI:
|
||||
case Calendar.[Friend]CAL_THAI:
|
||||
return "th-TH"; // "th-TH" Thailand
|
||||
|
||||
case Calendar.CAL_HEBREW:
|
||||
case Calendar.[Friend]CAL_HEBREW:
|
||||
return "he-IL"; // "he-IL" Israel
|
||||
|
||||
case Calendar.CAL_GREGORIAN_ME_FRENCH:
|
||||
case Calendar.[Friend]CAL_GREGORIAN_ME_FRENCH:
|
||||
return "ar-DZ"; // "ar-DZ" Algeria
|
||||
|
||||
case Calendar.CAL_GREGORIAN_XLIT_ENGLISH:
|
||||
case Calendar.CAL_GREGORIAN_XLIT_FRENCH:
|
||||
case Calendar.[Friend]CAL_GREGORIAN_XLIT_ENGLISH:
|
||||
case Calendar.[Friend]CAL_GREGORIAN_XLIT_FRENCH:
|
||||
return "ar-IQ"; // "ar-IQ"; Iraq
|
||||
|
||||
default:
|
||||
|
@ -482,7 +482,7 @@ namespace System.Globalization
|
|||
|
||||
|
||||
|
||||
internal static int nativeGetTwoDigitYearMax(int calID)
|
||||
static int nativeGetTwoDigitYearMax(int calID)
|
||||
{
|
||||
Runtime.NotImplemented();
|
||||
}
|
||||
|
@ -494,7 +494,7 @@ namespace System.Globalization
|
|||
return true;
|
||||
}
|
||||
|
||||
internal static int nativeGetCalendars(String localeName, bool useUserOverride, int[] calendars)
|
||||
static int nativeGetCalendars(String localeName, bool useUserOverride, int[] calendars)
|
||||
{
|
||||
Runtime.NotImplemented();
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ namespace System.Globalization
|
|||
|
||||
}
|
||||
|
||||
internal void GetNFIValues(NumberFormatInfo nfi)
|
||||
void GetNFIValues(NumberFormatInfo nfi)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ namespace System.Globalization
|
|||
}
|
||||
}
|
||||
|
||||
internal Calendar DefaultCalendar
|
||||
Calendar DefaultCalendar
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -158,11 +158,11 @@ namespace System.Globalization
|
|||
return CultureInfo.GetCalendarInstance(defaultCalId);*/
|
||||
//Runtime.NotImplemented();
|
||||
// NotImplemented
|
||||
return CultureInfo.GetCalendarInstance(Calendar.CAL_GREGORIAN);
|
||||
return CultureInfo.[Friend]GetCalendarInstance(Calendar.[Friend]CAL_GREGORIAN);
|
||||
}
|
||||
}
|
||||
|
||||
internal StringView CultureName
|
||||
StringView CultureName
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -176,7 +176,7 @@ namespace System.Globalization
|
|||
}
|
||||
}
|
||||
|
||||
internal String[] LongTimes
|
||||
String[] LongTimes
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -205,7 +205,7 @@ namespace System.Globalization
|
|||
}
|
||||
}
|
||||
|
||||
internal String[] ShortTimes
|
||||
String[] ShortTimes
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ namespace System.Globalization
|
|||
}
|
||||
}
|
||||
|
||||
internal static CultureData GetCultureData(StringView cultureName, bool useUserOverride)
|
||||
static CultureData GetCultureData(StringView cultureName, bool useUserOverride)
|
||||
{
|
||||
CultureData culture = CreateCultureData(cultureName, useUserOverride);
|
||||
return culture;
|
||||
|
@ -290,7 +290,7 @@ namespace System.Globalization
|
|||
//
|
||||
// We don't build the stringbuilder unless we find something to change
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
static internal void ReescapeWin32String(String inStr)
|
||||
static void ReescapeWin32String(String inStr)
|
||||
{
|
||||
// If we don't have data, then don't try anything
|
||||
if (inStr == null)
|
||||
|
@ -342,7 +342,7 @@ namespace System.Globalization
|
|||
}
|
||||
}
|
||||
|
||||
static internal void ReescapeWin32Strings(String[] inArray)
|
||||
static void ReescapeWin32Strings(String[] inArray)
|
||||
{
|
||||
if (inArray != null)
|
||||
{
|
||||
|
@ -353,7 +353,7 @@ namespace System.Globalization
|
|||
}
|
||||
}
|
||||
|
||||
internal bool UseUserOverride
|
||||
bool UseUserOverride
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -361,7 +361,7 @@ namespace System.Globalization
|
|||
}
|
||||
}
|
||||
|
||||
internal bool IsSupplementalCustomCulture
|
||||
bool IsSupplementalCustomCulture
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -376,9 +376,9 @@ namespace System.Globalization
|
|||
Environment.OSVersion.Version < Version(6, 2); // Win7 is 6.1.Build.Revision so we have to check for anything less than 6.2
|
||||
}
|
||||
|
||||
internal CalendarData GetCalendar(int calendarId)
|
||||
CalendarData GetCalendar(int calendarId)
|
||||
{
|
||||
Debug.Assert(calendarId > 0 && calendarId <= CalendarData.MAX_CALENDARS,
|
||||
Debug.Assert(calendarId > 0 && calendarId <= CalendarData.[Friend]MAX_CALENDARS,
|
||||
"[CultureData.GetCalendar] Expect calendarId to be in a valid range");
|
||||
|
||||
// arrays are 0 based, calendarIds are 1 based
|
||||
|
@ -387,7 +387,7 @@ namespace System.Globalization
|
|||
// Have to have calendars
|
||||
if (calendars == null)
|
||||
{
|
||||
calendars = new CalendarData[CalendarData.MAX_CALENDARS];
|
||||
calendars = new CalendarData[CalendarData.[Friend]MAX_CALENDARS];
|
||||
}
|
||||
|
||||
// we need the following local variable to avoid returning null
|
||||
|
@ -417,77 +417,77 @@ namespace System.Globalization
|
|||
return calendarData;
|
||||
}
|
||||
|
||||
internal String[] ShortDates(int calendarId)
|
||||
String[] ShortDates(int calendarId)
|
||||
{
|
||||
return GetCalendar(calendarId).saShortDates;
|
||||
return GetCalendar(calendarId).[Friend]saShortDates;
|
||||
}
|
||||
|
||||
internal String[] LongDates(int calendarId)
|
||||
String[] LongDates(int calendarId)
|
||||
{
|
||||
return GetCalendar(calendarId).saLongDates;
|
||||
return GetCalendar(calendarId).[Friend]saLongDates;
|
||||
}
|
||||
|
||||
// (user can override) date year/month format.
|
||||
internal String[] YearMonths(int calendarId)
|
||||
String[] YearMonths(int calendarId)
|
||||
{
|
||||
return GetCalendar(calendarId).saYearMonths;
|
||||
return GetCalendar(calendarId).[Friend]saYearMonths;
|
||||
}
|
||||
|
||||
// day names
|
||||
internal String[] DayNames(int calendarId)
|
||||
String[] DayNames(int calendarId)
|
||||
{
|
||||
return GetCalendar(calendarId).saDayNames;
|
||||
return GetCalendar(calendarId).[Friend]saDayNames;
|
||||
}
|
||||
|
||||
// abbreviated day names
|
||||
internal String[] AbbreviatedDayNames(int calendarId)
|
||||
String[] AbbreviatedDayNames(int calendarId)
|
||||
{
|
||||
// Get abbreviated day names for this calendar from the OS if necessary
|
||||
return GetCalendar(calendarId).saAbbrevDayNames;
|
||||
return GetCalendar(calendarId).[Friend]saAbbrevDayNames;
|
||||
}
|
||||
|
||||
// The super short day names
|
||||
internal String[] SuperShortDayNames(int calendarId)
|
||||
String[] SuperShortDayNames(int calendarId)
|
||||
{
|
||||
return GetCalendar(calendarId).saSuperShortDayNames;
|
||||
return GetCalendar(calendarId).[Friend]saSuperShortDayNames;
|
||||
}
|
||||
|
||||
// month names
|
||||
internal String[] MonthNames(int calendarId)
|
||||
String[] MonthNames(int calendarId)
|
||||
{
|
||||
return GetCalendar(calendarId).saMonthNames;
|
||||
return GetCalendar(calendarId).[Friend]saMonthNames;
|
||||
}
|
||||
|
||||
// Genitive month names
|
||||
internal String[] GenitiveMonthNames(int calendarId)
|
||||
String[] GenitiveMonthNames(int calendarId)
|
||||
{
|
||||
return GetCalendar(calendarId).saMonthGenitiveNames;
|
||||
return GetCalendar(calendarId).[Friend]saMonthGenitiveNames;
|
||||
}
|
||||
|
||||
// month names
|
||||
internal String[] AbbreviatedMonthNames(int calendarId)
|
||||
String[] AbbreviatedMonthNames(int calendarId)
|
||||
{
|
||||
return GetCalendar(calendarId).saAbbrevMonthNames;
|
||||
return GetCalendar(calendarId).[Friend]saAbbrevMonthNames;
|
||||
}
|
||||
|
||||
// Genitive month names
|
||||
internal String[] AbbreviatedGenitiveMonthNames(int calendarId)
|
||||
String[] AbbreviatedGenitiveMonthNames(int calendarId)
|
||||
{
|
||||
return GetCalendar(calendarId).saAbbrevMonthGenitiveNames;
|
||||
return GetCalendar(calendarId).[Friend]saAbbrevMonthGenitiveNames;
|
||||
}
|
||||
|
||||
// Leap year month names
|
||||
// Note: This only applies to Hebrew, and it basically adds a "1" to the 6th month name
|
||||
// the non-leap names skip the 7th name in the normal month name array
|
||||
internal String[] LeapYearMonthNames(int calendarId)
|
||||
String[] LeapYearMonthNames(int calendarId)
|
||||
{
|
||||
return GetCalendar(calendarId).saLeapYearMonthNames;
|
||||
return GetCalendar(calendarId).[Friend]saLeapYearMonthNames;
|
||||
}
|
||||
|
||||
// month/day format (single string, no override)
|
||||
internal String MonthDay(int calendarId)
|
||||
String MonthDay(int calendarId)
|
||||
{
|
||||
return GetCalendar(calendarId).sMonthDay;
|
||||
return GetCalendar(calendarId).[Friend]sMonthDay;
|
||||
}
|
||||
|
||||
void DoGetLocaleInfo(uint lctype, String outStr)
|
||||
|
@ -560,7 +560,7 @@ namespace System.Globalization
|
|||
GetSeparator(format, "Hhms", outStr);
|
||||
}
|
||||
|
||||
internal String TimeSeparator
|
||||
String TimeSeparator
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace System.Globalization
|
|||
private static CultureInfo tlCurrentUICulture;
|
||||
|
||||
String m_name ~ delete _;
|
||||
internal bool m_isInherited;
|
||||
bool m_isInherited;
|
||||
DateTimeFormatInfo dateTimeInfo ~ delete _;
|
||||
CultureData m_cultureData ~ delete _;
|
||||
Calendar calendar ~ delete _;
|
||||
|
@ -29,13 +29,13 @@ namespace System.Globalization
|
|||
|
||||
// LOCALE constants of interest to us internally and privately for LCID functions
|
||||
// (ie: avoid using these and use names if possible)
|
||||
internal const int LOCALE_NEUTRAL = 0x0000;
|
||||
private const int LOCALE_USER_DEFAULT = 0x0400;
|
||||
private const int LOCALE_SYSTEM_DEFAULT = 0x0800;
|
||||
internal const int LOCALE_CUSTOM_DEFAULT = 0x0c00;
|
||||
internal const int LOCALE_CUSTOM_UNSPECIFIED = 0x1000;
|
||||
internal const int LOCALE_INVARIANT = 0x007F;
|
||||
private const int LOCALE_TRADITIONAL_SPANISH = 0x040a;
|
||||
private const int LOCALE_NEUTRAL = 0x0000;
|
||||
private const int LOCALE_USER_DEFAULT = 0x0400;
|
||||
private const int LOCALE_SYSTEM_DEFAULT = 0x0800;
|
||||
private const int LOCALE_CUSTOM_DEFAULT = 0x0c00;
|
||||
private const int LOCALE_CUSTOM_UNSPECIFIED = 0x1000;
|
||||
private const int LOCALE_INVARIANT = 0x007F;
|
||||
private const int LOCALE_TRADITIONAL_SPANISH = 0x040a;
|
||||
|
||||
public static CultureInfo DefaultThreadCurrentCulture
|
||||
{
|
||||
|
@ -121,10 +121,10 @@ namespace System.Globalization
|
|||
//Contract.Assert(this.m_cultureData.CalendarIds.Length > 0, "this.m_cultureData.CalendarIds.Length > 0");
|
||||
// Get the default calendar for this culture. Note that the value can be
|
||||
// from registry if this is a user default culture.
|
||||
Calendar newObj = this.m_cultureData.DefaultCalendar;
|
||||
Calendar newObj = this.m_cultureData.[Friend]DefaultCalendar;
|
||||
|
||||
Interlocked.Fence();
|
||||
newObj.SetReadOnlyState(m_isReadOnly);
|
||||
newObj.[Friend]SetReadOnlyState(m_isReadOnly);
|
||||
calendar = newObj;
|
||||
}
|
||||
return (calendar);
|
||||
|
@ -239,14 +239,14 @@ namespace System.Globalization
|
|||
public this(String name, bool useUserOverride)
|
||||
{
|
||||
// Get our data providing record
|
||||
this.m_cultureData = CultureData.GetCultureData(name, useUserOverride);
|
||||
this.m_cultureData = CultureData.[Friend]GetCultureData(name, useUserOverride);
|
||||
|
||||
if (this.m_cultureData == null) {
|
||||
//throw new CultureNotFoundException("name", name, Environment.GetResourceString("Argument_CultureNotSupported"));
|
||||
Runtime.FatalError();
|
||||
}
|
||||
|
||||
this.m_name = new String(this.m_cultureData.CultureName);
|
||||
this.m_name = new String(this.m_cultureData.[Friend]CultureName);
|
||||
this.m_isInherited = (this.GetType() != typeof(System.Globalization.CultureInfo));
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ namespace System.Globalization
|
|||
|
||||
private static volatile bool s_isTaiwanSku;
|
||||
private static volatile bool s_haveIsTaiwanSku;
|
||||
internal static bool IsTaiwanSku
|
||||
static bool IsTaiwanSku
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -326,7 +326,7 @@ namespace System.Globalization
|
|||
|
||||
// Helper function both both overloads of GetCachedReadOnlyCulture. If lcid is 0, we use the name.
|
||||
// If lcid is -1, use the altName and create one of those special SQL cultures.
|
||||
internal static CultureInfo GetCultureInfoHelper(int lcid, StringView name, StringView altName)
|
||||
static CultureInfo GetCultureInfoHelper(int lcid, StringView name, StringView altName)
|
||||
{
|
||||
return new CultureInfo();
|
||||
}
|
||||
|
@ -336,9 +336,9 @@ namespace System.Globalization
|
|||
//NotImplemented
|
||||
}
|
||||
|
||||
internal static Calendar GetCalendarInstance(int calType)
|
||||
static Calendar GetCalendarInstance(int calType)
|
||||
{
|
||||
if (calType==Calendar.CAL_GREGORIAN) {
|
||||
if (calType==Calendar.[Friend]CAL_GREGORIAN) {
|
||||
return new GregorianCalendar();
|
||||
}
|
||||
Runtime.NotImplemented();
|
||||
|
|
|
@ -120,25 +120,24 @@ namespace System {
|
|||
*/
|
||||
|
||||
//This class contains only static members and does not require the serializable attribute.
|
||||
internal static
|
||||
class DateTimeFormat {
|
||||
static class DateTimeFormat {
|
||||
|
||||
internal const int MaxSecondsFractionDigits = 7;
|
||||
internal static readonly TimeSpan NullOffset = TimeSpan.MinValue;
|
||||
const int MaxSecondsFractionDigits = 7;
|
||||
static readonly TimeSpan NullOffset = TimeSpan.MinValue;
|
||||
|
||||
internal static char8[] allStandardFormats = new char8[]
|
||||
static char8[] allStandardFormats = new char8[]
|
||||
{
|
||||
'd', 'D', 'f', 'F', 'g', 'G',
|
||||
'm', 'M', 'o', 'O', 'r', 'R',
|
||||
's', 't', 'T', 'u', 'U', 'y', 'Y',
|
||||
} ~ delete _;
|
||||
|
||||
internal const String RoundtripFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK";
|
||||
internal const String RoundtripDateTimeUnfixed = "yyyy'-'MM'-'ddTHH':'mm':'ss zzz";
|
||||
const String RoundtripFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK";
|
||||
const String RoundtripDateTimeUnfixed = "yyyy'-'MM'-'ddTHH':'mm':'ss zzz";
|
||||
|
||||
private const int DEFAULT_ALL_DATETIMES_SIZE = 132;
|
||||
|
||||
internal static String[] fixedNumberFormats = new String[] {
|
||||
static String[] fixedNumberFormats = new String[] {
|
||||
"0",
|
||||
"00",
|
||||
"000",
|
||||
|
@ -162,12 +161,12 @@ namespace System {
|
|||
// The function can format to Int32.MaxValue.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
internal static void FormatDigits(String outputBuffer, int value, int len) {
|
||||
static void FormatDigits(String outputBuffer, int value, int len) {
|
||||
Contract.Assert(value >= 0, "DateTimeFormat.FormatDigits(): value >= 0");
|
||||
FormatDigits(outputBuffer, value, len, false);
|
||||
}
|
||||
|
||||
internal static void FormatDigits(String outputBuffer, int value, int len, bool overrideLengthLimit) {
|
||||
static void FormatDigits(String outputBuffer, int value, int len, bool overrideLengthLimit) {
|
||||
Contract.Assert(value >= 0, "DateTimeFormat.FormatDigits(): value >= 0");
|
||||
|
||||
var len;
|
||||
|
@ -206,7 +205,7 @@ namespace System {
|
|||
digits.ToString(outputBuffer);
|
||||
}
|
||||
|
||||
internal static int ParseRepeatPattern(StringView format, int pos, char8 patternChar)
|
||||
static int ParseRepeatPattern(StringView format, int pos, char8 patternChar)
|
||||
{
|
||||
int len = format.Length;
|
||||
int index = pos + 1;
|
||||
|
@ -295,7 +294,7 @@ namespace System {
|
|||
// The pos should point to a quote character. This method will
|
||||
// get the string encloed by the quote character.
|
||||
//
|
||||
internal static Result<int> ParseQuoteString(StringView format, int pos, String result)
|
||||
static Result<int> ParseQuoteString(StringView format, int pos, String result)
|
||||
{
|
||||
var pos;
|
||||
|
||||
|
@ -356,7 +355,7 @@ namespace System {
|
|||
// Return value of -1 means 'pos' is already at the end of the 'format' string.
|
||||
// Otherwise, return value is the int value of the next character.
|
||||
//
|
||||
internal static int ParseNextChar(StringView format, int pos)
|
||||
static int ParseNextChar(StringView format, int pos)
|
||||
{
|
||||
if (pos >= format.Length - 1)
|
||||
{
|
||||
|
@ -439,7 +438,7 @@ namespace System {
|
|||
Calendar cal = dtfi.Calendar;
|
||||
// This is a flag to indicate if we are format the dates using Hebrew calendar.
|
||||
|
||||
bool isHebrewCalendar = (cal.ID == Calendar.CAL_HEBREW);
|
||||
bool isHebrewCalendar = (cal.[Friend]ID == Calendar.[Friend]CAL_HEBREW);
|
||||
// This is a flag to indicate if we are formating hour/minute/second only.
|
||||
bool bTimeOnly = true;
|
||||
|
||||
|
@ -480,7 +479,7 @@ namespace System {
|
|||
case 'F':
|
||||
tokenLen = ParseRepeatPattern(format, i, ch);
|
||||
if (tokenLen <= MaxSecondsFractionDigits) {
|
||||
int64 fraction = (dateTime.Ticks % Calendar.TicksPerSecond);
|
||||
int64 fraction = (dateTime.Ticks % Calendar.[Friend]TicksPerSecond);
|
||||
fraction = fraction / (int64)Math.Pow(10, 7 - tokenLen);
|
||||
if (ch == 'f') {
|
||||
((int)fraction).ToString(result, fixedNumberFormats[tokenLen - 1], CultureInfo.InvariantCulture);
|
||||
|
@ -585,7 +584,7 @@ namespace System {
|
|||
FormatHebrewMonthName(dateTime, month, tokenLen, dtfi, result);
|
||||
} else {
|
||||
if ((dtfi.FormatFlags & DateTimeFormatFlags.UseGenitiveMonth) != 0 && tokenLen >= 4) {
|
||||
dtfi.internalGetMonthName(
|
||||
dtfi.[Friend]internalGetMonthName(
|
||||
month,
|
||||
IsUseGenitiveForm(format, i, tokenLen, 'd')? MonthNameStyles.Genitive : MonthNameStyles.Regular,
|
||||
false, result);
|
||||
|
@ -607,7 +606,7 @@ namespace System {
|
|||
if (dtfi.HasForceTwoDigitYears) {
|
||||
FormatDigits(result, year, tokenLen <= 2 ? tokenLen : 2);
|
||||
}
|
||||
else if (cal.ID == Calendar.CAL_HEBREW) {
|
||||
else if (cal.[Friend]ID == Calendar.[Friend]CAL_HEBREW) {
|
||||
HebrewFormatDigits(result, year);
|
||||
}
|
||||
else {
|
||||
|
@ -715,10 +714,10 @@ namespace System {
|
|||
if (dateTimeFormat) {
|
||||
// No offset. The instance is a DateTime and the output should be the local time zone
|
||||
|
||||
if (timeOnly && dateTime.Ticks < Calendar.TicksPerDay) {
|
||||
if (timeOnly && dateTime.Ticks < Calendar.[Friend]TicksPerDay) {
|
||||
// For time only format and a time only input, the time offset on 0001/01/01 is less
|
||||
// accurate than the system's current offset because of daylight saving time.
|
||||
offset = TimeZoneInfo.GetLocalUtcOffset(DateTime.Now, TimeZoneInfoOptions.NoThrowOnInvalidTime);
|
||||
offset = TimeZoneInfo.[Friend]GetLocalUtcOffset(DateTime.Now, TimeZoneInfoOptions.NoThrowOnInvalidTime);
|
||||
} else if (dateTime.Kind == DateTimeKind.Utc) {
|
||||
#if FEATURE_CORECLR
|
||||
offset = TimeSpan.Zero;
|
||||
|
@ -730,10 +729,10 @@ namespace System {
|
|||
// explicitly emit the local time offset, which we can do by removing the UTC flag.
|
||||
InvalidFormatForUtc(format, dateTime);
|
||||
dateTime = DateTime.SpecifyKind(dateTime, DateTimeKind.Local);
|
||||
offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
|
||||
offset = TimeZoneInfo.[Friend]GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
|
||||
#endif // FEATURE_CORECLR
|
||||
} else {
|
||||
offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
|
||||
offset = TimeZoneInfo.[Friend]GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
|
||||
}
|
||||
}
|
||||
if (offset >= TimeSpan.Zero) {
|
||||
|
@ -773,7 +772,7 @@ namespace System {
|
|||
switch (dateTime.Kind) {
|
||||
case DateTimeKind.Local:
|
||||
// This should output the local offset, e.g. "-07:30"
|
||||
offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
|
||||
offset = TimeZoneInfo.[Friend]GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
|
||||
// fall through to shared time zone output code
|
||||
break;
|
||||
case DateTimeKind.Utc:
|
||||
|
@ -798,7 +797,7 @@ namespace System {
|
|||
}
|
||||
|
||||
|
||||
internal static Result<void> GetRealFormat(StringView format, DateTimeFormatInfo dtfi, String realFormat)
|
||||
static Result<void> GetRealFormat(StringView format, DateTimeFormatInfo dtfi, String realFormat)
|
||||
{
|
||||
switch (format[0])
|
||||
{
|
||||
|
@ -916,12 +915,12 @@ namespace System {
|
|||
return .Ok;
|
||||
}
|
||||
|
||||
internal static void Format(DateTime dateTime, StringView format, DateTimeFormatInfo dtfi, String outStr)
|
||||
static void Format(DateTime dateTime, StringView format, DateTimeFormatInfo dtfi, String outStr)
|
||||
{
|
||||
Format(dateTime, format, dtfi, NullOffset, outStr);
|
||||
}
|
||||
|
||||
internal static void Format(DateTime dateTime, StringView format, DateTimeFormatInfo dtfi, TimeSpan offset, String outStr)
|
||||
static void Format(DateTime dateTime, StringView format, DateTimeFormatInfo dtfi, TimeSpan offset, String outStr)
|
||||
{
|
||||
StringView useFormat = format;
|
||||
|
||||
|
@ -933,7 +932,7 @@ namespace System {
|
|||
if (format.IsEmpty)
|
||||
{
|
||||
bool timeOnlySpecialCase = false;
|
||||
if (dateTime.Ticks < Calendar.TicksPerDay) {
|
||||
if (dateTime.Ticks < Calendar.[Friend]TicksPerDay) {
|
||||
// If the time is less than 1 day, consider it as time of day.
|
||||
// Just print out the short time format.
|
||||
//
|
||||
|
@ -947,14 +946,14 @@ namespace System {
|
|||
// thrown when we try to get the Japanese year for Gregorian year 0001.
|
||||
// Therefore, the workaround allows them to call ToString() for time of day from a DateTime by
|
||||
// formatting as ISO 8601 format.
|
||||
switch (dtfi.Calendar.ID) {
|
||||
case Calendar.CAL_JAPAN:
|
||||
case Calendar.CAL_TAIWAN:
|
||||
case Calendar.CAL_HIJRI:
|
||||
case Calendar.CAL_HEBREW:
|
||||
case Calendar.CAL_JULIAN:
|
||||
case Calendar.CAL_UMALQURA:
|
||||
case Calendar.CAL_PERSIAN:
|
||||
switch (dtfi.Calendar.[Friend]ID) {
|
||||
case Calendar.[Friend]CAL_JAPAN:
|
||||
case Calendar.[Friend]CAL_TAIWAN:
|
||||
case Calendar.[Friend]CAL_HIJRI:
|
||||
case Calendar.[Friend]CAL_HEBREW:
|
||||
case Calendar.[Friend]CAL_JULIAN:
|
||||
case Calendar.[Friend]CAL_UMALQURA:
|
||||
case Calendar.[Friend]CAL_PERSIAN:
|
||||
timeOnlySpecialCase = true;
|
||||
dtfi = DateTimeFormatInfo.InvariantInfo;
|
||||
break;
|
||||
|
@ -992,7 +991,7 @@ namespace System {
|
|||
FormatCustomized(dateTime, useFormat, dtfi, offset, outStr);
|
||||
}
|
||||
|
||||
internal static Result<void> GetAllDateTimes(DateTime dateTime, char8 format, DateTimeFormatInfo dtfi, List<String> outResults)
|
||||
static Result<void> GetAllDateTimes(DateTime dateTime, char8 format, DateTimeFormatInfo dtfi, List<String> outResults)
|
||||
{
|
||||
Contract.Requires(dtfi != null);
|
||||
//String [] allFormats = null;
|
||||
|
@ -1048,7 +1047,7 @@ namespace System {
|
|||
return .Ok;
|
||||
}
|
||||
|
||||
internal static String[] GetAllDateTimes(DateTime dateTime, DateTimeFormatInfo dtfi)
|
||||
static String[] GetAllDateTimes(DateTime dateTime, DateTimeFormatInfo dtfi)
|
||||
{
|
||||
List<String> results = new List<String>(DEFAULT_ALL_DATETIMES_SIZE);
|
||||
for (int i = 0; i < allStandardFormats.Count; i++)
|
||||
|
@ -1062,14 +1061,14 @@ namespace System {
|
|||
|
||||
// This is a placeholder for an MDA to detect when the user is using a
|
||||
// local DateTime with a format that will be interpreted as UTC.
|
||||
internal static void InvalidFormatForLocal(StringView format, DateTime dateTime)
|
||||
static void InvalidFormatForLocal(StringView format, DateTime dateTime)
|
||||
{
|
||||
}
|
||||
|
||||
// This is an MDA for cases when the user is using a local format with
|
||||
// a Utc DateTime.
|
||||
|
||||
internal static void InvalidFormatForUtc(StringView format, DateTime dateTime) {
|
||||
static void InvalidFormatForUtc(StringView format, DateTime dateTime) {
|
||||
#if MDA_SUPPORTED
|
||||
Mda.DateTimeInvalidLocalFormat();
|
||||
#endif
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
using System.Collections.Generic;
|
||||
namespace System.Globalization
|
||||
{
|
||||
internal enum MonthNameStyles {
|
||||
enum MonthNameStyles {
|
||||
Regular = 0x00000000,
|
||||
Genitive = 0x00000001,
|
||||
LeapYear = 0x00000002,
|
||||
}
|
||||
|
||||
internal enum DateTimeFormatFlags {
|
||||
enum DateTimeFormatFlags {
|
||||
None = 0x00000000,
|
||||
UseGenitiveMonth = 0x00000001,
|
||||
UseLeapYearMonth = 0x00000002,
|
||||
|
@ -35,7 +35,7 @@ namespace System.Globalization
|
|||
private CultureData m_cultureData;
|
||||
|
||||
// The culture name used to create this DTFI.
|
||||
internal String m_name = null;
|
||||
private String m_name = null;
|
||||
|
||||
// The language name of the culture used to create this DTFI.
|
||||
private String m_langName = null;
|
||||
|
@ -53,49 +53,49 @@ namespace System.Globalization
|
|||
//
|
||||
|
||||
//NotImpl: Shouldn't be initialized
|
||||
internal String amDesignator = "AM";
|
||||
internal String pmDesignator = "PM";
|
||||
internal String dateSeparator = "/"; // derived from short date (whidbey expects, arrowhead doesn't)
|
||||
internal String generalShortTimePattern = null; // short date + short time (whidbey expects, arrowhead doesn't)
|
||||
internal String generalLongTimePattern = null; // short date + long time (whidbey expects, arrowhead doesn't)
|
||||
internal String timeSeparator = ":"; // derived from long time (whidbey expects, arrowhead doesn't)
|
||||
internal String monthDayPattern = null;
|
||||
internal String dateTimeOffsetPattern = null;
|
||||
String amDesignator = "AM";
|
||||
String pmDesignator = "PM";
|
||||
String dateSeparator = "/"; // derived from short date (whidbey expects, arrowhead doesn't)
|
||||
String generalShortTimePattern = null; // short date + short time (whidbey expects, arrowhead doesn't)
|
||||
String generalLongTimePattern = null; // short date + long time (whidbey expects, arrowhead doesn't)
|
||||
String timeSeparator = ":"; // derived from long time (whidbey expects, arrowhead doesn't)
|
||||
String monthDayPattern = null;
|
||||
String dateTimeOffsetPattern = null;
|
||||
|
||||
//
|
||||
// The following are constant values.
|
||||
//
|
||||
internal const String rfc1123Pattern = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
|
||||
const String rfc1123Pattern = "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'";
|
||||
|
||||
// The sortable pattern is based on ISO 8601.
|
||||
internal const String sortableDateTimePattern = "yyyy'-'MM'-'dd'T'HH':'mm':'ss";
|
||||
internal const String universalSortableDateTimePattern = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'";
|
||||
const String sortableDateTimePattern = "yyyy'-'MM'-'dd'T'HH':'mm':'ss";
|
||||
const String universalSortableDateTimePattern = "yyyy'-'MM'-'dd HH':'mm':'ss'Z'";
|
||||
|
||||
//
|
||||
// The following are affected by calendar settings.
|
||||
//
|
||||
internal Calendar calendar = null;
|
||||
Calendar calendar = null;
|
||||
|
||||
internal int firstDayOfWeek = -1;
|
||||
internal int calendarWeekRule = -1;
|
||||
int firstDayOfWeek = -1;
|
||||
int calendarWeekRule = -1;
|
||||
|
||||
internal String fullDateTimePattern = null; // long date + long time (whidbey expects, arrowhead doesn't)
|
||||
String fullDateTimePattern = null; // long date + long time (whidbey expects, arrowhead doesn't)
|
||||
|
||||
internal String[] abbreviatedDayNames = null;
|
||||
String[] abbreviatedDayNames = null;
|
||||
|
||||
internal String[] m_superShortDayNames = null;
|
||||
String[] m_superShortDayNames = null;
|
||||
|
||||
internal String[] dayNames = null;
|
||||
internal String[] abbreviatedMonthNames = null;
|
||||
internal String[] monthNames = null;
|
||||
String[] dayNames = null;
|
||||
String[] abbreviatedMonthNames = null;
|
||||
String[] monthNames = null;
|
||||
// Cache the genitive month names that we retrieve from the data table.
|
||||
internal String[] genitiveMonthNames = null;
|
||||
String[] genitiveMonthNames = null;
|
||||
|
||||
// Cache the abbreviated genitive month names that we retrieve from the data table.
|
||||
internal String[] m_genitiveAbbreviatedMonthNames = null;
|
||||
String[] m_genitiveAbbreviatedMonthNames = null;
|
||||
|
||||
// Cache the month names of a leap year that we retrieve from the data table.
|
||||
internal String[] leapYearMonthNames = null;
|
||||
String[] leapYearMonthNames = null;
|
||||
|
||||
// For our "patterns" arrays we have 2 variables, a string and a string[]
|
||||
//
|
||||
|
@ -104,36 +104,36 @@ namespace System.Globalization
|
|||
// When we initially construct our string[], we set the string to string[0]
|
||||
|
||||
// The "default" Date/time patterns
|
||||
internal String longDatePattern = "dddd, MMMM d, yyyy";
|
||||
internal String shortDatePattern = "M/d/yyyy";
|
||||
internal String yearMonthPattern = "MMMM yyyy";
|
||||
internal String longTimePattern = null;
|
||||
internal String shortTimePattern = null;
|
||||
String longDatePattern = "dddd, MMMM d, yyyy";
|
||||
String shortDatePattern = "M/d/yyyy";
|
||||
String yearMonthPattern = "MMMM yyyy";
|
||||
String longTimePattern = null;
|
||||
String shortTimePattern = null;
|
||||
|
||||
// These are Whidbey-serialization compatable arrays (eg: default not included)
|
||||
// "all" is a bit of a misnomer since the "default" pattern stored above isn't
|
||||
// necessarily a member of the list
|
||||
private String[] allYearMonthPatterns = null; // This was wasn't serialized in Whidbey
|
||||
internal String[] allShortDatePatterns = null;
|
||||
internal String[] allLongDatePatterns = null;
|
||||
internal String[] allShortTimePatterns = null;
|
||||
internal String[] allLongTimePatterns = null;
|
||||
String[] allYearMonthPatterns = null; // This was wasn't serialized in Whidbey
|
||||
String[] allShortDatePatterns = null;
|
||||
String[] allLongDatePatterns = null;
|
||||
String[] allShortTimePatterns = null;
|
||||
String[] allLongTimePatterns = null;
|
||||
|
||||
// Cache the era names for this DateTimeFormatInfo instance.
|
||||
internal String[] m_eraNames = null;
|
||||
internal String[] m_abbrevEraNames = null;
|
||||
internal String[] m_abbrevEnglishEraNames = null;
|
||||
String[] m_eraNames = null;
|
||||
String[] m_abbrevEraNames = null;
|
||||
String[] m_abbrevEnglishEraNames = null;
|
||||
|
||||
internal int[] optionalCalendars = null;
|
||||
int[] optionalCalendars = null;
|
||||
|
||||
private const int DEFAULT_ALL_DATETIMES_SIZE = 132;
|
||||
|
||||
// CultureInfo updates this
|
||||
internal bool m_isReadOnly=false;
|
||||
bool m_isReadOnly=false;
|
||||
|
||||
// This flag gives hints about if formatting/parsing should perform special code path for things like
|
||||
// genitive form or leap year month names.
|
||||
internal DateTimeFormatFlags formatFlags = DateTimeFormatFlags.NotInitialized;
|
||||
DateTimeFormatFlags formatFlags = DateTimeFormatFlags.NotInitialized;
|
||||
//internal static bool preferExistingTokens = InitPreferExistingTokens();
|
||||
|
||||
List<Object> ownedObjects = new .() ~ DeleteContainerAndItems!(_);
|
||||
|
@ -166,7 +166,7 @@ namespace System.Globalization
|
|||
get
|
||||
{
|
||||
CultureInfo culture = CultureInfo.CurrentCulture;
|
||||
if (!culture.m_isInherited)
|
||||
if (!culture.[Friend]m_isInherited)
|
||||
{
|
||||
DateTimeFormatInfo info = culture.[Friend]dateTimeInfo;
|
||||
if (info != null) {
|
||||
|
@ -183,7 +183,7 @@ namespace System.Globalization
|
|||
if (invariantInfo == null)
|
||||
{
|
||||
DateTimeFormatInfo info = new DateTimeFormatInfo();
|
||||
info.Calendar.SetReadOnlyState(true);
|
||||
info.Calendar.[Friend]SetReadOnlyState(true);
|
||||
info.m_isReadOnly = true;
|
||||
invariantInfo = info;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ namespace System.Globalization
|
|||
{
|
||||
if (timeSeparator == null)
|
||||
{
|
||||
timeSeparator = this.m_cultureData.TimeSeparator;
|
||||
timeSeparator = this.m_cultureData.[Friend]TimeSeparator;
|
||||
}
|
||||
return timeSeparator;
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ namespace System.Globalization
|
|||
{
|
||||
if (this.monthDayPattern == null)
|
||||
{
|
||||
this.monthDayPattern = this.m_cultureData.MonthDay(Calendar.ID);
|
||||
this.monthDayPattern = this.m_cultureData.[Friend]MonthDay(Calendar.ID);
|
||||
}
|
||||
//Contract.Assert(this.monthDayPattern != null, "DateTimeFormatInfo.MonthDayPattern, monthDayPattern != null");
|
||||
return (this.monthDayPattern);
|
||||
|
@ -431,30 +431,30 @@ namespace System.Globalization
|
|||
|
||||
public void GetAbbreviatedDayName(DayOfWeek dayofweek, String outStr)
|
||||
{
|
||||
outStr.Append(CalendarData.Invariant.saAbbrevDayNames[(int)dayofweek]);
|
||||
outStr.Append(CalendarData.[Friend]Invariant.[Friend]saAbbrevDayNames[(int)dayofweek]);
|
||||
}
|
||||
|
||||
public void GetDayName(DayOfWeek dayofweek, String outStr)
|
||||
{
|
||||
outStr.Append(CalendarData.Invariant.saDayNames[(int)dayofweek]);
|
||||
outStr.Append(CalendarData.[Friend]Invariant.[Friend]saDayNames[(int)dayofweek]);
|
||||
}
|
||||
|
||||
public void GetAbbreviatedMonthName(int month, String outStr)
|
||||
{
|
||||
outStr.Append(CalendarData.Invariant.saAbbrevMonthNames[month - 1]);
|
||||
outStr.Append(CalendarData.[Friend]Invariant.[Friend]saAbbrevMonthNames[month - 1]);
|
||||
}
|
||||
|
||||
public void GetMonthName(int month, String outStr)
|
||||
{
|
||||
outStr.Append(CalendarData.Invariant.saMonthNames[month - 1]);
|
||||
outStr.Append(CalendarData.[Friend]Invariant.[Friend]saMonthNames[month - 1]);
|
||||
}
|
||||
|
||||
public void GetEraName(int era, String outStr)
|
||||
{
|
||||
outStr.Append(CalendarData.Invariant.saEraNames[era]);
|
||||
outStr.Append(CalendarData.[Friend]Invariant.[Friend]saEraNames[era]);
|
||||
}
|
||||
|
||||
internal void internalGetMonthName(int month, MonthNameStyles style, bool abbreviated, String outStr)
|
||||
void internalGetMonthName(int month, MonthNameStyles style, bool abbreviated, String outStr)
|
||||
{
|
||||
GetMonthName(month, outStr);
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ namespace System.Globalization
|
|||
// Fast case for a regular CultureInfo
|
||||
DateTimeFormatInfo info;
|
||||
CultureInfo cultureProvider = provider as CultureInfo;
|
||||
if (cultureProvider != null && !cultureProvider.m_isInherited)
|
||||
if (cultureProvider != null && !cultureProvider.[Friend]m_isInherited)
|
||||
{
|
||||
return cultureProvider.DateTimeFormat;
|
||||
}
|
||||
|
@ -495,7 +495,7 @@ namespace System.Globalization
|
|||
{
|
||||
if (this.allYearMonthPatterns == null)
|
||||
{
|
||||
this.allYearMonthPatterns = this.m_cultureData.YearMonths(this.Calendar.ID);
|
||||
this.allYearMonthPatterns = this.m_cultureData.[Friend]YearMonths(this.Calendar.ID);
|
||||
}
|
||||
|
||||
return this.allYearMonthPatterns;
|
||||
|
@ -508,7 +508,7 @@ namespace System.Globalization
|
|||
{
|
||||
if (allShortDatePatterns == null)
|
||||
{
|
||||
this.allShortDatePatterns = this.m_cultureData.ShortDates(this.Calendar.ID);
|
||||
this.allShortDatePatterns = this.m_cultureData.[Friend]ShortDates(this.Calendar.ID);
|
||||
}
|
||||
|
||||
return this.allShortDatePatterns;
|
||||
|
@ -521,7 +521,7 @@ namespace System.Globalization
|
|||
{
|
||||
if (allLongDatePatterns == null)
|
||||
{
|
||||
this.allLongDatePatterns = this.m_cultureData.LongDates(this.Calendar.ID);
|
||||
this.allLongDatePatterns = this.m_cultureData.[Friend]LongDates(this.Calendar.ID);
|
||||
}
|
||||
|
||||
return this.allLongDatePatterns;
|
||||
|
@ -534,7 +534,7 @@ namespace System.Globalization
|
|||
{
|
||||
if (this.allShortTimePatterns == null)
|
||||
{
|
||||
this.allShortTimePatterns = this.m_cultureData.ShortTimes;
|
||||
this.allShortTimePatterns = this.m_cultureData.[Friend]ShortTimes;
|
||||
}
|
||||
|
||||
return this.allShortTimePatterns;
|
||||
|
@ -547,7 +547,7 @@ namespace System.Globalization
|
|||
{
|
||||
if (this.allLongTimePatterns == null)
|
||||
{
|
||||
this.allLongTimePatterns = this.m_cultureData.LongTimes;
|
||||
this.allLongTimePatterns = this.m_cultureData.[Friend]LongTimes;
|
||||
}
|
||||
|
||||
return this.allLongTimePatterns;
|
||||
|
@ -555,15 +555,15 @@ namespace System.Globalization
|
|||
}
|
||||
|
||||
private String m_fullTimeSpanPositivePattern ~ delete _;
|
||||
internal String FullTimeSpanPositivePattern
|
||||
String FullTimeSpanPositivePattern
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_fullTimeSpanPositivePattern == null)
|
||||
{
|
||||
CultureData cultureDataWithoutUserOverrides;
|
||||
if (m_cultureData.UseUserOverride)
|
||||
cultureDataWithoutUserOverrides = CultureData.GetCultureData(m_cultureData.CultureName, false);
|
||||
if (m_cultureData.[Friend]UseUserOverride)
|
||||
cultureDataWithoutUserOverrides = CultureData.[Friend]GetCultureData(m_cultureData.[Friend]CultureName, false);
|
||||
else
|
||||
cultureDataWithoutUserOverrides = m_cultureData;
|
||||
StringView decimalSeparator = scope NumberFormatInfo(cultureDataWithoutUserOverrides).NumberDecimalSeparator;
|
||||
|
@ -577,7 +577,7 @@ namespace System.Globalization
|
|||
}
|
||||
|
||||
private String m_fullTimeSpanNegativePattern ~ delete _;
|
||||
internal String FullTimeSpanNegativePattern
|
||||
String FullTimeSpanNegativePattern
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace System.Globalization
|
||||
{
|
||||
internal enum CalendarId : uint16
|
||||
enum CalendarId : uint16
|
||||
{
|
||||
GREGORIAN = 1 , // Gregorian (localized) calendar
|
||||
GREGORIAN_US = 2 , // Gregorian (U.S.) calendar
|
||||
|
|
|
@ -8,9 +8,9 @@ namespace System.Globalization
|
|||
// This class represents a starting/ending time for a period of daylight saving time.
|
||||
public class DaylightTime
|
||||
{
|
||||
internal DateTime m_start;
|
||||
internal DateTime m_end;
|
||||
internal TimeSpan m_delta;
|
||||
DateTime m_start;
|
||||
DateTime m_end;
|
||||
TimeSpan m_delta;
|
||||
|
||||
public this()
|
||||
{
|
||||
|
|
|
@ -19,12 +19,12 @@ namespace System.Globalization {
|
|||
|
||||
public enum GregorianCalendarTypes
|
||||
{
|
||||
Localized = Calendar.CAL_GREGORIAN,
|
||||
USEnglish = Calendar.CAL_GREGORIAN_US,
|
||||
MiddleEastFrench = Calendar.CAL_GREGORIAN_ME_FRENCH,
|
||||
Arabic = Calendar.CAL_GREGORIAN_ARABIC,
|
||||
TransliteratedEnglish = Calendar.CAL_GREGORIAN_XLIT_ENGLISH,
|
||||
TransliteratedFrench = Calendar.CAL_GREGORIAN_XLIT_FRENCH,
|
||||
Localized = Calendar.[Friend]CAL_GREGORIAN,
|
||||
USEnglish = Calendar.[Friend]CAL_GREGORIAN_US,
|
||||
MiddleEastFrench = Calendar.[Friend]CAL_GREGORIAN_ME_FRENCH,
|
||||
Arabic = Calendar.[Friend]CAL_GREGORIAN_ARABIC,
|
||||
TransliteratedEnglish = Calendar.[Friend]CAL_GREGORIAN_XLIT_ENGLISH,
|
||||
TransliteratedFrench = Calendar.[Friend]CAL_GREGORIAN_XLIT_FRENCH,
|
||||
}
|
||||
|
||||
// This calendar recognizes two era values:
|
||||
|
@ -40,25 +40,25 @@ namespace System.Globalization {
|
|||
public const int ADEra = 1;
|
||||
|
||||
|
||||
internal const int DatePartYear = 0;
|
||||
internal const int DatePartDayOfYear = 1;
|
||||
internal const int DatePartMonth = 2;
|
||||
internal const int DatePartDay = 3;
|
||||
const int DatePartYear = 0;
|
||||
const int DatePartDayOfYear = 1;
|
||||
const int DatePartMonth = 2;
|
||||
const int DatePartDay = 3;
|
||||
|
||||
//
|
||||
// This is the max Gregorian year can be represented by DateTime class. The limitation
|
||||
// is derived from DateTime class.
|
||||
//
|
||||
internal const int MaxYear = 9999;
|
||||
const int MaxYear = 9999;
|
||||
|
||||
internal GregorianCalendarTypes m_type;
|
||||
GregorianCalendarTypes m_type;
|
||||
|
||||
internal static readonly int[] DaysToMonth365 = new int[]
|
||||
static readonly int[] DaysToMonth365 = new int[]
|
||||
{
|
||||
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
|
||||
} ~ delete _;
|
||||
|
||||
internal static readonly int[] DaysToMonth366 = new int[]
|
||||
static readonly int[] DaysToMonth366 = new int[]
|
||||
{
|
||||
0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366
|
||||
} ~ delete _;
|
||||
|
@ -115,7 +115,7 @@ namespace System.Globalization {
|
|||
**Exceptions:
|
||||
============================================================================*/
|
||||
|
||||
internal static Calendar GetDefaultInstance() {
|
||||
static Calendar GetDefaultInstance() {
|
||||
if (s_defaultInstance == null) {
|
||||
s_defaultInstance = new GregorianCalendar();
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ namespace System.Globalization {
|
|||
}
|
||||
|
||||
set {
|
||||
VerifyWritable();
|
||||
this.[Friend]VerifyWritable();
|
||||
|
||||
switch (value)
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ namespace System.Globalization {
|
|||
}
|
||||
}
|
||||
|
||||
internal override int ID {
|
||||
protected override int ID {
|
||||
get {
|
||||
// By returning different ID for different variations of GregorianCalendar,
|
||||
// we can support the Transliterated Gregorian calendar.
|
||||
|
@ -180,7 +180,7 @@ namespace System.Globalization {
|
|||
|
||||
// Returns a given date part of this DateTime. This method is used
|
||||
// to compute the year, day-of-year, month, or day part.
|
||||
internal virtual int GetDatePart(int64 ticks, int part)
|
||||
protected virtual int GetDatePart(int64 ticks, int part)
|
||||
{
|
||||
// n = number of days since 1/1/0001
|
||||
int n = (int)(ticks / TicksPerDay);
|
||||
|
@ -247,7 +247,7 @@ namespace System.Globalization {
|
|||
**
|
||||
============================================================================*/
|
||||
|
||||
internal static Result<int64> GetAbsoluteDate(int year, int month, int day) {
|
||||
static Result<int64> GetAbsoluteDate(int year, int month, int day) {
|
||||
if (year >= 1 && year <= MaxYear && month >= 1 && month <= 12)
|
||||
{
|
||||
int[] days = ((year % 4 == 0 && (year % 100 != 0 || year % 400 == 0))) ? DaysToMonth366: DaysToMonth365;
|
||||
|
@ -263,7 +263,7 @@ namespace System.Globalization {
|
|||
|
||||
// Returns the tick count corresponding to the given year, month, and day.
|
||||
// Will check the if the parameters are valid.
|
||||
internal virtual Result<int64> DateToTicks(int year, int month, int day) {
|
||||
protected virtual Result<int64> DateToTicks(int year, int month, int day) {
|
||||
return (Try!(GetAbsoluteDate(year, month, day)) * TicksPerDay);
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ namespace System.Globalization {
|
|||
d = days;
|
||||
}
|
||||
int64 ticks = Try!(DateToTicks(y, m, d)) + time.Ticks % TicksPerDay;
|
||||
Try!(Calendar.CheckAddResult(ticks, MinSupportedDateTime, MaxSupportedDateTime));
|
||||
Try!(Calendar.[Friend]CheckAddResult(ticks, MinSupportedDateTime, MaxSupportedDateTime));
|
||||
|
||||
return (DateTime(ticks));
|
||||
}
|
||||
|
@ -597,9 +597,9 @@ namespace System.Globalization {
|
|||
return .Err;
|
||||
}
|
||||
|
||||
internal override bool TryToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era, out DateTime result) {
|
||||
protected override bool TryToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era, out DateTime result) {
|
||||
if (era == CurrentEra || era == ADEra) {
|
||||
switch (DateTime.TryCreate(year, month, day, hour, minute, second, millisecond))
|
||||
switch (DateTime.[Friend]TryCreate(year, month, day, hour, minute, second, millisecond))
|
||||
{
|
||||
case .Ok(out result):
|
||||
return true;
|
||||
|
@ -617,13 +617,13 @@ namespace System.Globalization {
|
|||
{
|
||||
get {
|
||||
if (twoDigitYearMax == -1) {
|
||||
twoDigitYearMax = GetSystemTwoDigitYearSetting(ID, DEFAULT_TWO_DIGIT_YEAR_MAX);
|
||||
twoDigitYearMax = GetSystemTwoDigitYearSetting([Friend]ID, DEFAULT_TWO_DIGIT_YEAR_MAX);
|
||||
}
|
||||
return (twoDigitYearMax);
|
||||
}
|
||||
|
||||
set {
|
||||
VerifyWritable();
|
||||
this.[Friend]VerifyWritable();
|
||||
if (value < 99 || value > MaxYear) {
|
||||
/*throw new ArgumentOutOfRangeException(
|
||||
"year",
|
||||
|
|
|
@ -90,46 +90,45 @@ namespace System.Globalization {
|
|||
// DO NOT UPDATE THIS WITHOUT UPDATING THAT STRUCTURE. IF YOU ADD BOOL, ADD THEM AT THE END.
|
||||
// ALSO MAKE SURE TO UPDATE mscorlib.h in the VM directory to check field offsets.
|
||||
// READTHIS READTHIS READTHIS
|
||||
internal int32[] numberGroupSizes = new int32[] {3} ~ delete _;
|
||||
internal int32[] currencyGroupSizes = new int32[] {3} ~ delete _;
|
||||
internal int32[] percentGroupSizes = new int32[] {3} ~ delete _;
|
||||
internal OwnedString positiveSign = .("+") ~ _.Dispose();
|
||||
internal OwnedString negativeSign = .("-") ~ _.Dispose();
|
||||
internal OwnedString numberDecimalSeparator = .(".") ~ _.Dispose();
|
||||
internal OwnedString numberGroupSeparator = .(",") ~ _.Dispose();
|
||||
internal OwnedString currencyGroupSeparator = .(",") ~ _.Dispose();;
|
||||
internal OwnedString currencyDecimalSeparator = .(".") ~ _.Dispose();
|
||||
internal OwnedString currencySymbol = .("\u{00a4}") ~ _.Dispose(); // U+00a4 is the symbol for International Monetary Fund.
|
||||
protected int32[] numberGroupSizes = new int32[] {3} ~ delete _;
|
||||
protected int32[] currencyGroupSizes = new int32[] {3} ~ delete _;
|
||||
protected int32[] percentGroupSizes = new int32[] {3} ~ delete _;
|
||||
protected OwnedString positiveSign = .("+") ~ _.Dispose();
|
||||
protected OwnedString negativeSign = .("-") ~ _.Dispose();
|
||||
protected OwnedString numberDecimalSeparator = .(".") ~ _.Dispose();
|
||||
protected OwnedString numberGroupSeparator = .(",") ~ _.Dispose();
|
||||
protected OwnedString currencyGroupSeparator = .(",") ~ _.Dispose();;
|
||||
protected OwnedString currencyDecimalSeparator = .(".") ~ _.Dispose();
|
||||
protected OwnedString currencySymbol = .("\u{00a4}") ~ _.Dispose(); // U+00a4 is the symbol for International Monetary Fund.
|
||||
// The alternative currency symbol used in Win9x ANSI codepage, that can not roundtrip between ANSI and Unicode.
|
||||
// Currently, only ja-JP and ko-KR has non-null values (which is U+005c, backslash)
|
||||
// NOTE: The only legal values for this string are null and "\u005c"
|
||||
internal String ansiCurrencySymbol = null;
|
||||
internal OwnedString nanSymbol = .("NaN") ~ _.Dispose();
|
||||
internal OwnedString positiveInfinitySymbol = .("Infinity") ~ _.Dispose();
|
||||
internal OwnedString negativeInfinitySymbol = .("-Infinity") ~ _.Dispose();
|
||||
internal OwnedString percentDecimalSeparator = .(".") ~ _.Dispose();
|
||||
internal OwnedString percentGroupSeparator = .(",") ~ _.Dispose();
|
||||
internal OwnedString percentSymbol = .("%") ~ _.Dispose();
|
||||
internal OwnedString perMilleSymbol = .("\u{2030}") ~ _.Dispose();
|
||||
protected String ansiCurrencySymbol = null;
|
||||
protected OwnedString nanSymbol = .("NaN") ~ _.Dispose();
|
||||
protected OwnedString positiveInfinitySymbol = .("Infinity") ~ _.Dispose();
|
||||
protected OwnedString negativeInfinitySymbol = .("-Infinity") ~ _.Dispose();
|
||||
protected OwnedString percentDecimalSeparator = .(".") ~ _.Dispose();
|
||||
protected OwnedString percentGroupSeparator = .(",") ~ _.Dispose();
|
||||
protected OwnedString percentSymbol = .("%") ~ _.Dispose();
|
||||
protected OwnedString perMilleSymbol = .("\u{2030}") ~ _.Dispose();
|
||||
|
||||
internal String[] nativeDigits = new .[] {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} ~ DeleteNativeDigits();
|
||||
protected String[] nativeDigits = new .[] {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} ~ DeleteNativeDigits();
|
||||
|
||||
internal int32 numberDecimalDigits = 2;
|
||||
internal int32 currencyDecimalDigits = 2;
|
||||
internal int32 currencyPositivePattern = 0;
|
||||
internal int32 currencyNegativePattern = 0;
|
||||
internal int32 numberNegativePattern = 1;
|
||||
internal int32 percentPositivePattern = 0;
|
||||
internal int32 percentNegativePattern = 0;
|
||||
internal int32 percentDecimalDigits = 2;
|
||||
protected int32 numberDecimalDigits = 2;
|
||||
protected int32 currencyDecimalDigits = 2;
|
||||
protected int32 currencyPositivePattern = 0;
|
||||
protected int32 currencyNegativePattern = 0;
|
||||
protected int32 numberNegativePattern = 1;
|
||||
protected int32 percentPositivePattern = 0;
|
||||
protected int32 percentNegativePattern = 0;
|
||||
protected int32 percentDecimalDigits = 2;
|
||||
|
||||
protected int32 digitSubstitution = 1; // DigitShapes.None
|
||||
|
||||
internal int32 digitSubstitution = 1; // DigitShapes.None
|
||||
|
||||
internal bool isReadOnly=false;
|
||||
protected bool isReadOnly=false;
|
||||
|
||||
// Is this NumberFormatInfo for invariant culture?
|
||||
internal bool m_isInvariant=false;
|
||||
protected bool m_isInvariant=false;
|
||||
|
||||
void DeleteNativeDigits()
|
||||
{
|
||||
|
@ -211,13 +210,13 @@ namespace System.Globalization {
|
|||
|
||||
// We aren't persisting dataItem any more (since its useless & we weren't using it),
|
||||
// Ditto with m_useUserOverride. Don't use them, we use a local copy of everything.
|
||||
internal this(CultureData cultureData)
|
||||
public this(CultureData cultureData)
|
||||
{
|
||||
if (cultureData != null)
|
||||
{
|
||||
// We directly use fields here since these data is coming from data table or Win32, so we
|
||||
// don't need to verify their values (except for invalid parsing situations).
|
||||
cultureData.GetNFIValues(this);
|
||||
cultureData.[Friend]GetNFIValues(this);
|
||||
|
||||
if (cultureData.IsInvariantCulture)
|
||||
{
|
||||
|
@ -339,7 +338,7 @@ namespace System.Globalization {
|
|||
// Every element in the groupSize array should be between 1 and 9
|
||||
// excpet the last element could be zero.
|
||||
//
|
||||
static internal void CheckGroupSize(String propName, int[] groupSize)
|
||||
static protected void CheckGroupSize(String propName, int[] groupSize)
|
||||
{
|
||||
for (int i = 0; i < groupSize.Count; i++)
|
||||
{
|
||||
|
|
|
@ -12,17 +12,17 @@ namespace System.Globalization {
|
|||
using System.Globalization;
|
||||
using System.Collections.Generic;
|
||||
|
||||
internal static class TimeSpanFormat
|
||||
static class TimeSpanFormat
|
||||
{
|
||||
private static void IntToString(int n, int digits, String outStr)
|
||||
{
|
||||
((int32)n).[Friend]ToString(outStr, digits);
|
||||
}
|
||||
|
||||
internal static readonly FormatLiterals PositiveInvariantFormatLiterals = TimeSpanFormat.FormatLiterals.InitInvariant(false /*isNegative*/) ~ _.Dispose();
|
||||
internal static readonly FormatLiterals NegativeInvariantFormatLiterals = TimeSpanFormat.FormatLiterals.InitInvariant(true /*isNegative*/) ~ _.Dispose();
|
||||
protected static readonly FormatLiterals PositiveInvariantFormatLiterals = TimeSpanFormat.FormatLiterals.[Friend]InitInvariant(false /*isNegative*/) ~ _.Dispose();
|
||||
protected static readonly FormatLiterals NegativeInvariantFormatLiterals = TimeSpanFormat.FormatLiterals.[Friend]InitInvariant(true /*isNegative*/) ~ _.Dispose();
|
||||
|
||||
internal enum Pattern {
|
||||
protected enum Pattern {
|
||||
None = 0,
|
||||
Minimum = 1,
|
||||
Full = 2,
|
||||
|
@ -33,7 +33,7 @@ namespace System.Globalization {
|
|||
//
|
||||
// Actions: Main method called from TimeSpan.ToString
|
||||
//
|
||||
internal static Result<void> Format(TimeSpan value, StringView format, IFormatProvider formatProvider, String outStr)
|
||||
protected static Result<void> Format(TimeSpan value, StringView format, IFormatProvider formatProvider, String outStr)
|
||||
{
|
||||
var format;
|
||||
|
||||
|
@ -54,9 +54,9 @@ namespace System.Globalization {
|
|||
DateTimeFormatInfo dtfi = DateTimeFormatInfo.GetInstance(formatProvider);
|
||||
|
||||
if ((int64)value < 0)
|
||||
format = dtfi.FullTimeSpanNegativePattern;
|
||||
format = dtfi.[Friend]FullTimeSpanNegativePattern;
|
||||
else
|
||||
format = dtfi.FullTimeSpanPositivePattern;
|
||||
format = dtfi.[Friend]FullTimeSpanPositivePattern;
|
||||
if (f == 'g')
|
||||
pattern = Pattern.Minimum;
|
||||
else
|
||||
|
@ -99,27 +99,27 @@ namespace System.Globalization {
|
|||
}
|
||||
else {
|
||||
literal = FormatLiterals();
|
||||
literal.Init(format, pattern == Pattern.Full);
|
||||
literal.[Friend]Init(format, pattern == Pattern.Full);
|
||||
}
|
||||
if (fraction != 0) { // truncate the partial second to the specified length
|
||||
fraction = (int)((int64)fraction / (int64)Math.Pow(10, DateTimeFormat.MaxSecondsFractionDigits - literal.ff));
|
||||
fraction = (int)((int64)fraction / (int64)Math.Pow(10, DateTimeFormat.[Friend]MaxSecondsFractionDigits - literal.[Friend]ff));
|
||||
}
|
||||
|
||||
// Pattern.Full: [-]dd.hh:mm:ss.fffffff
|
||||
// Pattern.Minimum: [-][d.]hh:mm:ss[.fffffff]
|
||||
|
||||
outStr.Append(literal.Start); // [-]
|
||||
outStr.Append(literal.[Friend]Start); // [-]
|
||||
if (pattern == Pattern.Full || day != 0) { //
|
||||
day.ToString(outStr); // [dd]
|
||||
outStr.Append(literal.DayHourSep); // [.]
|
||||
outStr.Append(literal.[Friend]DayHourSep); // [.]
|
||||
} //
|
||||
IntToString(hours, literal.hh, outStr); // hh
|
||||
outStr.Append(literal.HourMinuteSep); // :
|
||||
IntToString(minutes, literal.mm, outStr); // mm
|
||||
outStr.Append(literal.MinuteSecondSep); // :
|
||||
IntToString(seconds, literal.ss, outStr); // ss
|
||||
IntToString(hours, literal.[Friend]hh, outStr); // hh
|
||||
outStr.Append(literal.[Friend]HourMinuteSep); // :
|
||||
IntToString(minutes, literal.[Friend]mm, outStr); // mm
|
||||
outStr.Append(literal.[Friend]MinuteSecondSep); // :
|
||||
IntToString(seconds, literal.[Friend]ss, outStr); // ss
|
||||
if (!isInvariant && pattern == Pattern.Minimum) {
|
||||
int effectiveDigits = literal.ff;
|
||||
int effectiveDigits = literal.[Friend]ff;
|
||||
while (effectiveDigits > 0) {
|
||||
if (fraction % 10 == 0) {
|
||||
fraction = fraction / 10;
|
||||
|
@ -130,15 +130,15 @@ namespace System.Globalization {
|
|||
}
|
||||
}
|
||||
if (effectiveDigits > 0) {
|
||||
outStr.Append(literal.SecondFractionSep); // [.FFFFFFF]
|
||||
(fraction).ToString(outStr, DateTimeFormat.fixedNumberFormats[effectiveDigits - 1], CultureInfo.InvariantCulture);
|
||||
outStr.Append(literal.[Friend]SecondFractionSep); // [.FFFFFFF]
|
||||
(fraction).ToString(outStr, DateTimeFormat.[Friend]fixedNumberFormats[effectiveDigits - 1], CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
else if (pattern == Pattern.Full || fraction != 0) {
|
||||
outStr.Append(literal.SecondFractionSep); // [.]
|
||||
IntToString(fraction, literal.ff, outStr); // [fffffff]
|
||||
outStr.Append(literal.[Friend]SecondFractionSep); // [.]
|
||||
IntToString(fraction, literal.[Friend]ff, outStr); // [fffffff]
|
||||
} //
|
||||
outStr.Append(literal.End); //
|
||||
outStr.Append(literal.[Friend]End); //
|
||||
return .Ok;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ namespace System.Globalization {
|
|||
//
|
||||
// Actions: Format the TimeSpan instance using the specified format.
|
||||
//
|
||||
internal static Result<void> FormatCustomized(TimeSpan value, StringView format, DateTimeFormatInfo dtfi, String result)
|
||||
protected static Result<void> FormatCustomized(TimeSpan value, StringView format, DateTimeFormatInfo dtfi, String result)
|
||||
{
|
||||
|
||||
Contract.Assert(dtfi != null, "dtfi == null");
|
||||
|
@ -176,50 +176,50 @@ namespace System.Globalization {
|
|||
int nextChar;
|
||||
switch (ch) {
|
||||
case 'h':
|
||||
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
|
||||
tokenLen = DateTimeFormat.[Friend]ParseRepeatPattern(format, i, ch);
|
||||
if (tokenLen > 2)
|
||||
//throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
|
||||
return .Err;
|
||||
DateTimeFormat.FormatDigits(result, hours, tokenLen);
|
||||
DateTimeFormat.[Friend]FormatDigits(result, hours, tokenLen);
|
||||
break;
|
||||
case 'm':
|
||||
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
|
||||
tokenLen = DateTimeFormat.[Friend]ParseRepeatPattern(format, i, ch);
|
||||
if (tokenLen > 2)
|
||||
return .Err;
|
||||
//throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
|
||||
DateTimeFormat.FormatDigits(result, minutes, tokenLen);
|
||||
DateTimeFormat.[Friend]FormatDigits(result, minutes, tokenLen);
|
||||
break;
|
||||
case 's':
|
||||
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
|
||||
tokenLen = DateTimeFormat.[Friend]ParseRepeatPattern(format, i, ch);
|
||||
if (tokenLen > 2)
|
||||
return .Err;
|
||||
//throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
|
||||
DateTimeFormat.FormatDigits(result, seconds, tokenLen);
|
||||
DateTimeFormat.[Friend]FormatDigits(result, seconds, tokenLen);
|
||||
break;
|
||||
case 'f':
|
||||
//
|
||||
// The fraction of a second in single-digit precision. The remaining digits are truncated.
|
||||
//
|
||||
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
|
||||
if (tokenLen > DateTimeFormat.MaxSecondsFractionDigits)
|
||||
tokenLen = DateTimeFormat.[Friend]ParseRepeatPattern(format, i, ch);
|
||||
if (tokenLen > DateTimeFormat.[Friend]MaxSecondsFractionDigits)
|
||||
return .Err;
|
||||
//throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
|
||||
|
||||
tmp = (int64)fraction;
|
||||
tmp /= (int64)Math.Pow(10, DateTimeFormat.MaxSecondsFractionDigits - tokenLen);
|
||||
(tmp).ToString(result, DateTimeFormat.fixedNumberFormats[tokenLen - 1], CultureInfo.InvariantCulture);
|
||||
tmp /= (int64)Math.Pow(10, DateTimeFormat.[Friend]MaxSecondsFractionDigits - tokenLen);
|
||||
(tmp).ToString(result, DateTimeFormat.[Friend]fixedNumberFormats[tokenLen - 1], CultureInfo.InvariantCulture);
|
||||
break;
|
||||
case 'F':
|
||||
//
|
||||
// Displays the most significant digit of the seconds fraction. Nothing is displayed if the digit is zero.
|
||||
//
|
||||
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
|
||||
if (tokenLen > DateTimeFormat.MaxSecondsFractionDigits)
|
||||
tokenLen = DateTimeFormat.[Friend]ParseRepeatPattern(format, i, ch);
|
||||
if (tokenLen > DateTimeFormat.[Friend]MaxSecondsFractionDigits)
|
||||
return .Err;
|
||||
//throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
|
||||
|
||||
tmp = (int64)fraction;
|
||||
tmp /= (int64)Math.Pow(10, DateTimeFormat.MaxSecondsFractionDigits - tokenLen);
|
||||
tmp /= (int64)Math.Pow(10, DateTimeFormat.[Friend]MaxSecondsFractionDigits - tokenLen);
|
||||
int effectiveDigits = tokenLen;
|
||||
while (effectiveDigits > 0) {
|
||||
if (tmp % 10 == 0) {
|
||||
|
@ -231,7 +231,7 @@ namespace System.Globalization {
|
|||
}
|
||||
}
|
||||
if (effectiveDigits > 0) {
|
||||
(tmp).ToString(result, DateTimeFormat.fixedNumberFormats[effectiveDigits - 1], CultureInfo.InvariantCulture);
|
||||
(tmp).ToString(result, DateTimeFormat.[Friend]fixedNumberFormats[effectiveDigits - 1], CultureInfo.InvariantCulture);
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
|
@ -239,23 +239,23 @@ namespace System.Globalization {
|
|||
// tokenLen == 1 : Day as digits with no leading zero.
|
||||
// tokenLen == 2+: Day as digits with leading zero for single-digit days.
|
||||
//
|
||||
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
|
||||
tokenLen = DateTimeFormat.[Friend]ParseRepeatPattern(format, i, ch);
|
||||
if (tokenLen > 8)
|
||||
return .Err;
|
||||
//throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
|
||||
DateTimeFormat.FormatDigits(result, day, tokenLen, true);
|
||||
DateTimeFormat.[Friend]FormatDigits(result, day, tokenLen, true);
|
||||
break;
|
||||
case '\'':
|
||||
case '\"':
|
||||
//StringBuilder enquotedString = new StringBuilder();
|
||||
tokenLen = DateTimeFormat.ParseQuoteString(format, i, result);
|
||||
tokenLen = DateTimeFormat.[Friend]ParseQuoteString(format, i, result);
|
||||
//result.Append(enquotedString);
|
||||
break;
|
||||
case '%':
|
||||
// Optional format character.
|
||||
// For example, format string "%d" will print day
|
||||
// Most of the cases, "%" can be ignored.
|
||||
nextChar = DateTimeFormat.ParseNextChar(format, i);
|
||||
nextChar = DateTimeFormat.[Friend]ParseNextChar(format, i);
|
||||
// nextChar will be -1 if we already reach the end of the format string.
|
||||
// Besides, we will not allow "%%" appear in the pattern.
|
||||
if (nextChar >= 0 && nextChar != (int)'%')
|
||||
|
@ -277,7 +277,7 @@ namespace System.Globalization {
|
|||
// Escaped character. Can be used to insert character into the format string.
|
||||
// For example, "\d" will insert the character 'd' into the string.
|
||||
//
|
||||
nextChar = DateTimeFormat.ParseNextChar(format, i);
|
||||
nextChar = DateTimeFormat.[Friend]ParseNextChar(format, i);
|
||||
if (nextChar >= 0)
|
||||
{
|
||||
result.Append(((char8)nextChar));
|
||||
|
@ -304,43 +304,43 @@ namespace System.Globalization {
|
|||
|
||||
|
||||
|
||||
internal struct FormatLiterals {
|
||||
internal String Start {
|
||||
protected struct FormatLiterals {
|
||||
String Start {
|
||||
get {
|
||||
return literals[0];
|
||||
}
|
||||
}
|
||||
internal String DayHourSep {
|
||||
String DayHourSep {
|
||||
get {
|
||||
return literals[1];
|
||||
}
|
||||
}
|
||||
internal String HourMinuteSep {
|
||||
String HourMinuteSep {
|
||||
get {
|
||||
return literals[2];
|
||||
}
|
||||
}
|
||||
internal String MinuteSecondSep {
|
||||
String MinuteSecondSep {
|
||||
get {
|
||||
return literals[3];
|
||||
}
|
||||
}
|
||||
internal String SecondFractionSep {
|
||||
String SecondFractionSep {
|
||||
get {
|
||||
return literals[4];
|
||||
}
|
||||
}
|
||||
internal String End {
|
||||
String End {
|
||||
get {
|
||||
return literals[5];
|
||||
}
|
||||
}
|
||||
internal String AppCompatLiteral;
|
||||
internal int dd;
|
||||
internal int hh;
|
||||
internal int mm;
|
||||
internal int ss;
|
||||
internal int ff;
|
||||
String AppCompatLiteral;
|
||||
int dd;
|
||||
int hh;
|
||||
int mm;
|
||||
int ss;
|
||||
int ff;
|
||||
|
||||
private String[] literals;
|
||||
private List<String> ownedStrs;
|
||||
|
@ -365,7 +365,7 @@ namespace System.Globalization {
|
|||
}
|
||||
|
||||
/* factory method for static invariant FormatLiterals */
|
||||
internal static FormatLiterals InitInvariant(bool isNegative) {
|
||||
static FormatLiterals InitInvariant(bool isNegative) {
|
||||
FormatLiterals x = FormatLiterals();
|
||||
x.literals = new String[6];
|
||||
x.literals[0] = isNegative ? "-" : String.Empty;
|
||||
|
@ -379,7 +379,7 @@ namespace System.Globalization {
|
|||
x.hh = 2;
|
||||
x.mm = 2;
|
||||
x.ss = 2;
|
||||
x.ff = DateTimeFormat.MaxSecondsFractionDigits;
|
||||
x.ff = DateTimeFormat.[Friend]MaxSecondsFractionDigits;
|
||||
return x;
|
||||
}
|
||||
|
||||
|
@ -387,7 +387,7 @@ namespace System.Globalization {
|
|||
// the constants guaranteed to include DHMSF ordered greatest to least significant.
|
||||
// Once the data becomes more complex than this we will need to write a proper tokenizer for
|
||||
// parsing and formatting
|
||||
internal void Init(StringView format, bool useInvariantFieldLengths) mut
|
||||
void Init(StringView format, bool useInvariantFieldLengths) mut
|
||||
{
|
||||
literals = new String[6];
|
||||
for (int i = 0; i < literals.Count; i++)
|
||||
|
@ -498,7 +498,7 @@ namespace System.Globalization {
|
|||
hh = 2;
|
||||
mm = 2;
|
||||
ss = 2;
|
||||
ff = DateTimeFormat.MaxSecondsFractionDigits;
|
||||
ff = DateTimeFormat.[Friend]MaxSecondsFractionDigits;
|
||||
}
|
||||
else {
|
||||
if (dd < 1 || dd > 2) dd = 2; // The DTFI property has a problem. let's try to make the best of the situation.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue