本文整理汇总了C++中IValue::free方法的典型用法代码示例。如果您正苦于以下问题:C++ IValue::free方法的具体用法?C++ IValue::free怎么用?C++ IValue::free使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IValue
的用法示例。
在下文中一共展示了IValue::free方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StdMap_remove
void* StdMap_remove( StdMap* self, const IKey* key )
{
void* ret = 0;
IPIterator* it = self->entries->positions( self->entries );
while ( it->hasNext( it ) )
{
const IPosition* p = it->next( it );
const StdEntry* entry = (StdEntry*) p->getElement( p );
const IKey* e_key = (const IKey*) StdEntry_getKey( entry );
if ( e_key->contentEquals( e_key, key ) )
{
StdEntry* removed_entry = (StdEntry*) self->entries->remove( self->entries, p );
IValue* v = (IValue*) StdEntry_replaceValue( removed_entry, NULL );
ret = v->replaceValue( v, NULL );
free_StdEntry( removed_entry );
v->free( v );
break;
}
}
it->free( it );
return ret;
}
示例2: StdMap_put_IValue
void* StdMap_put_IValue( StdMap* self, const IKey* key, StdValue* aValue )
{
void* ret = 0;
int inserted = 0;
IPIterator* it = self->entries->positions( self->entries );
bool loop = TRUE;
while ( loop && it->hasNext( it ) )
{
const IPosition* p = it->next( it );
const IEntry* entry = p->getElement( p );
const IKey* e_key = entry->getKey( entry );
if ( e_key->contentEquals( e_key, key ) )
{
IValue* value = (IValue*) StdEntry_replaceValue( (StdEntry*) entry, aValue );
ret = value->replaceValue( value, NULL );
value->free( value );
inserted = 1;
break;
}
else if ( 0 < e_key->compareTo( e_key, key ) )
{
IEntry* entry = (IEntry*) new_StdEntry( key, (IValue*) aValue );
self->entries->insertBefore( self->entries, p, entry );
inserted = 1;
loop = FALSE;
}
//int x = e_key->compareTo( e_key, key );
//fprintf( stdout, "%i %s - %s\n", x, e_key->getChars( e_key ), key->getChars( key ) );
}
it->free( it );
if ( ! inserted )
{
IEntry* entry = (IEntry*) new_StdEntry( key, (IValue*) aValue );
self->entries->insertLast( self->entries, entry );
}
return ret;
}