本文整理汇总了C++中UserList::GetUser方法的典型用法代码示例。如果您正苦于以下问题:C++ UserList::GetUser方法的具体用法?C++ UserList::GetUser怎么用?C++ UserList::GetUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserList
的用法示例。
在下文中一共展示了UserList::GetUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: headImagePath
int LuaV6Chat3App::GetUserInfoByID(lua_State *luaState)
{
V6Chat3App *App = GetV6Chat3App(luaState);
if (App)
{
int id = lua_tointeger(luaState, 2);
UserList *list = UserList::Instance();
wstring nick_name, group_name, introduction, location;
unsigned short sex = 0;
unsigned int age = 0;
if(list->GetUser(id, nick_name, group_name, sex, age, introduction, location))
{
lua_newtable(luaState);
lua_pushstring(luaState, "name");
lua_pushstring(luaState, V6Util::UnicodeToUtf8(nick_name.c_str()).c_str());
lua_settable(luaState,-3);
lua_pushstring(luaState, "groupname");
lua_pushstring(luaState, V6Util::UnicodeToUtf8(group_name.c_str()).c_str());
lua_settable(luaState,-3);
lua_pushstring(luaState, "sex");
lua_pushnumber(luaState, sex);
lua_settable(luaState,-3);
lua_pushstring(luaState, "age");
lua_pushnumber(luaState, age);
lua_settable(luaState,-3);
lua_pushstring(luaState, "introduction");
lua_pushstring(luaState, V6Util::UnicodeToUtf8(introduction.c_str()).c_str());
lua_settable(luaState,-3);
lua_pushstring(luaState, "location");
lua_pushstring(luaState, V6Util::UnicodeToUtf8(location.c_str()).c_str());
lua_settable(luaState,-3);
wstring headImagePath(USERHEAD_RELATIVE_PATH);
wstringstream sid;
sid<<id;
headImagePath = headImagePath + L"\\" + sid.str();
XL_BITMAP_HANDLE bmp = V6Util::GetUserDataImageHandle(headImagePath.c_str());
if(bmp)
{
lua_pushstring(luaState, "head");
if(!XLUE_PushBitmap(luaState, bmp))
lua_pushnil(luaState);
lua_settable(luaState,-3); //弹出key,value,并设置到subtable里面去
}
return 1;
}
}
lua_pushnil(luaState);
return 1;
}