void RuleOptionsDialog::fillInterfaces(QComboBox* cb) { QSet<QString> deduplicated_interface_names; list<FWObject*> interfaces = firewall->getByTypeDeep(Interface::TYPENAME); for (list<FWObject*>::iterator i=interfaces.begin(); i!=interfaces.end(); ++i) { Interface *iface = Interface::cast(*i); assert(iface); if (iface->isLoopback()) continue; deduplicated_interface_names.insert(iface->getName().c_str()); if (Cluster::isA(firewall)) { FailoverClusterGroup *failover_group = FailoverClusterGroup::cast( iface->getFirstByType(FailoverClusterGroup::TYPENAME)); if (failover_group) { for (FWObject::iterator it=failover_group->begin(); it!=failover_group->end(); ++it) { FWObject *mi = FWReference::getObject(*it); if (Interface::isA(mi) && ! iface->isLoopback()) { deduplicated_interface_names.insert(mi->getName().c_str()); } } } } } QStringList sorted_interfaces; QSetIterator<QString> it(deduplicated_interface_names); while (it.hasNext()) { sorted_interfaces << it.next(); } sorted_interfaces.sort(); cb->clear(); cb->addItem(""); cb->addItems(sorted_interfaces); }
void ColorClip::CreateNewFloater() { CreateDialog( hInstance, MAKEINTRESOURCE(IDD_COLORCLIP_FLOATER), ip->GetMAXHWnd(), ColorClipFloaterDlgProc); }
void Unreal3DExport::CheckCancel() { if( pInt->GetCancel() ) { if( !bShowPrompts ) throw CancelException(); switch(MessageBox(pInt->GetMAXHWnd(), GetString(IDS_CANCEL_Q), GetString(IDS_CANCEL_C), MB_ICONQUESTION | MB_YESNO)) { case IDYES: throw CancelException(); case IDNO: pInt->SetCancel(FALSE); } } }
ErrorCode DeformMeshRemap::write_to_coords(Range &elems, Tag tagh, Tag tmp_tag) { // Write the tag to coordinates Range verts; ErrorCode rval = mbImpl->get_adjacencies(elems, 0, false, verts, Interface::UNION);MB_CHK_SET_ERR(rval, "Failed to get adj vertices"); vector<double> coords(3*verts.size()); if (tmp_tag) { // Save the coords to tmp_tag first rval = mbImpl->get_coords(verts, &coords[0]);MB_CHK_SET_ERR(rval, "Failed to get tmp copy of coords"); rval = mbImpl->tag_set_data(tmp_tag, verts, &coords[0]);MB_CHK_SET_ERR(rval, "Failed to save tmp copy of coords"); } rval = mbImpl->tag_get_data(tagh, verts, &coords[0]);MB_CHK_SET_ERR(rval, "Failed to get tag data"); rval = mbImpl->set_coords(verts, &coords[0]);MB_CHK_SET_ERR(rval, "Failed to set coordinates"); return MB_SUCCESS; }
ErrorCode DeformMeshRemap::write_and_save(Range &ents, EntityHandle seth, Tag tagh, const char *filename, bool restore_coords) { Tag tmp_tag = 0; ErrorCode rval; if (restore_coords) rval = mbImpl->tag_get_handle("", 3, MB_TYPE_DOUBLE, tmp_tag, MB_TAG_CREAT|MB_TAG_DENSE); rval = write_to_coords(ents, tagh, tmp_tag);MB_CHK_ERR(rval); rval = mbImpl->write_file(filename, NULL, NULL, &seth, 1);MB_CHK_ERR(rval); if (restore_coords) { rval = write_to_coords(ents, tmp_tag);MB_CHK_ERR(rval); rval = mbImpl->tag_delete(tmp_tag);MB_CHK_ERR(rval); } return rval; }
bool Root::init(bool fullscr, int w, int h) { LOG_INFO("loading root"); windowWidth = w; windowHeight = h; fullscreen = fullscr; if(!initGLFW()) return false; if(!initGLEW()) return false; // set GL stuff glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //Call these in the right order: Models need Textures TextureManager::shared().initialize(); //MaterialManager::shared().initialize(); ModelManager::shared().initialize(); overlay = new Overlay(); if(!overlay->init()) return false; Interface* interf = new Interface; if(!interf->init()) { LOG_INFO("Could not initialize interface"); return false; } addFrameListener(interf); Console* console = new Console; if(!console->init()) { LOG_INFO("Could not initialize console"); return false; } addFrameListener(console); addInputListener(console); LOG_INFO("Root initialized"); return true; }
void Unreal3DExport::Init() { // Init CheckCancel(); pScene = GetIGameInterface(); GetConversionManager()->SetUserCoordSystem(UnrealCoords); if( bExportSelected ) { Tab<INode*> selnodes;; for( int i=0; i<pInt->GetSelNodeCount(); ++i ) { INode* n = pInt->GetSelNode(i); selnodes.Append(1,&n); } if( !pScene->InitialiseIGame(selnodes,false) ) throw MAXException(GetString(IDS_ERR_IGAME)); } else { if( !pScene->InitialiseIGame() ) throw MAXException(GetString(IDS_ERR_IGAME)); } // Enumerate scene NodeCount = pScene->GetTotalNodeCount(); for( int i=0; i<pScene->GetTopLevelNodeCount(); ++i ) { IGameNode * n = pScene->GetTopLevelNode(i); ExportNode(n); } Progress += U3D_PROGRESS_ENUM; // Get animation info FrameStart = pScene->GetSceneStartTime() / pScene->GetSceneTicks(); FrameEnd = pScene->GetSceneEndTime() / pScene->GetSceneTicks(); FrameCount = FrameEnd - FrameStart+1; if( FrameCount <= 0 || FrameEnd < FrameStart ) { ProgressMsg.printf(GetString(IDS_ERR_FRAMERANGE),FrameStart,FrameEnd); throw MAXException(ProgressMsg.data()); } pScene->SetStaticFrame(FrameStart); }
int main(int argc,char *argv[]) { QDir::setCurrent(QFileInfo(QString::fromLocal8Bit(argv[0])).absolutePath()); Local::addLibraryPath("./plugins"); Local::setStyle("Fusion"); Local a(argc,argv); Config::load(); int single; if((single=Config::getValue("/Interface/Single",1))){ QLocalSocket socket; socket.connectToServer("BiliLocalInstance"); if(socket.waitForConnected()){ QDataStream s(&socket); s<<a.arguments().mid(1); socket.waitForBytesWritten(); return 0; } } Shield::load(); loadTranslator(); setDefaultFont(); setToolTipBase(); a.connect(&a,&Local::aboutToQuit,[](){ Shield::save(); Config::save(); }); qsrand(QTime::currentTime().msec()); Interface w; Plugin::loadPlugins(); w.show(); w.tryLocal(a.arguments().mid(1)); QLocalServer *server=NULL; if(single){ server=new QLocalServer(qApp); server->listen("BiliLocalInstance"); QObject::connect(server,&QLocalServer::newConnection,[&](){ QLocalSocket *r=server->nextPendingConnection(); r->waitForReadyRead(); QDataStream s(r); QStringList args; s>>args; r->deleteLater(); w.tryLocal(args); }); }
ErrorCode VectorSetIterator::get_next_arr(std::vector<EntityHandle> &arr, bool &atend) { int count; const EntityHandle *ptr; WriteUtilIface *iface; Interface *mbImpl = dynamic_cast<Interface*>(myCore); ErrorCode rval = mbImpl->query_interface(iface); if (MB_SUCCESS != rval) return rval; rval = iface->get_entity_list_pointers( &entSet, 1, &ptr, WriteUtilIface::CONTENTS, &count); if (MB_SUCCESS != rval) return rval; mbImpl->release_interface(iface); if (!count || iterPos >= count) { atend = true; return MB_SUCCESS; } std::vector<EntityHandle> tmp_arr; std::vector<EntityHandle> *tmp_ptr = &arr; if (checkValid) tmp_ptr = &tmp_arr; // just get the next chunkSize entities, or as many as you can int this_ct = 0; while (this_ct < (int)chunkSize && iterPos < count) { if ((MBMAXTYPE == entType || TYPE_FROM_HANDLE(ptr[iterPos]) == entType) && (-1 == entDimension || CN::Dimension(TYPE_FROM_HANDLE(ptr[iterPos])) == entDimension)) { arr.push_back(ptr[iterPos]); this_ct++; } iterPos++; } atend = (iterPos == count); if (checkValid) { for (std::vector<EntityHandle>::iterator vit = tmp_ptr->begin(); vit != tmp_ptr->end(); vit++) { if (myCore->is_valid(*vit)) arr.push_back(*vit); } } // step along list, adding entities return MB_SUCCESS; }
bayonne_status *bayonne_status_2_svc(void *, struct svc_req *req) { static char node_server[BAYONNE_NODE_SERVER_SZ]; static char node_version[BAYONNE_NODE_VERSION_SZ]; static bayonne_status status; memset(&status, 0, sizeof(status)); snprintf(node_server, sizeof(node_server), "%s", bayonne.getLast("servername")); snprintf(node_version, sizeof(node_version), "%s", bayonne.getLast("serverversion")); status.node_uptime = Bayonne::uptime(); status.node_server = node_server; status.node_version = node_version; status.node_count = bayonne.getCount(); status.node_active = bayonne.getUsed(); return &status; }
bool add_interface(Interface interface) { if (interface.validate()) { _interfaces.push_back(interface); _sub.notify(dynamic_cast<Module*>(&interface), Subscriber::Interface, Event::ADD); return true; } return false; }
int main() { BroadcastReceiver *broadcastReceiver = new BroadcastReceiver(); broadcastReceiver->start(); UnicastReceiver *unicastReceiver = new UnicastReceiver(); unicastReceiver->start(); Controller *controller = new Controller(); controller->start(); Interface interf; interf.start(); //ResourceIdentifier *ri = new ResourceIdentifier("Victory.mp3", 503200); //char *address = "25.9.227.212"; //ResourceManager::getInstance().addRemoteResource(*ri, *(new Source(address))); //ResourceManager::getInstance().addDownloadedResource(*ri); //ResourceManager::getInstance().addLocalResource("Victory2.mp3"); getchar(); return 0; }
void Preference::supprproxy(void) { if(combo_proxy->count()) //on s'assure qu'on essai pas de vider une liste vide { QSettings options("proxy.ini", QSettings::IniFormat); //on enregistre dans le fichier proxy nom_proxy->clear(); champ_ip->clear(); champ_port->clear(); type_proxy->setCurrentIndex(0); champ_pseudo->clear(); champ_pass->clear(); combo_proxy->removeItem(combo_proxy->currentIndex()); options.remove("ProxyList/"+combo_proxy->currentText()); Interface * navigateur = (Interface *) this->parentWidget()->window(); //on modifie la liste déroulante du prog principale navigateur->setListeProxy(combo_proxy); } }
StreamNameIO::StreamNameIO( const Interface &iface, const shared_ptr<Cipher> &cipher, const CipherKey &key ) : _interface( iface.major() ) , _cipher( cipher ) , _key( key ) { }
void MainWindow::dropEvent(QDropEvent * event) { qCDebug(ARK) << "dropEvent" << event; Interface *iface = qobject_cast<Interface*>(m_part); if (iface->isBusy()) { return; } if ((event->source() == NULL) && (isValidArchiveDrag(event->mimeData()))) { event->acceptProposedAction(); } //TODO: if this call provokes a message box the drag will still be going //while the box is onscreen. looks buggy, do something about it openUrl(event->mimeData()->urls().at(0)); }
Animatable *AppDataTest::PickAnim() { TrackViewPick pick; if (ip->TrackViewPickDlg(hPanel,&pick)) { return pick.anim; } else { return NULL; } }
int main() { Interface* userInterface = new Interface(); string input = ""; cout << "Welcome to Budget Tracker." << endl; do { cout << "******************************************" << endl; cout << "Please select one of the options below." << endl; cout << "1. Add an item." << endl; cout << "2. Remove and item." << endl; cout << "3. Display all itmes." << endl; cout << "4. Save changes." << endl; cout << "Q. Quit." << endl; cout << "******************************************" << endl; cin >> input; cin.sync(); if (input == "1") { userInterface->add(); } else if (input == "2") { if (!userInterface->remove()) cout << "No item was removed." << endl; } else if (input == "3") { userInterface->displayAll(); } else if (input == "4") { userInterface->save(); cout << "<<saved>>" << endl; } } while (input != "Q"); return 0; }
/* * looks for objects with address 0.0.0.0 and aborts compilation if * finds such object */ bool PolicyCompiler::checkForZeroAddr::processNext() { PolicyRule *rule=getNext(); if (rule==NULL) return false; Address *a=NULL; a = findHostWithNoInterfaces( rule->getSrc() ); if (a==NULL) a = findHostWithNoInterfaces( rule->getDst() ); if (a!=NULL) compiler->abort( rule, "Object '"+a->getName()+ "' has no interfaces, therefore it does not have " "address and can not be used in the rule."); a = findZeroAddress( rule->getSrc() ); if (a==NULL) a = findZeroAddress( rule->getDst() ); if (a!=NULL) { string err="Object '"+a->getName()+"'"; if (IPv4::cast(a)!=NULL) // || IPv6::cast(a)!=NULL { FWObject *p=a->getParent(); Interface *iface = Interface::cast(p); if (iface!=NULL) { err+=" (an address of interface "; if (iface->getLabel()!="") err+=iface->getLabel(); else err+=iface->getName(); err+=" )"; } } err += " has address or netmask 0.0.0.0, which is equivalent to 'any'. " "This is likely an error."; compiler->abort(rule, err); } tmp_queue.push_back(rule); return true; }
static void GetSceneLights(Tab<INode*> & lights) { Interface *ip = GetCOREInterface(); TimeValue t = ip->GetTime(); INode * Root = ip->GetRootNode(); int Count = Root->NumberOfChildren(); int i=0; for( i=0; i < Count; i++) { INode * node = Root->GetChildNode(i); ObjectState Os = node->EvalWorldState(t); if(Os.obj && Os.obj->SuperClassID() == LIGHT_CLASS_ID) { lights.Append(1, &node); } } }
void InitializeLibSettings() { Interface *gi = GetCOREInterface(); TCHAR iniName[MAX_PATH]; if (gi) { LPCTSTR pluginDir = gi->GetDir(APP_PLUGCFG_DIR); PathCombine(iniName, pluginDir, "MaxNifTools.ini"); } else { GetModuleFileName(NULL, iniName, _countof(iniName)); if (LPTSTR fname = PathFindFileName(iniName)) fname = NULL; PathAddBackslash(iniName); PathAppend(iniName, "plugcfg"); PathAppend(iniName, "MaxNifTools.ini"); } libVersion = GetIniValue("MaxNifExport", "MaxSDKVersion", libVersion, iniName); if (libVersion == 0) libVersion = VERSION_3DSMAX; }
Interface* get_interface(net_domain* domain, uint32 index) { RecursiveLocker locker(sLock); Interface* interface; if (index == 0) interface = sInterfaces.First(); else interface = find_interface(index); if (interface == NULL || interface->IsBusy()) return NULL; if (interface->CreateDomainDatalinkIfNeeded(domain) != B_OK) return NULL; interface->AcquireReference(); return interface; }
ErrorCode leaf( EntityHandle node ) { OrientedBox box; ErrorCode rval = mTool->box( node, box ); if (MB_SUCCESS !=rval) return rval; EntityHandle h; rval = box.make_hex( h, mOut ); if (MB_SUCCESS !=rval) return rval; int i = hash_handle( node ); return mOut->tag_set_data( mTag, &h, 1, &i ); }
// On error sets m_failed, m_error_message and returns false bool require_module(const ss_ &name, bool optional, const ss_ &log_extra_info = "") { if(m_required_modules.count(name)) return true; log_d(MODULE, "require_module(): New requirement: \"%s\"", cs(name)); interface::ModuleInfo *info = m_loader->get_module_info(name); if(info == nullptr){ if(optional){ log_d(MODULE, "require_module(): " "Optional module info not found: \"%s\"", cs(name)); return true; } return set_error(ss_()+"Couldn't get module info for \""+name+"\""+ (log_extra_info == "" ? "" : ss_()+" ("+log_extra_info+")")); } m_required_modules.insert(name); // Require dependencies for(auto &dep : info->meta.dependencies){ log_d(MODULE, "require_module(): [\"%s\" depends on \"%s\"]", cs(name), cs(dep.module)); if(!require_module(dep.module, dep.optional, ss_()+"required by \""+name+"\"")) return false; } // Handle reverse dependencies for(auto &dep : info->meta.reverse_dependencies){ log_d(MODULE, "require_module(): [\"%s\" depends on \"%s\"]" " (defined in reverse)", cs(dep.module), cs(name)); // Warn about deficiency in implementation if(m_promised_modules.count(dep.module)){ log_w(MODULE, "%s: Reverse dependency %s ignored (already " "marked to be loaded)", cs(name), cs(dep.module)); continue; // Adding the dependency would have no effect } // Store dependency information interface::ModuleDependency forward_dep; forward_dep = dep; // Base dependency on reverted one forward_dep.module = name; // The other module depends now on this // dep.module is the other module which should depeend on this one m_reverse_dependencies[dep.module].push_back(forward_dep); if(!require_module(dep.module, dep.optional, ss_()+"required by \""+name+"\" as a reverse dependency")) return false; } return true; }
int Building_collision_exp::DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts, DWORD options) { //TODO: Implement the actual file Export here and // return TRUE If the file is exported properly //if(!suppressPrompts) // DialogBoxParam(hInstance, // MAKEINTRESOURCE(IDD_PANEL), // GetActiveWindow(), // Building_collision_expOptionsDlgProc, (LPARAM)this);// m_bIsExport = false; ip = i; int numChildren = ip->GetRootNode()->NumberOfChildren(); if(0 == numChildren) { MessageBox(NULL, "3dmax中没有物体!", "警告!", MB_OK); return TRUE; } for(int i = 0; i < numChildren; i++) { if(ExportOneMesh(ip->GetRootNode()->GetChildNode(i), &m_MeshDataBuf)) { break; } } if(m_bIsExport) { WriteDataToFile(name); } if(!m_bIsExport) { MessageBox(NULL, "没有选择一个行走面!", "警告!", MB_OK); return TRUE; } MessageBox(NULL, "导出完毕!", "提示!", MB_OK); return TRUE; }
void compare_tags( const char* name, Interface& mb1, Interface& mb2 ) { ErrorCode rval; Tag tag1, tag2; rval = mb1.tag_get_handle( name, 0, MB_TYPE_OPAQUE, tag1, MB_TAG_ANY ); CHECK_ERR(rval); rval = mb2.tag_get_handle( name, 0, MB_TYPE_OPAQUE, tag2, MB_TAG_ANY ); CHECK_ERR(rval); int size; CHECK_EQUAL( MB_VARIABLE_DATA_LENGTH, mb1.tag_get_length( tag1, size ) ); CHECK_EQUAL( MB_VARIABLE_DATA_LENGTH, mb2.tag_get_length( tag2, size ) ); TagType storage1, storage2; rval = mb1.tag_get_type( tag1, storage1 ); CHECK_ERR(rval); rval = mb2.tag_get_type( tag2, storage2 ); CHECK_ERR(rval); CHECK_EQUAL( storage1, storage2 ); DataType type1, type2; rval = mb1.tag_get_data_type( tag1, type1 ); CHECK_ERR(rval); rval = mb2.tag_get_data_type( tag2, type2 ); CHECK_ERR(rval); const void *defval1, *defval2; int defsize1, defsize2; ErrorCode rval1 = mb1.tag_get_default_value( tag1, defval1, defsize1 ); ErrorCode rval2 = mb2.tag_get_default_value( tag2, defval2, defsize2 ); if (MB_SUCCESS == rval1) { CHECK_ERR(rval2); CHECK_EQUAL( defsize1, defsize2 ); CHECK( !memcmp( defval1, defval2, defsize1 ) ); } else if (MB_ENTITY_NOT_FOUND == rval1 || MB_TAG_NOT_FOUND == rval1) CHECK_EQUAL( rval1, rval2 ); else CHECK_ERR( rval1 ); }
void UMaxFind::BeginEditParams(Interface *ip,IUtil *iu) { this->iu = iu; this->ip = ip; hPanel = ip->AddRollupPage( hInstance, MAKEINTRESOURCE(IDD_PANEL), UMaxFindDlgProc, GetString(IDS_TITLE), 0); }
void maxniftools::BeginEditParams(Interface* ip,IUtil* iu) { this->iu = iu; this->ip = ip; hPanel = ip->AddRollupPage( hInstance, MAKEINTRESOURCE(IDD_PANEL), DlgProc, GetString(IDS_PARAMS), 0); }
void PolicyCompiler_ipf::specialCaseWithDynInterface::dropDynamicInterface(RuleElement *re) { list<FWObject*> cl; for (list<FWObject*>::iterator i1=re->begin(); i1!=re->end(); ++i1) { FWObject *o = *i1; FWObject *obj = o; if (FWReference::cast(o)!=NULL) obj=FWReference::cast(o)->getPointer(); Interface *ifs =Interface::cast( obj ); if (ifs!=NULL && !ifs->isRegular()) continue; cl.push_back(obj); } if (!cl.empty()) { re->clearChildren(); for (list<FWObject*>::iterator i1=cl.begin(); i1!=cl.end(); ++i1) re->addRef( (*i1) ); } }
~MainMenu() { _net->detachScene(this); _net = NULL; _core->resetReceiver(); _core = NULL; _interface->resetInterface(); _interface = NULL; }
~NameSelection() { _net->detachScene(this); _net = NULL; _core->resetReceiver(); _core = NULL; _interface->resetInterface(); _interface = NULL; }