render_policy_conf.cpp
来自「ncbi源码」· C++ 代码 · 共 166 行
CPP
166 行
/* * =========================================================================== * PRODUCTION $Log: render_policy_conf.cpp,v $ * PRODUCTION Revision 1000.1 2004/06/01 21:12:47 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.8 * PRODUCTION * =========================================================================== *//* $Id: render_policy_conf.cpp,v 1000.1 2004/06/01 21:12:47 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. * * =========================================================================== * * Author: Robert G. Smith * * File Description: * */#include <ncbi_pch.hpp>#include <gui/widgets/seq_graphic/render_policy_conf.hpp>#include <util/static_map.hpp>BEGIN_NCBI_SCOPEclass CRenderPolicyDefaultSettings : public IFactoryDefaultSettings{public: virtual ~CRenderPolicyDefaultSettings() {} string Get(const string& key) const { return "default"; }};CRenderPolicyConfig::CRenderPolicyConfig(objects::CPluginConfigCache* config_cache, const string& desc ) : CSettingsSet(config_cache, "Render Policy", new CRenderPolicyDefaultSettings, desc){}CRenderPolicyConfig::~CRenderPolicyConfig(){}//// static lookup table for converting string-based feature type to actual// feature type//// these must be in "ASCIIbetical" order; beware of the fact that// closing quotes sort after spaces.//namespace {typedef pair<const string, CRenderPolicyConfig::ERenderPolicys> TRenderType;const TRenderType s_RenderTypes[] = { TRenderType("compact", CRenderPolicyConfig::eRenderPolicyCompact), TRenderType("default", CRenderPolicyConfig::eRenderPolicyDefault), TRenderType("genome", CRenderPolicyConfig::eRenderPolicyGenome), TRenderType("inline", CRenderPolicyConfig::eRenderPolicyInline)};typedef CStaticArrayMap<const string, CRenderPolicyConfig::ERenderPolicys, PCase> TRenderTypeMap;const TRenderTypeMap s_RenderPolicyMap(s_RenderTypes, sizeof(s_RenderTypes));}/// convert between current settings and the PluginConfigCache.static const string s_key("Policy");bool CRenderPolicyConfig::LoadCurrentSettings(ELoadValueSource src){ m_RenderPolicy = eRenderPolicyDefault; const string value_str(Get(s_key, src)); TRenderTypeMap::const_iterator rp_it = s_RenderPolicyMap.find(value_str); if (rp_it != s_RenderPolicyMap.end()) { m_RenderPolicy = rp_it->second; } return true;}bool CRenderPolicyConfig::SaveCurrentSettings(void){ ITERATE(TRenderTypeMap, rp_it, s_RenderPolicyMap) { if (rp_it->second == m_RenderPolicy) { Set(s_key, rp_it->first); break; } } return true;}CRenderPolicyConfig::ERenderPolicys CRenderPolicyConfig::GetRenderPolicy() const{ return m_RenderPolicy;}END_NCBI_SCOPE/** ===========================================================================** $Log: render_policy_conf.cpp,v $* Revision 1000.1 2004/06/01 21:12:47 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.8** Revision 1.8 2004/05/21 22:27:55 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.7 2004/02/04 15:06:32 rsmith* changed implementation to use a CStaticArrayMap** Revision 1.6 2004/02/02 18:45:48 rsmith* add description to CSettingsSet, constructor and descendants.** Revision 1.5 2004/01/20 14:02:26 rsmith* Add method GetRenderPolicy, so this class can be used!** Revision 1.4 2003/12/31 16:34:12 rsmith* more readable type name** Revision 1.3 2003/12/31 13:12:51 rsmith* fix LoadCurrentSettings** Revision 1.2 2003/12/30 15:05:42 dicuccio* Dropped export specifier on internal class - causes unresolved externals** Revision 1.1 2003/12/29 14:57:35 rsmith* initial checkin.*** ===========================================================================*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?