void CreateGroup(char *group) { char *p = group; char *sub = group; CMStringA buf; while ((p = strchr(sub, '\\'))) { *p = 0; if (!buf.IsEmpty()) buf.AppendChar('\\'); buf.Append(sub); if (!availableGroups.Contains(buf)) AddNewGroup(buf); *p++ = '\\'; sub = p; } if (sub) { if (!buf.IsEmpty()) buf.AppendChar('\\'); buf.Append(sub); if (!availableGroups.Contains(buf)) AddNewGroup(buf); } }
GroupExpression *Memo::InsertExpression(std::shared_ptr<GroupExpression> gexpr, GroupID target_group, bool enforced) { // If leaf, then just return if (gexpr->Op().GetType() == OpType::Leaf) { const LeafOperator *leaf = gexpr->Op().As<LeafOperator>(); PELOTON_ASSERT(target_group == UNDEFINED_GROUP || target_group == leaf->origin_group); gexpr->SetGroupID(leaf->origin_group); return nullptr; } // Lookup in hash table auto it = group_expressions_.find(gexpr.get()); if (it != group_expressions_.end()) { gexpr->SetGroupID((*it)->GetGroupID()); return *it; } else { group_expressions_.insert(gexpr.get()); // New expression, so try to insert into an existing group or // create a new group if none specified GroupID group_id; if (target_group == UNDEFINED_GROUP) { group_id = AddNewGroup(gexpr); } else { group_id = target_group; } Group *group = GetGroupByID(group_id); group->AddExpression(gexpr, enforced); return gexpr.get(); } }
bool CNNM2ECC::addNewGroup(string svname, svutil::word & putid, string parentid) { WORDLIST subglist; //获取所有子孙 id if(parentid.find(".")==std::string::npos) { OBJECT objse= Cache_GetSVSE(parentid); if( objse==INVALID_VALUE ) return false; SVSE *se= reinterpret_cast<SVSE *>(objse); if(se==NULL) return false; subglist= se->GetSubGroups(); } else { OBJECT objgroup= Cache_GetGroup( parentid ); if(objgroup==INVALID_VALUE) return false; Group* pNnmGroup = reinterpret_cast<Group *>(objgroup); if(pNnmGroup==NULL) return false; subglist= pNnmGroup->GetSubGroups(); } //遍历子孙 for(WORDLIST::iterator it1=subglist.begin();it1!=subglist.end();it1++) { OBJECT objgroup2= Cache_GetGroup( (*it1).getword() ); if(objgroup2==INVALID_VALUE) continue; Group *pGroup = reinterpret_cast<Group *>(objgroup2); if(pGroup!=NULL) { std::string groupname = svname.c_str(); if(groupname.compare((pGroup->GetProperty())["sv_name"])==0) { putid = pGroup->GetID(); return true; } } } //如果没有发现需要的子孙,则新建 OBJECT newobj= CreateGroup(); if(newobj==INVALID_VALUE) return false; Group* pg= reinterpret_cast<Group *>(newobj); if(pg==NULL) return false; (pg->GetProperty())["sv_name"]= svname.c_str(); putid = AddNewGroup(newobj,parentid); bool ret= SubmitGroup(newobj); CloseGroup( newobj ); return ret; }
//测试用的函数 std::string CCheckBoxTreeView::MyAddNode(std::string name, std::string id, std::string type, std::string index) { std::string strTmp = ""; OBJECT root; if(type == "1") root = CreateGroup(); else root = CreateEntity(); if (root != INVALID_VALUE) { MAPNODE attr; if(type == "1") attr = GetGroupMainAttribNode(root); else attr = GetEntityMainAttribNode(root); bool bState = false; if(attr != INVALID_VALUE) { if(AddNodeAttrib(attr, "sv_id", id)) { if(AddNodeAttrib(attr, "sv_type", type)) { bState = AddNodeAttrib(attr, "sv_name", name); } } } if(bState) { if(type == "1") strTmp = AddNewGroup(root, index); else strTmp = AddNewEntity(root, index); } if(type == "1") CloseGroup(root); else CloseEntity(root); } return strTmp; }
void GroupStateMenu::Update(){ //輸入正確 if(this->CheckInput((this->COMMAND_NUMBER))){ switch(command) { case 1: AddNewGroup(); break; case 2: AddMembersToGroup(); break; case 3: this->gms->SwitchToOtherMenu(TextMenuKey::GMSMenuKey); break; } } else{ cout << "\nOption not Exist,please select again\n"<<endl ; } }
void create_link(BOOL force){ _log("entry:link"); char szText [MAX_PATH]; //call this because we are using COM..initializes com CoInitialize(NULL); AddNewGroup("Piero", szText,force);//create the demo program group strcat(szText, "\\Piero.lnk"); // if (FileExists(szText)) // return ; char filename[255] ; GetModuleFileName(0,filename,sizeof(filename)); if (!CreateShellLink(filename, szText, ""))//create program link { MessageBox(NULL,"Error Creating Program Link","ERROR",MB_OK); return; } //the companion to CoInitialize() CoUninitialize(); }
bool Memo::InsertExpression(std::shared_ptr<GroupExpression> gexpr, GroupID target_group) { // If leaf, then just return if (gexpr->Op().type() == OpType::Leaf) { const LeafOperator *leaf = gexpr->Op().as<LeafOperator>(); assert(target_group == UNDEFINED_GROUP || target_group == leaf->origin_group); gexpr->SetGroupID(leaf->origin_group); return false; } // Lookup in hash table auto it = group_expressions.find(gexpr.get()); bool new_expression; if (it != group_expressions.end()) { new_expression = false; assert(target_group == UNDEFINED_GROUP || target_group == (*it)->GetGroupID()); gexpr->SetGroupID((*it)->GetGroupID()); } else { new_expression = true; group_expressions.insert(gexpr.get()); // New expression, so try to insert into an existing group or // create a new group if none specified GroupID group_id; if (target_group == UNDEFINED_GROUP) { group_id = AddNewGroup(); } else { group_id = target_group; } Group *group = GetGroupByID(group_id); group->AddExpression(gexpr); } return new_expression; }
bool SVGroupview::triggerSlot(WObject *sender, const WSlot_ *slot, void **args) { if (slot == slots_ + 0) { sender_ = sender; MenuItemRequestProc(*((MENU_REQUEST *)args[0])); return true; } if (slot == slots_ + 1) { sender_ = sender; backParent(); return true; } if (slot == slots_ + 2) { sender_ = sender; AddNewGroup(); return true; } if (slot == slots_ + 3) { sender_ = sender; EditGroupParam(*((string *)args[0])); return true; } if (slot == slots_ + 4) { sender_ = sender; showIconView(); return true; } if (slot == slots_ + 5) { sender_ = sender; showListView(); return true; } if (slot == slots_ + 6) { sender_ = sender; AddGroupData(*((string *)args[0]), *((string *)args[1])); return true; } if (slot == slots_ + 7) { sender_ = sender; EditGroupData(*((string *)args[0]), *((string *)args[1])); return true; } if (slot == slots_ + 8) { sender_ = sender; ChangeGroupState(*((string *)args[0]), *((int *)args[1])); return true; } if (slot == slots_ + 9) { sender_ = sender; showMainView(); return true; } if (slot == slots_ + 10) { sender_ = sender; AddNewDevice(); return true; } if (slot == slots_ + 11) { sender_ = sender; AddDevice2nd(*((string *)args[0])); return true; } if (slot == slots_ + 12) { sender_ = sender; EnumDevice(*((string *)args[0])); return true; } if (slot == slots_ + 13) { sender_ = sender; EditDeviceByIndex(*((string *)args[0])); return true; } if (slot == slots_ + 14) { sender_ = sender; AddNewDeviceSucc(*((string *)args[0]), *((string *)args[1])); return true; } if (slot == slots_ + 15) { sender_ = sender; EditDeviceSuccByID(*((string *)args[0]), *((string *)args[1])); return true; } if (slot == slots_ + 16) { sender_ = sender; ChangeDeviceState(*((string *)args[0]), *((int *)args[1])); return true; } if (slot == slots_ + 17) { sender_ = sender; EnterDeviceByID(*((string *)args[0])); return true; } if (slot == slots_ + 18) { sender_ = sender; EnterNewDeviceByID(*((string *)args[0])); return true; } if (slot == slots_ + 19) { sender_ = sender; AddMonitor(*((string *)args[0]), *((string *)args[1])); return true; } if (slot == slots_ + 20) { sender_ = sender; CancelAddMonitor(); return true; } if (slot == slots_ + 21) { sender_ = sender; AddNewMonitorByType(*((int *)args[0]), *((string *)args[1])); return true; } if (slot == slots_ + 22) { sender_ = sender; AddMonitorSucc(*((string *)args[0]), *((string *)args[1])); return true; } if (slot == slots_ + 23) { sender_ = sender; EditMonitorSuccByID(*((string *)args[0]), *((string *)args[1])); return true; } if (slot == slots_ + 24) { sender_ = sender; EditMonitorByIndex(*((string *)args[0])); return true; } if (slot == slots_ + 25) { sender_ = sender; BackMonitorList(); return true; } if (slot == slots_ + 26) { sender_ = sender; BackGroupDeviceList(*((string *)args[0])); return true; } if (slot == slots_ + 27) { sender_ = sender; EditSVSESuccByIndex(*((string *)args[0]), *((string *)args[1])); return true; } if (slot == slots_ + 28) { sender_ = sender; EditSVSEByIndex(*((string *)args[0])); return true; } if (slot == slots_ + 29) { sender_ = sender; enterSVSE(*((string *)args[0])); return true; } if (slot == slots_ + 30) { sender_ = sender; enterGroup(*((string *)args[0])); return true; } if (slot == slots_ + 31) { sender_ = sender; backSVSEView(); return true; } if (slot == slots_ + 32) { sender_ = sender; DelDeviceByIdProc(*((string *)args[0]), *((string *)args[1])); return true; } if (slot == slots_ + 33) { sender_ = sender; DelGroupByIdProc(*((string *)args[0]), *((string *)args[1])); return true; } if (slot == slots_ + 34) { sender_ = sender; BatchAddMonitor(); return true; } if (slot == slots_ + 35) { sender_ = sender; ReloadCurrentView(); return true; } if (slot == slots_ + 36) { sender_ = sender; SortObjects(*((int *)args[0])); return true; } if (slot == slots_ + 37) { sender_ = sender; RefreshCurrentList(); return true; } if (slot == slots_ + 38) { sender_ = sender; enterGroupByID(*((const std::string *)args[0])); return true; } if (slot == slots_ + 39) { sender_ = sender; Translate(); return true; } if (slot == slots_ + 40) { sender_ = sender; ExChange(); return true; } if (slot == slots_ + 41) { sender_ = sender; CopyNewDeviceSucc(*((string *)args[0]), *((string *)args[1])); return true; } if (slot == slots_ + 42) { sender_ = sender; CopyNewMonitorSucc(*((string *)args[0]), *((string *)args[1])); return true; } return WContainerWidget::triggerSlot(sender, slot, args); }