PluginCommand.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:8k
- /*
- * ===========================================================================
- * PRODUCTION $Log: PluginCommand.cpp,v $
- * PRODUCTION Revision 1000.2 2004/06/01 20:53:39 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.13
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: PluginCommand.cpp,v 1000.2 2004/06/01 20:53:39 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: Mike DiCuccio, Denis Vakatov, Anatoliy Kuznetsov
- *
- * File Description:
- * CPluginCommand -- defines an interface for managing a single command
- * passed in to a plugin
- *
- * Remark:
- * This code was originally generated by application DATATOOL
- * using specifications from the data definition file
- * 'plugin.asn'.
- */
- // standard includes
- // generated includes
- #include <ncbi_pch.hpp>
- #include <gui/plugin/PluginCommand.hpp>
- #include <gui/plugin/PluginArgSet.hpp>
- // generated classes
- BEGIN_NCBI_SCOPE
- BEGIN_objects_SCOPE // namespace ncbi::objects::
- // destructor
- CPluginCommand::~CPluginCommand(void)
- {
- }
- // operator[] for indexing based on named argument
- // this will throw if the named argument isn't found
- const CPluginArg& CPluginCommand::operator[](const string& name) const
- {
- return GetArgs()[ name ];
- }
- CPluginArg& CPluginCommand::operator[](const string& name)
- {
- return SetArgs()[ name ];
- }
- // verify whether a named argument exists
- bool CPluginCommand::HasArgument(const string& name) const
- {
- return GetArgs().HasArgument(name);
- }
- // add a named argument. This argument is required, and has no default
- // value. Attempts to access the value without setting the value will
- // result in an exception being thrown.
- CPluginArg& CPluginCommand::AddArgument(const string& name,
- const string& desc,
- CPluginArg::EType type,
- CPluginArg::TData::E_Choice single_or_array)
- {
- return SetArgs().AddArgument(name, desc, type, single_or_array);
- }
- // add a named argument. This argument is required, and has no default
- // value. Attempts to access the value without setting the value will
- // result in an exception being thrown.
- CPluginArg& CPluginCommand::AddArgument(const string& name,
- const string& desc,
- const CTypeInfo* type,
- CPluginArg::TData::E_Choice single_or_array)
- {
- return SetArgs().AddArgument(name, desc, type, single_or_array);
- }
- CPluginArg& CPluginCommand::AddFlag(const string& name,
- const string& desc)
- {
- return SetArgs().AddFlag(name, desc);
- }
- // Add a default argument to the set of arguments. This function creates a
- // named argument with a default value of type string.
- CPluginArg& CPluginCommand::AddDefaultArgument(const string& name,
- const string& desc,
- CPluginArg::EType type,
- const string& val)
- {
- return SetArgs().AddDefaultArgument(name, desc, type, val);
- }
- CPluginArg& CPluginCommand::AddDefaultFlag(const string& name,
- const string& desc,
- bool val)
- {
- return SetArgs().AddDefaultFlag(name, desc, val);
- }
- // add an optional argument to the set of arguments. This supports an
- // optional default value argument. For non-built-in types, the default
- // value is ignored.
- CPluginArg& CPluginCommand::AddOptionalArgument(const string& name,
- const string& desc,
- CPluginArg::EType type,
- CPluginArg::TData::E_Choice s_or_a)
- {
- return SetArgs().AddOptionalArgument(name, desc, type, s_or_a);
- }
- CPluginArg& CPluginCommand::AddOptionalArgument(const string& name,
- const string& desc,
- const CTypeInfo* type,
- CPluginArg::TData::E_Choice s_or_a)
- {
- return SetArgs().AddOptionalArgument(name, desc, type, s_or_a);
- }
- // add a constraint to a named argument
- void CPluginCommand::SetConstraint(const string& name,
- CPluginValueConstraint& constraint)
- {
- SetArgs().SetConstraint(name, constraint);
- }
- void CPluginCommand::AddConstraint(const string& name,
- CPluginValueConstraint& constraint)
- {
- SetArgs().AddConstraint(name, constraint);
- }
- END_objects_SCOPE // namespace ncbi::objects::
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- *
- * $Log: PluginCommand.cpp,v $
- * Revision 1000.2 2004/06/01 20:53:39 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.13
- *
- * Revision 1.13 2004/05/21 22:27:45 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.12 2004/01/21 14:13:16 dicuccio
- * Added AddFlag() and AddDefaultFlag() - front-ends to AddArgument() and
- * AddDefaultArgument()
- *
- * Revision 1.11 2003/10/07 13:36:45 dicuccio
- * Renamed PluginURL* to PluginValue*. Moved validation code into CPluginUtils
- *
- * Revision 1.10 2003/07/31 17:01:31 dicuccio
- * Changed AddArgument() functions to return the argument added
- *
- * Revision 1.9 2003/07/23 19:14:08 dicuccio
- * Moved logic for validating plugin arguments into CPluginUtils.
- *
- * Revision 1.8 2003/06/20 14:48:16 dicuccio
- * Revised handling of default arguments - all built-in argument types are now
- * supported
- *
- * Revision 1.7 2003/05/19 13:37:46 dicuccio
- * Moved gui/core/plugin/ --> gui/plugin/
- *
- * Revision 1.6 2003/05/09 16:47:02 dicuccio
- * Added interface forwards for non-const op[], HasCommand() -> directed to
- * CPluginArgSet
- *
- * Revision 1.5 2003/04/30 13:57:06 dicuccio
- * Added interface for specifying multiple constraints for a given argument
- *
- * Revision 1.4 2003/04/25 14:14:58 dicuccio
- * Changed optional argument API - allow data model objects as optional arguments
- * using new plugin API; remove old "optional-and-default" notions
- *
- * Revision 1.3 2003/04/24 16:33:34 dicuccio
- * Added new interface to specify argument object type to AddArgument
- *
- * Revision 1.2 2003/03/03 14:50:56 dicuccio
- * Added plugin argument constraints - lower bound, upper bound, range, and
- * member-of-set
- *
- * Revision 1.1 2003/02/24 13:03:17 dicuccio
- * Renamed classes in plugin spec:
- * CArgSeg --> CPluginArgSet
- * CArgument --> CPluginArg
- * CPluginArgs --> CPluginCommand
- * CPluginCommands --> CPluginCommandSet
- *
- * Revision 1.1 2003/02/20 19:49:57 dicuccio
- * Created new plugin architecture, based on ASN.1 spec. Moved GBENCH frameowrk
- * over to use new plugin architecture.
- *
- *
- * ===========================================================================
- */
- /* Original file checksum: lines: 64, chars: 1885, CRC32: 56e32803 */