本文整理匯總了C++中GetDataPtr函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetDataPtr函數的具體用法?C++ GetDataPtr怎麽用?C++ GetDataPtr使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GetDataPtr函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: Allocate
KString::KString(LPCTSTR pStr1, size_t szLength1, LPCTSTR pStr2, size_t szLength2)
{
Allocate(szLength1 + szLength2);
memcpy(GetDataPtr(), pStr1, GetStreamCharsLength(szLength1));
memcpy(GetDataPtr(szLength1), pStr2, GetStreamCharsLength(szLength2));
}
示例2: DeleteAllColumns
void CPageDocuments::DisplayShips(int index)
{
CString info;
m_list.DeleteAllItems();
DeleteAllColumns();
m_list.InsertColumn(0 , "船艦名字" , LVCFMT_LEFT , 100);
m_list.InsertColumn(1 , "建造金屬" , LVCFMT_LEFT , 80);
m_list.InsertColumn(2 , "建造晶體" , LVCFMT_LEFT , 80);
m_list.InsertColumn(3 , "建造重氫" , LVCFMT_LEFT , 80);
m_list.InsertColumn(4 , "建造時間" , LVCFMT_LEFT , 80);
m_list.InsertColumn(5 , "攻擊能力" , LVCFMT_LEFT , 80);
m_list.InsertColumn(6 , "運載能力" , LVCFMT_LEFT , 80);
m_list.InsertColumn(7 , "飛行速度" , LVCFMT_LEFT , 80);
m_list.InsertColumn(8 , "技術需求" , LVCFMT_LEFT , 250);
for(int i = 0 ; i < BOAT_MAX ; ++i)
{
info.Format("%s" , BOATS_NAME[i]);
m_list.InsertItem(i , info);
//metal
info.Format("%d" , BOATS_RESOURCE_NEED_BASE[i][0] );
m_list.SetItemText(i , 1 , info);
//crystal
info.Format("%d" , BOATS_RESOURCE_NEED_BASE[i][1] );
m_list.SetItemText(i , 2 , info);
//diplogen
info.Format("%d" , BOATS_RESOURCE_NEED_BASE[i][2] );
m_list.SetItemText(i , 3 , info);
//time
double t = get_boat_produce_seconds(
GetDataPtr()->GetBuildingLevel(FACTORY_BUILDING_BOATYARD), //shipyard level
GetDataPtr()->GetBuildingLevel(FACTORY_BUILDING_NANITE), //nanitefactory level
BOATS_RESOURCE_NEED_BASE[i][0] ,
BOATS_RESOURCE_NEED_BASE[i][1],
1.0);
HighFrequencyElapsedTimer timer;
timer.Init(t * 1000);
m_list.SetItemText(i , 4 , timer.ToCString());
//attack force
info.Format("%d" , UINT(SHIP_ATTACK_FORCE_BASE[i] * (1 + 0.1 * GetDataPtr()->GetResearchLevel(RESEARCH_WEAPON))) );
m_list.SetItemText(i , 5 , info);
//transfer capacity force
info.Format("%d" , SHIP_TRANSFER_CAPACITY[i] );
m_list.SetItemText(i , 6 , info);
//speed
info.Format("%d" , kernel_.GetShipSpeed(ITEM_TYPE(i) , 0));
m_list.SetItemText(i , 7 , info);
//tech needed
m_list.SetItemText(i , 8 , Boats_Entry(i)->GetTechNeeded());
}
}
示例3: DEBUG_VERIFY
size_t KString::Find(LPCTSTR pSString, size_t szStart) const
{
DEBUG_VERIFY(szStart <= GetLength());
LPCTSTR ptr = _tcsstr(GetDataPtr() + szStart, pSString);
return ptr ? ptr - GetDataPtr() : UINT_MAX;
}
示例4: assert
BOOL CPageBoatyard::IsResourceEnough(int index , UINT number)
{
assert(index >= 0 && index < boat_keeper_->Size());
if(GetDataPtr()->GetResource(RESOURCE_METAL) >= (Boats_Entry(index)->GetProduceMinal() * number) &&
GetDataPtr()->GetResource(RESOURCE_CRYSTAL) >= (Boats_Entry(index)->GetProduceCrystal() * number) &&
GetDataPtr()->GetResource(RESOURCE_DIPLOGEN) >= (Boats_Entry(index)->GetProduceDiplogen() * number))
return TRUE;
return FALSE;
}
示例5: wcslen
TWideString::TWideString(LPCWSTR pWideString)
{
const size_t szLength = wcslen(pWideString);
AllocateAdd(szLength + 1);
memcpy(GetDataPtr(), pWideString, szLength * sizeof(WCHAR));
GetDataPtr()[szLength] = 0;
}
示例6: strlen
TAnsiString::TAnsiString(LPCSTR pAnsiString)
{
const size_t szLength = strlen(pAnsiString);
AllocateAdd(szLength + 1);
memcpy(GetDataPtr(), pAnsiString, szLength * sizeof(CHAR));
GetDataPtr()[szLength] = 0;
}
示例7: KString
KString KString::operator + (TAlignment Alignment) const
{
if(Alignment == ALIGNMENT_MIN)
return KString(GetDataPtr(), GetLength(), TEXT("min"), 3);
if(Alignment == ALIGNMENT_MID)
return KString(GetDataPtr(), GetLength(), TEXT("mid"), 3);
if(Alignment == ALIGNMENT_MAX)
return KString(GetDataPtr(), GetLength(), TEXT("max"), 3);
INITIATE_FAILURE;
}
示例8: _stprintf
KString KString::operator + (float fValue) const
{
TCHAR Buf[32];
_stprintf(Buf, TEXT("%.2f"), fValue);
return KString(GetDataPtr(), GetLength(), Buf, _tcslen(Buf));
};
示例9: WTRACE
void* MMsgRoutingUnsubscribeDataObject::Pack(void)
{
WTRACE("MMsgRoutingUnsubscribeDataObject::Pack");
SetServiceType(WONMsg::MiniRoutingServer);
SetMessageType(WONMsg::RoutingUnsubscribeDataObject);
RoutingServerMessage::Pack();
WDBG_LL("MMsgRoutingUnsubscribeDataObject::Pack Appending message data");
// append the client/group id
AppendClientOrGroupId(mLinkId);
// append the datatype length followed by the datatype itself
AppendByte(mDataType.size());
AppendBytes(mDataType.size(), mDataType.data());
// append the flags
unsigned char aFlags = 0;
if (mExactOrRecursiveFlag) aFlags |= 0x01;
if (mGroupOrMembersFlag) aFlags |= 0x02;
AppendByte(aFlags);
return GetDataPtr();
}
示例10: WTRACE
void* MMsgRoutingCreateGroup::Pack(void)
{
WTRACE("MMsgRoutingCreateGroup::Pack");
SetServiceType(WONMsg::MiniRoutingServer);
SetMessageType(WONMsg::RoutingCreateGroup);
RoutingServerMessage::Pack();
WDBG_LL("MMsgRoutingCreateGroup::Pack Appending message data");
// append group name
AppendGroupName(mGroupName);
// append flags
unsigned char aFlags = 0;
if (mIsPublic) aFlags |= 0x01;
if (mAnnounceGroupChanges) aFlags |= 0x02;
AppendByte(aFlags);
// append client count
_ASSERT(mClientList.size() <= USHRT_MAX);
AppendShort(mClientList.size());
// append client list
std::list<unsigned short>::iterator itr = mClientList.begin();
while (itr != mClientList.end())
AppendClientId(*(itr++));
return GetDataPtr();
}
示例11: TCPSendDataCallback
err_t
TCPSendDataCallback(struct netif *netif, struct pbuf *p, struct ip_addr *dest)
{
NDIS_STATUS NdisStatus;
PNEIGHBOR_CACHE_ENTRY NCE;
IP_PACKET Packet = { 0 };
IP_ADDRESS RemoteAddress, LocalAddress;
PIPv4_HEADER Header;
UINT i;
struct pbuf *p1;
/* The caller frees the pbuf struct */
if (((*(u8_t*)p->payload) & 0xF0) == 0x40)
{
Header = p->payload;
LocalAddress.Type = IP_ADDRESS_V4;
LocalAddress.Address.IPv4Address = Header->SrcAddr;
RemoteAddress.Type = IP_ADDRESS_V4;
RemoteAddress.Address.IPv4Address = Header->DstAddr;
}
else
{
return ERR_IF;
}
if (!(NCE = RouteGetRouteToDestination(&RemoteAddress)))
{
return ERR_RTE;
}
NdisStatus = AllocatePacketWithBuffer(&Packet.NdisPacket, NULL, p->tot_len);
if (NdisStatus != NDIS_STATUS_SUCCESS)
{
return ERR_MEM;
}
GetDataPtr(Packet.NdisPacket, 0, (PCHAR*)&Packet.Header, &Packet.ContigSize);
for (i = 0, p1 = p; i < p->tot_len; i += p1->len, p1 = p1->next)
{
ASSERT(p1);
RtlCopyMemory(((PUCHAR)Packet.Header) + i, p1->payload, p1->len);
}
Packet.HeaderSize = sizeof(IPv4_HEADER);
Packet.TotalSize = p->tot_len;
Packet.SrcAddr = LocalAddress;
Packet.DstAddr = RemoteAddress;
if (!NT_SUCCESS(IPSendDatagram(&Packet, NCE, TCPPacketSendComplete, NULL)))
{
FreeNdisPacket(Packet.NdisPacket);
return ERR_IF;
}
return 0;
}
示例12: WTRACE
// TMsgDirFindServiceReply::Pack
// Virtual method from TMessage. Packs data into message buffer and
// sets the new message length.
void*
TMsgDirFindServiceReply::Pack(void)
{
WTRACE("TMsgDirFindServiceReply::Pack");
SetServiceType(WONMsg::DirServer);
SetMessageType(WONMsg::DirFindServiceReply);
TMessage::Pack();
WDBG_LL("TMsgDirFindServiceReply::Pack Appending message data");
AppendShort(static_cast<short>(mStatus));
// Service info only sent if status is ok
if (mStatus == WONMsg::StatusCommon_Success)
{
Append_PW_STRING(mService.mPath);
Append_PW_STRING(mService.mName);
Append_PW_STRING(mService.mDisplayName);
Append_PW_STRING(mService.mVersion);
Append_PW_STRING(mService.mProtoName);
Append_PW_STRING(mService.mProtoVersion);
Append_PW_STRING(mService.mNetAddress);
AppendLong(mService.mLifespan);
AppendLong(mService.mCreated);
AppendShort(mService.mBlobLen);
AppendBytes(mService.mBlobLen, mService.mBlob);
}
return GetDataPtr();
}
示例13: WTRACE
// SMsgDirG2ModifyService::Pack
// Virtual method from SmallMessage. Packs data into message buffer.
void*
SMsgDirG2ModifyService::Pack(void)
{
WTRACE("SMsgDirG2ModifyService::Pack");
SetKeyType(KT_SERVICE);
SetServiceType(WONMsg::SmallDirServerG2);
if (IsExtended())
{
SetMessageType(WONMsg::DirG2ModifyServiceEx);
SetExtended(true, true);
}
else
SetMessageType(WONMsg::DirG2ModifyService);
SMsgDirG2UpdateExtendBase::Pack();
AppendByte(mEntityFlags);
PackKey(*this);
Append_PW_STRING(mNewName);
unsigned char aLen = mNewNetAddress.size();
AppendByte(aLen);
if (aLen > 0)
AppendBytes(aLen, mNewNetAddress.data());
Append_PW_STRING(mNewDisplayName);
AppendLong(mNewLifespan);
PackExtended();
PackPeerData();
return GetDataPtr();
}
示例14: WTRACE
void* MMsgRoutingModifyDataObject::Pack(void)
{
WTRACE("MMsgRoutingModifyDataObject::Pack");
SetServiceType(WONMsg::MiniRoutingServer);
SetMessageType(WONMsg::RoutingModifyDataObject);
RoutingServerMessage::Pack();
WDBG_LL("MMsgRoutingModifyDataObject::Pack Appending message data");
// append the client/group id
AppendClientOrGroupId(mLinkId);
// append the datatype, preceded by datatype length
AppendByte(mDataType.size());
AppendBytes(mDataType.size(), mDataType.data());
// append the offset
AppendShort(mOffset);
// append the IsInsert flag
AppendBool(mIsInsert);
// append the data length followed by the data itself
AppendShort(mData.size());
AppendBytes(mData.size(), mData.data());
return GetDataPtr();
}
示例15: WTRACE
// TMsgAuth1Complete::Pack
// Virtual method from TMessage. Packs data into message buffer and
// sets the new message length.
void*
TMsgAuth1Complete::Pack(void)
{
WTRACE("TMsgAuth1Complete::Pack");
SetServiceType(WONMsg::Auth1PeerToPeer);
SetMessageType(WONMsg::Auth1Complete);
TMsgAuthRawBufferBase::Pack();
WDBG_LL("TMsgAuth1Complete::Pack Appending message data");
AppendShort(static_cast<short>(mStatus));
// Append error info if status implies failure
if (mStatus < 0)
{
WDBG_LL("TMsgAuth1Complete::Pack Failure status, append error info");
AppendShort(mErrList.size());
ErrorList::iterator anItr(mErrList.begin());
for (; anItr != mErrList.end(); anItr++)
Append_PA_STRING(*anItr);
}
// Otherwise append success info
else
{
WDBG_LL("TMsgAuth1Complete::Pack Success status, append secret and optional session");
PackRawBuf();
if (mSessionId != 0) AppendShort(mSessionId);
}
return GetDataPtr();
}