vjournal.h

Go to the documentation of this file.
00001 ///
00002 /// \file       vjournal.h
00003 ///             Conversion routines for vjournals (VCALENDAR, etc)
00004 ///
00005 
00006 /*
00007     Copyright (C) 2008-2009, Nicolas VIVIEN
00008     Copyright (C) 2006-2012, Net Direct Inc. (http://www.netdirect.ca/)
00009 
00010     This program is free software; you can redistribute it and/or modify
00011     it under the terms of the GNU General Public License as published by
00012     the Free Software Foundation; either version 2 of the License, or
00013     (at your option) any later version.
00014 
00015     This program is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00018 
00019     See the GNU General Public License in the COPYING file at the
00020     root directory of this project for more details.
00021 */
00022 
00023 #ifndef __BARRY_SYNC_VJOURNAL_H__
00024 #define __BARRY_SYNC_VJOURNAL_H__
00025 
00026 #include "dll.h"
00027 #include "vbase.h"
00028 #include "vformat.h"
00029 #include "r_memo.h"
00030 #include <stdint.h>
00031 #include <string>
00032 
00033 namespace Barry { namespace Sync {
00034 
00035 //
00036 // vJournal
00037 //
00038 /// Class for converting between RFC 2445 iCalendar data format,
00039 /// and the Barry::Memo class.
00040 ///
00041 class BXEXPORT vJournal : public vBase
00042 {
00043         // external reference
00044         vTimeConverter &m_vtc;
00045 
00046         // data to pass to external requests
00047         char *m_gJournalData;   // dynamic memory returned by vformat()... can
00048                                 // be used directly by the plugin, without
00049                                 // overmuch allocation and freeing (see Extract())
00050         std::string m_vJournalData;     // copy of m_gJournalData, for C++ use
00051         Barry::Memo m_BarryMemo;
00052 
00053 protected:
00054         bool HasMultipleVJournals() const;
00055 
00056 public:
00057         explicit vJournal(vTimeConverter &vtc);
00058         ~vJournal();
00059 
00060         const std::string&      ToMemo(const Barry::Memo &memo);
00061         const Barry::Memo&      ToBarry(const char *vjournal, uint32_t RecordId);
00062 
00063         char* ExtractVJournal();
00064 
00065         void Clear();
00066 
00067         // This is the v-name of the innermost BEGIN/END block
00068         static const char* GetVName() { return "VJOURNAL"; }
00069 };
00070 
00071 }} // namespace Barry::Sync
00072 
00073 #endif
00074