NCBI C++ ToolKit
macro_item_constraint_panel.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: macro_item_constraint_panel.cpp 46866 2021-11-16 22:59:56Z 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: Andrea Asztalos
27 
28  */
29 
30 
31 #include <ncbi_pch.hpp>
38 
40 
42 {
43  ostrm << "Description: " << constraint.m_Label << endl;
44  ostrm << "Constr. expression: " << constraint.m_Constraint << endl;
45  ostrm << "Variables: " << constraint.m_Variables.size() << endl;
46  for (const auto& it : constraint.m_Variables) {
47  ostrm << it << endl;
48  }
49  ostrm << "Field name: " << constraint.m_Fieldname << endl;
50  for (const auto& it : constraint.m_FuncInfo) {
51  ostrm << it << endl;
52  }
53  return ostrm;
54 }
55 
57 {
59  {macro::CMacroFunction_LocationStrand::GetFuncName(), EMMatcherPanelType::eMMatcher_Location},
60  {macro::CMacroFunction_LocPartialTest::sm_PartialStart, EMMatcherPanelType::eMMatcher_Location},
61  {macro::CMacroFunction_LocPartialTest::sm_PartialStop, EMMatcherPanelType::eMMatcher_Location},
62  {macro::CMacroFunction_LocationType::GetFuncName(), EMMatcherPanelType::eMMatcher_Location},
63  {macro::CMacroFunction_LocationSeqType::sm_SeqAa, EMMatcherPanelType::eMMatcher_Location},
64  {macro::CMacroFunction_LocationSeqType::sm_SeqNa, EMMatcherPanelType::eMMatcher_Location},
65  {macro::CMacroFunction_NumberOfFeatures::GetFuncName(), EMMatcherPanelType::eMMatcher_SeqFeatures},
66  {macro::CMacroFunction_GetSequence::sm_SeqForFeat, EMMatcherPanelType::eMMatcher_SeqFeatures},
67  {macro::CMacroFunction_GetSequence::sm_SeqForDescr, EMMatcherPanelType::eMMatcher_SeqFeatures},
68  };
69 
70  auto it = sm_FunctionToPanelMap.find(func_info.m_FName);
71  if (it != sm_FunctionToPanelMap.end()) {
72  return it->second;
73  }
74  else {
75  if (func_info.m_FName == macro::CMacroFunction_LocationDistConstraint::sm_FromStart ||
76  func_info.m_FName == macro::CMacroFunction_LocationDistConstraint::sm_FromStop) {
77  if (func_info.m_FArgs.count(NMacroArgs::kFeatType) > 0) {
79  }
80  else {
82  }
83  }
84  else if (func_info.m_FName == NMFncParse::kComparisonOp &&
85  !NStr::EqualNocase(func_info.m_ParentFnc, "in")) {
87  }
88  }
90 }
91 
Class to store one function as it appears in the macro and its arguments (as GUI fieldnames)
static map< string, vector< EMMatcherPanelType > > sm_FunctionToPanelMap
Map between constraint macro function and panel type(s)
static const EMMatcherPanelType s_GetMatcherPanels(const CFuncWithArgs &func_info)
const_iterator end() const
Definition: map.hpp:152
const_iterator find(const key_type &key) const
Definition: map.hpp:153
Definition: map.hpp:338
#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
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5353
CNcbiOstream & operator<<(CNcbiOstream &ostrm, const SMacroConstraint &constraint)
EMMatcherPanelType
Denotes the type of panel that is used to create macro constraint.
const string kComparisonOp
const string kFeatType
vector< CFuncWithArgs > m_FuncInfo
interpreted functions with their arguments
string m_Fieldname
fieldname referred in the constraint
vector< string > m_Variables
variables used in the constraint
string m_Constraint
constraint expression, e.g., Strand() = "plus"
string m_Label
description of the constraint as it is listed in the macro editor
Modified on Sun Jun 16 04:29:34 2024 by modify_doxy.py rev. 669887