* 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:
Oliver Tappe 2010-08-30 14:30:22 +00:00
parent b543dbc293
commit 6e30c4b8af
4 changed files with 45 additions and 38 deletions

View File

@ -42,9 +42,10 @@ public:
static const char* kNameOfGmtZone;
struct Accessor;
friend struct BTimeZone::Accessor;
class Private;
private:
friend class Private;
icu_44::TimeZone* fIcuTimeZone;
icu_44::Locale* fIcuLocale;
status_t fInitStatus;

View File

@ -1,31 +0,0 @@
/*
* Copyright 2010, Oliver Tappe <zooey@hirschkaefer.de>
* 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

View File

@ -0,0 +1,37 @@
/*
* Copyright 2010, Oliver Tappe <zooey@hirschkaefer.de>
* 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

View File

@ -18,7 +18,7 @@
#include <LocaleRoster.h>
#include <TimeZone.h>
#include <TimeZoneAccessor.h>
#include <TimeZonePrivate.h>
// maps our unit element to the corresponding ICU unit
@ -112,18 +112,18 @@ BDurationFormat::SetTimeZone(const BTimeZone* timeZone)
if (fCalendar == NULL)
return B_NO_INIT;
BTimeZone::Accessor zoneAccessor;
BTimeZone::Private zonePrivate;
if (timeZone == NULL) {
BTimeZone defaultTimeZone;
status_t result
= be_locale_roster->GetDefaultTimeZone(&defaultTimeZone);
if (result != B_OK)
return result;
zoneAccessor.SetTo(&defaultTimeZone);
zonePrivate.SetTo(&defaultTimeZone);
} else
zoneAccessor.SetTo(timeZone);
zonePrivate.SetTo(timeZone);
TimeZone* icuTimeZone = zoneAccessor.IcuTimeZone();
TimeZone* icuTimeZone = zonePrivate.IcuTimeZone();
if (icuTimeZone != NULL)
fCalendar->setTimeZone(*icuTimeZone);