Skip to content

Instantly share code, notes, and snippets.

@Groogy
Created March 2, 2013 01:41
Show Gist options
  • Save Groogy/5069241 to your computer and use it in GitHub Desktop.
Save Groogy/5069241 to your computer and use it in GitHub Desktop.
static int ToRubyHashIterator( VALUE aKey, VALUE aValue, VALUE anExtra )
{
ToRubyHashInfo* info = ( ToRubyHashInfo* )anExtra;
std::string sym;
if( rb_type( aKey ) == T_SYMBOL )
sym = rb_id2name( SYM2ID( aKey ) );
else
sym = StringValueCStr( aKey );
if( sym == "depth_bits" or sym == "DepthBits" )
info->instance->depthBits = NUM2UINT( aValue );
else if( sym == "stencil_bits" or sym == "StencilBits" )
info->instance->stencilBits = NUM2UINT( aValue );
else if( sym == "antialiasing_level" or sym == "AntialiasingLevel" )
info->instance->antialiasingLevel = NUM2UINT( aValue );
else if( sym == "major_version" or sym == "MajorVersion" )
info->instance->majorVersion = NUM2UINT( aValue );
else if( sym == "minor_version" or sym == "MinorVersion" )
info->instance->minorVersion = NUM2UINT( aValue );
else
rb_raise( rb_eArgError,
"unknown attribute %s for %s", sym.c_str(), info->klass );
return ST_CONTINUE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment