static void dict_foreach( const char* key, xmmsv_t *value, void* userdata ) { Xmms::Dict::ForEachFunc* func = static_cast< Xmms::Dict::ForEachFunc* >( userdata ); Xmms::Dict::Variant val; std::string keystring( static_cast< const char* >( key ) ); getValue( val, value ); (*func)( key, val ); }
static void mark_table(lua_State *L, lua_State *dL, const void * parent, const char * desc) { const void * t = readobject(L, dL, parent, desc); if (t == NULL) return; bool weakk = false; bool weakv = false; if (lua_getmetatable(L, -1)) { lua_pushliteral(L, "__mode"); lua_rawget(L, -2); if (lua_isstring(L,-1)) { const char *mode = lua_tostring(L, -1); if (strchr(mode, 'k')) { weakk = true; } if (strchr(mode, 'v')) { weakv = true; } } lua_pop(L,1); luaL_checkstack(L, LUA_MINSTACK, NULL); mark_table(L, dL, t, "[metatable]"); } lua_pushnil(L); while (lua_next(L, -2) != 0) { if (weakv) { lua_pop(L,1); } else { char temp[32]; const char * desc = keystring(L, -2, temp); mark_object(L, dL, t , desc); } if (!weakk) { lua_pushvalue(L,-1); mark_object(L, dL, t , "[key]"); } } lua_pop(L,1); }
void ServerSelectionDialog::accept() { debug(LOG_DEBUG, DEBUG_LOG, 0, "select activated"); // selected value QString qs = ui->serverListWidget->currentItem()->text(); std::string keystring(qs.toLatin1().data()); // get the service key from the list ServiceDiscovery::ServiceKeySet keys = _servicediscovery->list(); ServiceDiscovery::ServiceKeySet::const_iterator i; for (i = keys.begin(); i != keys.end(); i++) { if (keystring == i->toString()) { debug(LOG_DEBUG, DEBUG_LOG, 0, "found %s", keystring.c_str()); ServiceObject so = _servicediscovery->find(*i); // create a main window MainWindow *m = new MainWindow(NULL, so); m->show(); } } // close the window close(); }