Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

evamemo.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by casper                                          *
00003  *   tlmcasper@163.com                                                     *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef LIBEVAMEMO_H
00021 #define LIBEVAMEMO_H
00022 
00023 #include "evapacket.h" 
00024 #include "evadefines.h"
00025 #include <string>
00026 #include <vector>
00027 
00028 typedef std::vector<std::string> stringList;
00029 
00030 typedef struct MemoItem{
00031         std::string address;
00032         std::string telephone;
00033         std::string email;
00034         std::string mobile;
00035         std::string name;
00036         std::string note;
00037         std::string zipcode;
00038 }MemoItem;
00039 
00040 class EvaMemoPacket : public OutPacket
00041 {
00042 public:
00043         EvaMemoPacket(){}
00044         EvaMemoPacket( const int id, const unsigned char type);
00045         EvaMemoPacket( const EvaMemoPacket &rhs );
00046         virtual ~EvaMemoPacket(){};
00047  
00048         EvaMemoPacket &operator=( const EvaMemoPacket &rhs );
00049  
00050         void setType( const unsigned char type ) { m_Type = type; }
00051         void setMemo( const MemoItem &memo ) { m_Memo = memo; }
00052         void setQQ( const int qq ) { m_Id = qq; } 
00053         
00054         const unsigned char  getType() const { return m_Type; }
00055         const MemoItem getMemo() const { return m_Memo; }
00056         const int getQQ() const { return m_Id; }
00057         
00058         void setDetails( const MemoItem &memo);
00059         void setDetails( const stringList infos ) { m_Infos = infos; }
00060         const stringList &getDetails() const { return m_Infos; }
00061  
00062 protected:
00063         virtual int putBody( unsigned char *buf );
00064 private:
00065         int m_Id; 
00066         unsigned char m_Type;
00067         MemoItem m_Memo;
00068         stringList m_Infos;
00069 };
00070 
00071 class EvaMemoReplyPacket : public InPacket
00072 {
00073 public:
00074         EvaMemoReplyPacket(){}
00075         EvaMemoReplyPacket( unsigned char *buf, int len );
00076         EvaMemoReplyPacket( const EvaMemoReplyPacket &rhs );
00077         virtual ~EvaMemoReplyPacket(){}
00078         
00079         EvaMemoReplyPacket &operator=( const EvaMemoReplyPacket &rhs );
00080         
00081         unsigned char getType() const { return m_Type; }
00082         const unsigned char getReplyCode() const { return m_ReplyCode; }
00083         const MemoItem &getMemo() const { return m_Memo; }
00084         const int getQQ() const { return m_Id; }
00085         const stringList &getDetails() const { return m_Infos; }
00086         
00087         void setType( const unsigned char type ) { m_Type = type; }
00088         void setReplyCode( const unsigned char replyCode ) { m_ReplyCode = replyCode; }
00089         void setQQ( const int qq ) { m_Id = qq; }
00090         void setMemo( const MemoItem &memo ) { m_Memo = memo; }
00091         void setMemo( const stringList &infos);
00092         void setDetails( const stringList &infos ) { m_Infos = infos; }
00093         
00094         const bool isChangeAccepted() const { return m_ReplyCode == 0x00; }
00095         
00096 protected:
00097         virtual void parseBody();
00098 private:
00099         unsigned char m_Type;
00100         unsigned char m_ReplyCode;
00101         MemoItem m_Memo;
00102         int m_Id;
00103         stringList m_Infos;
00104 };
00105 
00106 #endif

Generated on Mon May 15 20:48:41 2006 for libeva by  doxygen 1.4.4