PluginValue.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:9k
- /*
- * ===========================================================================
- * PRODUCTION $Log: PluginValue.hpp,v $
- * PRODUCTION Revision 1000.1 2004/04/12 18:14:51 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.5
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: PluginValue.hpp,v 1000.1 2004/04/12 18:14:51 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: .......
- *
- * File Description:
- * .......
- *
- * Remark:
- * This code was originally generated by application DATATOOL
- * using specifications from the data definition file
- * 'plugin.asn'.
- */
- #ifndef GUI_CORE_PLUGIN_PLUGINURL_HPP
- #define GUI_CORE_PLUGIN_PLUGINURL_HPP
- // generated includes
- #include <gui/plugin/PluginObject.hpp>
- #include <gui/plugin/PluginValue_.hpp>
- #include <gui/plugin/PluginArg.hpp>
- #include <gui/core/plugin_exception.hpp>
- // generated classes
- BEGIN_NCBI_SCOPE
- BEGIN_objects_SCOPE // namespace ncbi::objects::
- class NCBI_XGBPLUGIN_EXPORT CPluginValue
- : public CPluginValue_Base
- {
- typedef CPluginValue_Base Tparent;
- public:
- // default constructor
- CPluginValue(void);
- // conversion constructors
- CPluginValue(int i);
- CPluginValue(double d);
- CPluginValue(bool b);
- CPluginValue(const string& str);
- CPluginValue(const IDocument& doc);
- CPluginValue(const IDocument& doc, const CObject& obj);
- CPluginValue(const CTypeInfo* info);
- // destructor
- ~CPluginValue(void);
- // determine if this argument has an empty value
- bool IsEmpty(void) const;
- // Special accessor for the implied or actual document
- const IDocument* GetDocument (void) const;
- // Special accessor for the stored object
- const CObject* GetObject (void) const;
- // Special accessor for any named object subtype
- const string& GetObjectSubtype(void) const;
- bool AsBoolean (void) const;
- int AsInteger (void) const;
- double AsDouble (void) const;
- const string& AsString (void) const;
- const string& AsFile (void) const;
- const IDocument& AsDocument(void) const;
- const CObject& AsObject (void) const;
- // type-specific setters
- const string& SetInteger();
- void SetInteger(const string& str);
- void SetInteger(int val);
- const string& SetDouble();
- void SetDouble(const string& str);
- void SetDouble(double val);
- const string& SetBoolean();
- void SetBoolean(const string& str);
- void SetBoolean(bool val);
- // setters for object arguments
- void SetDocument(void);
- void SetDocument(const IDocument& doc);
- void SetObject(const IDocument& doc, const CObject& obj);
- void SetObject(const CTypeInfo* info = NULL);
- void SetObject(const string& subtype);
- private:
- // Prohibit copy constructor and assignment operator
- CPluginValue(const CPluginValue& value);
- CPluginValue& operator=(const CPluginValue& value);
- };
- /////////////////// CPluginValue inline methods
- inline
- const IDocument* CPluginValue::GetDocument(void) const
- {
- if (IsDocument()) {
- return Tparent::GetDocument().GetDocument();
- } else if (IsObject()) {
- return Tparent::GetObject().GetDocument();
- }
- NCBI_THROW(CPluginException, eInvalidArg,
- "Attempt to access non-object argument as object");
- }
- inline
- const CObject* CPluginValue::GetObject(void) const
- {
- if (IsDocument()) {
- return Tparent::GetDocument().GetObject();
- } else if (IsObject()) {
- return Tparent::GetObject().GetObject();
- }
- NCBI_THROW(CPluginException, eInvalidArg,
- "Attempt to access non-object argument as object");
- }
- /////////////////// end of CPluginValue inline methods
- END_objects_SCOPE // namespace ncbi::objects::
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- *
- * $Log: PluginValue.hpp,v $
- * Revision 1000.1 2004/04/12 18:14:51 gouriano
- * PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.5
- *
- * Revision 1.5 2004/02/03 21:23:10 dicuccio
- * Added ClearObjects(). Added SetObjects() with string-based descriptor
- *
- * Revision 1.4 2003/12/22 19:14:59 dicuccio
- * Added explicit setters from parent for integer, boolean, double
- *
- * Revision 1.3 2003/12/16 20:39:48 jcherry
- * Added support for plugin arguments of type file
- *
- * Revision 1.2 2003/10/27 17:32:19 dicuccio
- * Introduced CPluginObject to hold CPluginValue types when the type is an object.
- * Made CPluginValue a variant; removed ad hoc URL encoding
- *
- * Revision 1.1 2003/10/07 13:33:43 dicuccio
- * Renamed CPluginURL* to CPluginValue*. Dropped find_if.hpp. Moved validation
- * code into CPluginUtils.
- *
- * Revision 1.15 2003/09/04 14:00:27 dicuccio
- * Introduce IDocument and IView as abstract base classes. Use IDocument instead
- * of CDocument.
- *
- * Revision 1.14 2003/08/05 19:25:45 meric
- * Removed superfluous semicolon
- *
- * Revision 1.13 2003/07/22 15:27:51 dicuccio
- * Dropped support for CSeqVector as an explicitly handled argument type
- *
- * Revision 1.12 2003/06/26 15:32:02 dicuccio
- * Moved GetURLValue() from PluginURL.hpp to plugin_utils.hpp - relieves one
- * circular dependency betweein gui/gqplugin and gui/core/
- *
- * Revision 1.11 2003/06/02 16:01:29 dicuccio
- * Rearranged include/objects/ subtree. This includes the following shifts:
- * - include/objects/alnmgr --> include/objtools/alnmgr
- * - include/objects/cddalignview --> include/objtools/cddalignview
- * - include/objects/flat --> include/objtools/flat
- * - include/objects/objmgr/ --> include/objmgr/
- * - include/objects/util/ --> include/objmgr/util/
- * - include/objects/validator --> include/objtools/validator
- *
- * Revision 1.10 2003/05/19 13:33:02 dicuccio
- * Moved gui/core/plugin --> gui/plugin/
- *
- * Revision 1.9 2003/05/09 16:44:20 dicuccio
- * Added check to see if a given URL is empty - useful for optional arguments
- *
- * Revision 1.8 2003/04/24 16:17:51 dicuccio
- * Simplified type-specific access - eliminated most distinct object types in
- * favor of a more generic mechanism.
- *
- * Revision 1.7 2003/03/28 17:12:03 dicuccio
- * Added PostRead()
- *
- * Revision 1.6 2003/03/25 19:37:50 dicuccio
- * Added CSeq_annot as a named type
- *
- * Revision 1.5 2003/02/28 15:05:42 dicuccio
- * Added overloaded Assign() as well as generic object accessor
- *
- * Revision 1.4 2003/02/26 20:51:22 dicuccio
- * Added utility function to wrap insertion into a multimap
- *
- * Revision 1.3 2003/02/26 14:34:18 dicuccio
- * Changed all setters to take const arguments - relieves need to use
- * const_cast<> outside of the plugin framework. Added beefed up argument
- * validation.
- *
- * Revision 1.2 2003/02/25 14:42:17 dicuccio
- * Changed internal sotrage mechanism for plugin URL - confogrms more closely to
- * URL spec (addresses look like 'gbdata://PluginValue/Document=0xaddr&...')
- *
- * Revision 1.1 2003/02/24 13:00:18 dicuccio
- * Renamed classes in plugin spec:
- * CArgSeg --> CPluginArgSet
- * CArgument --> CPluginArg
- * CPluginArgs --> CPluginCommand
- * CPluginCommands --> CPluginCommandSet
- *
- * Revision 1.2 2003/02/21 16:44:13 dicuccio
- * Added Win32 export specifiers for new plugin library. Fixed compilation
- * issues for Win32.
- *
- * Revision 1.1 2003/02/20 19:44:06 dicuccio
- * Created new plugin architecture, mediated via an ASN.1 spec. Moved GBENCH
- * framework over to use new plugin architecture.
- *
- *
- * ===========================================================================
- */
- #endif // GUI_CORE_PLUGIN_PLUGINURL_HPP
- /* Original file checksum: lines: 93, chars: 2297, CRC32: e57c0a79 */