本文整理汇总了C++中NF_SHARE_PTR::FromString方法的典型用法代码示例。如果您正苦于以下问题:C++ NF_SHARE_PTR::FromString方法的具体用法?C++ NF_SHARE_PTR::FromString怎么用?C++ NF_SHARE_PTR::FromString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NF_SHARE_PTR
的用法示例。
在下文中一共展示了NF_SHARE_PTR::FromString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConvertVectorToPropertyManager
bool NFCCommonRedisModule::ConvertVectorToPropertyManager(std::vector<std::string>& vKeyList, std::vector<std::string>& vValueList, NF_SHARE_PTR<NFIPropertyManager> pPropertyManager)
{
if (vKeyList.size() == vValueList.size())
{
for (int i = 0; i < vKeyList.size(); ++i)
{
const std::string& strKey = vKeyList[i];
const std::string& strValue = vValueList[i];
if (strValue.empty())
{
continue;
}
NF_SHARE_PTR<NFIProperty> pProperty = pPropertyManager->GetElement(strKey);
if (!pProperty->GetCache() && !pProperty->GetSave())
{
continue;
}
if(!pProperty->FromString(strValue))
{
//TODO
//error
}
}
}
return true;
}
示例2: AttachData
const bool NFCObjectSaveModule::AttachData( const NFIDENTID& self )
{
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject(self);
if (!pObject)
{
return false;
}
NF_SHARE_PTR<NFMapEx<std::string, std::string> > pSelfData = mtObjectCache.GetElement(self);
if (!pSelfData)
{
return false;
}
NF_SHARE_PTR<NFIPropertyManager> pProManager = pObject->GetPropertyManager();
NF_SHARE_PTR<NFIRecordManager> pRecordManager = pObject->GetRecordManager();
//assign property value
NF_SHARE_PTR<NFIProperty> xProperty = pProManager->First(strName);
while (xProperty)
{
if (xProperty->GetSave())
{
NF_SHARE_PTR<std::string> pValue = pSelfData->GetElement(strName);
if (pValue)
{
const std::string& strData = *pValue;
if (!xProperty->FromString(strData))
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "Load Property fail " + strName , ": " + strData, __FUNCTION__, __LINE__);
}
else
{
m_pLogModule->LogNormal(NFILogModule::NLL_INFO_NORMAL, self, "Load Property success " + strName, ": " + strData, __FUNCTION__, __LINE__);
}
}
}
strName.clear();
xProperty = pProManager->Next(strName);
}
//assign record value
NF_SHARE_PTR<NFIRecord> xRecord = pRecordManager->First(strName);
while (xRecord)
{
if (xRecord->GetSave())
{
NF_SHARE_PTR<std::string> pValue = pSelfData->GetElement(strName);
if (pValue)
{
const std::string& strData = *pValue;
NFMsg::PlayerRecordBase xRecordData;
if (xRecordData.ParseFromString(strData) && xRecordData.record_name() == strName)
{
ConvertPBToRecord(xRecordData, xRecord);
}
}
}
strName.clear();
xRecord = pRecordManager->Next(strName);
}
mtObjectCache.RemoveElement(self);
return true;
}