-
Notifications
You must be signed in to change notification settings - Fork 0
/
StreamConnection.hpp
155 lines (130 loc) · 4.03 KB
/
StreamConnection.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#pragma once
#ifdef _MSC_VER
#ifdef GOOGLEPLUSLIBRARY_EXPORTS
#define GOOGLEPLUSLIBRARY_API __declspec(dllexport)
#else
#define GOOGLEPLUSLIBRARY_API __declspec(dllimport)
#endif
#else
#define GOOGLEPLUSLIBRARY_API
#endif
#ifdef GOOGLEPLUSLIBRARY_NO_WARNINGS
#ifdef _MSC_VER
#pragma warning (disable:4251)
#pragma warning (disable:4996)
#endif
#endif
#include <boost/scoped_ptr.hpp>
#include <boost/thread.hpp>
#include <boost/signals2.hpp>
#include <string>
struct lua_State;
namespace Gplusnasite
{
namespace GooglePlusLibrary
{
class StreamConnectionImpl;
/*!
* @~english
* @brief Class to connect to the stream and update
* @warning Please do not use use this class other than the editor of the Lua script and library developer
* @~japanese
* @brief ストリームに接続し更新するためのクラス
* @warning このクラスはライブラリ開発者ならびにLuaスクリプト編集者以外利用しないようにしてください
*/
class GOOGLEPLUSLIBRARY_API StreamConnection
{
public:
StreamConnection();
public:
/*!
* @~english
* @brief Initializes the connection to the stream
* @param account_id Account ID of the target(e.g. 116324207729009185938)
* @~japanese
* @brief ストリームへの接続を初期化します
* @param account_id 対象のアカウントID(例: 116324207729009185938)
*/
void initialize(const std::wstring& account_id);
/*!
* @~english
* @brief Initialize the asynchronous connection to the stream
* @param account_id Account ID of the target(e.g. 116324207729009185938)
* @~japanese
* @brief ストリームへの接続を非同期で初期化します
* @param account_id 対象のアカウントID(例: 116324207729009185938)
*/
void initializeAsync(const std::wstring& account_id);
/*!
* @~english
* @brief Wait until initialization is complete asynchronous connection to the stream
* @~japanese
* @brief ストリームへの接続の非同期初期化が完了するまで待機します
*/
void waitInitializeAsync();
private:
/*!
* @~english
* @brief A function that initializes the connection to the stream in a separate thread
* @param account_id Account ID of the target(e.g. 116324207729009185938)
* @~japanese
* @brief 別スレッドでストリームへの接続を初期化する関数です
* @param account_id 対象のアカウントID(例: 116324207729009185938)
*/
void initializeAsyncThreadMethod(const std::wstring& account_id);
boost::thread initialize_thread_;
public:
boost::signals2::signal<void()> onInitializeSucceed;
boost::signals2::signal<void()> onInitializeFailed;
public:
/*!
* @~english
* @brief Update the stream
* @details This function is blocking the thread until logout occurs is called in a separate thread
* @param account_id Account ID of the target(e.g. 116324207729009185938)
* @~japanese
* @brief ストリームを更新します
* @details この関数は別スレッドで呼ばれログアウトが行われるまでそのスレッドをブロッキングします
* @param account_id 対象のアカウントID(例: 116324207729009185938)
*/
void update(const std::wstring& account_id);
private:
boost::thread update_thread_;
public:
/*!
* @~english
* @brief Abort the update stream
* @details Blocking of the Update () will be released in good time this function is called
* @warning This function is implemented please do not use full for outstanding
* @~japanese
* @brief ストリームを更新を中止します
* @details この関数が呼ばれるとキリの良いタイミングでupdate()のブロッキングが解除されます
* @warning この関数は実装が未完全のため使用しないでください
*/
void cancelUpdate();
/*!
* @~english
* @brief Gets whether the stream was aborted update
* @return If it is discontinued, true, false otherwise
* @~japanese
* @brief ストリームの更新が中止されたかどうかを取得します
* @return 中止された場合はtrue,そうでない場合はfalse
*/
bool isCanceled();
public:
int getConnectCount() const;
protected:
void setConnectCount(int connect_count);
public:
int getMaximumConnectCount() const;
protected:
void setMaximumConnectCount(int maximum_connect_count);
public:
static void bindToScript(lua_State* lua_state);
public:
virtual ~StreamConnection();
private:
boost::scoped_ptr<StreamConnectionImpl> impl_;
};
}// namespace GooglePlusLibrary
}// namespace Gplusnasite