loader_utils.hpp
来自「ncbi源码」· HPP 代码 · 共 124 行
HPP
124 行
/* * =========================================================================== * PRODUCTION $Log: loader_utils.hpp,v $ * PRODUCTION Revision 1000.1 2004/06/01 20:58:21 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.2 * PRODUCTION * =========================================================================== */#ifndef GUI_PLUGINS_DOC_BASIC___LOADER_UTILS__HPP#define GUI_PLUGINS_DOC_BASIC___LOADER_UTILS__HPP/* $Id: loader_utils.hpp,v 1000.1 2004/06/01 20:58:21 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: Anatoliy Kuznetsov * * File Description: * Different utility functions used in basic document loaders/searchers */#include <corelib/ncbistr.hpp>BEGIN_NCBI_SCOPE////////////////////////////////////////////////////////////////////// Class incapsulates different string formatting functions // used in loaders.//class CLoaderStrFormatter{public: // Moderate validation of the input string, if it just numbers // assume it is a gi, and add "gi|" prefix static void AddGIPrefix(string* str); // Executes AddGIPrefix for every element of the input vector, // exclude all white space or empty elements static void PrepareSearchVector(vector<string>& str_vec);};////////////////////////////////////////////////////////////////////inlinevoid CLoaderStrFormatter::AddGIPrefix(string* str){ SIZE_TYPE pos = str->find_first_not_of("0123456789"); if (pos == string::npos) { pos = str->find_first_not_of(" "); if (pos != 0) { str->erase (0, pos); } str->insert(0, "gi|"); }}inlinevoid CLoaderStrFormatter::PrepareSearchVector(vector<string>& str_vec){ unsigned i = 0; while (i < str_vec.size()) { string& str = str_vec[i]; NStr::TruncateSpaces(str); if (str.empty()) { vector<string>::iterator it = str_vec.begin(); it += i; str_vec.erase(it); continue; } NStr::ToUpper(str); CLoaderStrFormatter::AddGIPrefix(&str); ++i; }}END_NCBI_SCOPE#endif // GUI_PLUGINS_DOC_BASIC___LOADER_UTILS__HPP/* * =========================================================================== * $Log: loader_utils.hpp,v $ * Revision 1000.1 2004/06/01 20:58:21 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.2 * * Revision 1.2 2004/05/25 17:21:59 dicuccio * Modified class names. Fonts to 12 point * * Revision 1.1 2003/08/05 17:08:35 kuznets * Initial revision * * * =========================================================================== */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?