43 lines
1.0 KiB
C++
43 lines
1.0 KiB
C++
//
|
|
// Created by dongl on 23-4-21.
|
|
//
|
|
|
|
#include "Response.h"
|
|
|
|
Response::Response(mp::MP_TYPE type, mp::MP_SUB_TYPE subType, const std::string &username, const std::string &msg, const std::string &token) :
|
|
Mph(type),
|
|
Sri(subType, username, msg, token) {
|
|
}
|
|
|
|
Response::Response(mp::MP_TYPE type, mp::MP_SUB_TYPE subType,
|
|
uint64_t account, const std::string &username,
|
|
const std::string &email, uint64_t phone,
|
|
const std::string &msg, const std::string &token,
|
|
const std::string & data) :
|
|
Mph(type),
|
|
Sri(subType, account, username, email, phone, msg, token, data) {
|
|
|
|
}
|
|
|
|
Response::~Response() {
|
|
delete response;
|
|
}
|
|
|
|
void Response::init() {
|
|
response = new mp::response();
|
|
response->set_allocated_sri(sri);
|
|
mph->set_mpb_size( response->ByteSizeLong());
|
|
}
|
|
|
|
std::string Response::packet () {
|
|
init();
|
|
std::string temp;
|
|
|
|
temp.push_back(mph->ByteSizeLong());
|
|
mph->AppendToString(&temp);
|
|
response->AppendToString(&temp);
|
|
|
|
return temp;
|
|
}
|
|
|