本文整理汇总了C++中UserManager类的典型用法代码示例。如果您正苦于以下问题:C++ UserManager类的具体用法?C++ UserManager怎么用?C++ UserManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int ac, char **av)
{
if (ac != 2)
{
std::cout << "usage: ./babel_server port" << std::endl;
return (0);
}
try
{
SocketManager sm((short) atoi(av[1]));
ASocket *newConnection;
UserManager um;
while (sm.Select() != -1)
{
um.handleSend(sm);
um.handleReceive(sm);
um.handlePendingAuth(sm);
newConnection = sm.tryNewConnection();
if (newConnection)
{
um.addPendingAuth(newConnection);
newConnection = NULL;
}
}
}
catch (const std::string &err)
{
std::cout << err << std::endl;
exit(1);
}
return (0);
}
示例2: HandleUserSynch
void TaskSynch::HandleUserSynch(unsigned __int64 since, bool isResponse, unsigned long ip)
{
UserManager *pUserMan = m_pDataManager->GetUserManagerInstance();
User *pUser = pUserMan->FindUserFromIP(ip);
int len = 0;
if(pUser)
{
IterWrapper<Task> iter(pUser->IterateModifiedOrAssignedTasks(since));
char *pMsg = NULL;
Task *pTask = NULL;
while(iter.Next())
{
pTask= iter.Get();
unsigned long hashLen = 0;
StringBuffer sb(1024);
unsigned char *pSegHash = HashTaskTreeSeg(pTask->ToXMLString(sb), &hashLen);
#ifdef DEBUG
OutputDebugString(_T("Handle User Synch: "));
OutputDebugString(sb);
OutputDebugString(_T("\n"));
#endif
if(pSegHash)
{
pMsg = MakeTaskSynchTreeSegMsg(pSegHash, hashLen, pTask->GetID(), pTask->GetModifiedDate(), false, &len);
m_pNetwork->Send(pMsg, len, ip);
delete [] pSegHash;
}
}
}
if(!isResponse)
{
char *pMsg = MakeUserTaskSynchReq(0, true, &len);
m_pNetwork->Send(pMsg, len, ip);
}
}
示例3: printf
// TODO when is this invoked??
/*private static*/ void XN_CALLBACK_TYPE UserManager::onPoseDetected(xn::PoseDetectionCapability& capability, const XnChar* detectedPoseName, XnUserID userId, void* cookie) {
printf("UserManager.Pose %s detected for user %d\n", detectedPoseName, userId);
UserManager* tthis = static_cast<UserManager*>(cookie);
tthis->userGenerator.GetPoseDetectionCap().StopPoseDetection(userId);
tthis->userGenerator.GetSkeletonCap().RequestCalibration(userId, TRUE);
tthis->broadcastUserChangeState(userId, USER_STATE_POSE_DETECTED);
}
示例4: TestUMUpdate
void TestUMUpdate()
{
UserManager um;
User user;
user.name = "admin";
user.password = "12345";
user.authority = 1;
testLog->debug(um.updateCmd(user).toLocal8Bit().data());
testLog->debug(um.updateCmd(user).toLocal8Bit().data());
testLog->debug(um.updateCmd(user).toLocal8Bit().data());
testLog->debug(um.updateCmd(user).toLocal8Bit().data());
}
示例5:
/*private static*/ void XN_CALLBACK_TYPE UserManager::onCalibrationEnd(xn::SkeletonCapability& capability, XnUserID userId, XnBool successfullyCalibrated, void* cookie) {
UserManager* tthis = static_cast<UserManager*>(cookie);
if (successfullyCalibrated) {
printf("Calibration complete, start tracking user %d\n", userId);
tthis->userGenerator.GetSkeletonCap().StartTracking(userId);
tthis->broadcastUserChangeState(userId, USER_STATE_CALIBRATION_ENDED_SUCCESFULLY);
} else {
printf("Calibration failed for user %d\n", userId);
tthis->userGenerator.GetSkeletonCap().RequestCalibration(userId, TRUE);
tthis->broadcastUserChangeState(userId, USER_STATE_CALIBRATION_ENDED_UNSUCCESFULLY);
}
}
示例6: comment
void CommentWindow::comment()
{
if (g_umUserManager.Comment(m_mvModel.m_sVideoID, m_qteComment->toPlainText().toStdString()) == SUCCESS)
{
g_umUserManager.GetLastVideo(m_mvModel);
emit updateModel(m_mvModel);
m_qteComment->clear();
m_qmbMsg->setText("Comment Successfully");
m_qmbMsg->setWindowModality(Qt::WindowModal);
m_qmbMsg->show();
connect(m_qmbMsg, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(toComment()));
}
示例7: Init
bool MainScene::Init()
{
// 获得用户
UserManager* userMgr = UserManager::getInstance();
// 启动子弹系统
BulletManager::getInstance()->startUp("Data/bulletConfig.lua");
// 启动道具系统
ItemManager::getInstance()->startUp("Data/itemConfig.lua");
// 启动飞机系统
PlaneManager::getInstance()->startUp("Data/planeConfig.lua");
// 启动特效系统
EffectManager::getInstance()->startUp("Data/effectConfig.lua");
// 调整摄像机的z轴位置
Camera::getInstance()->SetCameraPosition(0, 0, -600);
// 缓存音效
AudioManager* audioMgr = AudioManager::getInstance();
audioMgr->loadSoundForCache("Sound/se/beiji.ogg");
audioMgr->loadSoundForCache("Sound/se/boom.mp3");
audioMgr->loadSoundForCache("Sound/se/fly.ogg");
audioMgr->loadSoundForCache("Sound/se/get_item.mp3");
audioMgr->loadSoundForCache("Sound/se/missile.mp3");
audioMgr->loadSoundForCache("Sound/se/own_shoot1.ogg");
audioMgr->loadSoundForCache("Sound/se/own_shoot2.mp3");
audioMgr->loadSoundForCache("Sound/se/own_shoot3.ogg");
audioMgr->loadSoundForCache("Sound/se/se_warning.ogg");
// 初始化主角飞机
_own = Own::Create(userMgr->GetOwn());
_own->SetPosition(0, -150, 0);
Add(_own, LAYER_PLAYER);
// 分数
_scoreText = TextSprite::Create("SCORE:0", "微软雅黑", 16);
Add(_scoreText);
// 启动关卡系统
StageManager::getInstance()->startUp("Data/stage" + to_string(userMgr->GetStage()) + ".lua", this);
// 启动数据更新函数
AddUpdateFunc(UpdateFunc::Create(CALLBACK_PARAMETER_1(MainScene::UpdateData, this)));
EventDispatcher::getInstance()->Add(
KeyboardListener::Create(
this, KeyboardFunc::Create(
CALLBACK_PARAMETER_2(MainScene::onkey, this))));
return true;
}
示例8: toPosture
void Posture::toPosture(const QString &name)
{
if (modelList.size() == 0)
m_iListPage = 0;
if ((m_iListPage >= modelList.size() / MAXATONCE && modelList.size() % MAXATONCE == 0) ||
(modelList.size() % MAXATONCE != 0 && m_iListPage > modelList.size() / MAXATONCE))
{
if (name != "")
m_pmPageManager.GetModelByUserID(modelList, name.toStdString(), m_iListPage*MAXATONCE);
else
m_pmPageManager.GetModelByUserID(modelList, g_umUserManager.GetUsername(), m_iListPage*MAXATONCE);
}
int end = (m_iListPage + 1)*MAXATONCE < modelList.size() ? (m_iListPage + 1)*MAXATONCE : modelList.size();
m_iListPage = (end - 1) / MAXATONCE;
m_plwPosWin = new PostureListWindow(this, name, m_iListPage*MAXATONCE, end, modelList);
CloseCurrentWindow();
m_wtCurrentWin = POSTURELIST;
this->setCentralWidget(m_plwPosWin);
connect(m_plwPosWin, SIGNAL(toHome()), this, SLOT(toHomeWin()));
connect(m_plwPosWin, SIGNAL(toProfileMode(const QString&)), this, SLOT(toProfileMode(const QString&)));
connect(m_plwPosWin, SIGNAL(toUpload()), this, SLOT(toUploadMode()));
connect(m_plwPosWin, SIGNAL(logout()), this, SLOT(logout()));
connect(m_plwPosWin, SIGNAL(display(const ModelVideo&)), this, SLOT(toDisplay(const ModelVideo&)));
connect(m_plwPosWin, SIGNAL(prev(const QString&)), this, SLOT(prevList(const QString&)));
connect(m_plwPosWin, SIGNAL(next(const QString&)), this, SLOT(nextList(const QString&)));
}
示例9: updateModel
void DisplayWindow::likeIt()
{
if (m_qpbLike->text() == "Like")
{
if (g_umUserManager.Commend(m_mvModel.m_sVideoID) == SUCCESS)
{
g_umUserManager.GetLastVideo(m_mvModel);
emit updateModel(m_mvModel);
m_qpbLike->setIcon(QIcon(g_sImgRoot + "liked.png"));
m_qpbLike->setText("Liked");
}
else
{
m_qlMsg->setText("Commend Fail, please try again.");
QTimer *timer = new QTimer();
timer->start(1000);
connect(timer, SIGNAL(timeout()), m_qwMessage, SLOT(close()));
connect(timer, SIGNAL(timeout()), timer, SLOT(stop()));
}
}
else if (m_qpbLike->text() == "Liked")
{
if (g_umUserManager.UnCommend(m_mvModel.m_sVideoID) == SUCCESS)
{
g_umUserManager.GetLastVideo(m_mvModel);
emit updateModel(m_mvModel);
m_qpbLike->setIcon(QIcon(g_sImgRoot + "like.png"));
m_qpbLike->setText("Like");
}
else
{
m_qlMsg->setText("Uncommend Fail, please try again.");
QTimer *timer = new QTimer();
timer->start(1000);
connect(timer, SIGNAL(timeout()), m_qwMessage, SLOT(close()));
connect(timer, SIGNAL(timeout()), timer, SLOT(stop()));
}
}
}
示例10: main
int main(int argc, char** argv) {
User u1("Ruben", "1234");
User u2("Pablo", "1234");
User u3("Pepe", "1234");
User u4("Juan", "1234");
UserManager userManager;
userManager.addUser(&u1);
userManager.addUser(&u2);
userManager.addUser(&u3);
userManager.addUser(&u4);
u1.addFriend(&u2);
u1.addFriend(&u3);
u1.addFriend(&u4);
userManager.showUsers();
userManager.searchForUser("Ruben", true)->showFriends();
userManager.addUser(&u3);
u1.addFriend(&u4);
cout << "-------------[ENDING SERVER]-------------" << endl;
return 0;
}
示例11: logout
void Posture::logout()
{
g_umUserManager.Logout();
models.clear();
modelList.clear();
CloseCurrentWindow();
m_lwLogWin = new LogWindow(this,LOG);
this->setCentralWidget(m_lwLogWin);
connect(m_lwLogWin, SIGNAL(wait()), this, SLOT(message()));
connect(m_lwLogWin, SIGNAL(regSuccess()), this, SLOT(logout()));
m_wtCurrentWin = LOG;
this->setFixedSize(LOGWINDOW_W*xscale, LOGWINDOW_H*yscale);
}
示例12: InitWidgets
void ProfileEditWindow::InitWidgets()
{
SourceManager sm;
UserPro up;
sm.GetUserProfile(up, g_umUserManager.GetUsername());
m_qlName = new QLabel("Username", m_qwBottomRight);
m_qlName->setObjectName("uploadInfo");
m_qlName->setFixedSize(UPLOADINFO_W*xscale, UPLOADINFO_H*yscale);
m_qleName = new QLineEdit(m_qwBottomRight);
m_qleName->setObjectName("editProfile");
m_qleName->setFixedSize(EDITPROFILE_W*xscale, EDITPROFILE_H*yscale);
m_qleName->setText(up.m_sUserName.c_str());
m_qleName->setReadOnly(true);
m_qlPwd = new QLabel("Password", m_qwBottomRight);
m_qlPwd->setObjectName("uploadInfo");
m_qlPwd->setFixedSize(UPLOADINFO_W*xscale, UPLOADINFO_H*yscale);
m_qlePwd = new QLineEdit(m_qwBottomRight);
m_qlePwd->setEchoMode(QLineEdit::Password);
m_qlePwd->setObjectName("editProfile");
m_qlePwd->setFixedSize(EDITPROFILE_W*xscale, EDITPROFILE_H*yscale);
m_qlPwdc = new QLabel("Password Confirm", m_qwBottomRight);
m_qlPwdc->setObjectName("uploadInfo");
m_qlPwdc->setFixedSize(UPLOADINFO_W*xscale, UPLOADINFO_H*yscale);
m_qlePwdc = new QLineEdit(m_qwBottomRight);
m_qlePwdc->setEchoMode(QLineEdit::Password);
m_qlePwdc->setObjectName("editProfile");
m_qlePwdc->setFixedSize(EDITPROFILE_W*xscale, EDITPROFILE_H*yscale);
m_qlEmail = new QLabel("Email", m_qwBottomRight);
m_qlEmail->setObjectName("uploadInfo");
m_qlEmail->setFixedSize(UPLOADINFO_W*xscale, UPLOADINFO_H*yscale);
m_qleEmail = new QLineEdit(m_qwBottomRight);
m_qleEmail->setText(up.m_sEmail.c_str());
m_qleEmail->setObjectName("editProfile");
m_qleEmail->setFixedSize(EDITPROFILE_W*xscale, EDITPROFILE_H*yscale);
m_qlError = new QLabel(m_qwBottomRight);
m_qpbCancel = new QPushButton("Cancel", m_qwBottomRight);
m_qpbCancel->setObjectName("detail");
m_qpbCancel->setFixedSize(DETAIL_W*xscale, DETAIL_H*yscale);
m_qpbSubmit = new QPushButton("Submit", m_qwBottomRight);
m_qpbSubmit->setObjectName("detail");
m_qpbSubmit->setFixedSize(DETAIL_W*xscale, DETAIL_H*yscale);
connect(m_qpbCancel, SIGNAL(clicked()), this, SLOT(cancel()));
connect(m_qpbSubmit, SIGNAL(clicked()), this, SLOT(submit()));
}
示例13: forwardIt
void DisplayWindow::forwardIt()
{
if (g_umUserManager.Share(m_mvModel.m_sVideoID) == SUCCESS)
{
m_qmbMsg->setWindowModality(Qt::WindowModal);
m_qmbMsg->setText("Forward successfully");
m_qmbMsg->show();
}
else
{
m_qmbMsg->setWindowModality(Qt::WindowModal);
m_qmbMsg->setText("Forward fail, please try it again later");
m_qmbMsg->show();
}
}
示例14: submit
void ProfileEditWindow::submit()
{
string pwd = m_qlePwd->text().toStdString();
string pwdc = m_qlePwdc->text().toStdString();
if (pwd == "" && pwdc == "")
{
pwd = g_sPwd.toStdString();
pwdc = g_sPwd.toStdString();
}
string email = m_qleEmail->text().toStdString();
int result = g_umUserManager.ChangeProfile(pwd, pwdc, email);
QString error;
switch (result)
{
case SUCCESS:
emit success("");
return;
case PWDNOTCON:
error = "the password is not Consistent!";
break;
case PWDTOOSIM:
error = "the password is too simple";
break;
case EMAILFAIL:
error = "the email address is not right";
break;
case EMPTYINFO:
error = "the information is empty";
break;
case PASSWORD2L:
error = "the password is too long";
break;
}
m_qlError->setText(error);
m_qlError->setObjectName("error");
m_qlError->setAlignment(Qt::AlignCenter);
m_qlError->show();
}
示例15: PEG_METHOD_ENTER
//.........这里部分代码省略.........
cimMethodName,
PEGASUS_CIM_EXCEPTION(CIM_ERR_ACCESS_DENIED, ise.getMessage()));
PEG_METHOD_EXIT();
return;
}
#endif // #ifdef PEGASUS_ENABLE_USERGROUP_AUTHORIZATION
//
// Get a config manager instance
//
ConfigManager* configManager = ConfigManager::getInstance();
//
// Do namespace authorization verification
//
if (String::equalNoCase(
configManager->getCurrentValue("enableNamespaceAuthorization"),
"true"))
{
//
// If the user is not privileged, perform the authorization check.
//
#if !defined(PEGASUS_PLATFORM_OS400_ISERIES_IBM)
if ( ! System::isPrivilegedUser(userName) )
#else
// On OS/400, always check authorization if remote user.
// Always allow local privileged users through.
// Check authorization for local non-privileged users.
// (User authorization to providers are checked downstream from here).
if ( ! String::equalNoCase(authType,"Local") ||
! System::isPrivilegedUser(userName) )
#endif
{
UserManager* userManager = UserManager::getInstance();
if ( !userManager || !userManager->verifyAuthorization(
userName, nameSpace, cimMethodName) )
{
// l10n
// String description = "Not authorized to run ";
// description.append(cimMethodName);
// description.append(" in the namespace ");
// description.append(nameSpace.getString());
if (cimMethodName == "InvokeMethod")
{
// l10n
sendMethodError(
queueId,
req->getHttpMethod(),
req->messageId,
((CIMInvokeMethodRequestMessage*)req.get())->methodName,
PEGASUS_CIM_EXCEPTION_L(CIM_ERR_ACCESS_DENIED,
MessageLoaderParms(
"Server.CIMOperationRequestAuthorizer.NOT_AUTHORIZED",
"Not authorized to run $0 in the namespace $1",
cimMethodName, nameSpace.getString())));
}
else
{
// l10n
sendIMethodError(
queueId,
req->getHttpMethod(),