本文整理汇总了C++中Container::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Container::Clear方法的具体用法?C++ Container::Clear怎么用?C++ Container::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Container
的用法示例。
在下文中一共展示了Container::Clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeserializeContainerSet
//----------------------------------------------------------------------------------------------
int ObjectSerializer::DeserializeContainerSet(char* p_fieldAddress, TypeNode* p_type, fstream& p_eye)
{
// Pointer to set is not supported
_ASSERTE(p_type->Indirection == false);
Container* container = reinterpret_cast<Container*>(p_fieldAddress);
int count;
p_eye.read(reinterpret_cast<char*>(&count), sizeof(int));
container->Clear();
char* tempStorage0 = container->GetTemp();
for(int i = 0; i < count; ++i)
{
DeserializeType(tempStorage0, p_type->TemplateArguments[0], p_eye);
container->AddTemp();
}
return container->TypeSize();
}
示例2: RemoveControl
void Container::RemoveControl(Control* control)
{
// This is annoying... it looks like there might be a bug in wx having
// to do with wxButtons being the "TmpDefaultItem". The destructor of
// wxButton usually takes care of this, but because we remove the button
// before destroying it, the top level window is left holding a dead
// pointer. Therefore, we have to clean up that pointer manually.
// Update: Apparently the same problem occurs with wxTopLevelWindowMSW::m_winLastFocused.
// Therefore, we will also store and clear it ourselves.
wxTopLevelWindow* topWindow = wxDynamicCast( wxGetTopLevelParent( m_Window ), wxTopLevelWindow );
wxWindow* defaultItem = NULL;
wxWindow* lastFocus = NULL;
if ( topWindow )
{
defaultItem = topWindow->GetTmpDefaultItem();
lastFocus = topWindow->GetLastFocus();
}
// our child's internal window
wxWindow* window = NULL;
// hold a reference on the stack
ControlPtr referenceHolder = control;
// if the child is realized
if (control->GetWindow())
{
// If the child is a container, clear it before we break the window hierarchy
if ( control->HasType( Reflect::GetType<Container>() ) )
{
Container* container = static_cast< Container* >( control );
container->Clear();
}
// save the child window pointer
window = control->GetWindow();
// The item we are about to remove is stored on the frame, so
// clear it (see comments at top of this function).
if ( defaultItem && defaultItem == window )
{
topWindow->SetTmpDefaultItem( NULL );
}
// The item we are about to remove is stored on the frame (as
// the item last having focus), so clear it (see comments at
// top of this function).
if ( lastFocus && lastFocus == window )
{
topWindow->SetLastFocus( NULL );
}
// unhook the child from the nested control
if ( window->GetParent() == m_Window )
{
m_Window->RemoveChild(window);
}
}
// remove our reference to the control
const i32 numControls = static_cast< i32 >( m_Controls.size() ) - 1;
for ( i32 controlIndex = numControls; controlIndex > -1; --controlIndex )
{
if ( control == m_Controls.at( controlIndex ) )
{
// remove control from our list
m_Controls.erase( m_Controls.begin() + controlIndex );
break;
}
}
// unrealize the control
control->UnRealize();
}