OSDN Git Service

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