void VHDDExplorer::OnExport(wxCommandEvent& event) { if(m_list->GetSelectedItemCount() > 1) { wxDirDialog ctrl(this, "Select export folder", wxGetCwd()); if(ctrl.ShowModal() == wxID_CANCEL) { return; } for(int sel = m_list->GetNextSelected(-1); sel != wxNOT_FOUND; sel = m_list->GetNextSelected(sel)) { Export(m_names[sel], fmt::ToUTF8(ctrl.GetPath()) + '\\' + m_names[sel]); } } else { int sel = m_list->GetFirstSelected(); wxFileDialog ctrl(this, "Select export file", wxEmptyString, fmt::FromUTF8(m_names[sel]), wxFileSelectorDefaultWildcardStr, wxFD_SAVE | wxFD_OVERWRITE_PROMPT); if(ctrl.ShowModal() == wxID_CANCEL) { return; } Export(m_names[sel], fmt::ToUTF8(ctrl.GetPath())); } UpdateList(); }
/** * @brief Compute valid MSER regions from a given region * @param delta distance (in level) to the other region to compute stability (stability is not made up to delta level) * @param minimumArea Minimum area to be accepted as stable * @param maximumArea Maximum area to be accepted as stable * @param maxVariation Maximum variation (difference between parent area and region area) to be accepted as stable * @param minDiversity Minimum diversity to validate the region * @param[out] regions Region that validate the criterion */ void MSERRegion::ComputeMSER( const int delta , const int minArea , const int maxArea , const double maxVariation , const double minDiversity , std::vector< MSERRegion > & regions ) { // Compute MSER stability stats on all the hierarchy ComputeStability( delta , minArea , maxArea , maxVariation ); // Export regions that pass all MSER stability checks (region and it's direct hierarchy) Export( minDiversity , regions ); }
BOOL CFileIdCreator::Export(LPCSTR lpszExport) { FILE* fpOut = NULL; fopen_s(&fpOut, lpszExport, "wt"); VRETURN(fpOut != NULL); m_bIsEnum = FALSE; UINT nRootKey = izanagi::CKey::GenerateValue(m_strRoot); std::map<UINT, SIdInfo>::const_iterator it = m_InfoList.find(nRootKey); IZ_ASSERT(it != m_InfoList.end()); const SIdInfo& sRootInfo = it->second; BOOL ret = Export( fpOut, sRootInfo, 0); IZ_ASSERT(ret); fclose(fpOut); return ret; }
void Mapper::LoadInputMappings(const std::string &file) { if (boost::filesystem::exists(file) == false) { InputModuleOIS::LogInfo("Input mappings file not found, using default mappings."); Export(file); } else { InputModuleOIS::LogInfo("Loading input mappings from file " + file + "..."); try { Poco::XML::InputSource source(file); Poco::XML::DOMParser parser; Poco::XML::AutoPtr<Poco::XML::Document> document = parser.parse(&source); if (!document.isNull()) { Poco::XML::Node* node = document->firstChild(); if (node) { LoadInputMappings(node); } } else { throw Exception("Failed to parse xml document."); } } catch (std::exception &e) { InputModuleOIS::LogInfo(e.what()); InputModuleOIS::LogInfo("Failed to parse input mappings file, using default mappings."); } } }
bool VLIFileManager::WriteConfigFile(const char *filename) { DataNode topLevel("topLevel"); // Create the color table node. DataNode *ctNode = new DataNode("VLIFile"); topLevel.AddNode(ctNode); ctNode->AddNode(new DataNode("Version", std::string(VISIT_VERSION))); // Let the vli file manager create and add its information to the node. ctNode->AddNode(Export()); // Try to open the output file. if((fp = fopen(filename, "wb")) == 0) { return false; } // Write the output file. fprintf(fp, "<?xml version=\"1.0\"?>\n"); WriteObject(ctNode); // Close the file fclose(fp); fp = 0; return true; }
bool CMountProg::ReadPathsFromFile(char* sFileName) { sFileName = FormatPath(sFileName, FORMAT_PATH); std::ifstream pathFile(sFileName); if (pathFile.is_open()) { std::string line; while (std::getline(pathFile, line)) { char *pCurPath = (char*)malloc(line.size() + 1); pCurPath = (char*)line.c_str(); if (pCurPath != NULL) { char curPathAlias[MAXPATHLEN]; strcpy_s(curPathAlias, pCurPath); char *pCurPathAlias = (char*)malloc(strlen(curPathAlias)); pCurPathAlias = curPathAlias; Export(pCurPath, pCurPathAlias); } } } else { printf("Can't open file %s.\n", sFileName); return false; } return true; }
void Compiler::EmitFunction(FunctionSymbol p) { BBlock bb; int varsize; Export((Symbol)p); DefineLabel((Symbol)p); LayoutFrame(p, 2); /* pushl %ebp movl %esp, %ebp */ varsize = p->locals.size(); EmitPrologue(varsize); bb = p->entryBB; while (true) { if (bb->ref != 0) DefineLabel(bb->sym); EmitBBlock(bb); if (bb != p->exitBB) bb = bb->next; else break; } /* movl %sebp, %esp popl %ebp */ EmitEpilogue(varsize); }
void DefineGlobal(Symbol p) { Align(p); if (p->sclass != TK_STATIC) { Export(p); } Print("%s:\t", GetAccessName(p)); }
void CStorageDoc::OnToolsBuildNewnoiseremoveproc8 () { /* uint nCount; POSITION pos; CFile fImport; CFileDialog dlgOpen (true); dlgOpen.m_ofn.lpstrInitialDir = "."; dlgOpen.m_ofn.lpstrFilter = "DIAS Images Storages (*.dis)""\0""*.DIS""\0""\0"; dlgOpen.m_ofn.nFilterIndex = 1; dlgOpen.m_ofn.lpstrFile = new char[4096]; dlgOpen.m_ofn.nMaxFile = 4096; dlgOpen.m_ofn.Flags |= OFN_ALLOWMULTISELECT; if (dlgOpen.DoModal () != IDOK) return; for (nCount = 0, pos = dlgOpen.GetStartPosition (); pos != NULL; ++nCount) { CString file = dlgOpen.GetNextPathName (pos); theApp.Documents.Open ((uchar *)file.GetBuffer ()); CStorageDoc *pDoc = &(theApp.Documents[(uchar *)file.GetBuffer ()]);*/ CStorageDoc *pDoc = this; uvar32_64 cnt = pDoc->Images.GetCount () / 4; CString strText; theApp.MacroStart ("Remove Noise"); strText.Format ("0 images processed (0%%)"); if (pDoc->Images.GetCount () % 84 != 0) if (MessageBox (Frames[aimActive], "Image count does not proportional to 4!\nDo you wish to continue?", "Remove Noise", MB_ICONWARNING | MB_YESNO) == IDNO) return; for (svar32_64 n = 0; (pDoc->Images.GetCount () - n) / 8 > 0; n+=1) { pDoc->Images[n].Hvg (pDoc->Images[n + 1]); pDoc->Images[n + 2].Hvg (pDoc->Images[n + 3]); pDoc->Images[n].Hvg (Images[n + 2]); pDoc->Images[n].Median (1, 1); pDoc->Images.Delete (n + 1); pDoc->Images.Delete (n + 1); pDoc->Images.Delete (n + 1); pDoc->Images[n + 1].Hvg (pDoc->Images[n + 2]); pDoc->Images[n + 3].Hvg (pDoc->Images[n + 4]); pDoc->Images[n + 1].Hvg (Images[n + 3]); pDoc->Images[n + 1].Median (1, 1); pDoc->Images[n].Hvg (Images[n + 1]); pDoc->Images.Delete (n + 1); pDoc->Images.Delete (n + 1); pDoc->Images.Delete (n + 1); pDoc->Images.Delete (n + 1); strText.Format ("%d images processed (%d%%)", n, (n * 100)/cnt); theApp.StatusText (strText); } pDoc->Save (); Export (pDoc->GetPathName () + ".img", 1); // pDoc->Close (); // } theApp.MacroStop (); }
void Lua::Init() { m_lua_state = lua_open(); luabind::open(m_lua_state); luaopen_base(m_lua_state); luaopen_math(m_lua_state); Engine::RegisterInLua(m_lua_state); Export(); }
// 导出 void CListPage::OnClickedButton4() { CFileDialog dlg(FALSE, _T("xml"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("XML文件 (*.xml)|*.xml|TXT文件 (*.txt)|*.txt|所有文件 (*.*)|*.*||"), this); if (dlg.DoModal() == IDOK) { if (!Export(dlg.GetPathName())) AfxMessageBox(_T("保存失败!"), MB_ICONERROR); } }
void DataElement::WriteINIFile() { Export(); FILE *fp = fopen("master.ini","w"); if(fp) { fprintf(fp,"%s\n",filename); fclose(fp); } }
void CRecordPlayerDlg::OnExport() { CString filter(LPCTSTR(IDS_MIDI_FILE_FILTER)); CPathStr title; m_TitleText.GetWindowText(title); title.RemoveExtension(); CFileDialog fd(FALSE, MIDI_FILE_EXT, title, OFN_OVERWRITEPROMPT, filter); if (fd.DoModal() == IDOK) { Export(fd.GetPathName()); } }
bool Profile::SaveFile(const FileTransaction &transaction) { TextWriter writer(transaction.GetTemporaryPath()); // ... on error -> return if (!writer.IsOpen()) return false; KeyValueFileWriter kvwriter(writer); Export(kvwriter); return writer.Flush(); }
BOOL CXmlFile::BuildDOM(CXmlDocumentWrapper* pDoc) const { if (!pDoc || !pDoc->IsValid()) return FALSE; // Valik - Change IXMLDOMNode* to IXMLDOMNodePtr to prevent an ambiguous symbol error (C2872) in VC 7.1 MSXML2::IXMLDOMNodePtr pNode = pDoc->AsNode(); CXmlNodeWrapper node(pNode); BOOL bRes = Export(&m_xiRoot, &node); return bRes; }
void EDetail::Export(LPCSTR name) { CSurface* surf = *m_pRefs->FirstSurface(); R_ASSERT (surf); IWriter* F = FS.w_open(name); if (F){ Fvector2 offs = {0,0}; Fvector2 scale = {1,1}; Export (*F,surf->_Texture(),offs,scale,false); FS.w_close (F); }else{ Log ("!Can't export detail:",name); } }
BOOL CXmlFile::Export(const CXmlItem* pItem, CXmlNodeWrapper* pNode) const { // own value if (pItem->GetValueLen()) pNode->SetText(pItem->GetValue()); // attributes and items POSITION pos = pItem->GetFirstItemPos(); int nNode = 0; while (pos) { const CXmlItem* pXIChild = pItem->GetNextItem(pos); ASSERT (pXIChild); CString sItem = pXIChild->GetName(); if (pXIChild->IsAttribute()) { ASSERT (!pXIChild->GetSibling()); pNode->SetValue(sItem, pXIChild->GetValue()); } else if (pXIChild->IsCDATA()) { // create a named node to wrap the CDATA MSXML2::IXMLDOMNodePtr pChildNode = pNode->InsertNode(nNode++, (LPCTSTR)sItem); MSXML2::IXMLDOMCDATASectionPtr pCData = pNode->ParentDocument()->createCDATASection((LPCTSTR)pXIChild->GetValue()); pChildNode->appendChild(pCData); } else // node { while (pXIChild) { // Valik - Change IXMLDOMNode* to IXMLDOMNodePtr to prevent an ambiguous symbol error (C2872) in VC 7.1 MSXML2::IXMLDOMNodePtr pChildNode = pNode->InsertNode(nNode++, (LPCTSTR)sItem); CXmlNodeWrapper nodeChild(pChildNode); ASSERT (nodeChild.IsValid()); Export(pXIChild, &nodeChild); // siblings pXIChild = pXIChild->GetSibling(); } } } return TRUE; }
void MainWindow::connectActions() { ui->actionSave_XML_file->setVisible(true); ui->actionOpen_XML_file->setVisible(true); connect(ui->actionExit, SIGNAL(triggered()), qApp, SLOT(quit())); connect(ui->actionOpen_XML_file, SIGNAL(triggered()), this, SLOT(openTreeFromXML())); ui->actionOpen_XML_file->setShortcuts(QKeySequence::Open); ui->actionOpen_XML_file->setStatusTip(tr("Open a sketch from an XML file")); connect(ui->actionSave_XML_file, SIGNAL(triggered()), this, SLOT(saveTreeToXML())); ui->actionSave_XML_file->setShortcuts(QKeySequence::Save); ui->actionSave_XML_file->setStatusTip(tr("Save your current sketch to an XML file")); /*connect(ui->actionGenerate_output_for_XML_file, SIGNAL(triggered()), this, SLOT(generateFromXML())); ui->actionGenerate_output_for_XML_file->setStatusTip(tr("Generate rendered output for an XML file"));*/ connect(ui->actionDisplay_XML_file, SIGNAL(triggered()), this, SLOT(displayXMLFile())); ui->actionDisplay_XML_file->setStatusTip(tr("Display an XML file")); connect(ui->actionDisplay_LST_file, SIGNAL(triggered()), this, SLOT(displayLSTFile())); ui->actionDisplay_LST_file->setStatusTip(tr("Display an LST file")); connect(ui->actionGenerate_from_current, SIGNAL(triggered()), this, SLOT(generateFromCurrent())); ui->actionGenerate_from_current->setStatusTip(tr("Generate rendered output from the current sketch")); connect(ui->actionExport_Cylinder_Model_to_OBJ, SIGNAL(triggered()), this, SLOT(Export())); ui->actionExport_Cylinder_Model_to_OBJ->setStatusTip(tr("Export current view to OBJ file")); connect(ui->actionBlack_background, SIGNAL(triggered()), this, SLOT(blackBackground())); ui->actionBlack_background->setStatusTip(tr("Set tree display background to black")); connect(ui->actionWhite_background, SIGNAL(triggered()), this, SLOT(whiteBackground())); ui->actionWhite_background->setStatusTip(tr("Set tree display background to white")); connect(ui->actionUndo, SIGNAL(triggered()), this, SLOT(undoAction())); ui->actionUndo->setShortcuts(QKeySequence::Undo); ui->actionUndo->setStatusTip(tr("Undo your last action")); connect(ui->actionRedo, SIGNAL(triggered()), this, SLOT(redoAction())); ui->actionRedo->setShortcuts(QKeySequence::Redo); ui->actionRedo->setStatusTip(tr("Redo your last undone action")); }
void CXmlFile::Trace() const { #ifdef _DEBUG CString sXml; Export(sXml); // because the string might be long, output it in chunks of 255 chars int nPos = 0; while (nPos < sXml.GetLength()) { OutputDebugString(sXml.Mid(nPos, 255)); nPos += 255; } #endif }
void CStorageDoc::OnFileExport () { CFileDialog dlgSave (false); // #### TODO: Place here initial directory name taken from configuration structures dlgSave.m_ofn.lpstrInitialDir = "."; dlgSave.m_ofn.lpstrFilter = "Kontron Elektronik(C) VIDAS(R) Sequences""\0""*.IMG""\0"; dlgSave.m_ofn.nFilterIndex = 1; if (dlgSave.DoModal () != IDOK) return; // #### TODO: Add support for video formats // #### TODO: Add support for multi-page tif format // #### TODO: Create import dialog // #### TODO: Add progress control on the status bar Export (dlgSave.GetPathName () + ".img", dlgSave.m_ofn.nFilterIndex); }
void RDImportAudio::importData() { if(import_import_conv!=NULL) { import_import_conv->abort(); return; } if(import_export_conv!=NULL) { import_export_conv->abort(); return; } if(import_mode_group->selectedId()==0) { Import(); } else { Export(); } }
bool wxRegKey::Export(const wxString& filename) const { #if wxUSE_FFILE && wxUSE_STREAMS if ( wxFile::Exists(filename) ) { wxLogError(_("Exporting registry key: file \"%s\" already exists and won't be overwritten."), filename.c_str()); return false; } wxFFileOutputStream ostr(filename, wxT("w")); return ostr.IsOk() && Export(ostr); #else wxUnusedVar(filename); return false; #endif }
bool VLIFileManager::WriteConfigFile(std::ostream &out) { DataNode topLevel("topLevel"); // Create the color table node. DataNode *ctNode = new DataNode("VLIFile"); topLevel.AddNode(ctNode); ctNode->AddNode(new DataNode("Version", std::string(VISIT_VERSION))); // Let the vli file manager create and add its information to the node. ctNode->AddNode(Export()); // Write the output file. out << "<?xml version=\"1.0\"?>\n"; WriteObject(out, ctNode); return true; }
int main(int argc, char * argv[]) { clock_t startTime, endTime; startTime = clock(); Rule rules[NUM_RULES]; initRules(rules); Contradiction contradictions[NUM_CONTRADICTIONS]; initContradictions(contradictions); int selectedRules[NUM_RULES - NUM_CONST_RULES]; for (int i = 0; i < NUM_RULES - NUM_CONST_RULES; i++) { selectedRules[i] = i; } for (int i = 1; i < argc; i++) { char * filename = argv[i]; std::cout << "Puzzle: " << filename << std::endl; Grid grid; Import importer = Import(grid, filename); Export exporter = Export(grid); Solver solver = Solver(grid, rules, contradictions, selectedRules, NUM_RULES - NUM_CONST_RULES, 100); exporter.print(); if (grid.isSolved()) { std::cout << "Solved" << std::endl; } else { if (solver.testContradictions()) { std::cout << "Invalid puzzle" << std::endl; } else if (solver.hasMultipleSolutions()) { std::cout << "Puzzle has multiple solutions" << std::endl; } else { std::cout << "Not solved" << std::endl; } } } endTime = clock(); float diff = ((float)endTime - (float)startTime) / CLOCKS_PER_SEC; std::cout << "Total time:\t" << diff << " seconds" << std::endl; return EXIT_SUCCESS; }
void Mesh::Optimize2d(MeshingParameters& mp) { IndexBoundaryEdges(); const char* optstr = mp.optimize2d; int optsteps = mp.optsteps2d; MeshOptimize meshopt(*this); for (int i = 1; i <= optsteps; i++) { for (size_t j = 0; j < strlen(optstr); j++) { switch (optstr[j]) { case 's': { // topological swap meshopt.EdgeSwapping(false); mp.n_steps++; break; } case 'S': { // metric swap meshopt.EdgeSwapping(true, 0.0); mp.n_steps++; break; } case 'm': { meshopt.ImproveMesh(1.0); mp.n_steps++; break; } case 'c': { meshopt.CombineImprove(); mp.n_steps++; break; } case 'p': { // print mesh std::stringstream mesh_name; mesh_name << "mesh_debug_" << std::setfill('0') << std::setw(2) << mp.n_steps << ".msh"; Export(mesh_name.str()); break; } default: MESHIT_LOG_ERROR("Optimization code " << optstr[j] << " not defined"); } } } }
void Report::CreateBasicWidgets(QGridLayout *aLt) { QVBoxLayout *lt = new QVBoxLayout; QGroupBox *gb = new QGroupBox(tr("Параметры")); gb->setLayout(aLt); QHBoxLayout *lt1 = new QHBoxLayout; btnExport = new QPushButton(tr("Выгрузить")); lt1->addStretch(1); lt1->addWidget(btnExport); lt1->addStretch(0); connect(btnExport, SIGNAL(clicked()), this, SLOT(Export())); lt->addWidget(gb); lt->addLayout(lt1); setLayout(lt); }
int Epetra_FEVector::GlobalAssemble(Epetra_CombineMode mode, bool reuse_map_and_exporter) { //In this method we need to gather all the non-local (overlapping) data //that's been input on each processor, into the (probably) non-overlapping //distribution defined by the map that 'this' vector was constructed with. //We don't need to do anything if there's only one processor or if //ignoreNonLocalEntries_ is true. if (Map().Comm().NumProc() < 2 || ignoreNonLocalEntries_) { return(0); } if (nonlocalMap_ == 0 || !reuse_map_and_exporter) { createNonlocalMapAndExporter<int_type>(); } Epetra_MultiVector& nonlocalVector = *nonlocalVector_; nonlocalVector.PutScalar(0.0); int elemSize = Map().MaxElementSize(); for(int vi=0; vi<NumVectors(); ++vi) { for(size_t i=0; i<nonlocalIDs<int_type>().size(); ++i) { for(int j=0; j<nonlocalElementSize_[i]; ++j) { nonlocalVector.ReplaceGlobalValue(nonlocalIDs<int_type>()[i], j, vi, nonlocalCoefs_[vi][i*elemSize+j]); } } } EPETRA_CHK_ERR( Export(nonlocalVector, *exporter_, mode) ); if (reuse_map_and_exporter) { zeroNonlocalData<int_type>(); } else { destroyNonlocalData(); } return(0); }
int main(int argv, char **argv) { BB_SYS_PARAM bb_param; int param_opt; while (-1 != (param_opt = getopt(argc, argv, "skei"))) { switch(param_opt) { case 's' : printf("BB_Setup---------------------------------------\n"); BB_Setup(&bb_param); printf("BB_Setup---------------------------------------\n"); break; case 'k' : printf("BB_Keygen---------------------------------------\n"); if(argc == 3) BB_Keygen(argv[2], &bb_param); else printf("Usage : %s <Domain Name>\n", argv[1]); printf("BB_Keygen---------------------------------------\n"); break; case 'e' : printf("export\n"); if(argc == 3) Export(argv[2], argv[3]); else printf("Usage : %s <Target IP> <Domain Name>\n", argv[1]); break; case 'i' : printf("import\n"); break; case '?' : printf("Usage : %s <mode (skei)> [option]\n", argv[0]); return 0; } } return 0; }
BOOL CXmlFile::SaveEx() { if (GetFileHandle() == (HANDLE)CStdioFileEx::hFileNull) return FALSE; BOOL bRes = FALSE; CString sXml; if (Export(sXml)) { try { // move to start Seek(0, CStdioFileEx::begin); // write the xml CStdioFileEx::WriteString((LPCTSTR)sXml); // update the file end VERIFY(::SetEndOfFile(GetFileHandle())); // verify file length matches length of xml DWORD dwFileSizeInBytes = ::GetFileSize(GetFileHandle(), NULL); DWORD dwXmlSizeInBytes = GetBytesWritten(); if (dwFileSizeInBytes == dwXmlSizeInBytes) bRes = TRUE; } catch (...) { m_nFileError = GetLastError(); } } return bRes; }
operator Angle() const { return Export(value); }