| 424 | } |
| 425 | |
| 426 | CScriptArray* CScriptDictionary::GetKeys() const |
| 427 | { |
| 428 | // Retrieve the object type for the array<string> from the cache |
| 429 | SDictionaryCache *cache = reinterpret_cast<SDictionaryCache*>(engine->GetUserData(DICTIONARY_CACHE)); |
| 430 | asITypeInfo *ti = cache->arrayType; |
| 431 | |
| 432 | // Create the array object |
| 433 | CScriptArray *array = CScriptArray::Create(ti, asUINT(dict.size())); |
| 434 | long current = -1; |
| 435 | dictMap_t::const_iterator it; |
| 436 | for( it = dict.begin(); it != dict.end(); it++ ) |
| 437 | { |
| 438 | current++; |
| 439 | *(dictKey_t*)array->At(current) = it->first; |
| 440 | } |
| 441 | |
| 442 | return array; |
| 443 | } |
| 444 | |
| 445 | //-------------------------------------------------------------------------- |
| 446 | // Generic wrappers |
no test coverage detected