OSDN Git Service

2011/12/28 2:09:13
[nlite/nlite.git] / nlite / nlite_nlib.h
1 #pragma once
2
3 namespace nlite{
4
5         class CNicoVideoAuth{
6
7         private:
8                 NicoVideoAuth_P nicoVideoAuth;
9
10
11         public:
12                 CNicoVideoAuth()
13                         :nicoVideoAuth(NicoVideoAuth_new()){}
14
15                 ~CNicoVideoAuth(){
16
17                         NicoVideoAuth_delete(&nicoVideoAuth);
18                 }
19
20                 VOID SetBrowserType(BROWSERTYPE bt){
21                         NLIB_RESULT rslt;
22
23                         rslt = NicoVideoAuth_getNicoVideoAuth(nicoVideoAuth,bt);
24                         if(rslt != NLIB_ERR_OK){
25
26                                 throw NLIBException(TEXT("\83j\83R\83j\83R\93®\89æ\94F\8fØ\8fî\95ñ\8eæ\93¾\82É\8e¸\94s\82µ\82Ü\82µ\82½"),rslt,__LINE__,TEXT(__FILE__));
27                         }
28
29                 }
30
31                 NicoVideoAuth_P GetAuth(){
32
33                         return this->nicoVideoAuth;
34                 }
35
36         };
37
38         class CNicoLiveStream{
39
40         private:
41                 NicoLiveStream_P nicoLiveStream;
42
43         public:
44                 CNicoLiveStream()
45                         :nicoLiveStream(NicoLiveStream_new())
46
47                 {}
48                 ~CNicoLiveStream(){
49
50                         NicoLiveStream_delete(&nicoLiveStream);
51                         
52                 }
53
54                 
55
56                 VOID Connect(CNicoVideoAuth &nicoVideoAuth,LPCTSTR url,NicoRecvCallBack callback,LPVOID userData){
57
58                         NLIB_RESULT rslt;
59
60                         rslt = NicoLiveStream_connect(nicoLiveStream,nicoVideoAuth.GetAuth(),url,callback,userData);
61
62                         if(rslt != NLIB_ERR_OK){
63
64                                 throw NLIBException(TEXT("\83j\83R\83j\83R\90\95ú\91\97\90Ú\91±\82É\8e¸\94s\82µ\82Ü\82µ\82½"),rslt,__LINE__,TEXT(__FILE__));
65                         }
66                 }
67                 
68
69                 VOID DisConnect(){
70
71                         NicoLiveStream_disConnect(nicoLiveStream);
72                 }
73                 
74                 VOID SendChat(LPCTSTR chatBuf,std::vector<LPCTSTR> mails,std::vector<LPCTSTR> extends){
75                         NLIB_RESULT rslt;
76                         mails.insert( mails.end(),(LPCTSTR)NULL);
77                         extends.insert(extends.end(),(LPCTSTR)NULL);
78                         rslt = NicoLiveStream_sendChat(nicoLiveStream,chatBuf,&mails[0],&extends[0]);
79
80                         if(rslt != NLIB_ERR_OK){
81                                 throw NLIBException(TEXT("\83R\83\81\83\93\83g\91\97\90M\92\86\82É\8fá\8aQ\82ª\94­\90\82µ\82Ü\82µ\82½"),rslt,__LINE__,TEXT(__FILE__));
82                         }
83                 }
84
85                 
86
87         };
88
89
90
91 }