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

Go to the SVN repository for this file.

1 #ifndef GUI_OBJUTILS___MACRO_PARSE_FUNCTIONS__HPP
2 #define GUI_OBJUTILS___MACRO_PARSE_FUNCTIONS__HPP
3 /* $Id: macro_parse_functions.hpp 46808 2021-10-20 20:54:24Z asztalos $
4  * ===========================================================================
5  *
6  * PUBLIC DOMAIN NOTICE
7  * National Center for Biotechnology Information
8  *
9  * This software/database is a "United States Government Work" under the
10  * terms of the United States Copyright Act. It was written as part of
11  * the author's official duties as a United States Government employee and
12  * thus cannot be copyrighted. This software/database is freely available
13  * to the public for use. The National Library of Medicine and the U.S.
14  * Government have not placed any restriction on its use or reproduction.
15  *
16  * Although all reasonable efforts have been taken to ensure the accuracy
17  * and reliability of the software and data, the NLM and the U.S.
18  * Government do not and cannot warrant the performance or results that
19  * may be obtained by using this software or data. The NLM and the U.S.
20  * Government disclaim all warranties, express or implied, including
21  * warranties of performance, merchantability or fitness for any particular
22  * purpose.
23  *
24  * Please cite the author in any work or product based on this material.
25  *
26  * ===========================================================================
27  *
28  * Authors: Andrea Asztalos
29  *
30  * File Description:
31  *
32  */
33 
34 #include <corelib/ncbistd.hpp>
36 #include <gui/gui_export.h>
37 
38 
40 
41 /// Structure to store parsed function name and its arguments - as it appears in the macro
42 /// It is used when a macro is about to be opened in the macro editor, it does not play a role
43 /// When a macro is parsed.
44 
45 struct SMacroFuncWithArgs : public CObject
46 {
47  using TArgs = vector<string>;
48  SMacroFuncWithArgs(const string& func_name) : m_FuncName(func_name) {}
51 
52  bool operator==(const SMacroFuncWithArgs&) const;
53 
54  string m_FuncName;
56  bool m_Negate { false }; // set to true when the function is negated, used in constraints
57  string m_ParentFnc;
58  CRef<SMacroFuncWithArgs> m_ChildFnc{ nullptr }; // to describe nested functions (used in constraints)
59 };
60 
62 
63 using TMacroFuncList = vector<SMacroFuncWithArgs>;
64 
65 namespace NMFncParse {
66  /// Temporary function name to return the relevant information from the Where clause
67  const string kPlaceHolderFn = "FieldPlaceHolder";
68 
69  const string kRnaTypeFn = "RNATypePlaceHolder";
70 
71  const string kncRNAclassFn = "ncRNAclassPlaceHolder";
72 
73  const string kFeatTypeFn = "FeatureTypePlaceHolder";
74 
75  const string kComparisonOp = "ComparisonOperator";
76 
77  /// Returns the list of do-functions present in the DO clause of the macro - includes multiples
78  vector<string> GetDoFunctions(const macro::CMacroRep& macro_rep);
79 
80  /// Returns the list of DO functions and their arguments as they appear in the macro
81  TMacroFuncList GetDoFunctionsWithArgs(const macro::CMacroRep& macro_rep, TMacroFuncList& do_constraints);
82  /// Returns the list of WHERE functions and their arguments as they appear in the macro
83  TMacroFuncList GetWhereFunctionsWithArgs(const macro::CMacroRep& macro_rep);
84  /// Looks up variables names used as function arguments and substitutes their name with their values
85  void LookupFncArguments(const macro::CMacroRep& macro_rep, TMacroFuncList& func_list);
86 }
87 
89 
90 #endif // GUI_OBJUTILS___MACRO_PARSE_FUNCTIONS__HPP
91 
CObject –.
Definition: ncbiobj.hpp:180
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
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
#define NCBI_GUIWIDGETS_EDIT_EXPORT
Definition: gui_export.h:526
Defines to provide correct exporting from DLLs in Windows.
CNcbiOstream & operator<<(CNcbiOstream &ostrm, const SMacroFuncWithArgs &f_args)
vector< SMacroFuncWithArgs > TMacroFuncList
const string kPlaceHolderFn
Temporary function name to return the relevant information from the Where clause.
TMacroFuncList GetWhereFunctionsWithArgs(const macro::CMacroRep &macro_rep)
Returns the list of WHERE functions and their arguments as they appear in the macro.
const string kncRNAclassFn
void LookupFncArguments(const macro::CMacroRep &macro_rep, TMacroFuncList &func_list)
Looks up variables names used as function arguments and substitutes their name with their values.
const string kFeatTypeFn
const string kComparisonOp
vector< string > GetDoFunctions(const macro::CMacroRep &macro_rep)
Returns the list of do-functions present in the DO clause of the macro - includes multiples.
TMacroFuncList GetDoFunctionsWithArgs(const macro::CMacroRep &macro_rep, TMacroFuncList &do_constraints)
Returns the list of DO functions and their arguments as they appear in the macro.
const string kRnaTypeFn
Structure to store parsed function name and its arguments - as it appears in the macro It is used whe...
bool operator==(const SMacroFuncWithArgs &) const
SMacroFuncWithArgs(const string &func_name)
CRef< SMacroFuncWithArgs > m_ChildFnc
Modified on Mon Dec 11 02:40:48 2023 by modify_doxy.py rev. 669887