r_message.h

Go to the documentation of this file.
00001 ///
00002 /// \file       r_message.h
00003 ///             Blackberry database record parser class for email records.
00004 ///
00005 
00006 /*
00007     Copyright (C) 2005-2012, Net Direct Inc. (http://www.netdirect.ca/)
00008 
00009     This program is free software; you can redistribute it and/or modify
00010     it under the terms of the GNU General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or
00012     (at your option) any later version.
00013 
00014     This program is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00017 
00018     See the GNU General Public License in the COPYING file at the
00019     root directory of this project for more details.
00020 */
00021 
00022 #ifndef __BARRY_RECORD_MESSAGE_H__
00023 #define __BARRY_RECORD_MESSAGE_H__
00024 
00025 #include "dll.h"
00026 #include "r_message_base.h"
00027 
00028 namespace Barry {
00029 
00030 //
00031 // NOTE:  All classes here must be container-safe!  Perhaps add sorting
00032 //        operators in the future.
00033 //
00034 
00035 /// \addtogroup RecordParserClasses
00036 /// @{
00037 
00038 class BXEXPORT Message : public MessageBase
00039 {
00040 public:
00041         Message()
00042         {
00043                 // must call this again, since base class can't call ours
00044                 Clear();
00045         }
00046 
00047         void Clear()
00048         {
00049                 MessageBase::Clear();
00050 
00051                 RecType = GetDefaultRecType();
00052                 RecordId = 0;
00053         }
00054 
00055         // database name
00056         static const char * GetDBName() { return "Messages"; }
00057         static uint8_t GetDefaultRecType() { return 0; }
00058 
00059         // Generic Field Handle support
00060         static const FieldHandle<Message>::ListT& GetFieldHandles();
00061 };
00062 
00063 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const Message &msg) {
00064         msg.Dump(os);
00065         return os;
00066 }
00067 
00068 /// @}
00069 
00070 } // namespace Barry
00071 
00072 #endif
00073