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

Go to the SVN repository for this file.

1 /* $Id: editing_action_constraint.hpp 45436 2020-08-03 17:23:15Z asztalos $
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  * Authors: Igor Filippov
27  */
28 
29 #ifndef _EDITING_ACTION_CONSTRAINT_H_
30 #define _EDITING_ACTION_CONSTRAINT_H_
31 
32 #include <corelib/ncbistd.hpp>
49 
52 
54 {
55 public:
56  virtual ~CConstraintMatcher() {}
57  virtual bool GetNegation(void) {return false;}
58  virtual void SetNegation(bool val) {}
59  virtual bool DoesTextMatch(const string& val) {return false;}
60  virtual bool IsEmpty(void) const {return true;}
61  virtual void SetFeat(CSeq_feat_Handle fh) {}
62  virtual void SetDesc(const CSeqdesc* desc) {}
63 };
64 
66 {
67 public :
69  virtual bool GetNegation() {return m_constraint->GetNegation();}
70  virtual void SetNegation(bool val) {m_constraint->SetNegation(val);}
71  virtual bool DoesTextMatch(const string& val) {return m_constraint->DoesTextMatch(val);}
72  virtual bool IsEmpty(void) const { return m_constraint.Empty() || m_constraint->GetMatchText().empty();}
73 private:
75 };
76 
78 {
79 public :
82  virtual void SetNegation(bool val) {m_constraint->SetNot_present(val);}
83  virtual bool DoesTextMatch(const string& val) {return m_constraint->Match(val);}
84  virtual bool IsEmpty(void) const { return m_constraint.Empty() || m_constraint->Empty();}
85 private:
87 };
88 
89 
91 {
92 public :
94  virtual bool GetNegation() {return m_negate;}
95  virtual void SetNegation(bool val) {m_negate = val;}
96  virtual bool DoesTextMatch(const string& val)
97  {
98  if (m_negate)
99  return val.empty();
100  else
101  return !val.empty();
102  }
103  virtual bool IsEmpty(void) const {return false;}
104 private:
105  bool m_negate;
106 };
107 
109 {
110 public :
111  explicit CSameConstraintMatcher(const string &field,
112  CFieldNamePanel::EFieldType field_type,
113  int subtype,
114  const string& ncRNA_class);
115 
116  virtual bool GetNegation() {return m_negate;}
117  virtual void SetNegation(bool val) {m_negate = val;}
118  virtual bool DoesTextMatch(const string& val)
119  {
120  if (m_negate)
121  return m_values.find(val) == m_values.end();
122  else
123  return m_values.find(val) != m_values.end();
124  }
125  virtual bool IsEmpty(void) const {return false;}
126  virtual void SetFeat(CSeq_feat_Handle fh);
127  virtual void SetDesc(const CSeqdesc* desc);
128 private:
129  bool m_negate;
135 };
136 
138 {
139 public :
141  virtual bool Match(CSeq_feat_Handle fh);
142  virtual bool IsEmpty(void) const;
143 private:
145 };
146 
148 {
149 public :
151  explicit CPubStatusConstraintMatcher(const string &status) {m_status = CPubFieldType::GetStatusFromString(status);}
152  virtual bool Match(const CSeqdesc* obj);
153  virtual bool IsEmpty(void) const {return m_status == CPubFieldType::ePubFieldStatus_Any;}
154 private:
156 };
157 
159 {
160 public:
163  virtual bool Match(const string &value);
164  virtual bool Match(CSeq_feat_Handle fh);
165  virtual bool Match(const CSeqdesc* desc);
166  virtual bool Match(CBioseq_Handle bsh);
167  virtual bool Match(void);
169  virtual void SetFeat(CSeq_feat_Handle fh) {}
170  virtual void SetDesc(const CSeqdesc* desc) {}
171 protected:
173 };
174 
176 {
177 public:
179  virtual bool Match(const string &value);
180  virtual bool Match(CSeq_feat_Handle fh);
181  virtual bool Match(const CSeqdesc* desc);
182  virtual bool Match(void) {return false;}
183  bool GetNegation() {return m_matcher->GetNegation();}
185  virtual void SetFeat(CSeq_feat_Handle fh) {m_matcher->SetFeat(fh);}
186  virtual void SetDesc(const CSeqdesc* desc) {m_matcher->SetDesc(desc);}
187 private:
189 };
190 
192 {
193 public:
194  CEditingActionSummaryConstraint(const string &const_field,
195  CFieldNamePanel::EFieldType const_field_type,
196  int const_subtype,
197  const string& ncRNA_class,
198  CRef<CConstraintMatcher>constraint);
199 
200 protected:
207 };
208 
210 {
211 public:
212  CEditingActionFeatureConstraint(const string &const_field,
213  CFieldNamePanel::EFieldType const_field_type,
214  int const_subtype,
215  const string& ncRNA_class,
216  CRef<CConstraintMatcher>constraint);
217  virtual bool Match(CSeq_feat_Handle fh);
218 };
219 
221 {
222 public:
224  virtual bool Match(CSeq_feat_Handle fh);
225 private:
227 };
228 
230 {
231 public:
232  CEditingActionRelatedFeatureConstraint(const string &const_field,
233  CFieldNamePanel::EFieldType const_field_type,
234  int const_subtype,
235  const string& ncRNA_class,
236  CRef<CConstraintMatcher>constraint);
237  virtual bool Match(CSeq_feat_Handle fh);
238 };
239 
240 
242 {
243 public:
244  CEditingActionDescriptorConstraint(const string &const_field,
245  CFieldNamePanel::EFieldType const_field_type,
246  int const_subtype,
247  const string& ncRNA_class,
248  CRef<CConstraintMatcher>constraint);
249  virtual bool Match(const CSeqdesc* desc);
250 };
251 
253 {
254 public:
255  CEditingActionBiosourceConstraint(const string &const_field,
256  CFieldNamePanel::EFieldType const_field_type,
257  int const_subtype,
258  const string& ncRNA_class,
259  CRef<CConstraintMatcher>constraint);
260  virtual bool Match(const CSeqdesc* desc);
261  virtual bool Match(CSeq_feat_Handle fh);
262 };
263 
265 {
266 public:
267  CEditingActionBioseqConstraint(const string &const_field,
268  CFieldNamePanel::EFieldType const_field_type,
269  int const_subtype,
270  const string& ncRNA_class,
271  CRef<CConstraintMatcher>constraint);
272  virtual bool Match(CBioseq_Handle bsh);
273 };
274 
276 {
277 public:
279  virtual bool Match(const CSeqdesc* obj);
280 private:
282 };
283 
284 CRef<CEditingActionConstraint> CreateEditingActionConstraint(const string &field, CFieldNamePanel::EFieldType field_type, int subtype, const string& ncRNA_class,
285  const string &const_field, CFieldNamePanel::EFieldType const_field_type, int const_subtype, string& const_ncRNA_class,
286  CRef<CConstraintMatcher>constraint);
288 
289 #endif
290  // _EDITING_ACTION_CONSTRAINT_H_
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
#define false
Definition: bool.h:36
CAdvancedConstraintMatcher(CRef< CString_constraint > constraint)
CRef< CString_constraint > m_constraint
virtual bool DoesTextMatch(const string &val)
CBioseq_Handle –.
virtual void SetFeat(CSeq_feat_Handle fh)
virtual void SetNegation(bool val)
virtual void SetDesc(const CSeqdesc *desc)
virtual bool GetNegation(void)
virtual bool IsEmpty(void) const
virtual bool DoesTextMatch(const string &val)
CEditingActionBioseqConstraint(const string &const_field, CFieldNamePanel::EFieldType const_field_type, int const_subtype, const string &ncRNA_class, CRef< CConstraintMatcher >constraint)
CEditingActionBiosourceConstraint(const string &const_field, CFieldNamePanel::EFieldType const_field_type, int const_subtype, const string &ncRNA_class, CRef< CConstraintMatcher >constraint)
virtual void SetDesc(const CSeqdesc *desc)
CEditingActionConstraint & operator+=(CRef< CEditingActionConstraint > next)
virtual void SetFeat(CSeq_feat_Handle fh)
CRef< CEditingActionConstraint > m_Next
CEditingActionDescriptorConstraint(const string &const_field, CFieldNamePanel::EFieldType const_field_type, int const_subtype, const string &ncRNA_class, CRef< CConstraintMatcher >constraint)
CEditingActionFeatureConstraint(const string &const_field, CFieldNamePanel::EFieldType const_field_type, int const_subtype, const string &ncRNA_class, CRef< CConstraintMatcher >constraint)
CRef< CLocationConstraintMatcher > m_matcher
CEditingActionFeatureLocationConstraint(CRef< CLocationConstraintMatcher > loc_matcher)
CEditingActionPubStatusConstraint(CRef< CPubStatusConstraintMatcher > pub_matcher)
CRef< CPubStatusConstraintMatcher > m_matcher
CEditingActionRelatedFeatureConstraint(const string &const_field, CFieldNamePanel::EFieldType const_field_type, int const_subtype, const string &ncRNA_class, CRef< CConstraintMatcher >constraint)
virtual void SetDesc(const CSeqdesc *desc)
CEditingActionStringConstraint(CRef< CConstraintMatcher >matcher)
virtual void SetFeat(CSeq_feat_Handle fh)
CRef< CEditingActionConstraint > m_string_constraint
CEditingActionSummaryConstraint(const string &const_field, CFieldNamePanel::EFieldType const_field_type, int const_subtype, const string &ncRNA_class, CRef< CConstraintMatcher >constraint)
CRef< objects::CLocation_constraint > m_lc
virtual bool Match(CSeq_feat_Handle fh)
CLocationConstraintMatcher(CRef< objects::CLocation_constraint > lc)
CObject –.
Definition: ncbiobj.hpp:180
virtual bool DoesTextMatch(const string &val)
static EPubFieldStatus GetStatusFromString(const string &str)
virtual bool Match(const CSeqdesc *obj)
CPubFieldType::EPubFieldStatus m_status
CPubStatusConstraintMatcher(CPubFieldType::EPubFieldStatus status)
CPubStatusConstraintMatcher(const string &status)
CSameConstraintMatcher(const string &field, CFieldNamePanel::EFieldType field_type, int subtype, const string &ncRNA_class)
virtual void SetFeat(CSeq_feat_Handle fh)
virtual void SetNegation(bool val)
virtual bool DoesTextMatch(const string &val)
virtual bool IsEmpty(void) const
CIRef< IEditingAction > m_action
virtual void SetDesc(const CSeqdesc *desc)
IEditingActionBiosource * m_src_action
CSeq_feat_Handle –.
CSimpleConstraintMatcher(CRef< edit::CStringConstraint > constraint)
virtual bool DoesTextMatch(const string &val)
CRef< edit::CStringConstraint > m_constraint
virtual void SetNegation(bool val)
virtual bool IsEmpty(void) const
bool Match(const CMatchString &str) const
const_iterator find(const key_type &key) const
Definition: set.hpp:137
const_iterator end() const
Definition: set.hpp:136
char value[7]
Definition: config.c:431
Include a standard set of the NCBI C++ Toolkit most basic headers.
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
Definition: dlist.tmpl.h:56
USING_SCOPE(objects)
CRef< CEditingActionConstraint > CreateEditingActionConstraint(const string &field, CFieldNamePanel::EFieldType field_type, int subtype, const string &ncRNA_class, const string &const_field, CFieldNamePanel::EFieldType const_field_type, int const_subtype, string &const_ncRNA_class, CRef< CConstraintMatcher >constraint)
static int lc
Definition: getdata.c:30
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
Definition: ncbiobj.hpp:719
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
bool IsSetNot_present(void) const
Check if a value has been assigned to Not_present data member.
TNot_present GetNot_present(void) const
Get the Not_present member data.
void SetNot_present(TNot_present value)
Assign a value to Not_present data member.
Modified on Thu Mar 28 17:13:13 2024 by modify_doxy.py rev. 669887