* 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
+3 -2
View File
@@ -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;
-31
View File
@@ -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
+37
View File
@@ -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
+5 -5
View File
@@ -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);