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

Go to the SVN repository for this file.

1 #ifndef _GUI_PACKAGES_EDIT__TABLE_READER_MACRO_HPP_
2 #define _GUI_PACKAGES_EDIT__TABLE_READER_MACRO_HPP_
3 
4 /* $Id: table_reader_macro.hpp 45505 2020-08-19 20:50:12Z asztalos $
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: Andrea Asztalos
30 *
31 * File Description:
32 *
33 */
34 
35 #include <corelib/ncbistd.hpp>
39 
42  class CSeq_table;
43  class CUser_object;
45 
46 class IEditingAction;
47 class CConstraintPanel;
48 
50 {
51 public:
53 
55  {
56  string m_Del;
57  bool m_Merge_delimiters{ false };
58  bool m_Split_first_col{ false };
59  bool m_Multispace_to_tab{ false };
60  bool m_Merge_first_two_cols{ false };
61  bool m_Multiple_spaces_only{ false };
62 
63  SColumnDelimiters(const string& del,
64  bool merge_delimiters = false,
65  bool split_first_col = false,
66  bool multispace_to_tab = false,
67  bool merge_first_two_cols = false,
68  bool multiple_spaces_only = false)
69  : m_Del(del), m_Merge_delimiters(merge_delimiters), m_Split_first_col(split_first_col),
70  m_Multispace_to_tab(multispace_to_tab), m_Merge_first_two_cols(merge_first_two_cols),
71  m_Multiple_spaces_only (multiple_spaces_only)
72  {}
73  };
76 
77 
78  TVecMacroNames CreateMacros(const wxString& filename,
79  CRef<objects::CUser_object> column_properties,
80  const SColumnDelimiters& del_options,
81  CConstraintPanel* panel = nullptr,
82  bool test = false);
83 
84  bool RunMacro(const TVecMacroNames& macros, objects::CSeq_entry_Handle entry, ICommandProccessor* cmd_processor);
85 
86  static bool s_LooksLikeHeader(const string& value);
89 private:
90 
92  {
93  string m_Iterator;
96  vector<string> m_ColumnInfo;
97  bool m_CreateProteins{ false };
98 
100  SOneMacroData(const string& iter) : m_Iterator(iter) {}
101  };
102 
103  string x_GetVariables(const SColumnDelimiters& del_options, bool list_update_mrna = false) const;
104  void x_GatherValuesAndMatchField();
105 
106  string x_GetIterator(const string& qual_type, EMacroFieldType& field_type, const string& qualifier, bool apply = false);
107 
108  // returns constraint pertaining to the maching field
109  void x_GetMatchFieldConstraint(const SOneMacroData& data, const string& delimiter, TStringPairsVector& constraints);
110 
111  // returns a single string constraint
112  TStringPairsVector x_GetStringConstraint(const string& target);
113  string x_GetFunction(SOneMacroData& data, TStringPairsVector& constraints);
114 
115  string x_GetMacro(SOneMacroData& data, const SColumnDelimiters& del_options);
116 
117  string x_GetCreateProtFeatsMacro();
118 
119  string m_Filename;
121 
124 
125  CConstraintPanel* m_ConstraintPnl{ nullptr };
126 
127  vector<SOneMacroData> m_MacroVec;
128 };
129 
131 
132 #endif
133  // _GUI_PACKAGES_EDIT__TABLE_READER_MACRO_HPP_
vector< string > TVecMacroNames
CMacroWorker::TVecMacroNames TVecMacroNames
SFieldFromTable m_MatchField
vector< SOneMacroData > m_MacroVec
CTableReaderMacro(const CTableReaderMacro &)=delete
CTableReaderMacro & operator=(const CTableReaderMacro &)=delete
CConstRef< objects::CUser_object > m_ColProperties
Undo/Redo interface for editing operations.
char value[7]
Definition: config.c:431
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 END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
vector< pair< string, string > > TStringPairsVector
Definition: ncbistr.hpp:4810
#define NCBI_GUIPKG_SEQUENCE_EDIT_EXPORT
Definition: gui_export.h:515
static const char delimiter[]
SColumnDelimiters(const string &del, bool merge_delimiters=false, bool split_first_col=false, bool multispace_to_tab=false, bool merge_first_two_cols=false, bool multiple_spaces_only=false)
int test(int srctype, const void *srcdata, int srclen, int dsttype, int dstlen)
Definition: t0019.c:43
Modified on Mon Mar 04 05:10:29 2024 by modify_doxy.py rev. 669887