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

Go to the SVN repository for this file.

1 /* $Id: editing_actions.hpp 45437 2020-08-03 17:44:02Z 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_ACTIONS_H_
30 #define _EDITING_ACTIONS_H_
31 
32 #include <corelib/ncbistd.hpp>
43 
46 
48 
49 class IEditingAction : public CObject
50 {
51 public:
53  virtual ~IEditingAction() {}
54  const string GetName(void) const;
63  const vector<string>& GetChangedValues(void);
64 
65  bool GetChangedIds(void);
66  void ResetChangedFeatures(void);
67  void ResetChangedDescriptors(void);
68  void ResetChangedInstances(void);
69  void ResetChangedIds(void);
70  void ResetChangedValues(void);
71 
72  void SetExistingText( edit::EExistingText existing_text);
78 
79  bool CheckValue(void);
80  bool CheckValues(void);
81  const vector<string>& GetValues(void);
82 
83  void Apply(const string& value);
84  void Edit(const string& find, const string& replace, macro::CMacroFunction_EditStringQual::ESearchLoc edit_loc, bool case_insensitive, bool is_regex);
85  void Remove(void) ;
87  void ConvertFrom(ECapChange cap_change, bool leave_on_original, const string& strip_name, IEditingAction* destination);
88  void ConvertTo(const string &value, IEditingAction* source);
89  void CopyFrom(IEditingAction* destination);
90  void CopyTo(const string& value, IEditingAction* source);
91  void SwapFrom(IEditingAction *destination);
92  void SwapTo(const string& value, IEditingAction* source);
93  void ParseFrom(edit::CParseTextOptions parse_options, IEditingAction *destination);
94  void ParseTo(const string& value, IEditingAction* source);
95  void NOOP(void);
96 
97  enum EActionType {
111  };
112 
113  int CheckForExistingText(CIRef<IEditingAction> action2, EActionType action_type, edit::CParseTextOptions parse_options = edit::CParseTextOptions());
116  bool IsModified() {return m_modified;}
117  void SetMaxRecords(size_t max) {m_max_records = max;}
118 protected:
119 
120  bool IsNOOP(EActionType action);
121  bool IsFrom(EActionType action);
122  bool IsTo(EActionType action);
123  bool IsCreateNew(EActionType action);
124 
126  CRef<CCmdComposite> GetRetranslateCdsCmd(const CSeq_feat_Handle fh, const CRef<CSeq_feat> feat, int& offset, bool create_general_only);
127 
128  void Action(EActionType action);
129  virtual void Find(EActionType action) = 0;
130  virtual void FindRelated(EActionType action) = 0;
131  virtual void Modify(EActionType action) = 0;
132  virtual void SwapContext(IEditingAction* source);
133  virtual bool SameObject() = 0;
134 
135  void DoApply(void);
136  void DoEdit(void);
137  void DoRemove(void);
138  void DoRemoveOutside(void);
139  void DoConvertFrom(void);
140  void DoConvertTo(void);
141  void DoCopyFrom(void);
142  void DoCopyTo(void);
143  void DoSwapFrom(void);
144  void DoSwapTo(void);
145  void DoParseFrom(void);
146  void DoParseTo(void);
147  void DoNOOP(void);
148 
149  void HandleValue(const string& value);
150  virtual bool IsSetValue(void) = 0;
151  virtual void SetValue(const string &value) = 0;
152  virtual string GetValue(void) = 0;
153  virtual void ResetValue(void) = 0;
154  virtual void ResetScope() {}
155 
164 
165  vector<string> m_ChangedValues;
167 
168  string m_Name;
173 
175 
177  macro::CMacroFunction_EditStringQual::ESearchLoc m_edit_loc;
183  edit::CParseTextOptions m_parse_options;
184 
190 };
191 
192 
194  const string &field,
195  CFieldNamePanel::EFieldType field_type,
196  int subtype,
197  const string& ncRNA_class = kEmptyStr,
199 
200 int GetSubtype(CFieldNamePanel *field_name_panel, string& ncRNA_class);
201 
202 int CorrectForncRNASubtypes(CSeqFeatData::ESubtype subtype, string& ncRNA_class);
203 
205 
206 CRef<CCmdComposite> GetReplacementCommand(CConstRef<CObject> oldobj, CRef<CObject> newobj, CScope& scope, const string& cmd_name);
207 
208 vector<CConstRef<CObject>> GetObjects(CSeq_entry_Handle seh,
209  const string &field,
210  CFieldNamePanel::EFieldType field_type,
211  int subtype,
212  const string& ncRNA_class,
214  CRef<CEditingActionConstraint> constraint,
215  vector<CSeq_entry_Handle>* descr_context = nullptr);
216 
217 
219 
220 #endif
221  // _EDITING_ACTIONS_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.
CObject –.
Definition: ncbiobj.hpp:180
CScope –.
Definition: scope.hpp:92
CSeq_entry_Handle –.
CSeq_feat_Handle –.
void SetRetranslateCds(bool value)
void SetExistingText(edit::EExistingText existing_text)
const string GetName(void) const
void SetTopSeqEntry(CSeq_entry_Handle seh)
virtual void FindRelated(EActionType action)=0
virtual void SetValue(const string &value)=0
edit::EExistingText m_existing_text
map< const CSeqdesc *, CSeq_entry_Handle > m_ContextForDescriptors
CRef< CSubmit_block > GetChangedSubmitBlock(void)
void ResetChangedFeatures(void)
virtual void Find(EActionType action)=0
void ConvertFrom(ECapChange cap_change, bool leave_on_original, const string &strip_name, IEditingAction *destination)
void Apply(const string &value)
virtual void Modify(EActionType action)=0
map< const CSeqdesc *, CSeq_entry_Handle > m_CreatedDescriptors
void SetConstraint(CRef< CEditingActionConstraint > constraint)
const vector< string > & GetChangedValues(void)
const map< const CSeqdesc *, CSeq_entry_Handle > & GetDeletedDescriptors(void)
CSeq_entry_Handle m_TopSeqEntry
void ResetChangedDescriptors(void)
CConstRef< objects::CSeq_submit > m_SeqSubmit
const map< CSeq_feat_Handle, CRef< CSeq_feat > > & GetChangedFeatures(void)
const map< CBioseq_Handle, CRef< CSeq_inst > > & GetChangedInstances(void)
void ConvertTo(const string &value, IEditingAction *source)
void ResetChangedIds(void)
map< const CSeqdesc *, CRef< CSeqdesc > > m_ChangedDescriptors
bool GetChangedIds(void)
IEditingAction(CSeq_entry_Handle seh, const string &name, CConstRef< objects::CSeq_submit > submit=CConstRef< objects::CSeq_submit >(NULL))
macro::CMacroFunction_EditStringQual::ESearchLoc m_edit_loc
map< CSeq_feat_Handle, CRef< CSeq_feat > > m_ChangedFeatures
CRef< CCmdComposite > GetActionCommand(void)
IEditingAction * m_Other
CRef< CCmdComposite > GetRetranslateCdsCmd(const CSeq_feat_Handle fh, const CRef< CSeq_feat > feat, int &offset, bool create_general_only)
void DoParseFrom(void)
void SetCurrentSeqEntry(CSeq_entry_Handle seh)
void DoRemoveOutside(void)
void RemoveOutside(CRef< macro::CRemoveTextOptions > options)
CRef< CSubmit_block > m_ChangedSubmitBlock
virtual bool SameObject()=0
const map< const CSeqdesc *, CSeq_entry_Handle > & GetContextForDescriptors(void)
bool IsTo(EActionType action)
int CheckForExistingText(CIRef< IEditingAction > action2, EActionType action_type, edit::CParseTextOptions parse_options=edit::CParseTextOptions())
void CopyTo(const string &value, IEditingAction *source)
CIRef< IEditCommand > GetUpdateMRNAProductNameCmd(const CSeq_feat_Handle fh, const CRef< CSeq_feat > feat)
CSeq_entry_Handle m_CurrentSeqEntry
void SwapFrom(IEditingAction *destination)
CConstRef< objects::CSeq_submit > GetSeqSubmit(void)
void CopyFrom(IEditingAction *destination)
void Action(EActionType action)
vector< string > m_ChangedValues
const map< const CSeqdesc *, CRef< CSeqdesc > > & GetChangedDescriptors(void)
void SwapTo(const string &value, IEditingAction *source)
ECapChange m_cap_change
void ParseFrom(edit::CParseTextOptions parse_options, IEditingAction *destination)
CRef< macro::CRemoveTextOptions > m_remove_options
map< CSeq_feat_Handle, CSeq_entry_Handle > m_CreatedFeatures
void ResetChangedInstances(void)
void SetMaxRecords(size_t max)
const vector< string > & GetValues(void)
void DoConvertFrom(void)
edit::CParseTextOptions m_parse_options
virtual void SwapContext(IEditingAction *source)
bool IsFrom(EActionType action)
virtual bool IsSetValue(void)=0
const map< CSeq_feat_Handle, CSeq_entry_Handle > & GetCreatedFeatures(void)
virtual void ResetValue(void)=0
bool CheckValue(void)
void DoParseTo(void)
void DoConvertTo(void)
CRef< CEditingActionConstraint > m_constraint
void ResetChangedValues(void)
bool IsCreateNew(EActionType action)
const map< const CSeqdesc *, CSeq_entry_Handle > & GetCreatedDescriptors(void)
virtual void ResetScope()
map< const CSeqdesc *, CSeq_entry_Handle > m_DeletedDescriptors
virtual ~IEditingAction()
void Edit(const string &find, const string &replace, macro::CMacroFunction_EditStringQual::ESearchLoc edit_loc, bool case_insensitive, bool is_regex)
void SetUpdateMRNAProduct(bool value)
void DoCopyFrom(void)
void ParseTo(const string &value, IEditingAction *source)
bool CheckValues(void)
virtual string GetValue(void)=0
void DoSwapFrom(void)
bool IsNOOP(EActionType action)
void HandleValue(const string &value)
map< CBioseq_Handle, CRef< CSeq_inst > > m_ChangedInstances
Definition: map.hpp:338
Include a standard set of the NCBI C++ Toolkit most basic headers.
USING_SCOPE(objects)
int CorrectForncRNASubtypes(CSeqFeatData::ESubtype subtype, string &ncRNA_class)
int GetSubtype(CFieldNamePanel *field_name_panel, string &ncRNA_class)
CIRef< IEditingAction > CreateAction(CSeq_entry_Handle seh, const string &field, CFieldNamePanel::EFieldType field_type, int subtype, const string &ncRNA_class=kEmptyStr, CConstRef< objects::CSeq_submit > submit=CConstRef< objects::CSeq_submit >(NULL))
vector< CConstRef< CObject > > GetObjects(CSeq_entry_Handle seh, const string &field, CFieldNamePanel::EFieldType field_type, int subtype, const string &ncRNA_class, CConstRef< objects::CSeq_submit > submit, CRef< CEditingActionConstraint > constraint, vector< CSeq_entry_Handle > *descr_context=nullptr)
CRef< CCmdComposite > GetReplacementCommand(CConstRef< CObject > oldobj, CRef< CObject > newobj, CScope &scope, const string &cmd_name)
CRef< CObject > GetNewObject(CConstRef< CObject > object)
int offset
Definition: replacements.h:160
#define NULL
Definition: ncbistd.hpp:225
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define kEmptyStr
Definition: ncbistr.hpp:123
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
const CharType(& source)[N]
Definition: pointer.h:1149
T max(T x_, T y_)
EExistingText
Modified on Thu May 30 12:29:41 2024 by modify_doxy.py rev. 669887