本文整理汇总了C++中ItemList::sort方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemList::sort方法的具体用法?C++ ItemList::sort怎么用?C++ ItemList::sort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemList
的用法示例。
在下文中一共展示了ItemList::sort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleIq
bool Disco::handleIq( const IQ& iq )
{
switch( iq.subtype() )
{
case IQ::Get:
{
IQ re( IQ::Result, iq.from(), iq.id() );
re.setFrom( iq.to() );
const SoftwareVersion* sv = iq.findExtension<SoftwareVersion>( ExtVersion );
if( sv )
{
re.addExtension( new SoftwareVersion( m_versionName, m_versionVersion, m_versionOs ) );
m_parent->send( re );
return true;
}
const Info *info = iq.findExtension<Info>( ExtDiscoInfo );
if( info )
{
Info *i = new Info( EmptyString, true );
if( !info->node().empty() )
{
i->setNode( info->node() );
IdentityList identities;
StringList features;
DiscoNodeHandlerMap::const_iterator it = m_nodeHandlers.find( info->node() );
if( it == m_nodeHandlers.end() )
{
delete i;
IQ re( IQ::Error, iq.from(), iq.id() );
re.addExtension( new Error( StanzaErrorTypeCancel, StanzaErrorItemNotFound ) );
m_parent->send( re );
return true;
}
else
{
DiscoNodeHandlerList::const_iterator in = (*it).second.begin();
for( ; in != (*it).second.end(); ++in )
{
IdentityList il = (*in)->handleDiscoNodeIdentities( iq.from(), info->node() );
il.sort(); // needed on win32
identities.merge( il );
StringList fl = (*in)->handleDiscoNodeFeatures( iq.from(), info->node() );
fl.sort(); // needed on win32
features.merge( fl );
}
}
i->setIdentities( identities );
i->setFeatures( features );
}
else
{
IdentityList il;
IdentityList::const_iterator it = m_identities.begin();
for( ; it != m_identities.end(); ++it )
{
il.push_back( new Identity( *(*it) ) );
}
i->setIdentities( il );
i->setFeatures( m_features );
if( m_form )
i->setForm( new DataForm( *m_form ) );
}
re.addExtension( i );
m_parent->send( re );
return true;
}
const Items *items = iq.findExtension<Items>( ExtDiscoItems );
if( items )
{
Items *i = new Items( items->node() );
if( !items->node().empty() )
{
DiscoNodeHandlerMap::const_iterator it = m_nodeHandlers.find( items->node() );
if( it == m_nodeHandlers.end() )
{
delete i;
IQ re( IQ::Error, iq.from(), iq.id() );
re.addExtension( new Error( StanzaErrorTypeCancel, StanzaErrorItemNotFound ) );
m_parent->send( re );
return true;
}
else
{
ItemList itemlist;
DiscoNodeHandlerList::const_iterator in = (*it).second.begin();
for( ; in != (*it).second.end(); ++in )
{
ItemList il = (*in)->handleDiscoNodeItems( iq.from(), iq.to(), items->node() );
il.sort(); // needed on win32
itemlist.merge( il );
}
i->setItems( itemlist );
}
}
re.addExtension( i );
//.........这里部分代码省略.........