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

evaqunlist.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by yunfan                                          *
00003  *   yunfan_zg@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 LIBEVAQUNLIST_H
00021 #define LIBEVAQUNLIST_H
00022 #include "evaqun.h"
00023 #include "evafriend.h"
00024 #include <list>
00025 #include <map>
00026 
00027 /*
00028          this file is for holding all Qun information for a user
00029 */
00030 
00031 // TempQun is only for temporary Qun
00032 
00033 class TmpQun{
00034 public:
00035         TmpQun();  // this constructor is for create TmpQun only
00036         TmpQun(const int pid);
00037         
00038         TmpQun &operator=(const TmpQun &rhs);
00039         
00040         void setQunID(const int id) { qunID = id; }
00041         void setParentID(const int id) { parentID = id; }
00042         void setName(const std::string &n) { name = n; }
00043         // set all members at one go
00044         void setMemberList(const std::list<int> &list) { memberList = list; }
00045         
00046         void addMember(const int qqNum); // add one more member
00047         const bool removeMember(const int qqNum);
00048         
00049         const int getQunID() const { return qunID; }
00050         const int getParentID() const { return parentID; }
00051         const std::string &getName() const { return name; }
00052         const std::list<int> &getMemberQQList() const { return memberList; }
00053 private:
00054         int qunID;
00055         int parentID;
00056         std::string name;
00057         std::list<int> memberList; // all member details are in its parent
00058 };
00059 
00060 // Qun is only for permenant Qun
00061 class Qun{
00062 public:
00063         /*
00064         * constructor for Qun
00065         *@param id   internal ID of a Qun
00066         */
00067         Qun(const int id);
00068         enum MessageType{Notify, Popup, Numbers, RecordOnly, Reject};
00069         Qun &operator=(const Qun &rhs);
00070         const int getQunID() const { return qunID; }
00071         const QunInfo &getDetails() const { return info; }
00072         const std::list<FriendItem> &getMembers() const { return memberList; }
00073         const FriendItem *getMemberDetails(const int qqNum);
00074         
00075         void setDetails(const QunInfo &info) { this->info = info; }
00076         
00077         void setMember(const FriendItem &fi);
00078         void setMembers(const std::list<FriendItem> &list);
00079 
00080         void updateOnlineMembers(const std::list<int> &list);
00081         
00082         void setQQList(const std::list<int> &list) { numberList = list; }
00083         const std::list<int> getQQList() const { return numberList; }
00084         
00085         void setMemberArgs(const std::map<int, QunMember> &list);
00086         const bool isAdmin( const int id);
00087         
00088         const int numMembers() const { return memberList.size(); }
00089         
00090         void setCardName(const std::string n) { cardName = n; }
00091         void setCardGender(const unsigned char g ) { cardGender = g; }
00092         void setCardPhone(const std::string p) { cardPhone = p; }
00093         void setCardEmail(const std::string e) { cardEmail = e; }
00094         void setCardMemo(const std::string m) { cardMemo = m; }
00095         
00096         const std::string &getCardName() const { return cardName; }
00097         const unsigned char &getCardGender() const { return cardGender; }
00098         const std::string &getCardPhone() const { return cardPhone; }
00099         const std::string &getCardEmail() const { return cardEmail; }
00100         const std::string &getCardMemo() const { return cardMemo; }
00101         
00102         void setMessageType(const MessageType type) { msgType = type; }
00103         const MessageType getMessageType() const { return msgType; }
00104         
00105         const std::list<TmpQun> &getTmpQunList() const { return tmpQunList; }
00106         void addTmpQun(const TmpQun &q);
00107         
00108         const bool hasTmpQun() const { return tmpQunList.size() != 0; }
00109         
00110         const bool hasMember(const int id);
00111 
00112         void setRealNamesVersion(const int v) { m_RealNamesVersion = v; }
00113         const int getRealNamesVersion() const { return m_RealNamesVersion; }
00114 
00115         const int getChatFontSize() const { return m_ChatFontSize; }
00116         const int getChatFontColor() const { return m_ChatFontColor; }
00117         const int getChatFontRed()     const { return (int)(( m_ChatFontColor>>16) & 0xff); }
00118         const int getChatFontGreen() const { return (int)(( m_ChatFontColor>>8) & 0xff); }
00119         const int getChatFontBlue()   const { return (int)(  m_ChatFontColor & 0xff); }
00120 
00121         void setChatFontSize( const int size) { m_ChatFontSize = size; }
00122         void setChatFontColor(  const int color) { m_ChatFontColor = color; }
00123         void setChatFontColor(const int red, const int green, const int blue) {
00124                         m_ChatFontColor = (( 0xff << 24) | ( ( red & 0xff) << 16) | ( (green & 0xff) << 8) | ( blue & 0xff) ); }
00125 private:
00126         int qunID;
00127         QunInfo info;
00128         std::list<int> numberList;
00129         std::map<int, QunMember> memberArgs;
00130         std::list<FriendItem> memberList;
00131         std::list<TmpQun> tmpQunList;
00132         
00133         // my Qun card information
00134         std::string cardName;
00135         unsigned char cardGender;
00136         std::string cardPhone;
00137         std::string cardEmail;
00138         std::string cardMemo;
00139 
00140         int m_RealNamesVersion;
00141         
00142         MessageType msgType;
00143 
00144         int m_ChatFontSize;
00145         int m_ChatFontColor;
00146 };
00147 
00148 class QunList {
00149 public:
00150         QunList() {};
00151         
00152         QunList &operator=(const QunList &rhs);
00153         void add(const Qun &q);
00154         bool remove(const int id);
00155         void update(const Qun &q);
00156         Qun *getQun(const int id);
00157         
00158         void setDetails(const QunInfo &info);
00159         void setMember(const int id, const FriendItem &fi);
00160         void setMembers(const int id, const std::list<FriendItem> &list);
00161         
00162         void setOnlineMembers(const int id, const std::list<int> &list);
00163         
00164         void setQQList(const int id, const std::list<int> &list);
00165         void setMemberArgs(const int id, const std::map<int, QunMember> &member);
00166         
00167         const std::list<Qun> &getQunList() const { return qunList; }
00168         void clearQunList() { qunList.clear(); }
00169         
00170         void setMyQunCardInfo(const int id, const std::string name, const unsigned char gender, const std::string phone,
00171                                 const std::string email, const std::string memo);
00172         const int numQuns() const { return qunList.size(); }
00173 private:
00174         std::list<Qun> qunList;
00175 };
00176 
00177 #endif

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