OSDN Git Service

IEクッキー取得持にログファイル出力されるよう変更
[nlite/nlite.git] / nlite / nlite_chatData.h
1 #pragma once
2
3 namespace nlite{
4
5         //\91O\95û\90é\8c¾
6         class CCommentListWindow;
7         class CListenerColorCollector;
8         class CCommentList;
9         class CListenerList;
10         class CReadUserSettingXML;
11
12         //\8d\91\83R\81[\83h
13         namespace cuntry{
14
15                 enum LOCALE{
16                         unknown,
17                         jp
18
19                 };
20
21         }
22
23         ///
24         ///\83\8a\83X\83i\81[\83f\81[\83^
25         ///
26         class CListenerData{
27         private:
28                 friend CListenerColorCollector;
29                 friend CCommentList;
30                 friend CListenerList;
31                 friend CReadUserSettingXML;
32
33                 CNLiteString user_id;                                   //\83\86\81[\83U\81[ID
34                 CNLiteString name;                                              //\83\86\81[\83U\81[\96¼
35                 CNLiteString community;                                 //\93o\98^\82µ\82½\83R\83~\83\85\83j\83e\83B
36                 COLORREF bgcolor;                                               //\94w\8ci\90F
37                 COLORREF nameColor;                                             //\96¼\91O\90F
38                 time_t time;                                                    //\93o\98^\8e\9e\8aÔ
39                 BOOL onlyCommunityFlag;
40         public:
41
42                 enum {
43                         INIT_COLOR = -1
44
45                 };
46
47
48                 //\83Z\83b\83^\81[
49         public:
50                 
51                 ///
52                 ///\83R\83\93\83X\83g\83\89\83N\83^
53                 ///
54                 CListenerData();
55
56                 ///
57                 ///\94w\8ci\90F\90Ý\92è
58                 ///
59                 VOID SetBkColor(COLORREF bkColor_in);
60
61                 ///
62                 ///\96¼\91O\90H\90Ý\92è
63                 ///
64                 VOID SetNameColor(COLORREF nameColor_in);
65                 
66                 ///
67                 ///\83\86\81[\83U\96¼\90Ý\92è
68                 ///
69                 VOID SetUserName(LPCTSTR name);
70
71
72                 //\83Q\83b\83^\81[
73         public:
74
75                 ///
76                 ///\94w\8ci\90F\82ð\8eæ\93¾
77                 ///
78                 COLORREF GetBackColor() const;
79
80
81                 ///
82                 ///\83j\83b\83N\83l\81[\83\80\82Ì\90F\82ð\8eæ\93¾
83                 ///
84                 COLORREF GetNameColor() const;
85
86                 ///
87                 ///\83\86\81[\83U\96¼\82ð\8eæ\93¾
88                 ///
89                 const CNLiteString &GetUserID() const;
90
91
92                 ///
93                 ///\83\86\81[\83U\96¼\82ð\8eæ\93¾
94                 ///
95                 const CNLiteString &GetName() const;
96         };
97
98         //
99         //\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
100         //
101         class CListenerColorCollector{
102
103         private:
104                 std::deque<COLORREF> colorlist;                                                                         //\90F\83\8a\83X\83g
105
106         public:
107
108                 typedef std::deque<COLORREF>::iterator iterator;
109
110                 //\8ew\92è\82µ\82½\90F\82ª\93o\98^\82³\82ê\82Ä\82¢\82é\82©\92²\82×\82é
111                 BOOL Find(COLORREF target){
112
113                         iterator end = colorlist.end();
114
115                         return std::find(colorlist.begin(),end,target) != end ? TRUE : FALSE;
116                 }
117
118                 //\83t\83@\83\93\83N\83V\83\87\83i\83\8b
119                 void operator()(CListenerData &target){
120
121                         if(target.bgcolor != CListenerData::INIT_COLOR){
122
123                                 colorlist.push_back(target.bgcolor);
124                         }
125
126                 }
127
128         };
129         
130         
131         ///
132         ///\83\8a\83X\83i\81[\83\8a\83X\83g
133         ///
134         class CListenerList{
135
136         private:
137                 typedef CListenerData InternalType;
138                 typedef std::list<InternalType> ListenerList_Internal; 
139                 ListenerList_Internal m_listenerList;
140
141         public:
142
143                 typedef InternalType& reference;
144                 typedef ListenerList_Internal::value_type value_type;
145                 typedef ListenerList_Internal::iterator iterator;
146
147                 
148
149                 ///
150                 ///\83\86\81[\83U\81[\93o\98^
151                 ///
152                 reference Register(CListenerData &listener,BOOL bUpdate);
153
154
155                 ///
156                 ///\83\8a\83X\83i\81[\83f\81[\83^\93Ç\82Ý\8d\9e\82Ý
157                 ///
158                 BOOL ReadProperty(LPCTSTR fileName);
159
160                 ///
161                 ///\83\8a\83X\83i\81[\83f\81[\83^\8f\91\82«\8d\9e\82Ý
162                 ///
163                 BOOL WriteProperty(LPCTSTR fileName);
164
165                 
166                 ///
167                 ///\94w\8ci\90F\82ð\8eû\8fW\82·\82é
168                 ///
169                 VOID BkColorCollect(CListenerColorCollector &target);
170
171         };
172
173         
174
175         class CChatData{
176                 friend CCommentList;
177                 
178         public:
179                 struct ViewData{
180
181                         //\90F\83R\81[\83h\8f\89\8aú\92l
182                         enum{
183                                 INIT_COLOR = -1
184                         };
185
186                         BOOL selectFlag;                                        //\91I\91ð\8fó\91Ô
187                         COLORREF stringColor;                           //\93Æ\8e©\95\8e\9a\90F
188                         COLORREF backColor;                                     //\93Æ\8e©\94w\8ci\90F
189                         COLORREF sellLineColor;                         //\98g\90ü\90F
190                         UINT_PTR height;
191
192                         ViewData();
193                 };
194
195         private:
196                 ViewData viewData;                                      //\95\\8e¦\97p\83f\81[\83^
197                 UINT_PTR premium;                                       //\83v\83\8c\83~\83A\83\80\8eí\95Ê
198                 BOOL anonymity;                                         //\93½\96¼\83t\83\89\83O
199                 UINT_PTR no;                                            //\83R\83\81\94Ô
200                 UINT_PTR vpos;                                          //\83R\83\81\83\93\83g\95\\8e¦\88Ê\92u
201                 time_t date;                                            //\8e\9e\8aÔ
202                 cuntry::LOCALE locale;                          //\8d\91\83R\81[\83h
203                 CListenerData *listenerData;                    //\83\86\81[\83U\8fî\95ñ
204                 CNLiteString name;                                      //\96¼\91O\81B\82Â\82¢\82Ä\82±\82È\82¢\8e\9e\82à\82 \82é
205                 CNLiteString chatBuf;                           //\83`\83\83\83b\83g\96{\95
206                 std::vector<CNLiteString> mail;         //\83\81\81[\83\8b\83R\83}\83\93\83h
207                 ULONG_PTR thread;                                       //\83X\83\8c\83b\83h\94Ô\8d\86
208                 
209
210                 //\83Z\83b\83^\81[
211         public:
212
213                 ///
214                 ///nlib\82Ì\83`\83\83\83b\83g\83f\81[\83^\82ð\83Z\83b\83g
215                 ///
216                 VOID SetChat(NicoLiveChat &chat_in,CListenerData &listener);
217
218                 ///
219                 ///\95\\8e¦\97p\8d\82\82³\82ð\90Ý\92è
220                 ///
221                 VOID SetHeight(UINT_PTR height);
222
223                 //\83Q\83b\83^\81[
224         public:
225
226                 ///
227                 ///\83\8a\83X\83i\81[\8fî\95ñ\83N\83\89\83X\82Ì\8eQ\8fÆ\82ð\8eæ\93¾
228                 ///
229                 CListenerData &GetListnerData();
230
231                 ///
232                 ///\83`\83\83\83b\83g\96{\95\8eæ\93¾
233                 ///
234                 const CNLiteString &GetChatBuff()const;
235
236                 ///
237                 ///\91I\91ð\8fó\91Ô\94»\92è\83t\83\89\83O\8eæ\93¾
238                 ///
239                 BOOL IsSelect()const;
240
241                 ///
242                 ///\94w\8ci\90F\82ð\8eæ\93¾
243                 ///
244                 COLORREF GetBackColor()const;
245
246                 ///
247                 ///\83v\83\8c\83~\83A\83\80\8eí\95Ê\8eæ\93¾
248                 ///
249                 UINT_PTR GetPremium()const;
250
251                 ///
252                 ///\83R\83\81\83\93\83g\8e\9e\8aÔ\8eæ\93¾
253                 ///
254                 time_t GetDate()const;
255
256                 ///
257                 ///\83R\83\81\83\93\83g\94Ô\8d\86\8eæ\93¾
258                 ///
259                 UINT_PTR GetNo()const;
260
261                 ///
262                 ///\95\8e\9a\97ñ\95\\8e¦\8e\9e\82Ì\90F\82ð\8eæ\93¾
263                 ///
264                 COLORREF GetStringColor()const;
265
266                 ///
267                 ///\98g\90ü\90F\8eæ\93¾
268                 ///
269                 COLORREF GetSellLineColor()const;
270
271                 ///
272                 ///\95\\8e¦\97p\82Ì\8d\82\82³\8eæ\93¾
273                 ///
274                 UINT_PTR GetHeight()const;
275
276
277         };
278
279
280
281
282         ///
283         ///\83R\83\81\83\93\83g\83\8a\83X\83g\83N\83\89\83X
284         ///
285         class CCommentList{
286
287         private:
288                 typedef std::list<CChatData> ChatList;
289         public:
290                 typedef ChatList::iterator iterator;
291                 typedef ChatList::reference reference;
292                 typedef ChatList::reverse_iterator reverse_iterator;
293         private:
294                 ChatList chatList;
295                 iterator shortcut;
296         
297
298         
299                 //\83G\83\89\81[\83R\81[\83h
300         public:
301                 enum ERRORCORD{
302                         ERR = -1,
303                         OK = 0
304
305
306                 };
307
308
309                 //\8c^\92è\8b`
310         
311
312         public:
313
314                 ///
315                 ///\83R\83\93\83X\83g\83\89\83N\83^
316                 ///
317                 CCommentList();
318                 
319                 ///
320                 ///\83f\83X\83g\83\89\83N\83^
321                 ///
322                 ~CCommentList();
323                 
324                 ///
325                 ///\90\95ú\91\97\90Ú\91±\8e\9e\82Ì\8f\88\97\9d
326                 ///
327                 VOID OnConnect();
328                 
329
330                 ///
331                 ///\94j\8aü\8e\9e\82Ì\8f\88\97\9d
332                 ///
333                 VOID OnDestroy();
334                 
335                 ///
336                 ///\8ai\94[\82³\82ê\82½\83R\83\81\83\93\83g\90\94\8eæ\93¾
337                 ///
338                 UINT_PTR Size();
339                 
340
341                 ///
342                 ///\91I\91ð\8d\80\96Ú\82ð\8eæ\93¾
343                 ///
344                 iterator GetCurSel();
345
346
347                 INT_PTR GetCurSelNo();
348
349                 ///
350                 ///\91I\91ð\8d\80\96Ú\82ð\90Ý\92è
351                 ///
352                 VOID SetCurSel(iterator cursel);
353
354                 ///
355                 ///\91I\91ð\8fó\91Ô\82Ì\83A\83C\83e\83\80\82ð\8eæ\93¾
356                 ///
357                 iterator GetCurSelItem();
358
359                 ///
360                 ///\8bó\82©\94»\92è
361                 ///
362                 BOOL empty();
363
364                 ///
365                 ///\8dÅ\8f\89\82Ì\83C\83e\83\8c\81[\83^\82ð\8eæ\93¾
366                 ///
367                 iterator begin();
368
369                 ///
370                 ///\8dÅ\8cã\82Ì\83C\83e\83\8c\81[\83^\82ð\8eæ\93¾
371                 ///
372                 iterator end();
373
374                 ///
375                 ///\8bt\8cü\82«\83C\83e\83\8c\81[\83^\82Ì\8dÅ\8f\89\82ð\8eæ\93¾
376                 ///
377                 reverse_iterator rbegein();
378
379                 ///
380                 ///\8bt\8cü\82«\83C\83e\83\8c\81[\83^\82Ì\8dÅ\8cã\82ð\8eæ\93¾
381                 ///
382                 reverse_iterator rend();
383
384                 ///
385                 ///\83`\83\83\83b\83g\8eó\90M\8e\9e\82Ì\8f\88\97\9d
386                 ///\83`\83\83\83b\83g\83f\81[\83^\82Ì\91}\93ü\82ð\8ds\82¤
387                 ///\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é
388                 ///\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é
389                 ///
390                 iterator OnChatReceve(NicoLiveChat_P chatData,LPCTSTR communityID, UINT_PTR count,CCommentListWindow &listWindow);
391
392                 ///
393                 ///\8ew\92è\82µ\82½\94Ô\8d\86\82Ì\83R\83\81\83\93\83g\8eQ\8fÆ\82ð\8eæ\93¾
394                 ///
395                 reference GetChatAt(UINT_PTR no);
396                 
397
398                 ///
399                 ///\83\8a\83X\83g\8dÅ\8cã\82Ì\8eQ\8fÆ\82ð\8eæ\93¾
400                 ///
401                 reference back();
402
403                 ///
404                 ///\83V\83\87\81[\83g\83J\83b\83g\83C\83e\83\8c\81[\83^\82ð\8eæ\93¾
405                 ///
406                 iterator GetShortCut();
407                 
408                 ///
409                 ///\83V\83\87\81[\83g\83J\83b\83g\82ð\90Ý\92è
410                 ///
411                 BOOL SetShortCut(UINT_PTR no);
412
413                 
414                 
415         };
416
417
418         ///
419         ///\83\86\81[\83U\90Ý\92è\83t\83@\83C\83\8b\93Ç\8eæ\83N\83\89\83X
420         ///
421         class CReadUserSettingXML:public CXmlParser{
422
423         private:
424                 CListenerData listenerBuff;
425                 CListenerList &m_listenerList;
426                 BOOL userNodeFlag;
427                 
428                 
429                 
430
431
432         public:
433
434                 CReadUserSettingXML(CListenerList &in_listenerList);
435
436                 void OnStartElement (const XML_Char *pszName, const XML_Char **papszAttrs);
437
438                 void OnEndElement (const XML_Char *pszName);
439
440                 void OnCharacterData (const XML_Char *pszData, int nLength);
441         };
442         
443 }