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 47519 2023-06-28 21:06:00Z 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_LocationLength::GetFuncName(), EMMatcherPanelType::eMMatcher_Location},
64  {macro::CMacroFunction_LocationSeqType::sm_SeqAa, EMMatcherPanelType::eMMatcher_Location},
65  {macro::CMacroFunction_LocationSeqType::sm_SeqNa, EMMatcherPanelType::eMMatcher_Location},
66  {macro::CMacroFunction_NumberOfFeatures::GetFuncName(), EMMatcherPanelType::eMMatcher_SeqFeatures},
67  {macro::CMacroFunction_GetSequence::sm_SeqForFeat, EMMatcherPanelType::eMMatcher_SeqFeatures},
68  {macro::CMacroFunction_GetSequence::sm_SeqForDescr, EMMatcherPanelType::eMMatcher_SeqFeatures},
69  };
70 
71  auto it = sm_FunctionToPanelMap.find(func_info.m_FName);
72  if (it != sm_FunctionToPanelMap.end()) {
73  return it->second;
74  }
75  else {
76  if (func_info.m_FName == macro::CMacroFunction_LocationDistConstraint::sm_FromStart ||
77  func_info.m_FName == macro::CMacroFunction_LocationDistConstraint::sm_FromStop) {
78  if (func_info.m_FArgs.count(NMacroArgs::kFeatType) > 0) {
80  }
81  else {
83  }
84  }
85  else if (func_info.m_FName == NMFncParse::kComparisonOp &&
86  !NStr::EqualNocase(func_info.m_ParentFnc, "in")) {
88  }
89  }
91 }
92 
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:5347
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 Fri Sep 20 14:58:10 2024 by modify_doxy.py rev. 669887