本文整理汇总了C++中CDataReader::readCString方法的典型用法代码示例。如果您正苦于以下问题:C++ CDataReader::readCString方法的具体用法?C++ CDataReader::readCString怎么用?C++ CDataReader::readCString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDataReader
的用法示例。
在下文中一共展示了CDataReader::readCString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: string
void CDBEntry::unserialize(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
uint32 uiEntryNameLength = pDataReader->readUint32();
m_strEntryName = string((char*)pDataReader->readCString(uiEntryNameLength));
m_uiEntrySize = pDataReader->readUint32();
m_uiEntryDataCRC = pDataReader->readUint32();
m_uiEntryCreationDate = pDataReader->readUint32();
m_bHasIssue = (pDataReader->readUint8() & 1) == 1;
}
示例2:
void CDATPathFormat::unserializeDefault(void)
{
CDataReader *pDataReader = CDataReader::getInstance();
m_uiFileIndex = 0;// uiAreaId;
uint32 uiSeek = 0;
uint32 uiSize;
CDATEntry_Paths_Default_Header *pHeader1 = pDataReader->readStruct<CDATEntry_Paths_Default_Header>();
m_header.m_ePathsFormat = DAT_PATH_DEFAULT;
m_header.m_uiPathNodeCount = pHeader1->m_uiPathNodeCount;
m_header.m_uiVehicleNodeCount = pHeader1->m_uiVehicleNodeCount;
m_header.m_uiPedNodeCount = pHeader1->m_uiPedNodeCount;
m_header.m_uiNaviNodeCount = pHeader1->m_uiNaviNodeCount;
m_header.m_uiLinkCount = pHeader1->m_uiLinkCount;
uiSize = 20;
uiSeek += uiSize;
m_vecPathNodes.resize(m_header.m_uiPathNodeCount);
m_vecNaviNodes.resize(m_header.m_uiNaviNodeCount);
m_vecLinks.resize(m_header.m_uiLinkCount);
CDATEntry_Paths_Default_PathNode *pPathNodes = new CDATEntry_Paths_Default_PathNode[m_header.m_uiPathNodeCount];
CDATEntry_Paths_Default_NaviNode *pNaviNodes = new CDATEntry_Paths_Default_NaviNode[m_header.m_uiNaviNodeCount];
CDATEntry_Paths_Default_Link *pLinks = new CDATEntry_Paths_Default_Link[m_header.m_uiLinkCount];
CDATEntry_Paths_Default_NaviLink *pNaviLinks = new CDATEntry_Paths_Default_NaviLink[m_header.m_uiLinkCount];
CDATEntry_Paths_Default_LinkLength *pLinkLengths = new CDATEntry_Paths_Default_LinkLength[m_header.m_uiLinkCount];
uiSize = m_header.m_uiPathNodeCount * 28;
memcpy(pPathNodes, pDataReader->readCString(uiSize), uiSize);
uiSeek += uiSize;
uiSize = m_header.m_uiNaviNodeCount * 14;
memcpy(pNaviNodes, pDataReader->readCString(uiSize), uiSize);
uiSeek += uiSize;
uiSize = m_header.m_uiLinkCount * 4;
memcpy(pLinks, pDataReader->readCString(uiSize), uiSize);
uiSeek += uiSize;
uiSeek += 768;
uiSize = m_header.m_uiLinkCount * 2;
memcpy(pNaviLinks, pDataReader->readCString(uiSize), uiSize);
uiSeek += uiSize;
uiSize = m_header.m_uiLinkCount * 1;
memcpy(pLinkLengths, pDataReader->readCString(uiSize), uiSize);
uiSeek += uiSize;
for (uint32 i = 0, j = m_header.m_uiPathNodeCount; i < j; i++)
{
CDATEntry_Paths_Default_PathNode &pPathNode_Default = *(pPathNodes + i);
CDATEntry_Paths_General_PathNode &pPathNode_General = m_vecPathNodes[i];
pPathNode_General.m_vecPosition.x = pPathNode_Default.m_iPosition[0];
pPathNode_General.m_vecPosition.y = pPathNode_Default.m_iPosition[1];
pPathNode_General.m_vecPosition.z = pPathNode_Default.m_iPosition[2];
pPathNode_General.m_wLinkId = pPathNode_Default.m_usLinkId;
pPathNode_General.m_wNodeId = pPathNode_Default.m_usNodeId;
pPathNode_General.m_wAreaId = pPathNode_Default.m_usAreaId;
pPathNode_General.m_ucPathWidth = pPathNode_Default.m_ucPathWidth;
pPathNode_General.m_ucNodeType = pPathNode_Default.m_ucNodeType;
pPathNode_General.m_uiFlags = pPathNode_Default.m_uiFlags;
}
for (uint32 i = 0, j = m_header.m_uiNaviNodeCount; i < j; i++)
{
CDATEntry_Paths_Default_NaviNode &pNaviNode_Default = *(pNaviNodes + i);
CDATEntry_Paths_General_NaviNode &pNaviNode_General = m_vecNaviNodes[i];
pNaviNode_General.m_iPosition[0] = pNaviNode_Default.m_iPosition[0];
pNaviNode_General.m_iPosition[1] = pNaviNode_Default.m_iPosition[1];
pNaviNode_General.m_ucDirection[0] = pNaviNode_Default.m_ucDirection[0];
pNaviNode_General.m_ucDirection[1] = pNaviNode_Default.m_ucDirection[1];
pNaviNode_General.m_uiFlags = pNaviNode_Default.m_uiFlags;
pNaviNode_General.m_usTargetNode_NodeId = pNaviNode_Default.m_usNodeId;
pNaviNode_General.m_usTargetNode_AreaId = pNaviNode_Default.m_usAreaId;
}
for (uint32 i = 0, j = m_header.m_uiLinkCount; i < j; i++)
{
CDATEntry_Paths_Default_Link &pLink_Default = *(pLinks + i);
CDATEntry_Paths_Default_NaviLink &pNaviLink_Default = *(pNaviLinks + i);
CDATEntry_Paths_Default_LinkLength &pLinkLength_Default = *(pLinkLengths + i);
CDATEntry_Paths_General_Link &pLink_General = m_vecLinks[i];
pLink_General.m_usAreaId = pLink_Default.m_usAreaId;
pLink_General.m_usNodeId = pLink_Default.m_usNodeId;
pLink_General.m_usNaviNodeId = pNaviLink_Default.m_usData & 0x3FF; // lower 10 bits
pLink_General.m_usNaviAreaId = (pNaviLink_Default.m_usData >> 10) & 0x3F; // upper 6 bits
pLink_General.m_ucLength = pLinkLength_Default.m_ucLength;
}
delete[] pHeader1;
delete[] pPathNodes;
delete[] pNaviNodes;
delete[] pLinks;
delete[] pNaviLinks;
delete[] pLinkLengths;
}