本文整理汇总了C++中NFGUID::ToString方法的典型用法代码示例。如果您正苦于以下问题:C++ NFGUID::ToString方法的具体用法?C++ NFGUID::ToString怎么用?C++ NFGUID::ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NFGUID
的用法示例。
在下文中一共展示了NFGUID::ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateRole
bool NFCAccountRedisModule::CreateRole(const std::string & strAccount, const std::string & strRoleName, const NFGUID & id)
{
std::string strAccountKey = m_pCommonRedisModule->GetAccountCacheKey(strAccount);
NF_SHARE_PTR<NFINoSqlDriver> xNoSqlDriver = m_pNoSqlModule->GetDriverBySuit(strAccount);
if (xNoSqlDriver)
{
if (xNoSqlDriver->Exists(strAccountKey) && !xNoSqlDriver->Exists(strRoleName))
{
xNoSqlDriver->HSet(strAccountKey, NFrame::Player::Name(), strRoleName);
xNoSqlDriver->HSet(strAccountKey, NFrame::Player::ID(), id.ToString());
NF_SHARE_PTR<NFINoSqlDriver> xRoleNameNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
if (xRoleNameNoSqlDriver)
{
xRoleNameNoSqlDriver->HSet(strRoleName, NFrame::Player::ID(), id.ToString());
}
/*
std::vector<std::string> vKey;
std::vector<std::string> vValue;
xNoSqlDriver->HMSet(m_pCommonRedisModule->GetPropertyCacheKey(id), vKey, vValue);
xNoSqlDriver->HMSet(m_pCommonRedisModule->GetRecordCacheKey(id), vKey, vValue);
xNoSqlDriver->HMSet(m_pCommonRedisModule->GetPropertyStorageKey(id), vKey, vValue);
xNoSqlDriver->HMSet(m_pCommonRedisModule->GetRecordStorageKey(id), vKey, vValue);
*/
return true;
}
}
return false;
}
示例2: OnLogin
bool NFCLoginNet_HttpServerModule::OnLogin(const NFHttpRequest& req)
{
std::string strResponse;
NFResponseLogin xResponsetLogin;
NFRequestLogin xRequestLogin;
ajson::load_from_buff(xRequestLogin, req.body.c_str());
if (xRequestLogin.user.empty()
|| xRequestLogin.password.empty())
{
xResponsetLogin.code = NFIResponse::ResponseType::RES_TYPE_FAILED;
xResponsetLogin.jwt = "";
ajson::string_stream ss;
ajson::save_to(ss, xResponsetLogin);
strResponse = ss.str();
}
else
{
NFGUID xGUIDKey = m_pKernelModule->CreateGUID();
xResponsetLogin.code = NFIResponse::ResponseType::RES_TYPE_SUCCESS;
xResponsetLogin.jwt = xGUIDKey.ToString();
mToken[xRequestLogin.user] = xGUIDKey.ToString();
ajson::string_stream ss;
ajson::save_to(ss, xResponsetLogin);
strResponse = ss.str();
}
return m_pHttpNetModule->ResponseMsg(req, strResponse, NFWebStatus::WEB_OK);
}
示例3: SetPlayerRoomID
bool NFCPVPMatchRedisModule::SetPlayerRoomID(const NFGUID& self, const NFGUID& xRoomID)
{
NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
if (pNoSqlDriver)
{
std::string strKey = MakePlayerRoomKey();
return pNoSqlDriver->HSet(strKey, self.ToString(), xRoomID.ToString());
}
return false;
}
示例4: ChangeServer
bool NFCGSSwichServerModule::ChangeServer(const NFGUID& self, const int nServer, const int nSceneID, const int nGroup)
{
NFMsg::ReqSwitchServer xMsg;
xMsg.set_sceneid(nSceneID);
*xMsg.mutable_selfid() = NFINetModule::NFToPB(self);
xMsg.set_self_serverid(pPluginManager->GetAppID());
xMsg.set_target_serverid(nServer);
xMsg.set_groupid(nGroup);
int nGate = 0;
NFGUID xClient;
NF_SHARE_PTR<NFIGameServerNet_ServerModule::GateBaseInfo> pGateInfo = m_pGameServerNet_ServerModule->GetPlayerGateInfo(self);
if (!pGateInfo)
{
return false;
}
nGate = pGateInfo->nGateID;
xClient = pGateInfo->xClientID;
*xMsg.mutable_client_id() = NFINetModule::NFToPB(xClient);
xMsg.set_gate_serverid(nGate);
m_pNetClientModule->SendSuitByPB(NF_SERVER_TYPES::NF_ST_WORLD, self.ToString(), NFMsg::EGMI_REQSWICHSERVER, xMsg);
return true;
}
示例5: SetStatusRoomID
bool NFCPVPMatchRedisModule::SetStatusRoomID(const int nPVPMode, const int nGrade, const int nStatus, const NFGUID& xRoomID)
{
NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
if (pNoSqlDriver)
{
std::string strKey = MakeStatusRoomIDRedisKey(nPVPMode, nGrade, nStatus);
std::string strData;
std::vector<std::string> valueVec;
if (pNoSqlDriver->HSet(strKey, xRoomID.ToString(), xRoomID.ToString()))
{
return true;
}
}
return false;
}
示例6: GetRankValue
bool NFCRankRedisModule::GetRankValue(const NFMsg::ERankType eRankType, const NFGUID & self, double& dwValue)
{
std::string strRankKey = MakeRedisKey(eRankType);
NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuit(strRankKey);
if (!pNoSqlDriver)
{
return 0;
}
return pNoSqlDriver->ZScore(strRankKey, self.ToString(), dwValue);
}
示例7: CreateGroup
const NFGUID NFCWorldChatGroupModule::CreateGroup( const NFGUID& self )
{
const NFGUID xGuidID = m_pUUIDModule->CreateGUID();
//Guild
std::vector<std::string> vGroupFieldVec;
std::vector<std::string> vGroupValueVec;
vGroupFieldVec.push_back("Name");
vGroupValueVec.push_back("");
vGroupFieldVec.push_back("CreateObject");
vGroupValueVec.push_back(self.ToString());
if (!m_pClusterSQLModule->Updata(mstrGroupTalble, xGuidID.ToString(), vGroupFieldVec, vGroupValueVec))
{
return NULL_OBJECT;
}
return xGuidID;
}
示例8: PushSinglePlayer
bool NFCPVPMatchRedisModule::PushSinglePlayer(const NFGUID& self, const int nPVPMode, const int nGrade)
{
NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
if (pNoSqlDriver)
{
std::string strKey = MakeSingleWaitRedisKey(nPVPMode, nGrade);
std::string strData;
return pNoSqlDriver->ListPush(strKey, self.ToString());
}
return false;
}
示例9: DeleteGroup
bool NFCWorldChatGroupModule::DeleteGroup( const NFGUID& self, const NFGUID& xGroupID )
{
NF_SHARE_PTR<NFIObject> pGuilD = m_pKernelModule->GetObject(xGroupID);
if (pGuilD.get())
{
m_pKernelModule->DestroyObject(xGroupID);
}
bool bExit = false;
if (!m_pClusterSQLModule->Exists(mstrGroupTalble, xGroupID.ToString(), bExit)
|| !bExit)
{
return false;
}
if (!m_pClusterSQLModule->Delete(mstrGroupTalble, xGroupID.ToString()))
{
return false;
}
return true;
}
示例10: SaveRecordInfo
bool NFCCommonRedisModule::SaveRecordInfo(const NFGUID & self, const NFMsg::ObjectRecordList& xRecordData, const int nExpireSecond)
{
if (self.IsNull())
{
return false;
}
NF_SHARE_PTR<NFIRedisClient> pDriver = m_pNoSqlModule->GetDriverBySuit(self.ToString());
if (!pDriver)
{
return false;
}
std::vector<std::string> vKeyList;
std::vector<std::string> vValueList;
for (int i = 0; i < xRecordData.record_list_size(); ++i)
{
const NFMsg::ObjectRecordBase& xRecord = xRecordData.record_list(i);
std::string strValue;
if (!xRecord.SerializeToString(&strValue))
{
continue;
}
vKeyList.push_back(xRecord.record_name());
vValueList.push_back(strValue);
}
if (vKeyList.size() != vValueList.size())
{
return false;
}
std::string strKey = GetRecordCacheKey(self);
if (!pDriver->HMSET(strKey, vKeyList, vValueList))
{
return false;
}
if (nExpireSecond > 0)
{
pDriver->EXPIRE(strKey, nExpireSecond);
}
return true;
}
示例11: DeleteRoomInfo
bool NFCPVPMatchRedisModule::DeleteRoomInfo(const NFGUID& xRoomID)
{
NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
if (pNoSqlDriver)
{
std::string strKey = MakePvpRoomRedisKey();
std::string strData;
if (pNoSqlDriver->HDel(strKey, xRoomID.ToString()))
{
return true;
}
}
return false;
}
示例12: RemoveGridStationInfo
bool NFCBigMapRedisModule::RemoveGridStationInfo(const std::string& strGridID, const NFGUID& self, const int nResource)
{
if (!m_pElementModule->ExistElement(strGridID))
{
return false;
}
NF_SHARE_PTR<NFIRedisClient> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
if (pNoSqlDriver)
{
std::string strKey = GetGridStationHistoryKey(strGridID);
return pNoSqlDriver->ZREM(strKey, self.ToString());
}
return false;
}
示例13: GetPlayerRoomID
bool NFCPVPMatchRedisModule::GetPlayerRoomID(const NFGUID& self, NFGUID& xRoomID)
{
NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
if (pNoSqlDriver)
{
std::string strKey = MakePlayerRoomKey();
std::string strData;
if (pNoSqlDriver->HGet(strKey, self.ToString(), strData))
{
if (xRoomID.FromString(strData))
{
return true;
}
}
}
return false;
}
示例14: SetRoomInfo
bool NFCPVPMatchRedisModule::SetRoomInfo(const NFGUID& xRoomID, NFMsg::PVPRoomInfo& xRoomInfo)
{
NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
if (pNoSqlDriver)
{
std::string strKey = MakePvpRoomRedisKey();
std::string strData;
if (xRoomInfo.ParseFromString(strData))
{
if (pNoSqlDriver->HSet(strKey, xRoomID.ToString(), strData))
{
return true;
}
}
}
return false;
}
示例15: SavePropertyInfo
bool NFCCommonRedisModule::SavePropertyInfo(const NFGUID& self, NF_SHARE_PTR<NFIPropertyManager> pPropertyManager, const int nExpireSecond)
{
if (self.IsNull())
{
return false;
}
if (!pPropertyManager)
{
return false;
}
NF_SHARE_PTR<NFIRedisClient> pDriver = m_pNoSqlModule->GetDriverBySuit(self.ToString());
if (!pDriver)
{
return false;
}
std::vector<std::string> vKeyList;
std::vector<std::string> vValueList;
if (!ConvertPropertyManagerToVector(pPropertyManager, vKeyList, vValueList))
{
return false;
}
if (vKeyList.size() != vValueList.size())
{
return false;
}
std::string strKey= GetPropertyCacheKey(self);
if (!pDriver->HMSET(strKey, vKeyList, vValueList))
{
return false;
}
if (nExpireSecond > 0)
{
pDriver->EXPIRE(strKey, nExpireSecond);
}
return true;
}