本文整理汇总了C++中UserInfo::get_id方法的典型用法代码示例。如果您正苦于以下问题:C++ UserInfo::get_id方法的具体用法?C++ UserInfo::get_id怎么用?C++ UserInfo::get_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserInfo
的用法示例。
在下文中一共展示了UserInfo::get_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void Home::setSurname(void *cmdptr, void *idptr)
{
std::vector<const char *> *value = (std::vector<const char *> *)cmdptr;
std::vector<int> *id = (std::vector<int> *)idptr;
std::map<int, UserInfo *>::iterator it;
static int tmp = 0;
if ((it = _musers.find(id[0][0])) == _musers.end()) {
UserInfo *info = new UserInfo;
if (tmp == 0)
_myid = id[0][0];
tmp++;
info->set_id(id[0][0]);
std::cout << info->get_id() << std::endl;
info->set_surname((*value)[0]);
_musers[id[0][0]] = info;
addContact(_musers[id[0][0]]);
}
else {
UserInfo *tmp = _musers[id[0][0]];
std::string stmp;
tmp->set_surname((*value)[0]);
stmp = tmp->get_name() + " " + tmp->get_surname();
std::map<int, t_contact *>::iterator it;
if ((it = _bcontact.find(id[0][0])) == _bcontact.end())
return;
_bcontact[id[0][0]]->item->setText(stmp.c_str());
}
}
示例2: PacketInfo
void Home::setCallRequest(void *cmdptr, void *idptr)
{
std::vector<const char *> *value = (std::vector<const char *> *)cmdptr;
std::vector<int> *id = (std::vector<int> *)idptr;
IPacketInfo *packet_info = new PacketInfo();
int i = (*id)[0];
std::cout << i << std::endl;
UserInfo *pkt = _musers[id[0][0]];
std::string tmp;
QMessageBox msgBox;
std::string ip = value[0][1];
char *answer_user = new char[1];
if ((int)(*value)[0][0] == 1)
tmp = pkt->get_name() + " audio call you";
if ((int)(*value)[0][0] == 2)
tmp = pkt->get_name() + " video call you";
msgBox.setText(tmp.c_str());
msgBox.setInformativeText("Do you want to receve that call ?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Ignore);
msgBox.setDefaultButton(QMessageBox::Yes);
int res = msgBox.exec();
packet_info->setCmd(26);
packet_info->getInts().push_back(pkt->get_id());
if (res == QMessageBox::Yes)
answer_user[0] = 0; // OK
else
answer_user[0] = 9; // OK
// #PA #bind
int modules = -1;
int port = 2000;
std::stringstream ss;
bool retbind = false;
while (retbind == false)
{
ss.flush();
ss << port;
std::string sport;
ss >> sport;
retbind = _links[(*value)[0][0] - 1]->bindSocket(sport.c_str());
++port;
if (port >= 65535)
answer_user[0] = 9;
}
// 3* PORT ||| P1 : audio P2 : video P3 : text
ss >> port;
packet_info->getChars().push_back(answer_user);
if ((int)(*value)[0][0] == 1)
packet_info->getInts().push_back(port); // P1
else
packet_info->getInts().push_back(0);
if ((int)(*value)[0][0] == 2)
packet_info->getInts().push_back(port); // P1
else
packet_info->getInts().push_back(0);
packet_info->getInts().push_back(0); // P3
Parser *parse;
parse = ((ThreadCom *)_com)->getParser();
Packet *enpacked;
enpacked = (Packet *)parse->encode(packet_info);
std::stringbuf sz;
sz >> enpacked;
if ((((ThreadCom *)_com)->getNetwork()->sendSocket(1, (void *)sz.str().c_str(), 65) == false))
std::cout << "Error Send\n";
delete(enpacked);
//LANCER LA RECEPTION UDP
if ((int)(*value)[0][0] == 1) {
timer = new QTimer;
_sockudp[0] = _links[0]->recvFromSocket();
if (!sound.initializePA())
std::cerr << "Error on InitPa()" << std::endl;
if (!(sound.initializeInput()))
std::cerr << "Error on initParams()" << std::endl;
if (!(sound.initializeOutput()))
std::cerr << "Error on initParams()" << std::endl;
sound.openStream();
sound.startStream();
encode.opusEncoderCreate();
encode.opusDecoderCreate();
connect(timer, SIGNAL(timeout()), this, SLOT(threadCall()));
timer->start();
}
if ((int)(*value)[0][0] == 2) {
_sockudp[1] = _links[1]->recvFromSocket();
timer = new QTimer;
connect(timer, SIGNAL(timeout()), this, SLOT(recvFrameFrom()));
timer->start();
}
}