OSDN Git Service

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