void Client::get(Path & dstPath, const Path & path, const Revision & revision, const Revision & peg_revision) throw(ClientException) { Pool pool; // create a new file and suppose we only want // this users to be able to read and write the file apr_file_t * file = openTempFile(dstPath, path, revision, pool); // now create a stream and let svn_client_cat write to the // stream svn_stream_t * stream = svn_stream_from_aprfile(file, pool); if (stream != 0) { svn_error_t * error = svn_client_cat2( stream, path.c_str(), peg_revision.revision() , revision.revision(), *m_context, pool); if (error != 0) throw ClientException(error); svn_stream_close(stream); } // finalize stuff apr_file_close(file); }
void EnergyPlotter::plotData(int limb, const QString& outFilename) { QTextStream& s = openTempFile(); switch (limb) { case 0: writeThighData (LeftLeg, frameInfo()->leftLeg(), s); break; case 1: writeThighData (RightLeg, frameInfo()->rightLeg(), s); break; case 2: writeLowerLegData(LeftLeg, frameInfo()->leftLeg(), s); break; case 3: writeLowerLegData(RightLeg, frameInfo()->rightLeg(), s); break; } m_limb = limb; saveGraph(outFilename); }
void openFile(TCHAR *file) { if(file == NULL || PathFileExists(file) == FALSE) { ::MessageBox(nppData._nppHandle, TEXT("No file to open"), TEXT("error"), MB_OK); return; } HWND window = openTempFile(); ifstream myfile(file,ios::in|ios::ate| ios::binary); if(myfile.is_open()) { long size = myfile.tellg(); char *memblock = new char [size+1]; myfile.seekg(0); myfile.read(memblock, size); myfile.close(); memblock[size] = 0; ::SendMessageA(window, SCI_GRABFOCUS, 0, 0); ::SendMessageA(window, SCI_APPENDTEXT, size, (LPARAM)memblock); delete[] memblock; if(startCompare()) { ::SendMessageA(window, SCI_GRABFOCUS, 0, 0); ::SendMessageA(window, SCI_SETSAVEPOINT, 1, 0); ::SendMessageA(window, SCI_EMPTYUNDOBUFFER, 0, 0); ::SendMessageA(window, SCI_SETREADONLY, 1, 0); reset(); } else { ::SendMessageA(window, SCI_GRABFOCUS, 0, 0); ::SendMessageA(window, SCI_SETSAVEPOINT, 1, 0); ::SendMessageA(window, SCI_EMPTYUNDOBUFFER, 0, 0); ::SendMessageA(window, SCI_SETREADONLY, 1, 0); ::SendMessageA(nppData._scintillaSecondHandle, SCI_GRABFOCUS, 0, 1); } } }
void FftPlotter::plot(const QString& plot, const QString& outFilename) { m_plot = plot; QTextStream& s = openTempFile(); for (int i=0 ; i<m_fft->resultSize() ; ++i) { double magnitude = std::abs(m_fft->result()[i]); double phase = std::arg(m_fft->result()[i]); QStringList cols; cols << QString::number(i); cols << QString::number(magnitude, 'f'); cols << QString::number(phase, 'f'); cols << QString::number(phase * magnitude, 'f'); s << cols.join(" ") << "\n"; } saveGraph(outFilename); }