From e0a4f349a8181c1c7b1f470d67c5b1e0d69616b6 Mon Sep 17 00:00:00 2001 From: Chris Frey Date: Wed, 14 Mar 2012 09:38:37 -0400 Subject: [PATCH] API: lib: renamed record parser class from Timezone to TimeZone --- desktop/src/Mode_Browse.cc | 2 +- examples/pipedump.cc | 2 +- src/parser.h | 4 +-- src/r_timezone.cc | 62 +++++++++++++++++++++++----------------------- src/r_timezone.h | 23 +++++++++-------- src/s11n-boost.h | 2 +- tools/bfuse.cc | 6 ++--- tools/btool.cc | 6 ++--- 8 files changed, 54 insertions(+), 53 deletions(-) diff --git a/desktop/src/Mode_Browse.cc b/desktop/src/Mode_Browse.cc index db4a9c9d..c79f8eec 100644 --- a/desktop/src/Mode_Browse.cc +++ b/desktop/src/Mode_Browse.cc @@ -140,7 +140,7 @@ bool EditRecord(wxWindow *parent, bool editable, Barry::Task &rec) return false; } -bool EditRecord(wxWindow *parent, bool editable, Barry::Timezone &rec) +bool EditRecord(wxWindow *parent, bool editable, Barry::TimeZone &rec) { return false; } diff --git a/examples/pipedump.cc b/examples/pipedump.cc index 473ef7a5..b2258ef9 100644 --- a/examples/pipedump.cc +++ b/examples/pipedump.cc @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) // and with the template member (does the same thing) mrp.Add( new Store ); mrp.Add( new Store ); - mrp.Add( new Store ); + mrp.Add( new Store ); builder.Restart(); pipe.PumpFile(mrp); diff --git a/src/parser.h b/src/parser.h index a74be562..47562e5c 100644 --- a/src/parser.h +++ b/src/parser.h @@ -45,7 +45,7 @@ namespace Barry { class SavedMessage; class Sms; class Folder; - class Timezone; + class TimeZone; class ContentStore; class HandheldAgent; } @@ -74,7 +74,7 @@ namespace Barry { HANDLE_PARSER(ServiceBook) \ HANDLE_PARSER(Sms) \ HANDLE_PARSER(Task) \ - HANDLE_PARSER(Timezone) + HANDLE_PARSER(TimeZone) namespace Barry { diff --git a/src/r_timezone.cc b/src/r_timezone.cc index e40c3b9f..d69021e2 100644 --- a/src/r_timezone.cc +++ b/src/r_timezone.cc @@ -39,9 +39,9 @@ namespace Barry { /////////////////////////////////////////////////////////////////////////////// -// Timezone Class +// TimeZone Class -// Timezone Field Codes +// TimeZone Field Codes #define TZFC_INDEX 0x01 #define TZFC_NAME 0x02 #define TZFC_OFFSET 0x03 @@ -52,24 +52,24 @@ namespace Barry #define TZFC_END 0xffff -static FieldLink TimezoneFieldLinks[] = { - { TZFC_NAME, "Name", 0, 0, &Timezone::Name, 0, 0, 0, 0, true }, +static FieldLink TimeZoneFieldLinks[] = { + { TZFC_NAME, "Name", 0, 0, &TimeZone::Name, 0, 0, 0, 0, true }, { TZFC_END, "End of List", 0, 0, 0, 0, 0, 0, 0, false }, }; -Timezone::Timezone() +TimeZone::TimeZone() { Clear(); } -Timezone::Timezone(int utc_offset) +TimeZone::TimeZone(int utc_offset) { Clear(); UTCOffset = utc_offset; } -Timezone::Timezone(int hours, int minutes) +TimeZone::TimeZone(int hours, int minutes) { Clear(); @@ -85,11 +85,11 @@ Timezone::Timezone(int hours, int minutes) UTCOffset += minutes; } -Timezone::~Timezone() +TimeZone::~TimeZone() { } -const unsigned char* Timezone::ParseField(const unsigned char *begin, +const unsigned char* TimeZone::ParseField(const unsigned char *begin, const unsigned char *end, const IConverter *ic) { @@ -105,13 +105,13 @@ const unsigned char* Timezone::ParseField(const unsigned char *begin, if( field->type == TZFC_TZTYPE ) { if( ( TZType = field->u.uint32 ) != 1 ) { - throw Error("Timezone::ParseField: Timezone Type is not valid"); + throw Error("TimeZone::ParseField: TimeZone Type is not valid"); } return begin; } // cycle through the type table - for( FieldLink *b = TimezoneFieldLinks; + for( FieldLink *b = TimeZoneFieldLinks; b->type != TZFC_END; b++ ) { @@ -162,33 +162,33 @@ const unsigned char* Timezone::ParseField(const unsigned char *begin, return begin; } -void Timezone::ParseHeader(const Data &data, size_t &offset) +void TimeZone::ParseHeader(const Data &data, size_t &offset) { // no header in Task records } -void Timezone::ParseFields(const Data &data, size_t &offset, const IConverter *ic) +void TimeZone::ParseFields(const Data &data, size_t &offset, const IConverter *ic) { const unsigned char *finish = ParseCommonFields(*this, data.GetData() + offset, data.GetData() + data.GetSize(), ic); offset += finish - (data.GetData() + offset); } -void Timezone::Validate() const +void TimeZone::Validate() const { } -void Timezone::BuildHeader(Data &data, size_t &offset) const +void TimeZone::BuildHeader(Data &data, size_t &offset) const { // not yet implemented } -void Timezone::BuildFields(Data &data, size_t &offset, const IConverter *ic) const +void TimeZone::BuildFields(Data &data, size_t &offset, const IConverter *ic) const { // not yet implemented } -void Timezone::Clear() +void TimeZone::Clear() { RecType = GetDefaultRecType(); RecordId = 0; @@ -207,9 +207,9 @@ void Timezone::Clear() Unknowns.clear(); } -const FieldHandle::ListT& Timezone::GetFieldHandles() +const FieldHandle::ListT& TimeZone::GetFieldHandles() { - static FieldHandle::ListT fhv; + static FieldHandle::ListT fhv; if( fhv.size() ) return fhv; @@ -218,33 +218,33 @@ const FieldHandle::ListT& Timezone::GetFieldHandles() #define CONTAINER_OBJECT_NAME fhv #undef RECORD_CLASS_NAME -#define RECORD_CLASS_NAME Timezone +#define RECORD_CLASS_NAME TimeZone FHP(RecType, "Record Type Code"); FHP(RecordId, "Unique Record ID"); - FHD(Name, "Timezone Name", TZFC_NAME, true); + FHD(Name, "TimeZone Name", TZFC_NAME, true); FHD(Index, "Index", TZFC_INDEX, false); - FHD(UTCOffset, "Timezone Offset in Minutes", TZFC_OFFSET, false); + FHD(UTCOffset, "TimeZone Offset in Minutes", TZFC_OFFSET, false); FHD(UseDST, "Use DST?", TZFC_DST, false); FHD(DSTOffset, "DST Offset", TZFC_DST, false); FHD(StartMonth, "Start Month", TZFC_STARTMONTH, false); FHD(EndMonth, "End Month", TZFC_ENDMONTH, false); - FHD(TZType, "Timezone Type", TZFC_TZTYPE, false); + FHD(TZType, "TimeZone Type", TZFC_TZTYPE, false); FHP(Unknowns, "Unknown Fields"); return fhv; } -std::string Timezone::GetDescription() const +std::string TimeZone::GetDescription() const { ostringstream oss; oss << Name << " (" << dec << (UTCOffset / 60.0) << ")"; return oss.str(); } -void Timezone::Dump(std::ostream &os) const +void TimeZone::Dump(std::ostream &os) const { ios_format_state state(os); @@ -253,11 +253,11 @@ void Timezone::Dump(std::ostream &os) const "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; - os << "Timezone entry: 0x" << setbase(16) << RecordId + os << "TimeZone entry: 0x" << setbase(16) << RecordId << " (" << (unsigned int)RecType << ")\n"; // cycle through the type table - for( const FieldLink *b = TimezoneFieldLinks; + for( const FieldLink *b = TimeZoneFieldLinks; b->type != TZFC_END; b++ ) { @@ -297,7 +297,7 @@ void Timezone::Dump(std::ostream &os) const } -void Timezone::Split(int *hours, int *minutes) const +void TimeZone::Split(int *hours, int *minutes) const { *hours = UTCOffset / 60; *minutes = UTCOffset % 60; @@ -305,7 +305,7 @@ void Timezone::Split(int *hours, int *minutes) const *minutes = -*minutes; } -void Timezone::SplitAbsolute(bool *west, +void TimeZone::SplitAbsolute(bool *west, unsigned int *hours, unsigned int *minutes) const { @@ -324,7 +324,7 @@ void Timezone::SplitAbsolute(bool *west, *minutes = tmpminutes; } -std::string Timezone::GetTz(const std::string &prefix) const +std::string TimeZone::GetTz(const std::string &prefix) const { int hours, minutes; Split(&hours, &minutes); @@ -343,7 +343,7 @@ std::string Timezone::GetTz(const std::string &prefix) const // daylight saving time next, if available if( UseDST ) { - Timezone dst(UTCOffset + DSTOffset); + TimeZone dst(UTCOffset + DSTOffset); dst.Split(&hours, &minutes); diff --git a/src/r_timezone.h b/src/r_timezone.h index df965b9c..4fbded8c 100644 --- a/src/r_timezone.h +++ b/src/r_timezone.h @@ -34,7 +34,7 @@ namespace Barry { // forward declarations class IConverter; -class BXEXPORT Timezone +class BXEXPORT TimeZone { public: typedef Barry::UnknownsType UnknownsType; @@ -66,23 +66,23 @@ public: UnknownsType Unknowns; public: - Timezone(); + TimeZone(); /// Creates a new timezone based on utc_offset minutes. /// Use same semantics as UTCOffset. For example, a -3.5 hour /// timezone (which is west of UTC) would be constructed - /// as: Timezone(-210) - explicit Timezone(int utc_offset); + /// as: TimeZone(-210) + explicit TimeZone(int utc_offset); /// Creates a new timezone based on negative/positive hours, /// and positive minutes. For example, a -3.5 hour timezone - /// (which is west of UTC) would be constructed as: Timezone(-3, 30) - Timezone(int hours, int minutes); + /// (which is west of UTC) would be constructed as: TimeZone(-3, 30) + TimeZone(int hours, int minutes); - virtual ~Timezone(); + virtual ~TimeZone(); // - // Timezone related utility functions + // TimeZone related utility functions // bool IsWest() const { return UTCOffset < 0; } @@ -128,20 +128,21 @@ public: void Dump(std::ostream &os) const; std::string GetDescription() const; - bool operator<(const Timezone &other) const { return Name < other.Name; } + bool operator<(const TimeZone &other) const { return Name < other.Name; } // database name static const char * GetDBName() { return "Time Zones"; } static uint8_t GetDefaultRecType() { return 2; } // Generic Field Handle support - static const FieldHandle::ListT& GetFieldHandles(); + static const FieldHandle::ListT& GetFieldHandles(); }; -BXEXPORT inline std::ostream& operator<<(std::ostream &os, const Timezone &msg) { +BXEXPORT inline std::ostream& operator<<(std::ostream &os, const TimeZone &msg) { msg.Dump(os); return os; } } // namespace Barry #endif /* __BARRY_RECORD_TIMEZONE_H__*/ + diff --git a/src/s11n-boost.h b/src/s11n-boost.h index 87df810e..84b7a80a 100644 --- a/src/s11n-boost.h +++ b/src/s11n-boost.h @@ -468,7 +468,7 @@ void serialize(ArchiveT &ar, Barry::Folder &f, const unsigned int ver) } template -void serialize(ArchiveT &ar, Barry::Timezone &t, const unsigned int ver) +void serialize(ArchiveT &ar, Barry::TimeZone &t, const unsigned int ver) { ar & make_nvp("RecType", t.RecType); ar & make_nvp("RecordId", t.RecordId); diff --git a/tools/bfuse.cc b/tools/bfuse.cc index 27cbc074..1966492c 100644 --- a/tools/bfuse.cc +++ b/tools/bfuse.cc @@ -208,10 +208,10 @@ ParserPtr GetParser(const string &name, std::ostream &os, bool null_parser) new RecordParser > ( new Store(os))); } - else if( name == Timezone::GetDBName() ) { + else if( name == TimeZone::GetDBName() ) { return ParserPtr( - new RecordParser > ( - new Store(os))); + new RecordParser > ( + new Store(os))); } else { // unknown database, use null parser diff --git a/tools/btool.cc b/tools/btool.cc index 0f7941d0..5684fbda 100644 --- a/tools/btool.cc +++ b/tools/btool.cc @@ -369,10 +369,10 @@ shared_ptr GetParser(const string &name, new RecordParser > ( new Store(filename, false, dnow, vmode))); } - else if( name == Timezone::GetDBName() ) { + else if( name == TimeZone::GetDBName() ) { return shared_ptr( - new RecordParser > ( - new Store(filename, false, dnow, vmode))); + new RecordParser > ( + new Store(filename, false, dnow, vmode))); } else if( name == HandheldAgent::GetDBName() ) { return shared_ptr( -- 2.11.4.GIT