void PropertyTreeViewer::tabChanged(int _newNum) { QWidget* w = m_ui->tabWidget->widget(_newNum); if(!w) return; if(!isServiceTab(m_currentTab) && !isNormalised()) saveValuesFromUi(); if(w == m_ui->average) { displayValuesForArithmeticalMean(); w->layout()->addWidget(m_treePropertyWidget); m_currentTab = _newNum; } else if(w == m_ui->add) { addTab(); return; } else if(w == m_ui->import) { import(); return; } else { m_treePropertyWidget->setValues(m_values[_newNum]); m_currentTab = _newNum; } setActiveTab(w); normalise(isNormalised()); }
void ImportSelectionDlg::on_button_import_variables(wxCommandEvent &event) { int count_user = list_ctrl_env_vars_user_->GetSelectedItemCount(); int count_system = list_ctrl_env_vars_system_->GetSelectedItemCount(); if (count_user + count_system == 0) { wxMessageBox("Nothing to import.\n\n" "You must select variables to import.", "Importing environment variables", wxOK | wxICON_WARNING); return; } if (count_user) { import(list_ctrl_env_vars_user_, env_vars_user_); } if (count_system) { import(list_ctrl_env_vars_system_, env_vars_system_); } this->Destroy(); }
Pulsar::PhaseVsPlot::Interface::Interface (PhaseVsPlot* instance) { if (instance) set_instance (instance); // import the interface of the base class import( PhasePlot::Interface() ); add( &PhaseVsPlot::get_rows, &PhaseVsPlot::set_rows, "rows", "Select rows to be plotted"); import( "z", PlotScale::Interface(), &PhaseVsPlot::get_z_scale ); add( &PhaseVsPlot::get_style, &PhaseVsPlot::set_style, "style", "Plot style: image or line"); add( &PhaseVsPlot::get_crop, &PhaseVsPlot::set_crop, "crop", "Crop the data at this percentage of max" ); import("cmap", pgplot::ColourMap::Interface(), &PhaseVsPlot::get_colour_map); }
int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow ) { import( rb_core ); import( rb_ui ); import( rb_extui ); JCore* pCore = new JCore(); pCore->Init(); UnitTest::RunAllTests(); return 0; }
inline XERCES_CPP_NAMESPACE::DOMNode& import( XERCES_CPP_NAMESPACE::DOMDocument& document, const XERCES_CPP_NAMESPACE::DOMNode& from, XERCES_CPP_NAMESPACE::DOMNode& to ) { if( from.getNodeType() == XERCES_CPP_NAMESPACE::DOMNode::DOCUMENT_NODE ) { if( from.getFirstChild() ) import( document, *from.getFirstChild(), to ); return document; } XERCES_CPP_NAMESPACE::DOMNode& added = detail::clone( document, from, to ); import( document, from.getFirstChild(), added ); return added; }
int main(int argc, char const *argv[]) { if(argc != 2){ printf("Useage: %s inputfile.txt\n",argv[0]); exit(-1); } input_file =fopen(argv[1],"r"); output_file =fopen("simulation.txt","w"); import(input_file); ini_context(); int i; for(i=1;i<32;i++){ clone(); fetch_decode(i); issue(); alu1(); alu2(); memory(); wb(); cout_state(i,output_file); } return 0; }
void UmlAccessVariableValueAction::import_it(FileIn & in, Token & token) { WrapperStr s = token.valueOf("variable"); if (! s.isEmpty()) setVariable(s); if (! token.closed()) { WrapperStr k = token.what(); const char * kstr = k; while (in.read(), !token.close(kstr)) { s = token.what(); if (s == "variable") { setVariable(token.xmiIdref()); if (! token.closed()) in.finish("variable"); } else import(in, token); } } }
void FitsKernel::setupSelfBefore() { ConvolutionKernel::setupSelfBefore(); // Import the kernel import(this, _filename); }
Pulsar::MultiPhase::Interface::Interface (MultiPhase* instance) { if (instance) set_instance (instance); import( "x", PhaseScale::Interface(), &MultiPhase::get_scale ); }
struct jstruct_result _jstruct_import(struct json_object *obj, const void *data, const struct jstruct_object_property *properties, struct json_object *errors) { _init_importers(); if (errors != NULL && json_object_get_type(errors) != json_type_array) { return jstruct_error_new(jstruct_error_errors_not_array_or_null, NULL, json_object_get_type(errors)); } const struct jstruct_object_property *property; struct json_object *prop; struct jstruct_result result = JSTRUCT_OK; result.allocated = array_list_new(jstruct_allocated_free); for (property = properties; property->name; ++property) { void *ptr = jstruct_prop_ptr(data, property, JSTRUCT_PROP_PTR_GET_NO_DEREF); struct jstruct_result err; if (json_object_object_get_ex(obj, property->name, &prop)) { if (json_object_get_type(prop) != property->type.json) { err = jstruct_error_new(jstruct_error_incorrect_type, property->name, json_object_get_type(prop)); } else { jstruct_import_importer import = importers[json_type_index(property->type.json)]; err = import(prop, data, ptr, property); } } else { if (!set_null(ptr, property)) { err = jstruct_error_array_add(errors, jstruct_error_not_nullable, property->name, 0); } } jstruct_error_consume(&result, &err, errors, property->name, -1); } if (result.allocated->length == 0) { array_list_free(result.allocated); result.allocated = NULL; } return result; }
// Parses a multi-import statement. void parse_multi_import(Parser *parser) { Lexer *lexer = parser->lexer; // Ensure there's at least one string within the // parentheses EXPECT(TOKEN_STRING, "Expected package name after `(`"); // Expect a comma separated list of strings while (lexer->token == TOKEN_STRING) { // Import the package char *name = lexer_extract_string(lexer->value.identifier); import(parser, name); // Consume the string lexer_next(lexer); // Expect a comma EXPECT(TOKEN_COMMA, "Expected `,` after package name"); lexer_next(lexer); } // Expect a close parenthesis EXPECT(TOKEN_CLOSE_PARENTHESIS, "Expected `)` to close import list"); lexer_next(lexer); }
void VoxelImporter::import() { switch (_importDialog.getMode()) { case loadingMode: _importDialog.setMode(placeMode); return; case placeMode: // Means the user chose to import _didImport = true; _importDialog.close(); return; case importMode: default: QString filename = _importDialog.getCurrentFile(); // if it's not a file, we ignore the call if (!QFileInfo(filename).isFile()) { return; } // Let's prepare the dialog window for import _importDialog.setMode(loadingMode); // If not already done, we switch to the local tree if (Application::getInstance()->getSharedVoxelSystem()->getTree() != &_voxelTree) { Application::getInstance()->getSharedVoxelSystem()->changeTree(&_voxelTree); } // Creation and launch of the import task on the thread pool _task = new ImportTask(filename); connect(_task, SIGNAL(destroyed()), SLOT(import())); QThreadPool::globalInstance()->start(_task); break; } }
bool TSShapeImport::import(const char* file,ITRGeometry* geometry) { TSInit(); TSShape* shape = TSShape::load(file); AssertFatal(shape != 0,"TSShapeImport::import: Could not load shape file"); return import(shape,geometry); }
bool loadBulletFile(std::string name, btBvhTriangleMeshShape*& trimeshShape) { btBulletWorldImporter import(0);//don't store info into the world // import.setVerboseMode(0xFF); if (import.loadFile(name.c_str())) { int numBvh = import.getNumBvhs(); int numBRB = import.getNumRigidBodies(); //if (numBvh) //{ // btOptimizedBvh* bvh = import.getBvhByIndex(0); // btVector3 aabbMin(-1000,-1000,-1000),aabbMax(1000,1000,1000); // trimeshShape = new btBvhTriangleMeshShape(m_indexVertexArrays,useQuantizedAabbCompression,aabbMin,aabbMax,false); // trimeshShape->setOptimizedBvh(bvh); //} //btCompoundShape* cs; int numShape = import.getNumCollisionShapes(); if (numShape) { //trimeshShape = (btBvhTriangleMeshShape*)import.getCollisionShapeByIndex(0); ////if you know the name, you can also try to get the shape by name: //const char* meshName = import.getNameForPointer(trimeshShape); //if (meshName) trimeshShape = (btBvhTriangleMeshShape*)import.getCollisionShapeByName("lod3"); } return true; } return false; }
bool PGNImporter::importFromFile(const QString& fileName) { pgn::GameCollection games; std::ifstream pgnfile(fileName.toStdString().c_str()); std::cout << "\"" << fileName.toStdString() << "\"" << std::endl; std::cout << "Called: " << pgnfile.is_open() << std::endl; emit onProgress(1); try { pgnfile >> games; } catch(pgn::ParseException& ex) { std::clog << "Parse error: " << ex.what() << std::endl; QMessageBox msg; msg.setIcon(QMessageBox::Critical); msg.setText(QString("Parse error: \"%1\" - document can not be imported").arg(ex.what())); msg.exec(); return false; } return import(games); }
void reFBXAsset::load() { clearChildren(); bool importNeeded = true; ifstream ifs(metaPath().toStdString().c_str(), ios::in); if (!ifs.fail()) { Json::Reader reader; Json::Value root; reader.parse(ifs, root); QString hash = root["hash"].asString().c_str(); if (fileHash() == hash) { loadJson(root); importNeeded = false; } } if (importNeeded) import(); loadNodeAssets(); Json::StyledWriter writer; ofstream fs(metaPath().toStdString().c_str(), ios::out); fs << writer.write(getJson()); fs.close(); }
Pulsar::StokesFluctPlot::Interface::Interface (StokesFluctPlot* instance) { if (instance) set_instance (instance); import ( FluctPlot::Interface() ); remove ("pol"); add( &StokesFluctPlot::get_plot_last_harmonic, &StokesFluctPlot::set_plot_last_harmonic, "last", "Plot the last harmonic marker" ); add( &StokesFluctPlot::get_plot_values, &StokesFluctPlot::set_plot_values, "val", "Values to be plotted (IQUVLpS)" ); add( &StokesFluctPlot::get_plot_colours, &StokesFluctPlot::set_plot_colours, "sci", "PGPLOT colour index for each value" ); add( &StokesFluctPlot::get_plot_lines, &StokesFluctPlot::set_plot_lines, "sls", "PGPLOT line style for each value" ); }
void testExecute(const char *source, bool verbose){ LOG("testExecuteSecond", "begin"); Context *globalContext = context_new(); context_enterScope(globalContext); LOG("testExecuteSecond", "filling op table"); fillOpTable(globalContext); LOG("testExecuteSecond", "loading extensions"); int ext_num = loadExtensions(EXT_LOCATION, globalContext); printf("Loaded %d extensions\n", ext_num); LOG("testExecuteSecond", "op table filled"); import(globalContext, "stl.x"); TokenStream ts; LOG("testExecuteSecond", "starting fill token stream"); fillTokenStream(&ts, source); LOG("testExecuteSecond", "token stream filled"); while(!isEndOfStream(&ts)){ LOG("testExecuteSecond", "calling parse"); Node head = parse(&ts, 0); LOG("testExecuteSecond", "returning form parse"); LOG("TestExecuteSecond", "calling execute"); if(verbose) printTree(head, 0); LOG("testExecuteSecond", "calling execute"); ObjectNode *node = execute(globalContext, &head); if(verbose){ printf("res>"); printObjectNode(node); printf("\n"); } } // closeExtensions(lib_handle, ext_num); context_leaveScope(globalContext); }
void REPL(bool verbose){ Context *globalContext = context_new(); context_enterScope(globalContext); fillOpTable(globalContext); int ext_num = loadExtensions(EXT_LOCATION, globalContext); printf("Loaded %d extensions\n", ext_num); import(globalContext, "stl.x"); int n_bytes = 100; char *source = malloc(n_bytes + 1); for(int i = 0;i < n_bytes + 1;i++) source[i] = 0; while (1){ getline(&source, &n_bytes, stdin); //printf("%s\n", source); TokenStream ts; fillTokenStream(&ts, source); while(!isEndOfStream(&ts)){ Node head = parse(&ts, 0); if(verbose) printTree(head, 0); ObjectNode *node = execute(globalContext, &head); printf("res>"); printObjectNode(node); printf("\n"); } } // closeExtensions(lib_handle, ext_num); context_leaveScope(globalContext); }
bool TSShapeImport::import(TSShape* shape,ITRGeometry* geometry) { // printf("TSShape Import\n"); // VectorPtr<TSPartList*> partStack; partStack.push_back(dynamic_cast<TSPartList*>(shape)); while (!partStack.empty()) { TSPartList& partList = *partStack.last(); partStack.decrement(); for (int i = 0; i < partList.getPartCount(); i++) if (TSPartList *pl = dynamic_cast<TSPartList*>(partList[i])) partStack.push_back(pl); else if (TSMesh* pm = dynamic_cast<TSMesh*>(partList[i])) { if (!import(pm,shape->getMaterialList(),geometry)) return false; } } printf(" Vertices: %d\n",geometry->point3List.size()); printf(" Surfaces: %d\n",geometry->surfaceList.size()); printf(" Polygons: %d\n",geometry->polyList.size()); printf(" Planes: %d\n",geometry->planeList.size()); return true; }
ImportDialog::ImportDialog(QWidget *parent) : QFileDialog(parent, WINDOW_NAME, DESKTOP_LOCATION, IMPORT_FILE_TYPES), _importButton (IMPORT_BUTTON_NAME, this), _clipboardImportBox(IMPORT_TO_CLIPBOARD_CHECKBOX_STRING, this), _previewBox (PREVIEW_CHECKBOX_STRING, this), _previewBar (this), _glPreview (new GLWidget(this)) { setOption(QFileDialog::DontUseNativeDialog, true); setFileMode(QFileDialog::ExistingFile); setViewMode(QFileDialog::Detail); QGridLayout* gridLayout = (QGridLayout*) layout(); gridLayout->addWidget(&_importButton , 2, 2); gridLayout->addWidget(&_clipboardImportBox, 2, 3); gridLayout->addWidget(&_previewBox , 3, 3); gridLayout->addWidget(&_previewBar , 0, 3); gridLayout->addWidget(_glPreview , 1, 3); gridLayout->setColumnStretch(3, 1); _previewBar.setVisible(false); _previewBar.setRange(0, 100); _previewBar.setValue(0); connect(&_importButton, SIGNAL(pressed()), SLOT(import())); connect(&_previewBox, SIGNAL(toggled(bool)), SIGNAL(previewToggled(bool))); connect(&_previewBox, SIGNAL(toggled(bool)), SLOT(preview(bool))); connect(this, SIGNAL(currentChanged(QString)), SLOT(saveCurrentFile(QString))); connect(&_glTimer, SIGNAL(timeout()), SLOT(timer())); }
void CImportDlg::import() { for(size_t i = 0; i < m_files.size(); i++) { import(m_files[i].c_str()); } }
FXint GMSyncTask::run() { FXASSERT(database); try { dbtracks.init(database,options.album_format_grouping); setID3v1Encoding(); if (options_sync.remove_all) { remove_missing(); } else if (options_sync.import_new) { if (options_sync.update) import_and_update(); else import(); if (options_sync.remove_missing) remove_missing(); } else if (options_sync.update) { update(); } else if (options_sync.remove_missing) { remove_missing(); } GMTag::setID3v1Encoding(nullptr); } catch(GMDatabaseException&) { database->rollbackTask(); return 1; } return 0; }
Pulsar::StokesPlot::Interface::Interface (StokesPlot* instance) { if (instance) set_instance (instance); import ( FluxPlot::Interface() ); remove ("pol"); add( &StokesPlot::get_plot_values, &StokesPlot::set_plot_values, "val", "Values to be plotted (IQUVLp)" ); add( &StokesPlot::get_plot_colours, &StokesPlot::set_plot_colours, "ci", "PGPLOT colour index for each value" ); add( &StokesPlot::get_plot_lines, &StokesPlot::set_plot_lines, "ls", "PGPLOT line style for each value" ); add( &StokesPlot::get_plot_widths, &StokesPlot::set_plot_widths, "lw", "PGPLOT line width for each value" ); add( &StokesPlot::get_pav_bias, &StokesPlot::set_pav_bias, "pav", "Handle bias as done in pav" ); }
int rt_obj_import(struct rt_db_internal *ip, const struct bu_external *ep, const mat_t mat, const struct db_i *dbip, struct resource *resp) { int id; const struct rt_functab *ft; int (*import)(struct rt_db_internal *, const struct bu_external *, const mat_t, const struct db_i *, struct resource *); if (!ip || !ep || !dbip) return -1; RT_CK_DB_INTERNAL(ip); BU_CK_EXTERNAL(ep); RT_CK_DBI(dbip); if (resp) RT_CK_RESOURCE(resp); id = ip->idb_minor_type; if (id < 0) return -2; ft = &OBJ[id]; if (!ft) return -3; if (dbip->dbi_version < 5) { import = ft->ft_import4; } else { import = ft->ft_import5; } if (!import) return -4; return import(ip, ep, mat, dbip, resp); }
// --------------------------------------------------------------------------- // // ------------ bool bXMapMMTImport::process(int msg, void* prm){ switch(msg){ case kExtProcessCallFromIntf: import(); break; case kExtProcessCallWithParams: import((import_prm*)prm); break; case kExtProcessCallWithXMLTree: import(true); break; default: break; } return(true); }
void Map::loadPrefabAt(const Vector3& targetCoords) { std::string filename = MapFileManager::getMapFilename(true, _("Load Prefab"), "prefab"); if (!filename.empty()) { UndoableCommand undo("loadPrefabAt"); // Deselect everything GlobalSelectionSystem().setSelectedAll(false); // Now import the prefab (imported items get selected) import(filename); // Switch texture lock on bool prevTexLockState = GlobalBrush().textureLockEnabled(); GlobalBrush().setTextureLock(true); // Translate the selection to the given point GlobalSelectionSystem().translateSelected(targetCoords); // Revert to previous state GlobalBrush().setTextureLock(prevTexLockState); } }
std::string writeTag( const std::string& tag, const std::string& label, persistency::Session& session, std::string tmpDir ){ session.transaction().start(); persistency::IOVProxy p = session.readIov( tag, true ); std::cout <<" "<<p.loadedSize()<<" iovs loaded."<<std::endl; std::string destFile = label+".db"; boost::filesystem::path destFilePath( destFile ); if( !tmpDir.empty() ) { destFilePath = boost::filesystem::path( tmpDir ) / destFilePath; } destFile = destFilePath.string(); persistency::ConnectionPool localPool; persistency::Session writeSession = localPool.createSession( "sqlite_file:"+destFile, true ); writeSession.transaction().start( false ); persistency::IOVEditor writeEditor = writeSession.createIov( p.payloadObjectType(), tag, p.timeType(), p.synchronizationType() ); writeEditor.setValidationMode(); writeEditor.setDescription("Validation"); for( auto iov : p ){ std::pair<std::string,boost::shared_ptr<void> > readBackPayload = fetch( iov.payloadId, session ); cond::Hash ph = import( session, iov.payloadId, readBackPayload.first, readBackPayload.second.get(), writeSession ); writeEditor.insert( iov.since, ph ); } writeEditor.flush(); writeSession.transaction().commit(); session.transaction().commit(); return destFile; }
medPacsWidget::medPacsWidget(QWidget *parent) : QTreeWidget(parent), d(new medPacsWidgetPrivate) { this->setFrameStyle(QFrame::NoFrame); this->setAttribute(Qt::WA_MacShowFocusRect, false); this->setUniformRowHeights(true); this->setAlternatingRowColors(true); this->setSortingEnabled(true); this->setContextMenuPolicy(Qt::CustomContextMenu); this->setSelectionMode(QAbstractItemView::ExtendedSelection); this->setHeaderLabels(QStringList() << "Name" << "Description" << "Id" << "Modality"); d->find = NULL; d->echo = NULL; d->server = medAbstractPacsFactory::instance()->createStoreScp("dcmtkStoreScp"); if (!d->server) { qWarning() << "Unable to find a valid implementation of the store scp service."; return; } connect(this, SIGNAL(itemExpanded(QTreeWidgetItem *)), this, SLOT(onItemExpanded(QTreeWidgetItem *))); connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(updateContextMenu(const QPoint&))); connect(this->d->server, SIGNAL(endOfStudy(QString)), this, SIGNAL(import(QString))); this->readSettings(); d->start(); d->selectedNodes = d->nodes; }
ImportDialog::ImportDialog(QWidget* parent) : QFileDialog(parent, WINDOW_NAME, DESKTOP_LOCATION, NULL), _importButton(IMPORT_BUTTON_NAME, this), _cancelButton(CANCEL_BUTTON_NAME, this), fileAccepted(false) { setOption(QFileDialog::DontUseNativeDialog, true); setFileMode(QFileDialog::ExistingFile); setViewMode(QFileDialog::Detail); #ifdef Q_OS_MAC QString cmdString = ("Command"); #else QString cmdString = ("Control"); #endif QLabel* infoLabel = new QLabel(QString(INFO_LABEL_TEXT).arg(cmdString)); infoLabel->setObjectName("infoLabel"); QGridLayout* gridLayout = (QGridLayout*) layout(); gridLayout->addWidget(infoLabel, 2, 0, 2, 1); gridLayout->addWidget(&_cancelButton, 2, 1, 2, 1); gridLayout->addWidget(&_importButton, 2, 2, 2, 1); setImportTypes(); setLayout(); connect(&_importButton, SIGNAL(pressed()), SLOT(import())); connect(this, SIGNAL(currentChanged(QString)), SLOT(saveCurrentFile(QString))); connect(&_cancelButton, SIGNAL(pressed()), SLOT(close())); connect(this, SIGNAL(currentChanged(QString)), SLOT(saveCurrentFile(QString))); }