本文整理汇总了C++中NFCDataList::String方法的典型用法代码示例。如果您正苦于以下问题:C++ NFCDataList::String方法的具体用法?C++ NFCDataList::String怎么用?C++ NFCDataList::String使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NFCDataList
的用法示例。
在下文中一共展示了NFCDataList::String方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddEctypeAward
int NFCEctypeModule::AddEctypeAward(const NFIDENTID& self, const int nSceneID)
{
std::string strSceneID = boost::lexical_cast<std::string>(nSceneID);
int nType = m_pElementInfoModule->GetPropertyInt(strSceneID, "SceneType");
int nAddMoney = 0;
int nAddExp = 0;
int nAddDiamnod = 0;
NFCDataList xItemList;
NFCDataList xCountList;
// 掉落奖励
m_pPackModule->DrawDropAward(self, nAddMoney, nAddExp, xItemList, xCountList);
// 通关奖励
// 通知客户端
NFCDataList xAwardInfoList;
xAwardInfoList << nAddMoney;
xAwardInfoList << nAddExp;
xAwardInfoList << nAddDiamnod;
if (xItemList.GetCount() == xCountList.GetCount())
{
for (int i = 0; i < xItemList.GetCount(); ++i)
{
xAwardInfoList << xItemList.String(i);
xAwardInfoList << xCountList.Int(i);
}
}
m_pEventProcessModule->DoEvent(self, NFED_ON_NOTICE_ECTYPE_AWARD, xAwardInfoList);
return 0;
}
示例2: DeSerialization
bool NFCProperty::DeSerialization()
{
bool bRet = false;
const TDATA_TYPE eType = GetType();
if (eType == TDATA_STRING && nullptr != mxData && !mxData->IsNullValue())
{
NFCDataList xDataList;
const std::string& strData = mxData->GetString();
xDataList.Split(strData.c_str(), ";");
if (xDataList.GetCount() <= 0)
{
return bRet;
}
NFCDataList xTemDataList;
xTemDataList.Split(xDataList.String(0).c_str(), ",");
const int nSubDataLength = xTemDataList.GetCount();
if (xDataList.GetCount() == 1 && nSubDataLength == 1)
{
//most of property value only one value
return bRet;
}
if (nullptr == mxEmbeddedList)
{
mxEmbeddedList = NF_SHARE_PTR<NFList<std::string>>(NF_NEW NFList<std::string>());
}
else
{
mxEmbeddedList->ClearAll();
}
for (int i = 0; i < xDataList.GetCount(); ++i)
{
if (xDataList.String(i).empty())
{
NFASSERT(0, strData, __FILE__, __FUNCTION__);
}
mxEmbeddedList->Add(xDataList.String(i));
}
////////////////////////////////////////
if (nSubDataLength < 2 || nSubDataLength > 2)
{
return bRet;
}
if (nullptr == mxEmbeddedMap)
{
mxEmbeddedMap = NF_SHARE_PTR<NFMapEx<std::string, std::string>>(NF_NEW NFMapEx<std::string, std::string>());
}
else
{
mxEmbeddedMap->ClearAll();
}
for (int i = 0; i < xDataList.GetCount(); ++i)
{
NFCDataList xTemDataList;
const std::string& strTemData = xDataList.String(i);
xTemDataList.Split(strTemData.c_str(), ",");
{
if (xTemDataList.GetCount() != nSubDataLength)
{
NFASSERT(0, strTemData, __FILE__, __FUNCTION__);
}
const std::string& strKey = xTemDataList.String(0);
const std::string& strValue = xTemDataList.String(1);
if (strKey.empty() || strValue.empty())
{
NFASSERT(0, strTemData, __FILE__, __FUNCTION__);
}
mxEmbeddedMap->AddElement(strKey, NF_SHARE_PTR<std::string>(NF_NEW std::string(strValue)));
}
}
bRet = true;
}
return bRet;
}