* rename BTimeZone::Accessor to BTimeZone::Private to match the other
private accessor classes * adjust style in BTimeZone::Private implementation to match other classes of this kind git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38449 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -42,9 +42,10 @@ public:
|
|||||||
|
|
||||||
static const char* kNameOfGmtZone;
|
static const char* kNameOfGmtZone;
|
||||||
|
|
||||||
struct Accessor;
|
class Private;
|
||||||
friend struct BTimeZone::Accessor;
|
|
||||||
private:
|
private:
|
||||||
|
friend class Private;
|
||||||
|
|
||||||
icu_44::TimeZone* fIcuTimeZone;
|
icu_44::TimeZone* fIcuTimeZone;
|
||||||
icu_44::Locale* fIcuLocale;
|
icu_44::Locale* fIcuLocale;
|
||||||
status_t fInitStatus;
|
status_t fInitStatus;
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2010, Oliver Tappe <[email protected]>
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
#ifndef _TIME_ZONE_ACCESSOR_H
|
|
||||||
#define _TIME_ZONE_ACCESSOR_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <TimeZone.h>
|
|
||||||
|
|
||||||
|
|
||||||
struct BTimeZone::Accessor {
|
|
||||||
Accessor(const BTimeZone* timeZone = NULL)
|
|
||||||
: fTimeZone(timeZone)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void SetTo(const BTimeZone* timeZone)
|
|
||||||
{
|
|
||||||
fTimeZone = timeZone;
|
|
||||||
}
|
|
||||||
|
|
||||||
icu_44::TimeZone* IcuTimeZone()
|
|
||||||
{
|
|
||||||
return fTimeZone->fIcuTimeZone;
|
|
||||||
}
|
|
||||||
|
|
||||||
const BTimeZone* fTimeZone;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _TIME_ZONE_ACCESSOR_H
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010, Oliver Tappe <[email protected]>
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef _TIME_ZONE_PRIVATE_H
|
||||||
|
#define _TIME_ZONE_PRIVATE_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <TimeZone.h>
|
||||||
|
|
||||||
|
|
||||||
|
class BTimeZone::Private {
|
||||||
|
public:
|
||||||
|
Private(const BTimeZone* timeZone = NULL)
|
||||||
|
:
|
||||||
|
fTimeZone(timeZone)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SetTo(const BTimeZone* timeZone)
|
||||||
|
{
|
||||||
|
fTimeZone = timeZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
icu_44::TimeZone*
|
||||||
|
IcuTimeZone()
|
||||||
|
{
|
||||||
|
return fTimeZone->fIcuTimeZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const BTimeZone* fTimeZone;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _TIME_ZONE_PRIVATE_H
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
#include <LocaleRoster.h>
|
#include <LocaleRoster.h>
|
||||||
#include <TimeZone.h>
|
#include <TimeZone.h>
|
||||||
|
|
||||||
#include <TimeZoneAccessor.h>
|
#include <TimeZonePrivate.h>
|
||||||
|
|
||||||
|
|
||||||
// maps our unit element to the corresponding ICU unit
|
// maps our unit element to the corresponding ICU unit
|
||||||
@@ -112,18 +112,18 @@ BDurationFormat::SetTimeZone(const BTimeZone* timeZone)
|
|||||||
if (fCalendar == NULL)
|
if (fCalendar == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
BTimeZone::Accessor zoneAccessor;
|
BTimeZone::Private zonePrivate;
|
||||||
if (timeZone == NULL) {
|
if (timeZone == NULL) {
|
||||||
BTimeZone defaultTimeZone;
|
BTimeZone defaultTimeZone;
|
||||||
status_t result
|
status_t result
|
||||||
= be_locale_roster->GetDefaultTimeZone(&defaultTimeZone);
|
= be_locale_roster->GetDefaultTimeZone(&defaultTimeZone);
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
return result;
|
return result;
|
||||||
zoneAccessor.SetTo(&defaultTimeZone);
|
zonePrivate.SetTo(&defaultTimeZone);
|
||||||
} else
|
} else
|
||||||
zoneAccessor.SetTo(timeZone);
|
zonePrivate.SetTo(timeZone);
|
||||||
|
|
||||||
TimeZone* icuTimeZone = zoneAccessor.IcuTimeZone();
|
TimeZone* icuTimeZone = zonePrivate.IcuTimeZone();
|
||||||
if (icuTimeZone != NULL)
|
if (icuTimeZone != NULL)
|
||||||
fCalendar->setTimeZone(*icuTimeZone);
|
fCalendar->setTimeZone(*icuTimeZone);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user