OSDN Git Service

2012/01/28 22:22:30
[nlite/nlite.git] / nlite / nlite_chatData.h
1 #pragma once
2
3 namespace nlite{
4
5         //\91O\95û\90é\8c¾
6         class CCommentListWindow;
7
8         //\8d\91\83R\81[\83h
9         namespace cuntry{
10
11                 enum LOCALE{
12                         unknown,
13                         jp
14
15                 };
16
17         }
18
19         ///
20         ///\83\8a\83X\83i\81[\83f\81[\83^
21         ///
22         struct ListenerData{
23
24         public:
25                 CNLiteString user_id;                                   //\83\86\81[\83U\81[ID
26                 CNLiteString userName;                                  //\83\86\81[\83U\81[\96¼
27                 COLORREF bkColor;                                               //\94w\8ci\90F
28                 BOOL originBkFlag;                                              //\94w\8ci\90F\90Ý\92è\83t\83\89\83O
29         public:
30                 
31                 ///
32                 ///\83R\83\93\83X\83g\83\89\83N\83^
33                 ///
34                 ListenerData(LPCTSTR user_id_in);
35
36                 ///
37                 ///\94w\8ci\90F\90Ý\92è
38                 ///
39                 VOID SetBkColor(COLORREF bkColor_in);
40                 
41         };
42
43         //
44         //\83\8a\83X\83i\81[\83f\81[\83^\82©\82ç\94w\8ci\83J\83\89\81[\8eû\8fW\83t\83@\83\93\83N\83V\83\87\83i\83\8b
45         //
46         class CListenerColorCollector{
47
48         private:
49                 std::deque<COLORREF> colorlist;                                                                         //\90F\83\8a\83X\83g
50
51         public:
52
53                 typedef std::deque<COLORREF>::iterator iterator;
54
55                 //\8ew\92è\82µ\82½\90F\82ª\93o\98^\82³\82ê\82Ä\82¢\82é\82©\92²\82×\82é
56                 BOOL Find(COLORREF target){
57
58                         iterator end = colorlist.end();
59
60                         return std::find(colorlist.begin(),end,target) != end ? TRUE : FALSE;
61                 }
62
63                 //\83t\83@\83\93\83N\83V\83\87\83i\83\8b
64                 void operator()(ListenerData &target){
65
66                         if(target.originBkFlag == TRUE){
67
68                                 colorlist.push_back(target.bkColor);
69                         }
70
71                 }
72
73         };
74         
75         
76         ///
77         ///\83\8a\83X\83i\81[\83\8a\83X\83g
78         ///
79         class CListenerList{
80
81         private:
82                 typedef ListenerData InternalType;
83                 typedef std::list<InternalType> ListenerList_Internal; 
84                 ListenerList_Internal m_listenerList;
85
86         public:
87
88                 typedef InternalType& reference;
89                 typedef ListenerList_Internal::value_type value_type;
90                 typedef ListenerList_Internal::iterator iterator;
91
92                 
93
94                 ///
95                 ///\83\86\81[\83U\81[\93o\98^
96                 ///
97                 reference Register(LPCTSTR user_id);
98
99                 ///
100                 ///\94w\8ci\90F\82ð\8eû\8fW\82·\82é
101                 ///
102                 VOID BkColorCollect(CListenerColorCollector &target);
103
104         };
105
106         
107
108         class CChatData{
109
110                 
111         public:
112                 struct ViewData{
113
114                         //\90F\83R\81[\83h\8f\89\8aú\92l
115                         enum{
116                                 INIT_COLOR = -1
117                         };
118
119                         BOOL selectFlag;                                        //\91I\91ð\8fó\91Ô
120                         COLORREF stringColor;                           //\93Æ\8e©\95\8e\9a\90F
121                         COLORREF backColor;                                     //\93Æ\8e©\94w\8ci\90F
122                         COLORREF sellLineColor;                         //\98g\90ü\90F
123
124                         ViewData();
125                 };
126
127                 ViewData viewData;                                      //\95\\8e¦\97p\83f\81[\83^
128                 UINT_PTR premium;                                       //\83v\83\8c\83~\83A\83\80\8eí\95Ê
129                 BOOL anonymity;                                         //\93½\96¼\83t\83\89\83O
130                 UINT_PTR no;                                            //\83R\83\81\94Ô
131                 UINT_PTR vpos;                                          //\83R\83\81\83\93\83g\95\\8e¦\88Ê\92u
132                 time_t date;                                            //\8e\9e\8aÔ
133                 cuntry::LOCALE locale;                          //\8d\91\83R\81[\83h
134                 ListenerData *listenerData;                     //\83\86\81[\83U\8fî\95ñ
135                 CNLiteString name;                                      //\96¼\91O\81B\82Â\82¢\82Ä\82±\82È\82¢\8e\9e\82à\82 \82é
136                 CNLiteString chatBuf;                           //\83`\83\83\83b\83g\96{\95
137                 std::vector<CNLiteString> mail;         //\83\81\81[\83\8b\83R\83}\83\93\83h
138                 ULONG_PTR thread;                                       //\83X\83\8c\83b\83h\94Ô\8d\86
139                 
140         public:
141
142
143                 ///
144                 ///nlib\82Ì\83`\83\83\83b\83g\83f\81[\83^\82ð\83Z\83b\83g
145                 ///
146                 VOID SetChat(NicoLiveChat &chat_in);
147
148         };
149
150
151         ///
152         ///\83R\83\81\83\93\83g\83\8a\83X\83g\83N\83\89\83X
153         ///
154         class CCommentList{
155
156         private:
157                 typedef std::list<CChatData> ChatList;
158                 ChatList chatList;
159
160         
161
162         
163                 //\83G\83\89\81[\83R\81[\83h
164         public:
165                 enum ERRORCORD{
166                         ERR = -1,
167                         OK = 0
168
169
170                 };
171
172
173                 //\8c^\92è\8b`
174         public:
175                 typedef ChatList::iterator iterator;
176                 typedef ChatList::reference reference;
177                 typedef ChatList::reverse_iterator reverse_iterator;
178
179         public:
180
181                 ///
182                 ///\83R\83\93\83X\83g\83\89\83N\83^
183                 ///
184                 CCommentList();
185                 
186                 ///
187                 ///\83f\83X\83g\83\89\83N\83^
188                 ///
189                 ~CCommentList();
190                 
191                 ///
192                 ///\90\95ú\91\97\90Ú\91±\8e\9e\82Ì\8f\88\97\9d
193                 ///
194                 VOID OnConnect();
195                 
196
197                 ///
198                 ///\94j\8aü\8e\9e\82Ì\8f\88\97\9d
199                 ///
200                 VOID OnDestroy();
201                 
202                 ///
203                 ///\8ai\94[\82³\82ê\82½\83R\83\81\83\93\83g\90\94\8eæ\93¾
204                 ///
205                 UINT_PTR Size();
206                 
207
208                 ///
209                 ///\91I\91ð\8d\80\96Ú\82Ì\94Ô\8d\86\82ð\8eæ\93¾
210                 ///\8e¸\94s\82·\82é\82ÆERR\82ª\95Ô\82Á\82Ä\82­\82é
211                 ///
212                 INT_PTR GetCurSel();
213
214
215                 ///
216                 ///\91I\91ð\8d\80\96Ú\82Ì\94Ô\8d\86\82ð\90Ý\92è
217                 ///
218                 VOID SetCurSel(INT_PTR cursel);
219
220                 ///
221                 ///\91I\91ð\8fó\91Ô\82Ì\83A\83C\83e\83\80\82ð\8eæ\93¾
222                 ///
223                 iterator GetCurSelItem();
224
225                 ///
226                 ///\8bó\82©\94»\92è
227                 ///
228                 BOOL empty();
229
230                 ///
231                 ///\8dÅ\8f\89\82Ì\83C\83e\83\8c\81[\83^\82ð\8eæ\93¾
232                 ///
233                 iterator begin();
234
235                 ///
236                 ///\8dÅ\8cã\82Ì\83C\83e\83\8c\81[\83^\82ð\8eæ\93¾
237                 ///
238                 iterator end();
239
240                 ///
241                 ///\8bt\8cü\82«\83C\83e\83\8c\81[\83^\82Ì\8dÅ\8f\89\82ð\8eæ\93¾
242                 ///
243                 reverse_iterator rbegein();
244
245                 ///
246                 ///\8bt\8cü\82«\83C\83e\83\8c\81[\83^\82Ì\8dÅ\8cã\82ð\8eæ\93¾
247                 ///
248                 reverse_iterator rend();
249
250                 ///
251                 ///\83`\83\83\83b\83g\8eó\90M\8e\9e\82Ì\8f\88\97\9d
252                 ///\83`\83\83\83b\83g\83f\81[\83^\82Ì\91}\93ü\82ð\8ds\82¤
253                 ///\83\8a\83X\83g\82ª\8bó\82©\81A\8eó\90M\82µ\82½\83`\83\83\83b\83g\83f\81[\83^\82Ìdate\82Ì\92l\82ª\83\8a\83X\83g\8dÅ\8cã\94ö\88È\8fã\82Ì\82à\82Ì\82¾\82Á\82½\8fê\8d\87\8dÅ\8cã\94ö\82É\91}\93ü\82³\82ê\82é
254                 ///\82»\82¤\82Å\82È\82©\82Á\82½\8fê\8d\87\82Í\83\8a\83X\83g\82Ì\8dÅ\8f\89\82©\82ç\88ø\90\94\82É\93n\82³\82ê\82½\83`\83\83\83b\83g\83f\81[\83^\82Ìdate\82æ\82è\91å\82«\82¢date\82ð\8e\9d\82Â\83f\81[\83^\82ð\92T\82µ\81A\82»\82Ì\83f\81[\83^\82Ì\92¼\91O\82É\91}\93ü\82·\82é
255                 ///
256                 iterator OnChatReceve(NicoLiveChat_P chatData, UINT_PTR count,CCommentListWindow &listWindow);
257
258                 ///
259                 ///\8ew\92è\82µ\82½\94Ô\8d\86\82Ì\83R\83\81\83\93\83g\8eQ\8fÆ\82ð\8eæ\93¾
260                 ///
261                 reference GetChatAt(UINT_PTR no);
262                 
263
264                 ///
265                 ///\83\8a\83X\83g\8dÅ\8cã\82Ì\8eQ\8fÆ\82ð\8eæ\93¾
266                 ///
267                 reference back();
268
269                 
270                 
271         };
272
273         
274 }