field_name, container;
108 if(
m_Args[0]->IsString()) {
109field_name =
m_Args[0]->GetString();
111container = field_name;
112field_name =
m_Args[1]->GetString();
115 if(field_name.empty() || (
m_Modifier&& container.empty()))
124 else if(
m_Args[0]->AreStrings()) {
125 constvector<string>& strs =
m_Args[0]->GetStrings();
126 for(
auto& it : strs) {
133 else if(
m_Args[0]->AreObjects()) {
142 else if(
m_Args[0]->IsRef()) {
143 m_Args[0]->Dereference();
144 if(
m_Args[0]->IsString()) {
147 else if(
m_Args[0]->AreObjects()) {
152 else if(
m_Args[0]->AreStrings()) {
153 constvector<string>& strs =
m_Args[0]->GetStrings();
154 for(
auto& it : strs) {
178 size_tas =
m_Args.size();
179 boolfirst_ok =
m_Args[0]->IsString() ||
180 m_Args[0]->AreStrings() ||
181 m_Args[0]->AreObjects() ||
185 if(as > 2 || !first_ok)
187 if(as == 2 && !
m_Args[1]->IsString())
190 if(as < 2 || !first_ok || !(
m_Args[1]->IsString() ||
m_Args[1]->IsInt() ||
m_Args[1]->IsDouble()))
216 return(
file.Exists());
225 if(
m_Args.size() == 2) {
230 if(
m_Args.size() > 2 &&
271 size_targ_size =
m_Args.size();
275 if(
check< arg_size) {
299 for( ;
n<
min(arg_size, opt_max); ++
n) {
344index =
min(opt_max,
n);
347 if(index &&
m_Args[index]->IsString()) {
348 stringsynonym_file =
m_Args[index]->GetString();
351 if(
n> arg_size || (
n< arg_size && !
m_Args[
n]->IsString())) {
356list<CRef<CWord_substitution> > word_subst_list;
357 while(
n< arg_size ) {
358 if(
m_Args[
n]->IsString()) {
363 "Synonyms for phrase '"+
m_Args[
n]->GetString() +
"' were not found in '"+ synonym_file +
"' file",
nullptr);
365 if(
n+ 1 < arg_size &&
m_Args[
n+ 1]->IsBool()) {
366word_subst->SetCase_sensitive(
m_Args[
n+ 1]->GetBool());
369 if(
n+ 1 < arg_size &&
m_Args[
n+ 1]->IsBool()) {
370word_subst->SetWhole_word(
m_Args[
n+ 1]->GetBool());
373word_subst_list.push_back(word_subst);
380 if(!word_subst_list.empty()) {
381 m_Constraint->SetIgnore_words().Set() = word_subst_list;
388 if(filename.empty() || phrase.empty()) {
389 LOG_POST(
Error<<
"Either synonym filename '"<< filename <<
"' or phrase '"<< phrase <<
"' is empty");
407 const char* kOptional =
"optional-";
408 const char* kEmpty =
"emptystring";
414word_subst->SetWord(word);
420 if(word_subst->GetSynonyms().empty()) {
421word_subst.
Reset();
425 stringword = phrase.substr(
sm_syn.size() + 3,
NPOS);
427word_subst->SetWord(word);
429 if(word_subst->GetSynonyms().empty()) {
430word_subst.
Reset();
435word_subst->SetWord(phrase);
437 if(word_subst->GetSynonyms().empty()) {
438word_subst.
Reset();
446 if(filename.empty() || phrase.empty()) {
447 LOG_POST(
Error<<
"Either synonym filename '"<< filename <<
"' or phrase '"<< phrase <<
"' is empty");
465 const char* kOptional =
"optional-";
466 const char* kEmpty =
"emptystring";
472word_subst->SetWord(word);
478 if(word_subst->GetSynonyms().empty()) {
479word_subst.
Reset();
483 stringword = phrase.substr(
sm_syn.size() + 3,
NPOS);
485word_subst->SetWord(word);
487 if(word_subst->GetSynonyms().empty()) {
488word_subst.
Reset();
493word_subst->SetWord(phrase);
495 if(word_subst->GetSynonyms().empty()) {
496word_subst.
Reset();
519 boolconstr_sat =
false;
521 while(elem.
Valid() && !constr_sat) {
559 boolall_authors =
true;
560 for(
auto& it : objs) {
561 if(it.field.GetName() !=
"Name-std") {
562all_authors =
false;
607 if(!
GetFieldsByName(&res_oi, objinfo, container) || res_oi.empty()) {
611 boolconstr_sat =
false;
616 while(elem.
Valid() && !constr_sat) {
645 if(!mem.
Valid()) {
650 if(!
GetFieldsByName(&type_objs, obj, mem_name) || type_objs.size() != 1) {
655 boolsubtype_found =
false;
678subtype_found =
true;
693 if(!mem.
Valid()) {
699 if(!
GetFieldsByName(&type_objs, obj, mem_name) || type_objs.size() != 1) {
703oi = type_objs.front().field;
User-defined methods of the data storage class.
Subclass of the IQueryParseUserObject which is held as the user-defined object in each CQueryParseNod...
class CMacroExecException
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Base class for any user function that performs editing operations on ASN.1 data.
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const CMemberId & GetId(void) const
const string & GetName(void) const
static const char * sm_Contain
static const char * sm_Lower
void x_BuildCaseStringConstraint(void)
void ThrowCMacroExecException(const CDiagCompileInfo &info, CMacroExecException::EErrCode code, const string &message, const CQueryParseTree::TNode *treeNode, const CException *previous=nullptr)
Throws CMacroExecException with the specified message and error location from the TNode.
bool x_CheckAuthorNames(const CObjectInfo &obj)
const list< string > GetSynonymListForPhrase(const string &phrase) const
Function returns the synonym list of a given phrase.
virtual bool x_ValidArguments() const
checks whether the arguments number and their type is good and sets the m_Modifier flag in case of a ...
static const char * sm_InList
static const char * sm_Equal
bool x_CheckConstraintWithinClass(const CObjectInfo &obj, const string &subtype)
list< SResolvedField > TObs
static const char * sm_UpperAll
static const string sm_syn
Classes related to STRING CONSTRAINTS.
void Dereference()
If it is a reference it is resolved to the first non reference type in the hierarchy.
const TObs & GetObjects() const
bool m_Modifier
flag that indicates that the field to be checked is a modifier
virtual void TheFunction()
Function implementation.
void SetDataType(EType dt)
string GetStringValue(CRef< CMQueryNodeValue > &value)
converts ints and doubles into string, by changing the type of the value
bool x_CheckConstraintPrimitive(const string &field)
static const char * sm_PunctAll
static const char * sm_Punct
static const char * sm_Upper
virtual CRef< objects::CWord_substitution > x_ReadSynonymsFor(const string &filename, const string &phrase)
EStrConstrCase m_TestCase
indicates to test for the case of the phrase
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 ...
virtual CRef< objects::CWord_substitution > x_ReadSynonymsFor(const string &filename, const string &phrase)
CRef< objects::CString_constraint > m_Constraint
the string constraint
bool x_CheckConstraintObjects(const CMQueryNodeValue::TObs &objs)
CRef< CMQueryNodeValue > m_Result
static const char * sm_End
void x_BuildNoCaseStringConstraint(void)
virtual bool x_IsNestedFunctionReturnValid() const
static const char * sm_LowerAll
CMacroFunction_StringConstraints(EScopeEnum func_scope, const string &type, EStrConstrCase testcase=eNotSet, ELogicType op_type=eOR)
string m_Type
specifies the type of pattern matching
static CMacroLib & GetInstance()
ELogicType m_Operation
flag to indicate whether to use OR or AND operation for the input values
void SwapGbQualWithValues(CMQueryNodeValue::TObs &objs)
static const char * sm_Start
bool x_CheckStringConstraint(const CObjectInfo &oi)
static bool s_IsStringMatching(const string &fn_name)
CIRef< IMacroBioDataIter > m_DataIter
bool x_CheckConstraintContainer(const string &container, const string &subtype)
virtual CRef< objects::CWord_substitution > x_ReadSynonymsFor(const string &filename, const string &phrase)=0
void x_BuildStringConstraint(void)
builds a new string constraint to later match with the value of the field
static bool s_IsSynonymFile(const string &str)
size_t TMemberIndex
Type used for indexing class members and choice variants.
@ ePrimitiveValueString
string|char*|const char*
@ ePrimitiveValueEnum
enum
bool Valid(void) const
Is iterator valid.
CElementIterator BeginElements(void) const
Create container elements iterator.
CObjectInfo GetPointedObject(void) const
Get data and type information of object to which this type refers.
CObjectInfo GetElement(void) const
Get element data and type information.
const CMemberInfo * GetMemberInfo(void) const
CMemberIterator BeginMembers(void) const
Create class member iterator.
CObjectInfo GetMember(void) const
Get class member data.
CChoiceVariant GetCurrentChoiceVariant(void) const
Get data and type information of selected choice variant.
CObjectInfo GetVariant(void) const
Get variant data.
bool Valid(void) const
Is iterator valid.
CMemberIterator GetClassMemberIterator(TMemberIndex index) const
Create class member iterator that initially points to specified member.
ETypeFamily GetTypeFamily(void) const
Get data type family.
void GetPrimitiveValueString(string &value) const
Get string data.
Int4 GetPrimitiveValueInt4(void) const
Get data as Int4.
const string & GetName(void) const
Get type name.
EPrimitiveValueType GetPrimitiveValueType(void) const
Get type of primitive value.
bool IsSet(void) const
Is member assigned a value.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define USING_SCOPE(ns)
Use the specified namespace.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
@ eString_location_inlist
@ eString_location_equals
@ eString_location_contains
@ eString_location_starts
Macro engine for macro execution.
Functions that resolve field names described in asn format.
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4