NCBI C++ ToolKit
PluginValue.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: PluginValue.hpp 30280 2014-04-23 20:28:26Z katargir $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: .......
27  *
28  * File Description:
29  * .......
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using specifications from the data definition file
34  * 'plugin.asn'.
35  */
36 
37 #ifndef GUI_CORE_PLUGIN_PLUGINURL_HPP
38 #define GUI_CORE_PLUGIN_PLUGINURL_HPP
39 
40 
41 // generated includes
45 
47 
48 // generated classes
49 
51 
52 BEGIN_objects_SCOPE /// namespace ncbi::objects::
53 
54 class CGBProjectHandle;
55 
56 
58  : public CPluginValue_Base
59 {
61 public:
62  /// default constructor
63  CPluginValue(void);
64 
65  /// conversion constructors
66  CPluginValue(int i);
67  CPluginValue(double d);
68  CPluginValue(bool b);
69  CPluginValue(const string& str);
70  CPluginValue(const CGBProjectHandle& doc);
71  CPluginValue(const CObject& obj, const CGBProjectHandle* doc = NULL, const CDataHandle * dh = NULL);
72  CPluginValue(const CTypeInfo* info);
73 
74  /// destructor
75  ~CPluginValue(void);
76 
77  /// Print a copy of the value stored to the output stream
78  void Print(CNcbiOstream& ostr) const;
79 
80  /// determine if this argument has an empty value
81  bool IsEmpty(void) const;
82 
83  /// Special accessor for the implied or actual document
84  const CGBProjectHandle* GetProject(void) const;
85 
86  /// Special accessor for the stored object
87  const CObject* GetObject(void) const;
88 
89  /// Special accessor for any named object subtype
90  const string& GetObjectSubtype(void) const;
91 
92  bool AsBoolean (void) const;
93  int AsInteger (void) const;
94  double AsDouble (void) const;
95  const string& AsString (void) const;
96  const string& AsSecretString(void) const;
97  const string& AsInputFile (void) const;
98  const string& AsOutputFile (void) const;
99  const CGBProjectHandle& AsProject (void) const;
100  const CObject& AsObject (void) const;
101 
102  /// type-specific setters
103  const string& SetInteger();
104  void SetInteger(const string& str);
105  void SetInteger(int val);
106 
107  const string& SetDouble();
108  void SetDouble(const string& str);
109  void SetDouble(double val);
110 
111  const string& SetBoolean();
112  void SetBoolean(const string& str);
113  void SetBoolean(bool val);
114 
115  /// setters for object arguments
116  void SetProject(void);
117  void SetProject(const CGBProjectHandle& doc);
118 
119  void SetObject(const CObject& obj, const CGBProjectHandle* doc = NULL, const CDataHandle * dh = NULL);
120  void SetObject(const CTypeInfo* info = NULL);
121  void SetObject(const string& subtype);
122 
123 private:
124 
125  /// Prohibit copy constructor and assignment operator
128 
129 };
130 
131 
132 /////////////////// CPluginValue inline methods
133 
134 inline
136 {
137  if (IsProject()) {
138  return Tparent::GetProject().GetProject();
139  }
140 
141  if (IsObject()) {
142  return Tparent::GetObject().GetProject();
143  }
144 
145  NCBI_THROW(CPluginException, eInvalidArg,
146  "Attempt to access non-object argument as object");
147 }
148 
149 
150 inline
152 {
153  if (IsProject()) {
154  return Tparent::GetProject().GetObject();
155  } else if (IsObject()) {
156  return Tparent::GetObject().GetObject();
157  }
158 
159  NCBI_THROW(CPluginException, eInvalidArg,
160  "Attempt to access non-object argument as object");
161 }
162 
163 /////////////////// end of CPluginValue inline methods
164 
165 
166 END_objects_SCOPE /// namespace ncbi::objects::
167 
169 
170 #endif /// GUI_CORE_PLUGIN_PLUGINURL_HPP
171 /* Original file checksum: lines: 93, chars: 2297, CRC32: e57c0a79 */
Data storage class.
CObject –.
Definition: ncbiobj.hpp:180
const CGBProjectHandle * GetProject(void) const
access the project for this object
const CObject * GetObject(void) const
access the object for this object
CPluginValue(const CPluginValue &value)
Prohibit copy constructor and assignment operator.
const CObject * GetObject(void) const
Special accessor for the stored object.
const CGBProjectHandle * GetProject(void) const
Special accessor for the implied or actual document.
CPluginValue & operator=(const CPluginValue &value)
CPluginValue_Base Tparent
Definition: PluginValue.hpp:60
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
Definition: typeinfo.hpp:76
void Print(const CCompactSAMApplication::AlignInfo &ai)
static const char * str(char *buf, int n)
Definition: stats.c:84
#define NULL
Definition: ncbistd.hpp:225
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
#define NCBI_GUIOBJECTS_EXPORT
Definition: gui_export.h:511
TObject & SetObject(void)
Select the variant.
const TProject & GetProject(void) const
Get the variant data.
bool IsObject(void) const
Check if variant Object is selected.
bool IsProject(void) const
Check if variant Project is selected.
TBoolean & SetBoolean(void)
Select the variant.
TDouble & SetDouble(void)
Select the variant.
TProject & SetProject(void)
Select the variant.
const TObject & GetObject(void) const
Get the variant data.
TInteger & SetInteger(void)
Select the variant.
int i
static MDB_envinfo info
Definition: mdb_load.c:37
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Tue Apr 23 07:39:37 2024 by modify_doxy.py rev. 669887