6 #ifndef CORELINKSENDSTREAM_H 7 #define CORELINKSENDSTREAM_H 12 inline SendStream::SendStream(
const STREAM_ID& stream,
int state,
int streamRef) :
13 streamID(stream), state(state), streamRef(streamRef)
16 inline SendStream::SendStream(
const StreamData& streamData) {
17 if ((streamData.
state & Const::STREAM_STATE_SEND) > 0) {
19 state = streamData.
state;
20 streamRef = streamData.streamRef;
23 streamID = STREAM_DEF;
24 state = Const::STREAM_STATE_NONE;
30 streamID(rhs.streamID), state(rhs.state), streamRef(rhs.streamRef)
34 std::swap(this->streamID, rhs.streamID);
35 std::swap(this->state, rhs.state);
36 std::swap(this->streamRef, rhs.streamRef);
40 this->streamID = rhs.streamID;
41 this->state = rhs.state;
42 this->streamRef = rhs.streamRef;
46 inline SendStream::operator STREAM_ID()
const {
47 return this->streamID;
51 return CorelinkDLL::sendMsg(this->state, this->streamRef, this->streamID, federationID, msg.c_str(), (int) msg.size());
54 inline bool SendStream::send(
const std::string& msg,
const rapidjson::Document& json,
bool serverCheck,
const int& federationID) {
55 rapidjson::StringBuffer buffer;
56 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
58 int len = (int) buffer.GetSize();
59 return CorelinkDLL::sendMsgJson(this->state, this->streamRef, this->streamID, federationID, msg.c_str(), (int)msg.size(), buffer.GetString(), len, serverCheck);
63 return CorelinkDLL::sendMsg(this->state, this->streamRef, this->streamID, federationID, msg, msgLen);
66 inline bool SendStream::send(
const char* msg,
int msgLen,
const rapidjson::Document& json,
bool serverCheck,
const int& federationID) {
67 rapidjson::StringBuffer buffer;
68 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
70 int len = (int)buffer.GetSize();
71 return CorelinkDLL::sendMsgJson(this->state, this->streamRef, this->streamID, federationID, msg, msgLen, buffer.GetString(), len, serverCheck);
Defines the classes in the wrapper and their relations.
int state
Stores the type of the stream (UDP, TCP, WS & SEND, RECV).
int streamID
ID of the stream seen by the server.
SendStream & operator=(const SendStream &rhs)
bool send(const std::string &msg, const int &federationID=0)