本文整理汇总了C++中MapList类的典型用法代码示例。如果您正苦于以下问题:C++ MapList类的具体用法?C++ MapList怎么用?C++ MapList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MapList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void GetSFieldHandle<SFAttachmentPtrMap>::flatten(MapList &vList)
{
vList.clear();
SFAttachmentPtrMap const *pMap =
static_cast<SFAttachmentPtrMap const *>(_pField);
if(pMap != NULL)
{
AttachmentMap::const_iterator mapIt = pMap->getValue().begin();
AttachmentMap::const_iterator mapEnd = pMap->getValue().end ();
for(; mapIt != mapEnd; ++mapIt)
{
if(mapIt->second->getInternal() == true)
continue;
std::string szKey;
TypeTraits<UInt32>::putToString((mapIt->first & 0x0000FFFF),
szKey);
ListEntry tmpEntry;
tmpEntry.first.push_back(szKey);
tmpEntry.second = mapIt->second;
vList.push_back(tmpEntry);
}
}
}
示例2: printf
void DynamicMaterial::setTextures(MaterialEditor* src) {
if(!m_material) return;
if(m_stream) m_stream->build();
// Textures
m_material->setTexture("diffuseArray", src->getDiffuseArray());
m_material->setTexture("normalArray", src->getNormalArray());
if(m_stream) {
m_stream->setTexture("diffuseArray", src->getDiffuseArray());
m_stream->setTexture("normalArray", src->getNormalArray());
printf("Textures set\n");
}
// Bind all the maps
typedef std::set<const char*> MapList;
MapList maps;
for(size_t i=0; i<m_layers.size(); ++i) {
if(m_layers[i]->map && m_layers[i]->map[0]) maps.insert( m_layers[i]->map );
if(m_layers[i]->map2 && m_layers[i]->map2[0]) maps.insert( m_layers[i]->map2 );
update(i);
}
for(MapList::iterator i=maps.begin(); i!=maps.end(); ++i) {
EditableTexture* map = src->getMap(*i);
if(map) {
m_material->setTexture(*i, map->getTexture());
if(m_stream) {
if(map->getTextureStream()) m_stream->addStream(*i, map->getTextureStream());
else m_stream->setOverlayTexture(*i, map->getTexture());
}
}
}
}
示例3: OnUserSexChanged
// Изменение иконки пользователя.
void OnUserSexChanged(BYTE *InBuffer) {
String name;
DWORD sex;
try {
//name
GetStreamString(&InBuffer, &name);
//ip
GetStreamString(&InBuffer, NULL);
//male
GetStreamDword(&InBuffer, NULL);
//new male
GetStreamDword(&InBuffer, &sex);
UpdateOnlineUserSex(name, sex);
MapList params;
params.insert(pair<String, String>("user", name));
params.insert(pair<String, String>("sex", sex));
String json_object = SetParametersObject(params);
SendNotification("user_sex_changed", json_object, GetConnectionsRef(true));
} catch (Exception *E) {
throw(Format(e_user_sex_changed, ARRAYOFCONST((E->Message))));
}
}
示例4:
void GetSFieldHandle<SFChunkBlockPtrMap>::flatten(MapList &vList)
{
vList.clear();
SFChunkBlockPtrMap const *pMap =
static_cast<SFChunkBlockPtrMap const *>(_pField);
if(pMap != NULL)
{
ChunkBlockMap::const_iterator mapIt = pMap->getValue().begin();
ChunkBlockMap::const_iterator mapEnd = pMap->getValue().end ();
for(; mapIt != mapEnd; ++mapIt)
{
ListEntry tmpEntry;
KeyPool::the()->keyToStringList(mapIt->first,
tmpEntry.first);
tmpEntry.second = mapIt->second;
vList.push_back(tmpEntry);
}
}
}
示例5: OnUserChannelDisconnect
// Отключение от канала стороннего или виртуального пользователя.
void OnUserChannelDisconnect(BYTE *InBuffer) {
String bot, channel, name;
try {
// virtual user.
GetStreamString(&InBuffer, &bot);
// channel.
GetStreamString(&InBuffer, &channel);
if (UserIsMonitoring(bot, channel)) {
// name.
GetStreamString(&InBuffer, &name);
MapList params;
params.insert(pair<String, String>("user", name));
params.insert(pair<String, String>("channel", channel));
String json_object = SetParametersObject(params);
SendNotification("user_channel_disconnect", json_object, GetChannelConnections(channel));
DeleteUserChannel(name, channel);
// If channel watcher was disconnected, then find new watcher.
if (name == bot) {
ChangeChannelWatcher(channel);
}
}
} catch (Exception *E) {
throw(Format(e_user_channel_disconnect, ARRAYOFCONST((E->Message))));
}
}
示例6: OnUserDisconnect
// Выход из чата.
void OnUserDisconnect(BYTE *InBuffer) {
String name;
try {
//name
GetStreamString(&InBuffer, &name);
RemoveUserFromChannels(name);
// Проверяем, является ли пользователь виртуальным. Если да, то проверяем список отслеживаний каналов.
LogicalConnections::iterator connection = FindConnectionByUser(name);
if (ConnectionExists(connection)) {
UnsetConnectionUser(connection);
}
RemoveOnlineUser(name);
MapList params;
params.insert(pair<String, String>("user", name));
String json_object = SetParametersObject(params);
SendNotification("user_disconnect", json_object, GetConnectionsRef(true));
} catch (Exception *E) {
throw(Format(e_user_disconnect, ARRAYOFCONST((E->Message))));
}
}
示例7: OnUserChannelConnect
// Подключение к каналу стороннего пользователя.
void OnUserChannelConnect(BYTE *InBuffer) {
String bot, name, channel, ip, query;
DWORD male;
try {
//virtual user
GetStreamString (&InBuffer, &bot);
//channel
GetStreamString(&InBuffer, &channel);
// If this user is channel watcher.
if (UserIsMonitoring(bot, channel)) {
//name
GetStreamString(&InBuffer, &name);
//ip
GetStreamString(&InBuffer, &ip);
//male
GetStreamDword(&InBuffer, &male);
AddUserChannel(name, channel);
MapList params;
params.insert(pair<String, String>("user", name));
params.insert(pair<String, String>("channel", channel));
String json_object = SetParametersObject(params);
SendNotification("user_channel_connect", json_object, GetChannelConnections(channel));
}
} catch (Exception *E) {
throw(Format(e_user_channel_connect, ARRAYOFCONST((E->Message))));
}
}
示例8: SetParametersObject
// Set value from the map list.
String SetParametersObject(MapList params, bool last_param_array) {
MapList::iterator it;
MapList::iterator last_param = params.end();
last_param--;
String params_object = "";
for (it = params.begin(); it != params.end(); it++) {
AddPair(params_object, it->first, it->second, (last_param == it && last_param_array) ? false : true, (last_param != it) ? true : false);
}
return params_object;
}
示例9: setItemIndexMethod
BattleArea::BattleArea(Map *map){
setItemIndexMethod(QGraphicsScene::NoIndex);
///
QTimer *timer = new QTimer();
timer->setInterval(1000);
m_width = m_height = map->size() * SIZE;
setSceneRect(0, 0, m_width, m_height);
BotPack *bpack = new BotPack("data/robots/botpacks/tank-0.bpack"); // must be dynamic, too (maybe by reference)
MapList *mapList = map->mapList();
int mapSize = map->size();
int i, j;
int listpos = 0;
// the TileObject used as BattleArea "background"
TileObject *tile = new TileObject("data/textures/" + map->pathTexture() + ".svgz", map->pathColor(), map->pathAltColor());
setBackgroundBrush(tile->pixmap());
// must add on KWB::Map a method to load the map
for (i = 0; i < mapSize; i++){
for (j = 0; j < mapSize; j++){
listpos = (j * mapSize) + i;
// iteratte trough the map list (objects and items)
if (mapList->at(listpos) == Ammo){
AmmoItem *ammo = new AmmoItem("data/items/" + map->ammoTexture() + ".svgz", QPoint(i, j), map->ammoValue());
addItem(ammo);
} else if (mapList->at(listpos) == Block){
BlockObject *block = new BlockObject("data/textures/" + map->blockTexture() + ".svgz", QPoint(i, j), map->blockColor());
addItem(block);
} else if (mapList->at(listpos) == Enemy){
// TODO
} else if (mapList->at(listpos) == Energy){
EnergyItem *energy = new EnergyItem("data/items/" + map->energyTexture() + ".svgz", QPoint(i, j), map->energyValue());
addItem(energy);
} else if (mapList->at(listpos) == StartPoint){
// the user programmed Robot
m_robot = new Robot(bpack, this, QPoint(i, j));
addItem(m_robot->robotObject());
} else if (mapList->at(listpos) == Wall){
WallObject *wall = new WallObject("data/textures/" + map->wallTexture() + ".svgz", QPoint(i, j), map->wallColor());
addItem(wall);
connect(wall, SIGNAL(deleteMe(QGraphicsItem*)), this, SLOT(deleteItem(QGraphicsItem*)));
} else if (mapList->at(listpos) == Water){
WaterObject *water = new WaterObject("data/textures/" + map->waterTexture() + ".svgz", QPoint(i, j), timer);
addItem(water);
} else if (mapList->at(listpos) == Weapon){
WeaponItem *weapon = new WeaponItem("data/items/" + map->weaponTexture() + ".svgz", QPoint(i, j), map->weaponValue());
addItem(weapon);
}
}
示例10: OnVirtualUserChannelConnect
// Подключение к каналу виртуального пользователя.
void OnVirtualUserChannelConnect(BYTE *InBuffer) {
String name, channel_name;
try {
// virtual user.
GetStreamString (&InBuffer, &name);
// channel.
GetStreamString(&InBuffer, &channel_name);
// topic.
GetStreamString(&InBuffer, NULL);
// greeting.
GetStreamString(&InBuffer, NULL);
LogicalConnections::iterator connection = FindConnectionByUser(name);
OnlineUsersList::iterator user = GetConnectionUser(connection);
ChannelsList::iterator channel = FindChannelByName(channel_name);
StringList channel_users;
if (!IsChannelMonitored(channel_name)) {
AddChannelWatcher(name, channel_name);
Channel channel_info = GetChannelInfo(channel_name);
channel_users = GetChannelUsersList(name, channel_name);
channel_info.online_users = channel_users.size();
UpdateChannel(channel, GetChannelInfo(channel_name));
for (unsigned int i = 0; i < channel_info.online_users; i++) {
AddUserChannel(name, channel_name);
}
} else {
AddUserChannel(name, channel_name);
channel_users = GetChannelUsers(channel_name);
}
MapList params;
params.insert(pair<String, String>("channel", channel_name));
params.insert(pair<String, String>("topic", channel->topic));
params.insert(pair<String, String>("greeting", channel->greeting));
params.insert(pair<String, String>("users", "[" + implode(channel_users) + "]"));
String json_object = SetParametersObject(params, true);
SendNotification("virtual_user_channel_connect", json_object, connection, false);
} catch (Exception *E) {
throw(Format(e_virtual_user_channel_connect, ARRAYOFCONST((E->Message))));
}
}
示例11: OnUserConnect
// Вход в чат.
void OnUserConnect(BYTE *InBuffer) {
String name, ip, query;
DWORD male;
try {
//name
GetStreamString(&InBuffer, &name);
//ip
GetStreamString(&InBuffer, &ip);
//male
GetStreamDword(&InBuffer, &male);
// Get user from registred users list, add it's reference to online users and update user info.
UsersList::iterator user = FindUserByName(name);
CFUserInfo user_info = GetUserInfo(name);
OnlineUsersList::iterator online_user = AddOnlineUser(user, user_info.state, user_info.client_version, user_info.process, user_info.window_activity, user_info.downtime);
UpdateUser(user, user_info.computer_id, user_info.ip, user_info.male);
// If user is in authorization queue.
AuthQueueMap::iterator auth_queue_item = FindAuthQueueByUser(name);
if (IsAuthQueueElement(auth_queue_item)) {
LogicalConnections::iterator connection = GetAuthQueueConnection(auth_queue_item);
SetConnectionUser(connection, online_user);
SetAuthorizationStatus(connection, 9);
DeleteAuthQueueItem(auth_queue_item);
}
MapList params;
params.insert(pair<String, String>("name", name));
params.insert(pair<String, String>("ip", ip));
params.insert(pair<String, String>("sex", male));
String json_object = SetParametersObject(params, true);
SendNotification("user_connect", json_object, GetConnectionsRef(true));
} catch (Exception *E) {
throw(Format(e_user_connect, ARRAYOFCONST((E->Message))));
}
}
示例12: OnChannelTopicChanged
// Изменение темы.
void OnChannelTopicChanged(BYTE *InBuffer) {
String bot, name, channel, topic;
try {
//bot_prop.name
GetStreamString(&InBuffer, &bot);
// Если виртуальный пользователь является пользователем, отслеживающим данный канал.
if (UserIsMonitoring(bot, channel)) {
//channel
GetStreamString(&InBuffer, &channel);
//name
GetStreamString(&InBuffer, &name);
//ip
GetStreamString(&InBuffer, NULL);
//male
GetStreamDword(&InBuffer, NULL);
//new theme
GetStreamString(&InBuffer, &topic);
int timestamp = time(NULL);
UpdateChannelTopic(channel, topic, name, timestamp);
MapList params;
params.insert(pair<String, String>("channel", channel));
params.insert(pair<String, String>("topic_editor", name));
params.insert(pair<String, String>("topic", topic));
params.insert(pair<String, String>("timestamp", timestamp));
String json_object = SetParametersObject(params);
SendNotification("channel_topic_changed", json_object, GetChannelConnections(channel));
}
} catch (Exception *E) {
throw(Format(e_chnl_theme_changed, ARRAYOFCONST((E->Message))));
}
}
示例13: while
void
CLxVertexMapSelection::GetList (
MapList &list)
{
LXtScanInfoID scan;
MapInfo info;
const char *str;
void *pkt;
scan = 0;
while (scan = srv_sel.ScanLoop (scan, sel_ID, &pkt)) {
pkt_trans.Type (pkt, &info.type);
if (!Include (info.type))
continue;
pkt_trans.Name (pkt, &str);
info.name = str;
list.push_back (info);
}
}
示例14: OnPublicChannelMessage
// Публикация в общий канал.
void OnPublicChannelMessage(BYTE *InBuffer) {
String bot, name, channel, text;
DWORD mode, male, image_length;
try {
//bot nick
GetStreamString (&InBuffer, &bot);
//nick
GetStreamString(&InBuffer, &name);
//ip
GetStreamString(&InBuffer, NULL);
//male
GetStreamDword(&InBuffer, &male);
//channel
GetStreamString(&InBuffer, &channel);
// Если виртуальный пользователь является пользователем, отслеживающим данный канал.
if (UserIsMonitoring(bot, channel)) {
//rezim
GetStreamDword(&InBuffer, &mode);
//text
GetStreamString(&InBuffer, &text);
GetStreamDword(&InBuffer, &image_length);
MapList params;
params.insert(pair<String, String>("sender", name));
params.insert(pair<String, String>("channel", channel));
params.insert(pair<String, String>("mode", mode));
params.insert(pair<String, String>("message", text));
if (image_length > 0) {
String image_name = SaveData(InBuffer, image_length);
if (!image_name.IsEmpty()) {
params.insert(pair<String, String>("image", image_name));
}
}
String json_object = SetParametersObject(params);
SendNotification("public_mess", json_object, GetChannelConnections(channel));
}
} catch (Exception *E) {
throw(Format(e_user_mess_recieve, ARRAYOFCONST((E->Message))));
}
}
示例15: if
ButtonAction TouchKeyboard::handle_button_pressed( TextButton* text_button )
{
if( this->keys.find(text_button) != this->keys.end() )
{
std::string button_text = this->handle_key_pressed( text_button->text );
// FIXME: besser db-patterns abfragen!
if( this->current_layout_dead_keys.find(button_text)!=std::string::npos )
{
this->modifier = button_text;
}
else if( button_text == "<" )
{
if( this->modifier.length() )
{
this->modifier = "";
}
else if( this->written_chars.size() )
{
this->written_chars.pop_back();
this->handle_text_changed();
}
}
else
{
if( this->modifier.length() )
{
button_text = this->modifier + button_text;
if( db )
{
int rc;
button_text = replace_pattern( button_text, "'", "\'" );
std::string stmt = "select result from modifiers where pattern='"+button_text+"'";
MapList result;
if( (rc = sqlite3_exec(db, stmt.c_str(), map_list_callback, &result, 0))!=SQLITE_OK )
{
std::stringstream msg;
msg << sqlite3_errmsg(db) << " (" << rc << "), in statement: " << stmt;
throw ERROR( msg.str() );
}
for( MapList::iterator ri=result.begin(); ri!=result.end(); ri++ )
{
button_text = (*ri)["result"];
break;
}
}
}
utf8_to_utf8_char_list( (const unsigned char*)button_text.c_str(), this->written_chars );
this->modifier = "";
this->handle_text_changed();
}
return BUTTON_ACTION_PRESSED | BUTTON_ACTION_SCREEN_SUB;
}
else if( text_button == &this->layout_minus )
{
if( this->current_layout != this->layouts.begin() )
{
this->current_layout--;
}
else if( this->layouts.end() != this->layouts.begin() )
{
this->current_layout = this->layouts.end();
this->current_layout--;
}
this->init_button_vram();
this->program.config->set( "touch_keyboard.current_layout", *this->current_layout );
// WARNING: button release handler will crash because of iterator invalidation if STOP_HANDLER ist not set:
return BUTTON_ACTION_PRESSED | BUTTON_ACTION_SCREEN_SUB | BUTTON_ACTION_STOP_HANDLER;
}
else if( text_button == &this->layout_plus )
{
if( this->layouts.size() && &*this->current_layout != &*this->layouts.rbegin() )
{
this->current_layout++;
}
else
{
this->current_layout = this->layouts.begin();
}
this->init_button_vram();
this->program.config->set( "touch_keyboard.current_layout", *this->current_layout );
// WARNING: button release handler will crash because of iterator invalidation when STOP_HANDLER ist not set:
return BUTTON_ACTION_PRESSED | BUTTON_ACTION_SCREEN_SUB | BUTTON_ACTION_STOP_HANDLER;
}
return this->ButtonProvider::handle_button_pressed( text_button );
}