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

Go to the SVN repository for this file.

1 #ifndef GUI_OBJUTILS___MACRO_FIELD_RESOLVE__HPP
2 #define GUI_OBJUTILS___MACRO_FIELD_RESOLVE__HPP
3 /* $Id: macro_field_resolve.hpp 37809 2017-02-17 15:50:55Z 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  * Functions used for resolving fields based on their names for editing, removal or setting
32  */
33 
34 /// @file macro_field_resolve.hpp
35 /// Functions that resolve field names described in asn format
36 
37 #include <corelib/ncbiobj.hpp>
38 #include <serial/objectinfo.hpp>
41 #include <objects/seq/MolInfo.hpp>
42 
43 /** @addtogroup GUI_MACRO_SCRIPTS_UTIL
44  *
45  * @{
46  */
47 
49 BEGIN_SCOPE(macro)
50 
51 // Functions GetFieldsByName(), SetFieldsByName() and RemoveFieldByName() should not be part of the IMacroBioDataIter
52 // interface, as in many instances, the object information instance is not related to the biodata iterator
53 
54 /// Resolve existing dot qualified ASN.1 name (field_name) starting from the object information instance
55 /// provided as a parameter (oi_i). The result is the list of CObjectInfo pairs, composed of the field and its parent.
56 ///
57 /// @return false if the name cannot be resolved.
58 /// @return true and an empty results if the field is valid, but has not been set
59 NCBI_GUIOBJUTILS_EXPORT bool GetFieldsByName(CMQueryNodeValue::TObs* results, const CObjectInfo& oi_i, const string& field_name);
60 
61 /// Resolve not necessarily existing dot qualified ASN.1 name (field_name) starting from the
62 /// object information instance provided as a parameter (oi_i).
63 ///
64 /// @return false if the name cannot be resolved.
65 NCBI_GUIOBJUTILS_EXPORT bool SetFieldsByName(CMQueryNodeValue::TObs* results, CObjectInfo& oi_i, const string& field_name);
66 
67 /// Remove the object information instance corresponding to field, using information about its parent node
68 /// @return true if the field was removed
70 
71 /// Resolve dot qualified ASN.1 node_name using the object information instance
72 /// provided as a parameter (oi) and sets node data.
74  const string& field_name,
75  const CMQueryNodeValue& value,
77 
78 /// Set single node data to the node specified by parameter of type CObjectInfo.
80  const CMQueryNodeValue& value,
82 
83 /// Get single node data from the node specified by parameter of type CObjectInfo
84 /// and additionally field field_name (set to empty string if oi is already at primitive value)
86 
87 /// Get a primitive value from oi
89 
90 /// Resolve name to simple types value
91 NCBI_GUIOBJUTILS_EXPORT bool ResolveIdentToSimple(const CObjectInfo& oi, const string& identifier, CMQueryNodeValue& v);
92 
93 /// Resolve name to the list of objects
94 NCBI_GUIOBJUTILS_EXPORT bool ResolveIdentToObjects(const CObjectInfo& oi, const string& identifier, CMQueryNodeValue& v);
95 
96 END_SCOPE(macro)
98 
99 /* @} */
100 
101 #endif // GUI_OBJUTILS___MACRO_FIELD_RESOLVE__HPP
Subclass of the IQueryParseUserObject which is held as the user-defined object in each CQueryParseNod...
Definition: macro_exec.hpp:71
CObjectInfo –.
Definition: objectinfo.hpp:597
bool ResolveAndSetSimpleTypeValue(CObjectInfo &oi, const string &field_name, const CMQueryNodeValue &value, objects::edit::EExistingText existing_text=objects::edit::eExistingText_replace_old)
Resolve dot qualified ASN.1 node_name using the object information instance provided as a parameter (...
bool RemoveFieldByName(CMQueryNodeValue::SResolvedField &res_field)
Remove the object information instance corresponding to field, using information about its parent nod...
list< SResolvedField > TObs
Definition: macro_exec.hpp:92
bool GetSimpleTypeValue(CObjectInfo &oi, const string &field_name, CMQueryNodeValue &value)
Get single node data from the node specified by parameter of type CObjectInfo and additionally field ...
bool ResolveIdentToObjects(const CObjectInfo &oi, const string &identifier, CMQueryNodeValue &v)
Resolve name to the list of objects.
bool SetSimpleTypeValue(CObjectInfo &oi, const CMQueryNodeValue &value, objects::edit::EExistingText existing_text=objects::edit::eExistingText_replace_old)
Set single node data to the node specified by parameter of type CObjectInfo.
bool GetFieldsByName(CMQueryNodeValue::TObs *results, const CObjectInfo &oi_i, const string &field_name)
Resolve existing dot qualified ASN.1 name (field_name) starting from the object information instance ...
bool ResolveIdentToSimple(const CObjectInfo &oi, const string &identifier, CMQueryNodeValue &v)
Resolve name to simple types value.
bool SetFieldsByName(CMQueryNodeValue::TObs *results, CObjectInfo &oi_i, const string &field_name)
Resolve not necessarily existing dot qualified ASN.1 name (field_name) starting from the object infor...
bool GetPrimitiveValue(const CObjectInfo &oi, CMQueryNodeValue &value)
Get a primitive value from oi.
#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
#define NCBI_GUIOBJUTILS_EXPORT
Definition: gui_export.h:512
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
EExistingText
@ eExistingText_replace_old
Modified on Tue Apr 16 20:08:47 2024 by modify_doxy.py rev. 669887