| ldif.h | | ldif.h | |
| | | | |
| skipping to change at line 171 | | skipping to change at line 171 | |
| virtual std::string LastName(const Barry::Contact &con) const; | | virtual std::string LastName(const Barry::Contact &con) const; | |
| virtual std::string Company(const Barry::Contact &con) const; | | virtual std::string Company(const Barry::Contact &con) const; | |
| virtual std::string DefaultCommunicationsMethod(const Barry::Contact
&con) const; | | virtual std::string DefaultCommunicationsMethod(const Barry::Contact
&con) const; | |
| virtual std::string Address1(const Barry::Contact &con) const; | | virtual std::string Address1(const Barry::Contact &con) const; | |
| virtual std::string Address2(const Barry::Contact &con) const; | | virtual std::string Address2(const Barry::Contact &con) const; | |
| virtual std::string Address3(const Barry::Contact &con) const; | | virtual std::string Address3(const Barry::Contact &con) const; | |
| virtual std::string City(const Barry::Contact &con) const; | | virtual std::string City(const Barry::Contact &con) const; | |
| virtual std::string Province(const Barry::Contact &con) const; | | virtual std::string Province(const Barry::Contact &con) const; | |
| virtual std::string PostalCode(const Barry::Contact &con) const; | | virtual std::string PostalCode(const Barry::Contact &con) const; | |
| virtual std::string Country(const Barry::Contact &con) const; | | virtual std::string Country(const Barry::Contact &con) const; | |
|
| virtual std::string Title(const Barry::Contact &con) const; | | virtual std::string JobTitle(const Barry::Contact &con) const; | |
| virtual std::string PublicKey(const Barry::Contact &con) const; | | virtual std::string PublicKey(const Barry::Contact &con) const; | |
| virtual std::string Notes(const Barry::Contact &con) const; | | virtual std::string Notes(const Barry::Contact &con) const; | |
| // calculated values... | | // calculated values... | |
| virtual std::string PostalAddress(const Barry::Contact &con) const; | | virtual std::string PostalAddress(const Barry::Contact &con) const; | |
| virtual std::string FullName(const Barry::Contact &con) const; | | virtual std::string FullName(const Barry::Contact &con) const; | |
| virtual std::string FQDN(const Barry::Contact &con) const; | | virtual std::string FQDN(const Barry::Contact &con) const; | |
| | | | |
| // | | // | |
| // Write functions | | // Write functions | |
| // | | // | |
| | | | |
| skipping to change at line 202 | | skipping to change at line 202 | |
| virtual void SetLastName(Barry::Contact &con, const std::string &val
) const; | | virtual void SetLastName(Barry::Contact &con, const std::string &val
) const; | |
| virtual void SetCompany(Barry::Contact &con, const std::string &val)
const; | | virtual void SetCompany(Barry::Contact &con, const std::string &val)
const; | |
| virtual void SetDefaultCommunicationsMethod(Barry::Contact &con, con
st std::string &val) const; | | virtual void SetDefaultCommunicationsMethod(Barry::Contact &con, con
st std::string &val) const; | |
| virtual void SetAddress1(Barry::Contact &con, const std::string &val
) const; | | virtual void SetAddress1(Barry::Contact &con, const std::string &val
) const; | |
| virtual void SetAddress2(Barry::Contact &con, const std::string &val
) const; | | virtual void SetAddress2(Barry::Contact &con, const std::string &val
) const; | |
| virtual void SetAddress3(Barry::Contact &con, const std::string &val
) const; | | virtual void SetAddress3(Barry::Contact &con, const std::string &val
) const; | |
| virtual void SetCity(Barry::Contact &con, const std::string &val) co
nst; | | virtual void SetCity(Barry::Contact &con, const std::string &val) co
nst; | |
| virtual void SetProvince(Barry::Contact &con, const std::string &val
) const; | | virtual void SetProvince(Barry::Contact &con, const std::string &val
) const; | |
| virtual void SetPostalCode(Barry::Contact &con, const std::string &v
al) const; | | virtual void SetPostalCode(Barry::Contact &con, const std::string &v
al) const; | |
| virtual void SetCountry(Barry::Contact &con, const std::string &val)
const; | | virtual void SetCountry(Barry::Contact &con, const std::string &val)
const; | |
|
| virtual void SetTitle(Barry::Contact &con, const std::string &val) c
onst; | | virtual void SetJobTitle(Barry::Contact &con, const std::string &val
) const; | |
| virtual void SetPublicKey(Barry::Contact &con, const std::string &va
l) const; | | virtual void SetPublicKey(Barry::Contact &con, const std::string &va
l) const; | |
| virtual void SetNotes(Barry::Contact &con, const std::string &val) c
onst; | | virtual void SetNotes(Barry::Contact &con, const std::string &val) c
onst; | |
| virtual void SetPostalAddress(Barry::Contact &con, const std::string
&val) const; | | virtual void SetPostalAddress(Barry::Contact &con, const std::string
&val) const; | |
| virtual void SetFullName(Barry::Contact &con, const std::string &val
) const; | | virtual void SetFullName(Barry::Contact &con, const std::string &val
) const; | |
| virtual void SetFQDN(Barry::Contact &con, const std::string &val) co
nst; | | virtual void SetFQDN(Barry::Contact &con, const std::string &val) co
nst; | |
| | | | |
| // | | // | |
| // Name heuristics | | // Name heuristics | |
| // | | // | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| parser.h | | parser.h | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 81 | |
| /// store the final packet somewhere, either in memory, disk, etc. | | /// store the final packet somewhere, either in memory, disk, etc. | |
| virtual void Store() {} | | virtual void Store() {} | |
| }; | | }; | |
| | | | |
| // | | // | |
| // RecordParser template class | | // RecordParser template class | |
| // | | // | |
| /// Template class for easy creation of specific parser objects. This temp
late | | /// Template class for easy creation of specific parser objects. This temp
late | |
| /// takes the following template arguments: | | /// takes the following template arguments: | |
| /// | | /// | |
|
| /// - Record: One of the record parser classes in record.h | | /// - RecordT: One of the record parser classes in record.h | |
| /// - Storage: A custom storage functor class. An object of this type | | /// - StorageT: A custom storage functor class. An object of this type | |
| /// will be called as a function with parsed Record as an | | /// will be called as a function with parsed Record as an | |
| /// argument. This happens on the fly as the data is retrieved | | /// argument. This happens on the fly as the data is retrieved | |
| /// from the device over USB, so it should not block forever. | | /// from the device over USB, so it should not block forever. | |
| /// | | /// | |
| /// Example LoadDatabase() call: | | /// Example LoadDatabase() call: | |
| /// | | /// | |
| /// <pre> | | /// <pre> | |
| /// struct StoreContact | | /// struct StoreContact | |
| /// { | | /// { | |
| /// std::vector<Contact> &array; | | /// std::vector<Contact> &array; | |
| | | | |
| skipping to change at line 108 | | skipping to change at line 108 | |
| /// }; | | /// }; | |
| /// | | /// | |
| /// Controller con(probeResult); | | /// Controller con(probeResult); | |
| /// con.OpenMode(Controller::Desktop); | | /// con.OpenMode(Controller::Desktop); | |
| /// std::vector<Contact> contactList; | | /// std::vector<Contact> contactList; | |
| /// StoreContact storage(contactList); | | /// StoreContact storage(contactList); | |
| /// RecordParser<Contact, StoreContact> parser(storage); | | /// RecordParser<Contact, StoreContact> parser(storage); | |
| /// con.LoadDatabase(con.GetDBID("Address Book"), parser); | | /// con.LoadDatabase(con.GetDBID("Address Book"), parser); | |
| /// </pre> | | /// </pre> | |
| /// | | /// | |
|
| template <class Record, class Storage> | | template <class RecordT, class StorageT> | |
| class RecordParser : public Parser | | class RecordParser : public Parser | |
| { | | { | |
|
| Storage *m_store; | | StorageT *m_store; | |
| bool m_owned; | | bool m_owned; | |
|
| Record m_rec; | | RecordT m_rec; | |
| | | | |
| public: | | public: | |
| /// Constructor that references an externally managed storage object
. | | /// Constructor that references an externally managed storage object
. | |
|
| RecordParser(Storage &storage) | | RecordParser(StorageT &storage) | |
| : m_store(&storage), m_owned(false) {} | | : m_store(&storage), m_owned(false) {} | |
| | | | |
| /// Constructor that references a locally managed storage object. | | /// Constructor that references a locally managed storage object. | |
| /// The pointer passed in will be stored, and freed when this class | | /// The pointer passed in will be stored, and freed when this class | |
| /// is destroyed. It is safe to call this constructor with | | /// is destroyed. It is safe to call this constructor with | |
| /// a 'new'ly created storage object. | | /// a 'new'ly created storage object. | |
|
| RecordParser(Storage *storage) | | RecordParser(StorageT *storage) | |
| : m_store(storage), m_owned(true) {} | | : m_store(storage), m_owned(true) {} | |
| | | | |
| ~RecordParser() | | ~RecordParser() | |
| { | | { | |
| if( this->m_owned ) | | if( this->m_owned ) | |
| delete m_store; | | delete m_store; | |
| } | | } | |
| | | | |
| virtual void Clear() | | virtual void Clear() | |
| { | | { | |
|
| m_rec = Record(); | | m_rec = RecordT(); | |
| } | | } | |
| | | | |
| virtual void SetIds(uint8_t RecType, uint32_t UniqueId) | | virtual void SetIds(uint8_t RecType, uint32_t UniqueId) | |
| { | | { | |
| m_rec.SetIds(RecType, UniqueId); | | m_rec.SetIds(RecType, UniqueId); | |
| } | | } | |
| | | | |
| virtual void ParseHeader(const Data &data, size_t &offset) | | virtual void ParseHeader(const Data &data, size_t &offset) | |
| { | | { | |
| m_rec.ParseHeader(data, offset); | | m_rec.ParseHeader(data, offset); | |
| | | | |
End of changes. 7 change blocks. |
| 8 lines changed or deleted | | 8 lines changed or added | |
|
| record.h | | record.h | |
| /// | | /// | |
| /// \file record.h | | /// \file record.h | |
| /// Blackberry database record classes. Help translate data | | /// Blackberry database record classes. Help translate data | |
| /// from data packets to useful structurs, and back. | | /// from data packets to useful structurs, and back. | |
|
| | | /// This header provides the common types and classes | |
| | | /// used by the general record parser classes in the | |
| | | /// r_*.h files. Only application-safe API stuff goes in | |
| | | /// here. Internal library types go in record-internal.h | |
| /// | | /// | |
| | | | |
| /* | | /* | |
| Copyright (C) 2005-2007, Net Direct Inc. (http://www.netdirect.ca/) | | Copyright (C) 2005-2007, Net Direct Inc. (http://www.netdirect.ca/) | |
| | | | |
| This program is free software; you can redistribute it and/or modify | | This program is free software; you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | | it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation; either version 2 of the License, or | | the Free Software Foundation; either version 2 of the License, or | |
| (at your option) any later version. | | (at your option) any later version. | |
| | | | |
| | | | |
| skipping to change at line 167 | | skipping to change at line 171 | |
| return os; | | return os; | |
| } | | } | |
| | | | |
| struct UnknownField | | struct UnknownField | |
| { | | { | |
| uint8_t type; | | uint8_t type; | |
| std::string data; | | std::string data; | |
| }; | | }; | |
| std::ostream& operator<< (std::ostream &os, const std::vector<UnknownField>
&unknowns); | | std::ostream& operator<< (std::ostream &os, const std::vector<UnknownField>
&unknowns); | |
| | | | |
|
| /// \addtogroup RecordParserClasses | | struct EmailAddress | |
| /// Parser and data storage classes. These classes take a | | | |
| /// Database Database record and convert them into C++ objects. | | | |
| /// Each of these classes are safe to be used in standard | | | |
| /// containers, and are meant to be used in conjunction with the | | | |
| /// RecordParser<> template when calling Controller::LoadDatabas | | | |
| e(). | | | |
| /// @{ | | | |
| | | | |
| class Contact | | | |
| { | | { | |
|
| public: | | std::string Name; | |
| struct GroupLink | | std::string Email; | |
| { | | | |
| uint32_t Link; | | | |
| uint16_t Unknown; | | | |
| | | | |
| GroupLink() : Link(0), Unknown(0) {} | | | |
| GroupLink(uint32_t link, uint16_t unknown) | | | |
| : Link(link), Unknown(unknown) | | | |
| {} | | | |
| }; | | | |
| | | | |
|
| typedef std::vector<GroupLink> GroupLinksType; | | void clear() | |
| typedef std::vector<UnknownField> UnknownsType; | | { | |
| | | Name.clear(); | |
| | | Email.clear(); | |
| | | } | |
| | | }; | |
| | | std::ostream& operator<<(std::ostream &os, const EmailAddress &msga); | |
| | | | |
|
| // contact specific data | | struct PostalAddress | |
| uint8_t RecType; | | { | |
| uint32_t RecordId; | | | |
| std::string | | std::string | |
|
| Email, | | | |
| Phone, | | | |
| Fax, | | | |
| WorkPhone, | | | |
| HomePhone, | | | |
| MobilePhone, | | | |
| Pager, | | | |
| PIN, | | | |
| FirstName, | | | |
| LastName, | | | |
| Company, | | | |
| DefaultCommunicationsMethod, | | | |
| Address1, | | Address1, | |
| Address2, | | Address2, | |
| Address3, | | Address3, | |
| City, | | City, | |
| Province, | | Province, | |
| PostalCode, | | PostalCode, | |
|
| Country, | | Country; | |
| Title, | | | |
| PublicKey, | | | |
| Notes; | | | |
| | | | |
| GroupLinksType GroupLinks; | | | |
| UnknownsType Unknowns; | | | |
| | | | |
| private: | | | |
| bool m_FirstNameSeen; | | | |
| | | | |
| //protected: | | | |
| public: | | | |
| const unsigned char* ParseField(const unsigned char *begin, | | | |
| const unsigned char *end); | | | |
| | | | |
| public: | | | |
| Contact(); | | | |
| ~Contact(); | | | |
| | | | |
| uint32_t GetID() const { return RecordId; } | | | |
| std::string GetPostalAddress() const; | | | |
| | | | |
| // Parser / Builder API (see parser.h / builder.h) | | | |
| uint8_t GetRecType() const { return RecType; } | | | |
| uint32_t GetUniqueId() const { return RecordId; } | | | |
| void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = | | | |
| Id; } | | | |
| void ParseHeader(const Data &data, size_t &offset); | | | |
| void ParseFields(const Data &data, size_t &offset); | | | |
| void BuildHeader(Data &data, size_t &offset) const; | | | |
| void BuildFields(Data &data, size_t &offset) const; | | | |
| | | | |
| void Clear(); // erase everything | | | |
| | | | |
| void Dump(std::ostream &os) const; | | | |
| | | | |
| // sorting - put group links at the end | | | |
| bool operator<(const Contact &other) const { | | | |
| return GroupLinks.size() == 0 && other.GroupLinks.size() > 0 | | | |
| ; | | | |
| // // testing - put group links at the top | | | |
| // return GroupLinks.size() > 0 && other.GroupLinks.size() == 0 | | | |
| ; | | | |
| } | | | |
| | | | |
| // database name | | | |
| static const char * GetDBName() { return "Address Book"; } | | | |
| static uint8_t GetDefaultRecType() { return 0; } | | | |
| | | | |
| // helpers | | | |
| static void SplitName(const std::string &full, std::string &first, s | | | |
| td::string &last); | | | |
| }; | | | |
| | | | |
| inline std::ostream& operator<< (std::ostream &os, const Contact &contact) | | | |
| { | | | |
| contact.Dump(os); | | | |
| return os; | | | |
| } | | | |
| | | | |
| class Message | | | |
| { | | | |
| public: | | | |
| struct Address | | | |
| { | | | |
| std::string Name; | | | |
| std::string Email; | | | |
| }; | | | |
| | | | |
| Address From; | | | |
| Address To; | | | |
| Address Cc; | | | |
| std::string Subject; | | | |
| std::string Body; | | | |
| std::vector<UnknownField> Unknowns; | | | |
| | | | |
| public: | | | |
| const unsigned char* ParseField(const unsigned char *begin, | | | |
| const unsigned char *end); | | | |
| | | | |
| public: | | | |
| Message(); | | | |
| ~Message(); | | | |
| | | | |
| // Parser / Builder API (see parser.h / builder.h) | | | |
| uint8_t GetRecType() const; | | | |
| uint32_t GetUniqueId() const; // empty API, not required by protoc | | | |
| ol | | | |
| void SetIds(uint8_t Type, uint32_t Id); // empty API, not required b | | | |
| y protocol | | | |
| void ParseHeader(const Data &data, size_t &offset); | | | |
| void ParseFields(const Data &data, size_t &offset); | | | |
| void BuildHeader(Data &data, size_t &offset) const; | | | |
| void BuildFields(Data &data, size_t &offset) const; | | | |
| | | | |
| void Clear(); | | | |
| | | | |
| void Dump(std::ostream &os) const; | | | |
| | | | |
| // sorting | | | |
| bool operator<(const Message &other) const { return Subject < other. | | | |
| Subject; } | | | |
| | | | |
| // database name | | | |
| static const char * GetDBName() { return "Messages"; } | | | |
| static uint8_t GetDefaultRecType() { return 0; } | | | |
| }; | | | |
| | | | |
| inline std::ostream& operator<<(std::ostream &os, const Message &msg) { | | | |
| msg.Dump(os); | | | |
| return os; | | | |
| } | | | |
| | | | |
| std::ostream& operator<<(std::ostream &os, const Message::Address &msga); | | | |
| | | | |
| class Calendar | | | |
| { | | | |
| public: | | | |
| typedef std::vector<UnknownField> UnknownsType; | | | |
| | | | |
| uint8_t RecType; | | | |
| uint32_t RecordId; | | | |
| | | | |
| // general data | | | |
| bool AllDayEvent; | | | |
| std::string Subject; | | | |
| std::string Notes; | | | |
| std::string Location; | | | |
| time_t NotificationTime; | | | |
| time_t StartTime; | | | |
| time_t EndTime; | | | |
| | | | |
| /// | | | |
| /// Recurring data | | | |
| /// | | | |
| /// Note: interval can be used on all of these recurring types to | | | |
| /// make it happen "every other time" or more, etc. | | | |
| /// | | | |
| enum RecurringCodeType { | | | |
| Day = 1, //< eg. every day | | | |
| //< set: nothing | | | |
| MonthByDate = 3, //< eg. every month on the 12th | | | |
| //< set: DayOfMonth | | | |
| MonthByDay = 4, //< eg. every month on 3rd Wed | | | |
| //< set: DayOfWeek and WeekOfMonth | | | |
| YearByDate = 5, //< eg. every year on March 5 | | | |
| //< set: DayOfMonth and MonthOfYear | | | |
| YearByDay = 6, //< eg. every year on 3rd Wed of Jan | | | |
| //< set: DayOfWeek, WeekOfMonth, and | | | |
| //< MonthOfYear | | | |
| Week = 12 //< eg. every week on Mon and Fri | | | |
| //< set: WeekDays | | | |
| }; | | | |
| | | | |
| bool Recurring; | | | |
| RecurringCodeType RecurringType; | | | |
| unsigned short Interval; // must be >= 1 | | | |
| time_t RecurringEndTime; // only pertains if Recurring is tru | | | |
| e | | | |
| // sets the date and time when | | | |
| // recurrence of this appointment | | | |
| // should no longer occur | | | |
| // If a perpetual appointment, this | | | |
| // is 0xFFFFFFFF in the low level da | | | |
| ta | | | |
| // Instead, set the following flag. | | | |
| bool Perpetual; // if true, this will always recur | | | |
| unsigned short TimeZoneCode; // the time zone originally used | | | |
| // for the recurrence data... | | | |
| // seems to have little use, but | | | |
| // set to your current time zone | | | |
| // as a good default | | | |
| | | | |
| unsigned short // recurring details, depending on t | | | |
| ype | | | |
| DayOfWeek, // 0-6 | | | |
| WeekOfMonth, // 1-5 | | | |
| DayOfMonth, // 1-31 | | | |
| MonthOfYear; // 1-12 | | | |
| unsigned char WeekDays; // bitmask, bit 0 = sunday | | | |
| | | | |
| // FIXME - put these somewhere usable by both C and C++ | | | |
| #define CAL_WD_SUN 0x01 | | | |
| #define CAL_WD_MON 0x02 | | | |
| #define CAL_WD_TUE 0x04 | | | |
| #define CAL_WD_WED 0x08 | | | |
| #define CAL_WD_THU 0x10 | | | |
| #define CAL_WD_FRI 0x20 | | | |
| #define CAL_WD_SAT 0x40 | | | |
| | | | |
| // unknown | | | |
| UnknownsType Unknowns; | | | |
| | | | |
| public: | | | |
| const unsigned char* ParseField(const unsigned char *begin, | | | |
| const unsigned char *end); | | | |
| void ParseRecurrenceData(const void *data); | | | |
| void BuildRecurrenceData(void *data); | | | |
| | | | |
| public: | | | |
| Calendar(); | | | |
| ~Calendar(); | | | |
| | | | |
| // Parser / Builder API (see parser.h / builder.h) | | | |
| uint8_t GetRecType() const { return RecType; } | | | |
| uint32_t GetUniqueId() const { return RecordId; } | | | |
| void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = | | | |
| Id; } | | | |
| void ParseHeader(const Data &data, size_t &offset); | | | |
| void ParseFields(const Data &data, size_t &offset); | | | |
| void BuildHeader(Data &data, size_t &offset) const; | | | |
| void BuildFields(Data &data, size_t &offset) const; | | | |
| | | | |
| void Clear(); | | | |
| | | | |
| void Dump(std::ostream &os) const; | | | |
| | | | |
| // sorting | | | |
| bool operator<(const Calendar &other) const { return StartTime < oth | | | |
| er.StartTime; } | | | |
| | | | |
| // database name | | | |
| static const char * GetDBName() { return "Calendar"; } | | | |
| static uint8_t GetDefaultRecType() { return 5; } // or 0? | | | |
| }; | | | |
| | | | |
| inline std::ostream& operator<<(std::ostream &os, const Calendar &msg) { | | | |
| msg.Dump(os); | | | |
| return os; | | | |
| } | | | |
| | | | |
| // This is a packed field, which is a group of fields packed in | | | |
| // variable length records inside one larger field of a normal record. | | | |
| class ServiceBookConfig | | | |
| { | | | |
| public: | | | |
| typedef std::vector<UnknownField> UnknownsType; | | | |
| | | | |
| uint8_t Format; | | | |
| | | | |
| UnknownsType Unknowns; | | | |
| | | | |
| public: | | | |
| const unsigned char* ParseField(const unsigned char *begin, | | | |
| const unsigned char *end); | | | |
| | | | |
| public: | | | |
| ServiceBookConfig(); | | | |
| ~ServiceBookConfig(); | | | |
| | | | |
| // Parser / Builder API (see parser.h / builder.h) | | | |
| void ParseHeader(const Data &data, size_t &offset); | | | |
| void ParseFields(const Data &data, size_t &offset); | | | |
| void BuildHeader(Data &data, size_t &offset) const; | | | |
| void BuildFields(Data &data, size_t &offset) const; | | | |
| | | | |
| void Clear(); | | | |
| | | | |
| void Dump(std::ostream &os) const; | | | |
| }; | | | |
| | | | |
| inline std::ostream& operator<<(std::ostream &os, const ServiceBookConfig & | | | |
| msg) { | | | |
| msg.Dump(os); | | | |
| return os; | | | |
| } | | | |
| | | | |
| class ServiceBook | | | |
| { | | | |
| int NameType, DescType, UniqueIdType; | | | |
| | | | |
| public: | | | |
| typedef std::vector<UnknownField> UnknownsType; | | | |
| | | | |
| uint8_t RecType; | | | |
| uint32_t RecordId; | | | |
| std::string Name; | | | |
| std::string HiddenName; | | | |
| std::string Description; | | | |
| std::string DSID; | | | |
| std::string BesDomain; | | | |
| std::string UniqueId; | | | |
| std::string ContentId; | | | |
| ServiceBookConfig Config; | | | |
| | | | |
| UnknownsType Unknowns; | | | |
| | | | |
| public: | | | |
| const unsigned char* ParseField(const unsigned char *begin, | | | |
| const unsigned char *end); | | | |
| | | | |
| public: | | | |
| ServiceBook(); | | | |
| ~ServiceBook(); | | | |
| | | | |
| // Parser / Builder API (see parser.h / builder.h) | | | |
| uint8_t GetRecType() const { return RecType; } | | | |
| uint32_t GetUniqueId() const { return RecordId; } | | | |
| void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = | | | |
| Id; } | | | |
| void ParseHeader(const Data &data, size_t &offset); | | | |
| void ParseFields(const Data &data, size_t &offset); | | | |
| void BuildHeader(Data &data, size_t &offset) const; | | | |
| void BuildFields(Data &data, size_t &offset) const; | | | |
| | | | |
|
| | | std::string GetLabel() const; | |
| void Clear(); | | void Clear(); | |
| | | | |
|
| void Dump(std::ostream &os) const; | | bool HasData() const { return Address1.size() || Address2.size() || | |
| | | Address3.size() || City.size() || Province.size() || | |
| // sorting | | PostalCode.size() || Country.size(); } | |
| bool operator<(const ServiceBook &other) const { return RecordId < R | | | |
| ecordId; } | | | |
| | | | |
| // database name | | | |
| static const char * GetDBName() { return "Service Book"; } | | | |
| static uint8_t GetDefaultRecType() { return 0; } | | | |
| }; | | }; | |
|
| | | std::ostream& operator<<(std::ostream &os, const PostalAddress &msga); | |
| | | | |
|
| inline std::ostream& operator<<(std::ostream &os, const ServiceBook &msg) { | | /// \addtogroup RecordParserClasses | |
| msg.Dump(os); | | /// Parser and data storage classes. These classes take a | |
| return os; | | /// Database Database record and convert them into C++ objects. | |
| } | | /// Each of these classes are safe to be used in standard | |
| | | /// containers, and are meant to be used in conjunction with the | |
| | | /// RecordParser<> template when calling Controller::LoadDatabas | |
| | | e(). | |
| | | /// @{ | |
| /// @} | | /// @} | |
| | | | |
| } // namespace Barry | | } // namespace Barry | |
| | | | |
|
| | | // Include all parser classes, to make it easy for the application to use. | |
| | | #include "r_calendar.h" | |
| | | #include "r_contact.h" | |
| | | #include "r_memo.h" | |
| | | #include "r_message.h" | |
| | | #include "r_servicebook.h" | |
| | | #include "r_task.h" | |
| | | #include "r_pin_message.h" | |
| | | #include "r_saved_message.h" | |
| | | #include "r_folder.h" | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 12 change blocks. |
| 357 lines changed or deleted | | 41 lines changed or added | |
|
| s11n-boost.h | | s11n-boost.h | |
| | | | |
| skipping to change at line 48 | | skipping to change at line 48 | |
| // equal or greater than this, only mappable
, | | // equal or greater than this, only mappable
, | |
| // POD data is included in the serialization | | // POD data is included in the serialization | |
| // | | // | |
| #define BARRY_BASE_S11N_VERSION 0 | | #define BARRY_BASE_S11N_VERSION 0 | |
| #define BARRY_POD_MAP_VERSION 1000 | | #define BARRY_POD_MAP_VERSION 1000 | |
| | | | |
| // namespace boost::serialization, for the non-intrusive version | | // namespace boost::serialization, for the non-intrusive version | |
| namespace boost { | | namespace boost { | |
| namespace serialization { | | namespace serialization { | |
| | | | |
|
| template <class Archive> | | template <class ArchiveT> | |
| void serialize(Archive &ar, Barry::UnknownField &uf, const unsigned int ver | | void serialize(ArchiveT &ar, Barry::UnknownField &uf, const unsigned int ve | |
| ) | | r) | |
| { | | { | |
| ar & make_nvp("type", uf.type); | | ar & make_nvp("type", uf.type); | |
| ar & make_nvp("data", uf.data); | | ar & make_nvp("data", uf.data); | |
| } | | } | |
| | | | |
|
| template <class Archive> | | template <class ArchiveT> | |
| void serialize(Archive &ar, Barry::Contact::GroupLink &g, const unsigned in | | void serialize(ArchiveT &ar, Barry::Contact::GroupLink &g, const unsigned i | |
| t ver) | | nt ver) | |
| { | | { | |
| ar & make_nvp("Link", g.Link); | | ar & make_nvp("Link", g.Link); | |
| ar & make_nvp("Unknown", g.Unknown); | | ar & make_nvp("Unknown", g.Unknown); | |
| } | | } | |
| | | | |
|
| template <class Archive> | | template <class ArchiveT> | |
| void serialize(Archive &ar, Barry::Contact &c, const unsigned int ver) | | void serialize(ArchiveT &ar, Barry::Contact &c, const unsigned int ver) | |
| { | | { | |
| ar & make_nvp("RecordId", c.RecordId); | | ar & make_nvp("RecordId", c.RecordId); | |
| | | | |
| ar & make_nvp("Email", c.Email); | | ar & make_nvp("Email", c.Email); | |
| ar & make_nvp("Phone", c.Phone); | | ar & make_nvp("Phone", c.Phone); | |
| ar & make_nvp("Fax", c.Fax); | | ar & make_nvp("Fax", c.Fax); | |
| ar & make_nvp("WorkPhone", c.WorkPhone); | | ar & make_nvp("WorkPhone", c.WorkPhone); | |
| ar & make_nvp("HomePhone", c.HomePhone); | | ar & make_nvp("HomePhone", c.HomePhone); | |
| ar & make_nvp("MobilePhone", c.MobilePhone); | | ar & make_nvp("MobilePhone", c.MobilePhone); | |
| ar & make_nvp("Pager", c.Pager); | | ar & make_nvp("Pager", c.Pager); | |
| ar & make_nvp("PIN", c.PIN); | | ar & make_nvp("PIN", c.PIN); | |
|
| | | ar & make_nvp("Radio", c.Radio); | |
| | | ar & make_nvp("WorkPhone2", c.WorkPhone2); | |
| | | ar & make_nvp("HomePhone2", c.HomePhone2); | |
| | | ar & make_nvp("OtherPhone", c.OtherPhone); | |
| ar & make_nvp("FirstName", c.FirstName); | | ar & make_nvp("FirstName", c.FirstName); | |
| ar & make_nvp("LastName", c.LastName); | | ar & make_nvp("LastName", c.LastName); | |
| ar & make_nvp("Company", c.Company); | | ar & make_nvp("Company", c.Company); | |
| ar & make_nvp("DefaultCommunicationsMethod", c.DefaultCommunications
Method); | | ar & make_nvp("DefaultCommunicationsMethod", c.DefaultCommunications
Method); | |
|
| ar & make_nvp("Address1", c.Address1); | | ar & make_nvp("Address1", c.WorkAddress.Address1); | |
| ar & make_nvp("Address2", c.Address2); | | ar & make_nvp("Address2", c.WorkAddress.Address2); | |
| ar & make_nvp("Address3", c.Address3); | | ar & make_nvp("Address3", c.WorkAddress.Address3); | |
| ar & make_nvp("City", c.City); | | ar & make_nvp("City", c.WorkAddress.City); | |
| ar & make_nvp("Province", c.Province); | | ar & make_nvp("Province", c.WorkAddress.Province); | |
| ar & make_nvp("PostalCode", c.PostalCode); | | ar & make_nvp("PostalCode", c.WorkAddress.PostalCode); | |
| ar & make_nvp("Country", c.Country); | | ar & make_nvp("Country", c.WorkAddress.Country); | |
| ar & make_nvp("Title", c.Title); | | ar & make_nvp("JobTitle", c.JobTitle); | |
| ar & make_nvp("PublicKey", c.PublicKey); | | ar & make_nvp("PublicKey", c.PublicKey); | |
|
| | | ar & make_nvp("URL", c.URL); | |
| | | ar & make_nvp("Prefix", c.Prefix); | |
| | | ar & make_nvp("Category", c.Category); | |
| | | ar & make_nvp("HomeAddress1", c.HomeAddress.Address1); | |
| | | ar & make_nvp("HomeAddress2", c.HomeAddress.Address2); | |
| | | ar & make_nvp("HomeAddress3", c.HomeAddress.Address3); | |
| ar & make_nvp("Notes", c.Notes); | | ar & make_nvp("Notes", c.Notes); | |
|
| | | ar & make_nvp("UserDefined1", c.UserDefined1); | |
| | | ar & make_nvp("UserDefined2", c.UserDefined2); | |
| | | ar & make_nvp("UserDefined3", c.UserDefined3); | |
| | | ar & make_nvp("UserDefined4", c.UserDefined4); | |
| | | ar & make_nvp("HomeCity", c.HomeAddress.City); | |
| | | ar & make_nvp("HomeProvince", c.HomeAddress.Province); | |
| | | ar & make_nvp("HomePostalCode", c.HomeAddress.PostalCode); | |
| | | ar & make_nvp("HomeCountry", c.HomeAddress.Country); | |
| | | ar & make_nvp("Image", c.Image); | |
| | | | |
| if( ver < BARRY_POD_MAP_VERSION ) { | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| ar & make_nvp("GroupLinks", c.GroupLinks); | | ar & make_nvp("GroupLinks", c.GroupLinks); | |
| ar & make_nvp("Unknowns", c.Unknowns); | | ar & make_nvp("Unknowns", c.Unknowns); | |
| } | | } | |
| } | | } | |
| | | | |
|
| template <class Archive> | | template <class ArchiveT> | |
| void serialize(Archive &ar, Barry::Message::Address &a, const unsigned int | | void serialize(ArchiveT &ar, Barry::EmailAddress &a, const unsigned int ver | |
| ver) | | ) | |
| { | | { | |
| ar & make_nvp("Name", a.Name); | | ar & make_nvp("Name", a.Name); | |
| ar & make_nvp("Email", a.Email); | | ar & make_nvp("Email", a.Email); | |
| } | | } | |
| | | | |
|
| template <class Archive> | | template <class ArchiveT> | |
| void serialize(Archive &ar, Barry::Message &m, const unsigned int ver) | | void serialize(ArchiveT &ar, Barry::Message &m, const unsigned int ver) | |
| { | | { | |
| ar & make_nvp("From", m.From); | | ar & make_nvp("From", m.From); | |
| ar & make_nvp("To", m.To); | | ar & make_nvp("To", m.To); | |
| ar & make_nvp("Cc", m.Cc); | | ar & make_nvp("Cc", m.Cc); | |
|
| | | ar & make_nvp("Sender", m.Sender); | |
| | | ar & make_nvp("ReplyTo", m.ReplyTo); | |
| ar & make_nvp("Subject", m.Subject); | | ar & make_nvp("Subject", m.Subject); | |
| ar & make_nvp("Body", m.Body); | | ar & make_nvp("Body", m.Body); | |
|
| | | ar & make_nvp("Attachment", m.Attachment); | |
| | | | |
| if( ver < BARRY_POD_MAP_VERSION ) { | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| ar & make_nvp("Unknowns", m.Unknowns); | | ar & make_nvp("Unknowns", m.Unknowns); | |
| } | | } | |
| } | | } | |
| | | | |
|
| template <class Archive> | | template <class ArchiveT> | |
| void serialize(Archive &ar, Barry::Calendar &c, const unsigned int ver) | | void serialize(ArchiveT &ar, Barry::Calendar &c, const unsigned int ver) | |
| { | | { | |
| ar & make_nvp("RecordId", c.RecordId); | | ar & make_nvp("RecordId", c.RecordId); | |
| | | | |
| ar & make_nvp("Recurring", c.Recurring); | | ar & make_nvp("Recurring", c.Recurring); | |
| ar & make_nvp("AllDayEvent", c.AllDayEvent); | | ar & make_nvp("AllDayEvent", c.AllDayEvent); | |
| | | | |
| ar & make_nvp("Subject", c.Subject); | | ar & make_nvp("Subject", c.Subject); | |
| ar & make_nvp("Notes", c.Notes); | | ar & make_nvp("Notes", c.Notes); | |
| ar & make_nvp("Location", c.Location); | | ar & make_nvp("Location", c.Location); | |
| | | | |
| ar & make_nvp("NotificationTime", c.NotificationTime); | | ar & make_nvp("NotificationTime", c.NotificationTime); | |
| ar & make_nvp("StartTime", c.StartTime); | | ar & make_nvp("StartTime", c.StartTime); | |
| ar & make_nvp("EndTime", c.EndTime); | | ar & make_nvp("EndTime", c.EndTime); | |
| | | | |
|
| | | ar & make_nvp("FreeBusyFlag", c.FreeBusyFlag); | |
| | | ar & make_nvp("ClassFlag", c.ClassFlag); | |
| | | | |
| | | ar & make_nvp("Recurring", c.Recurring); | |
| | | ar & make_nvp("RecurringType", c.RecurringType); | |
| | | ar & make_nvp("Interval", c.Interval); | |
| | | ar & make_nvp("RecurringEndTime", c.RecurringEndTime); | |
| | | ar & make_nvp("Perpetual", c.Perpetual); | |
| | | ar & make_nvp("TimeZoneCode", c.TimeZoneCode); | |
| | | | |
| if( ver < BARRY_POD_MAP_VERSION ) { | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| ar & make_nvp("Unknowns", c.Unknowns); | | ar & make_nvp("Unknowns", c.Unknowns); | |
| } | | } | |
| } | | } | |
| | | | |
|
| template <class Archive> | | template <class ArchiveT> | |
| void serialize(Archive &ar, Barry::ServiceBook &c, const unsigned int ver) | | void serialize(ArchiveT &ar, Barry::ServiceBook &c, const unsigned int ver) | |
| { | | { | |
| ar & make_nvp("RecordId", c.RecordId); | | ar & make_nvp("RecordId", c.RecordId); | |
| | | | |
| if( ver < BARRY_POD_MAP_VERSION ) { | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| ar & make_nvp("Unknowns", c.Unknowns); | | ar & make_nvp("Unknowns", c.Unknowns); | |
| } | | } | |
| } | | } | |
| | | | |
|
| | | template <class ArchiveT> | |
| | | void serialize(ArchiveT &ar, Barry::Memo &m, const unsigned int ver) | |
| | | { | |
| | | ar & make_nvp("RecordId", m.RecordId); | |
| | | | |
| | | ar & make_nvp("Title", m.Title); | |
| | | ar & make_nvp("Body", m.Body); | |
| | | ar & make_nvp("Category", m.Category); | |
| | | | |
| | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| | | ar & make_nvp( "Unknowns", m.Unknowns); | |
| | | } | |
| | | } | |
| | | | |
| | | template <class ArchiveT> | |
| | | void serialize(ArchiveT &ar, Barry::Task &t, const unsigned int ver) | |
| | | { | |
| | | ar & make_nvp("RecordId", t.RecordId); | |
| | | | |
| | | ar & make_nvp("Summary", t.Summary); | |
| | | ar & make_nvp("Notes", t.Notes); | |
| | | ar & make_nvp("Categories", t.Categories); | |
| | | | |
| | | ar & make_nvp("StartTime", t.StartTime); | |
| | | ar & make_nvp("AlarmTime", t.AlarmTime); | |
| | | ar & make_nvp("DueTime", t.DueTime); | |
| | | | |
| | | ar & make_nvp("TimeZoneCode", t.TimeZoneCode); | |
| | | ar & make_nvp("AlarmType", t.AlarmType); | |
| | | ar & make_nvp("Interval", t.Interval); | |
| | | ar & make_nvp("RecurringType", t.RecurringType); | |
| | | ar & make_nvp("RecurringEndTime", t.RecurringEndTime); | |
| | | ar & make_nvp("ClassType", t.ClassType); | |
| | | ar & make_nvp("PriorityFlag", t.PriorityFlag); | |
| | | ar & make_nvp("StatusFlag", t.StatusFlag); | |
| | | ar & make_nvp("Recurring", t.Recurring); | |
| | | | |
| | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| | | ar & make_nvp( "Unknowns", t.Unknowns); | |
| | | } | |
| | | } | |
| | | | |
| | | template<class ArchiveT> | |
| | | void serialize(ArchiveT &ar, Barry::PINMessage &p, const unsigned int ver) | |
| | | { | |
| | | ar & make_nvp("From", p.From); | |
| | | ar & make_nvp("To", p.To); | |
| | | ar & make_nvp("Cc", p.Cc); | |
| | | ar & make_nvp("Bcc", p.Bcc); | |
| | | ar & make_nvp("Subject", p.Subject); | |
| | | ar & make_nvp("Body", p.Body); | |
| | | | |
| | | if(ver < BARRY_POD_MAP_VERSION) { | |
| | | ar & make_nvp("Unknowns", p.Unknowns); | |
| | | } | |
| | | } | |
| | | | |
| | | template <class ArchiveT> | |
| | | void serialize(ArchiveT &ar, Barry::SavedMessage &m, const unsigned int ver | |
| | | ) | |
| | | { | |
| | | ar & make_nvp("From", m.From); | |
| | | ar & make_nvp("To", m.To); | |
| | | ar & make_nvp("Cc", m.Cc); | |
| | | ar & make_nvp("Bcc", m.Bcc); | |
| | | ar & make_nvp("Sender", m.Sender); | |
| | | ar & make_nvp("ReplyTo", m.ReplyTo); | |
| | | ar & make_nvp("Subject", m.Subject); | |
| | | ar & make_nvp("Body", m.Body); | |
| | | ar & make_nvp("Attachment", m.Attachment); | |
| | | | |
| | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| | | ar & make_nvp("Unknowns", m.Unknowns); | |
| | | } | |
| | | } | |
| | | | |
| | | template <class ArchiveT> | |
| | | void serialize(ArchiveT &ar, Barry::Folder &f, const unsigned int ver) | |
| | | { | |
| | | ar & make_nvp("FolderName", f.FolderName); | |
| | | if( ver < BARRY_POD_MAP_VERSION ) { | |
| | | ar & make_nvp( "Unknowns", f.Unknowns); | |
| | | } | |
| | | } | |
| | | | |
| }} // namespace boost::serialization | | }} // namespace boost::serialization | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 15 change blocks. |
| 25 lines changed or deleted | | 142 lines changed or added | |
|