📄 scanner_output_dlg.cpp
字号:
/* * =========================================================================== * PRODUCTION $Log: scanner_output_dlg.cpp,v $ * PRODUCTION Revision 1000.3 2004/06/01 20:48:49 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.14 * PRODUCTION * =========================================================================== *//* $Id: scanner_output_dlg.cpp,v 1000.3 2004/06/01 20:48:49 gouriano Exp $ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * Authors: Mike DiCuccio * * File Description: * CScannerOutputDlg -- dialog box to display the results of running * 'gbench_plugin_scan' */#include <ncbi_pch.hpp>#include "scanner_output_dlg.hpp"#include "gbench.hpp"#include <connect/ncbi_pipe.hpp>#include <gui/utils/system_path.hpp>BEGIN_NCBI_SCOPE#include "scanner_output_dlg_.cpp"CScannerOutputDlg::CScannerOutputDlg(){ m_Window.reset(x_CreateWindow()); m_Buffer.reset(new Fl_Text_Buffer()); m_Text->buffer(m_Buffer.get());}CScannerOutputDlg::~CScannerOutputDlg(){ m_Window.reset(); m_Buffer.reset();}void CScannerOutputDlg::Show(const string& plugin_path){ if ( !m_Window.get() ) { return; } m_Window->show(); m_Buffer->text(""); // pipe our command and run 'gbench_plugin_scan' string exec_path = CSystemPath::ResolvePath("<std>", "bin/gbench_plugin_scan"); list<string> paths; NStr::Split(plugin_path, ",", paths); ITERATE (list<string>, iter, paths) { string dir = NStr::TruncateSpaces(*iter); string subdir; if (dir == "<std>" || dir == "<home>") { subdir = "plugins"; } dir = CSystemPath::ResolvePath(dir, subdir);#ifdef NCBI_OS_MSWIN // if we're in windows, we should double quote the directory because // any spaces in the firectory name (and there will be spaces) will be // mis-interpreted dir = string("\"") + dir + string("\"");#endif vector<string> args; args.push_back(dir); CPipe pipe(exec_path.c_str(), args); size_t bytes_read; char buf[512]; while (pipe.Read(buf, 512, &bytes_read) == eIO_Success) { string val(buf, bytes_read); string::size_type pos = 0; while ( (pos = val.find_first_of("\r", pos)) != string::npos) { val.erase(pos, 1); } m_Buffer->append(val.c_str()); m_Text->scroll(m_Buffer->count_lines(0, m_Buffer->length()), 0); Fl::wait(); } }}END_NCBI_SCOPE/* * =========================================================================== * $Log: scanner_output_dlg.cpp,v $ * Revision 1000.3 2004/06/01 20:48:49 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.14 * * Revision 1.14 2004/05/21 22:27:42 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.13 2004/02/17 20:35:24 rsmith * moved core/settings.[ch]pp and core/system_path.[ch]pp to config and utils, respectively. * * Revision 1.12 2003/11/26 17:11:55 dicuccio * Fixed memory leak (Fl_Text_Buffer was dropped). Added autoscrolling * * Revision 1.11 2003/09/29 15:33:39 dicuccio * Inherit dialog from CDialog * * Revision 1.10 2003/09/02 23:23:57 jcherry * Accomodated changes to CPipe * * Revision 1.9 2003/07/30 12:51:53 dicuccio * Moved 'gbench_system.[h,c]pp' to 'system_path.[h,c]pp' * * Revision 1.8 2003/07/30 12:21:29 dicuccio * Changed access to system paths * * Revision 1.7 2003/04/29 14:51:52 dicuccio * Reworked FLUID-generated code: more explicit control over constructor, better * memeory management * * Revision 1.6 2003/03/14 18:28:40 dicuccio * Made quoting of direcotry argument conditional for Windows - quotes don't work * in Unix. * * Revision 1.5 2003/03/11 15:18:57 kuznets * iterate -> ITERATE * * Revision 1.4 2003/03/07 17:33:16 dicuccio * Quote directory names passed to 'gbench_plugin_scan' so that spaces in * directory names are adequately handled * * Revision 1.3 2003/03/07 17:00:49 dicuccio * Code clean-up. Strip '\r' from pipe output. * * Revision 1.2 2003/03/07 15:54:50 dicuccio * Minor fixes to the scanner output dialog * * Revision 1.1 2003/02/26 19:19:06 dicuccio * Initial revision * * =========================================================================== */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -