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

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_EDIT___SERIAL_MEMBER_PRIMITIVE_VALIDATORS__HPP
2 #define GUI_WIDGETS_EDIT___SERIAL_MEMBER_PRIMITIVE_VALIDATORS__HPP
3 
4 /* $Id: serial_member_primitive_validators.hpp 31271 2014-09-16 16:24:01Z bollin $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Roman Katargin
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbistd.hpp>
36 
38 #include <objects/biblio/Title.hpp>
39 
41 
43 {
44 public:
45  CSerialTextValidator(CSerialObject& object, const string& memberName)
46  : CSerialMemberValidator(object, memberName) {}
47 
49 
50  // Make a clone of this validator (or return NULL) - currently necessary
51  // if you're passing a reference to a validator.
52  // Another possibility is to always pass a pointer to a new validator
53  // (so the calling code can use a copy constructor of the relevant class).
54  virtual wxObject *Clone() const { return new CSerialTextValidator(*this); }
55 
56  // Called when the value in the window must be validated.
57  // This function can pop up an error message.
58  virtual bool Validate(wxWindow* /*parent*/) { return true; }
59 
60  // Called to transfer data to the window
61  virtual bool TransferToWindow();
62 
63  // Called to transfer data from the window
64  virtual bool TransferFromWindow();
65 
66 protected:
67  bool CheckValidator() const;
68 private:
70 };
71 
73 {
74 public:
75  CSerialAsciiTextValidator(CSerialObject& object, const string& memberName)
76  : CSerialTextValidator(object, memberName) {}
77 
80 
81  // Make a clone of this validator (or return NULL) - currently necessary
82  // if you're passing a reference to a validator.
83  // Another possibility is to always pass a pointer to a new validator
84  // (so the calling code can use a copy constructor of the relevant class).
85  virtual wxObject *Clone() const { return new CSerialAsciiTextValidator(*this); }
86 
87  // Called to transfer data from the window
88  virtual bool TransferFromWindow();
89 
90 private:
92 };
93 
95 {
96 public:
97  CSerialBoolValidator(CSerialObject& object, const string& memberName)
98  : CSerialMemberValidator(object, memberName) {}
99 
101 
102  // Make a clone of this validator (or return NULL) - currently necessary
103  // if you're passing a reference to a validator.
104  // Another possibility is to always pass a pointer to a new validator
105  // (so the calling code can use a copy constructor of the relevant class).
106  virtual wxObject *Clone() const { return new CSerialBoolValidator(*this); }
107 
108  // Called when the value in the window must be validated.
109  // This function can pop up an error message.
110  virtual bool Validate(wxWindow* /*parent*/) { return true; }
111 
112  // Called to transfer data to the window
113  virtual bool TransferToWindow();
114 
115  // Called to transfer data from the window
116  virtual bool TransferFromWindow();
117 
118 protected:
119  bool CheckValidator() const;
120 private:
122 };
123 
125 {
126 public:
127  CSerialEnumValidator(CSerialObject& object, const string& memberName)
128  : CSerialMemberValidator(object, memberName) {}
129 
131 
132  // Make a clone of this validator (or return NULL) - currently necessary
133  // if you're passing a reference to a validator.
134  // Another possibility is to always pass a pointer to a new validator
135  // (so the calling code can use a copy constructor of the relevant class).
136  virtual wxObject *Clone() const { return new CSerialEnumValidator(*this); }
137 
138  // Called when the value in the window must be validated.
139  // This function can pop up an error message.
140  virtual bool Validate(wxWindow* /*parent*/) { return true; }
141 
142  // Called to transfer data to the window
143  virtual bool TransferToWindow();
144 
145  // Called to transfer data from the window
146  virtual bool TransferFromWindow();
147 
148 protected:
149  bool CheckValidator() const;
150 private:
152 };
153 
155 {
156 public:
157  CSerialTitleValidator(CSerialObject& object, objects::CTitle::C_E::E_Choice title_choice, const string& label, bool show_err = true)
158  : m_Object (object),
159  m_TitleChoice (title_choice),
160  m_Label (label),
161  m_ShowErr (show_err)
162  { }
163 
165 
166  // Make a clone of this validator (or return NULL) - currently necessary
167  // if you're passing a reference to a validator.
168  // Another possibility is to always pass a pointer to a new validator
169  // (so the calling code can use a copy constructor of the relevant class).
170  virtual wxObject *Clone() const { return new CSerialTitleValidator(*this); }
171 
172  // Called when the value in the window must be validated.
173  // This function can pop up an error message.
174  virtual bool Validate(wxWindow* /*parent*/) { return true; }
175 
176  // Called to transfer data to the window
177  virtual bool TransferToWindow();
178 
179  // Called to transfer data from the window
180  virtual bool TransferFromWindow();
181 
182 protected:
183  bool CheckValidator() const;
184 private:
186  bool Copy(const CSerialTitleValidator& val);
188  objects::CTitle::C_E::E_Choice m_TitleChoice;
189  string m_Label;
190  bool m_ShowErr;
191 };
192 
193 
195 
196 #endif // GUI_WIDGETS_EDIT___SERIAL_MEMBER_PRIMITIVE_VALIDATORS__HPP
CSerialAsciiTextValidator & operator=(const CSerialAsciiTextValidator &)
CSerialAsciiTextValidator(CSerialObject &object, const string &memberName)
CSerialAsciiTextValidator(const CSerialTextValidator &val)
CSerialBoolValidator & operator=(const CSerialBoolValidator &)
CSerialBoolValidator(CSerialObject &object, const string &memberName)
CSerialEnumValidator(CSerialObject &object, const string &memberName)
CSerialEnumValidator & operator=(const CSerialEnumValidator &)
bool Copy(const CSerialMemberValidator &val)
Base class for all serializable objects.
Definition: serialbase.hpp:150
CSerialTextValidator & operator=(const CSerialTextValidator &)
CSerialTextValidator(CSerialObject &object, const string &memberName)
CSerialTitleValidator & operator=(const CSerialTitleValidator &)
CSerialTitleValidator(CSerialObject &object, objects::CTitle::C_E::E_Choice title_choice, const string &label, bool show_err=true)
objects::CTitle::C_E::E_Choice m_TitleChoice
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GUIWIDGETS_EDIT_EXPORT
Definition: gui_export.h:526
static const char label[]
Modified on Tue Apr 23 07:39:08 2024 by modify_doxy.py rev. 669887