本文整理汇总了C++中CItem::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ CItem::Clear方法的具体用法?C++ CItem::Clear怎么用?C++ CItem::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItem
的用法示例。
在下文中一共展示了CItem::Clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DelItem
///NotifyObserver전에 CInventory에있는 tagITEM을 Empty로 만들어야 한다.
bool CItemSlot::DelItem( int iInvenIdx )
{
assert( iInvenIdx >= 0 && iInvenIdx < INVENTORY_TOTAL_SIZE );
CItem* pItem = m_listItems[ iInvenIdx ];
assert( pItem );
if( pItem )
{
pItem->Clear();
m_pEvent->SetID( CTEventItem::EID_DEL_ITEM );
m_pEvent->SetIndex( iInvenIdx );
m_pEvent->SetItem( pItem );
SetChanged();
NotifyObservers( m_pEvent );
delete pItem;
m_listItems[ iInvenIdx ] = NULL;
}
return true;
}
示例2: Clear
void CItemSlot::Clear()
{
std::vector< CItem* >::iterator iter;
CItem* pItem = NULL;
for( iter = m_listItems.begin(); iter != m_listItems.end(); ++iter )
{
pItem = *iter;
if( pItem )
{
pItem->Clear();
m_pEvent->SetID( CTEventItem::EID_DEL_ITEM );
m_pEvent->SetIndex( pItem->GetIndex() );
m_pEvent->SetItem( pItem );
SetChanged();
NotifyObservers( m_pEvent );
delete pItem;
*iter = NULL;
}
}
}
示例3: ReadHeaderReal
bool CInArchive::ReadHeaderReal(const Byte *p, unsigned size, CItem &item)
{
const Byte *pStart = p;
item.Clear();
item.Flags = m_BlockHeader.Flags;
const unsigned kFileHeaderSize = 25;
if (size < kFileHeaderSize)
return false;
item.PackSize = Get32(p);
item.Size = Get32(p + 4);
item.HostOS = p[8];
item.FileCRC = Get32(p + 9);
item.MTime.DosTime = Get32(p + 13);
item.UnPackVersion = p[17];
item.Method = p[18];
unsigned nameSize = Get16(p + 19);
item.Attrib = Get32(p + 21);
item.MTime.LowSecond = 0;
item.MTime.SubTime[0] =
item.MTime.SubTime[1] =
item.MTime.SubTime[2] = 0;
p += kFileHeaderSize;
size -= kFileHeaderSize;
if ((item.Flags & NHeader::NFile::kSize64Bits) != 0)
{
if (size < 8)
return false;
item.PackSize |= ((UInt64)Get32(p) << 32);
item.Size |= ((UInt64)Get32(p + 4) << 32);
p += 8;
size -= 8;
}
if (nameSize > size)
return false;
ReadName(p, nameSize, item);
p += nameSize;
size -= nameSize;
/*
// It was commented, since it's difficult to support alt Streams for solid archives.
if (m_BlockHeader.Type == NHeader::NBlockType::kSubBlock)
{
if (item.HasSalt())
{
if (size < sizeof(item.Salt))
return false;
size -= sizeof(item.Salt);
p += sizeof(item.Salt);
}
if (item.Name == "ACL" && size == 0)
{
item.IsAltStream = true;
item.Name.Empty();
item.UnicodeName.SetFromAscii(".ACL");
}
else if (item.Name == "STM" && size != 0 && (size & 1) == 0)
{
item.IsAltStream = true;
item.Name.Empty();
for (UInt32 i = 0; i < size; i += 2)
{
wchar_t c = Get16(p + i);
if (c == 0)
return false;
item.UnicodeName += c;
}
}
}
*/
if (item.HasSalt())
{
if (size < sizeof(item.Salt))
return false;
for (unsigned i = 0; i < sizeof(item.Salt); i++)
item.Salt[i] = p[i];
p += sizeof(item.Salt);
size -= sizeof(item.Salt);
}
// some rar archives have HasExtTime flag without field.
if (size >= 2 && item.HasExtTime())
{
Byte aMask = (Byte)(p[0] >> 4);
Byte b = p[1];
p += 2;
size -= 2;
Byte mMask = (Byte)(b >> 4);
Byte cMask = (Byte)(b & 0xF);
if ((mMask & 8) != 0)
{
READ_TIME(mMask, item.MTime);
}
READ_TIME_2(cMask, item.CTimeDefined, item.CTime);
//.........这里部分代码省略.........