mimeio.h | mimeio.h | |||
---|---|---|---|---|
skipping to change at line 28 | skipping to change at line 28 | |||
See the GNU General Public License in the COPYING file at the | See the GNU General Public License in the COPYING file at the | |||
root directory of this project for more details. | root directory of this project for more details. | |||
*/ | */ | |||
#ifndef __BARRY_MIMEIO_H__ | #ifndef __BARRY_MIMEIO_H__ | |||
#define __BARRY_MIMEIO_H__ | #define __BARRY_MIMEIO_H__ | |||
#include "dll.h" | #include "dll.h" | |||
#include "builder.h" | #include "builder.h" | |||
#include "vcard.h" | ||||
#include "vevent.h" | ||||
#include "vjournal.h" | ||||
#include "vtodo.h" | ||||
#include <string> | #include <string> | |||
#include <vector> | #include <vector> | |||
#include <memory> | #include <memory> | |||
#include <iosfwd> | #include <iostream> | |||
namespace Barry { | namespace Barry { | |||
class Contact; | ||||
class Calendar; | ||||
class Memo; | ||||
class Task; | ||||
// | ||||
// Template classes to write MIME data to stream, from record. | ||||
// | ||||
template <class Record> | ||||
class MimeDump | ||||
{ | ||||
public: | ||||
static void Dump(std::ostream &os, const Record &rec) | ||||
{ | ||||
os << rec << std::endl; | ||||
} | ||||
static bool Supported() { return false; } | ||||
}; | ||||
template <> | ||||
class MimeDump<Barry::Contact> | ||||
{ | ||||
public: | ||||
static void Dump(std::ostream &os, const Barry::Contact &rec) | ||||
{ | ||||
Barry::Sync::vCard vcard; | ||||
os << vcard.ToVCard(rec) << std::endl; | ||||
} | ||||
static bool Supported() { return true; } | ||||
}; | ||||
template <> | ||||
class MimeDump<Barry::Calendar> | ||||
{ | ||||
public: | ||||
static void Dump(std::ostream &os, const Barry::Calendar &rec) | ||||
{ | ||||
Barry::Sync::vTimeConverter vtc; | ||||
Barry::Sync::vCalendar vcal(vtc); | ||||
os << vcal.ToVCal(rec) << std::endl; | ||||
} | ||||
static bool Supported() { return true; } | ||||
}; | ||||
template <> | ||||
class MimeDump<Barry::Memo> | ||||
{ | ||||
public: | ||||
static void Dump(std::ostream &os, const Barry::Memo &rec) | ||||
{ | ||||
Barry::Sync::vTimeConverter vtc; | ||||
Barry::Sync::vJournal vjournal(vtc); | ||||
os << vjournal.ToMemo(rec) << std::endl; | ||||
} | ||||
static bool Supported() { return true; } | ||||
}; | ||||
template <> | ||||
class MimeDump<Barry::Task> | ||||
{ | ||||
public: | ||||
static void Dump(std::ostream &os, const Barry::Task &rec) | ||||
{ | ||||
Barry::Sync::vTimeConverter vtc; | ||||
Barry::Sync::vTodo vtodo(vtc); | ||||
os << vtodo.ToTask(rec) << std::endl; | ||||
} | ||||
static bool Supported() { return true; } | ||||
}; | ||||
// | ||||
// Builder class, for reading MIME stream data and loading into | ||||
// a DBData record. | ||||
// | ||||
class BXEXPORT MimeBuilder : public Barry::Builder | class BXEXPORT MimeBuilder : public Barry::Builder | |||
{ | { | |||
std::auto_ptr<std::ifstream> m_ifs; | std::auto_ptr<std::ifstream> m_ifs; | |||
std::istream &m_is; | std::istream &m_is; | |||
public: | public: | |||
explicit MimeBuilder(const std::string &filename); | explicit MimeBuilder(const std::string &filename); | |||
explicit MimeBuilder(std::istream &is); | explicit MimeBuilder(std::istream &is); | |||
bool BuildRecord(DBData &data, size_t &offset, const IConverter *ic) ; | bool BuildRecord(DBData &data, size_t &offset, const IConverter *ic) ; | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 86 lines changed or added | |||
time.h | time.h | |||
---|---|---|---|---|
skipping to change at line 89 | skipping to change at line 89 | |||
BXEXPORT unsigned short GetStaticTimeZoneCode(signed short HourOffset, | BXEXPORT unsigned short GetStaticTimeZoneCode(signed short HourOffset, | |||
signed short MinOffset = 0); | signed short MinOffset = 0); | |||
// Message time conversion stuff | // Message time conversion stuff | |||
BXEXPORT time_t DayToDate( uint16_t Day ); | BXEXPORT time_t DayToDate( uint16_t Day ); | |||
BXEXPORT time_t Message2Time(uint16_t r_date, uint16_t r_time); | BXEXPORT time_t Message2Time(uint16_t r_date, uint16_t r_time); | |||
// Thread timeout creation | // Thread timeout creation | |||
BXEXPORT struct timespec* ThreadTimeout(int timeout_ms, struct timespec *sp ec); | BXEXPORT struct timespec* ThreadTimeout(int timeout_ms, struct timespec *sp ec); | |||
// Utility functions | ||||
BXEXPORT int DaysInMonth(struct tm &t); | ||||
} // namespace Barry | } // namespace Barry | |||
#endif | #endif | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 3 lines changed or added | |||
vevent.h | vevent.h | |||
---|---|---|---|---|
skipping to change at line 31 | skipping to change at line 31 | |||
#ifndef __BARRY_SYNC_VEVENT_H__ | #ifndef __BARRY_SYNC_VEVENT_H__ | |||
#define __BARRY_SYNC_VEVENT_H__ | #define __BARRY_SYNC_VEVENT_H__ | |||
#include "dll.h" | #include "dll.h" | |||
#include "vbase.h" | #include "vbase.h" | |||
#include "vformat.h" | #include "vformat.h" | |||
#include "r_calendar.h" | #include "r_calendar.h" | |||
#include <stdint.h> | #include <stdint.h> | |||
#include <string> | #include <string> | |||
#include <map> | ||||
namespace Barry { namespace Sync { | namespace Barry { namespace Sync { | |||
// | // | |||
// vCalendar | // vCalendar | |||
// | // | |||
/// Class for converting between RFC 2445 iCalendar data format, | /// Class for converting between RFC 2445 iCalendar data format, | |||
/// and the Barry::Calendar class. | /// and the Barry::Calendar class. | |||
/// | /// | |||
class BXEXPORT vCalendar : public vBase | class BXEXPORT vCalendar : public vBase | |||
{ | { | |||
typedef std::map<std::string, std::string> ArgMapType; | ||||
// external reference | // external reference | |||
vTimeConverter &m_vtc; | vTimeConverter &m_vtc; | |||
// data to pass to external requests | // data to pass to external requests | |||
char *m_gCalData; // dynamic memory returned by vformat()... c an | char *m_gCalData; // dynamic memory returned by vformat()... c an | |||
// be used directly by the plugin, without | // be used directly by the plugin, without | |||
// overmuch allocation and freeing (see Extr act()) | // overmuch allocation and freeing (see Extr act()) | |||
std::string m_vCalData; // copy of m_gCalData, for C++ use | std::string m_vCalData; // copy of m_gCalData, for C++ use | |||
Barry::Calendar m_BarryCal; | Barry::Calendar m_BarryCal; | |||
static const char *WeekDays[7]; | static const char *WeekDays[7]; | |||
void CheckUnsupportedArg(const ArgMapType &args, | ||||
const std::string &name); | ||||
std::vector<std::string> SplitBYDAY(const std::string &ByDay); | ||||
uint16_t GetMonthWeekNumFromBYDAY(const std::string& ByDay); | uint16_t GetMonthWeekNumFromBYDAY(const std::string& ByDay); | |||
uint16_t GetWeekDayIndexFromBYDAY(const std::string& ByDay); | uint16_t GetWeekDayIndexFromBYDAY(const std::string& ByDay); | |||
uint16_t GetDayOfMonthFromBYMONTHDAY(const ArgMapType &args, | ||||
int month_override = -1); | ||||
protected: | protected: | |||
void RecurToVCal(); | void RecurToVCal(); | |||
void RecurToBarryCal(vAttr& rrule, time_t starttime); | void RecurToBarryCal(vAttr& rrule, time_t starttime); | |||
static uint16_t GetWeekDayIndex(const char *dayname); | static uint16_t GetWeekDayIndex(const char *dayname); | |||
bool HasMultipleVEvents() const; | bool HasMultipleVEvents() const; | |||
public: | public: | |||
explicit vCalendar(vTimeConverter &vtc); | explicit vCalendar(vTimeConverter &vtc); | |||
End of changes. 4 change blocks. | ||||
0 lines changed or deleted | 8 lines changed or added | |||