(
value.m_Type) {
75: m_String(
str), m_Type(eValueTypeString)
153:
IMacroVar(name), m_DefaultValue(def_value), m_NewValue(def_value)
169 if(errno != 0 && !data_int) {
205 for(
size_tindex = 0; index <
m_Choices.size(); ++index) {
206 if(
m_Choices[index].AsString() == new_value) {
231os <<
" "<<
"Choices are: "<< endl;
233os << it.AsString() << endl;
255, m_NumOfVarBlocks(0)
256, m_ActiveNode(
NULL)
268TVariables::iterator it_v = (*it_b).begin();
269 for(; it_v != (*it_b).end(); ++it_v) {
298created_node->
GetValue().SetLoc(pos);
308created_node->
GetValue().SetLoc(pos);
318created_node->
GetValue().SetLoc(pos);
328created_node->
GetValue().SetLoc(pos);
337created_node =
m_DoTree->CreateNode(
value,
string(
"\"") +
value+
"\"",
false);
338created_node->
GetValue().SetLoc(pos);
354ref_node =
m_DoTree->CreateNode(
Int8(func_size), where_str);
357assignment_node->
AddNode(ref_node);
378var_block.push_back(var);
389var_block.push_back(var);
400var_block.push_back(var);
411var_block.push_back(var);
422var_block.push_back(var);
433var_block.push_back(var);
484 for(
auto& var_iter : block_it) {
485 if(var_iter->GetName() == name)
513 if(
m_VarIter!= (*m_BlockIter).end()) {
525 if(
m_VarIter!= (*m_BlockIter).end()) {
535 if(
m_VarIter!= (*m_BlockIter).end()) {
554 stringseparator(40,
'-'), main_sep(40,
'=');
556os << main_sep << endl;
558os <<
"Name: "<<
m_Name<< endl << endl;
559os <<
"Title: "<<
m_Title<< endl << endl;
560os <<
"\"Foreach\" selector: "<<
m_Foreach<< endl << endl;
562os <<
"Defined variables: ";
565TVarBlocks::const_iterator itb =
m_VarBlocks.begin();
568TVariables::const_iterator itv = vars.begin();
569 for(; itv != vars.end(); ++itv)
574os <<
"None."<< endl;
583 while(
i++,
i< vsize) {
590os << main_sep << endl;
594 const string& title,
const string& separator)
const 596os << separator << endl;
603os <<
"None"<< endl;
Class for "ask" variable representation (i.e.
Class for "choice" variable representation (i.e.
derived classes for representation of specific variable types.
Query execution environment holds the function registry and the execution context.
Query tree and associated utility methods.
definition of a Culling tree
Abstract interface for variable representation.
class IQueryMacroUserObject
virtual void SetDouble(double data)=0
virtual void SetString(const string &data)=0
Set/get underlying data type.
virtual void SetBool(bool data)=0
virtual void SetInt(Int8 data)=0
The NCBI C++ standard methods for dealing with std::string.
static const char * str(char *buf, int n)
virtual void Print(CNcbiOstream &os) const
Prints variable.
void AddChoiceFloat(double value)
void x_WriteAsString(void)
bool GetNodeValue(const string &name, IQueryMacroUserObject &v) const
Function fills in IQueryMacroUserObject-derived node out of stored variable.
CQueryExec * m_Exec
Execution objection associated with this macro (may be NULL)
void Print(CNcbiOstream &os) const
Output class content to NcbiCout.
TVarBlocks m_VarBlocks
Variables.
vector< SValue > m_Choices
Storage for "choice" variable values.
string m_Name
Macro name.
string m_Title
Macro title.
void SetVarChoiceString(const string &value)
virtual bool IsGUIResolvable() const =0
Returns true is the variable can be resolved via GUI.
static const string m_TopFuncName
Name for top level function.
Int4 m_NumOfVarBlocks
Number of blocks of variables.
virtual SValue x_GetValue() const =0
Gets the variable value from derived classes.
void SetAssignmentWhereClause(const string &where_str, CQueryParseTree *where_tree, const CQueryParseNode::SSrcLoc &pos)
Set the function Where clause as a part of an assignment operator.
const string * GetFirstChoice()
Get functions for stored choices.
virtual void Print(CNcbiOstream &os) const
Prints variable.
const string * GetNextChoice()
void SetFunctionParameterAsIdent(const string &name, const CQueryParseNode::SSrcLoc &pos)
Set the function parameters.
void SetFunctionParameterAsBool(bool value, const CQueryParseNode::SSrcLoc &pos)
virtual bool SetGUIResolvedValue(const string &new_value)
Sets GUI resolved value.
SValue(const string &str)
void SetVarFloat(const string &name, double value)
void SetVarString(const string &name, const string &value)
string m_Foreach
For each string.
CMacroRep(CQueryExec *exec=NULL)
Constructor.
bool GetNodeValue(IQueryMacroUserObject &v) const
Fill in IQueryMacroUserObject-derived node Return true if successful.
size_t m_ReturnedChoice
Internal state for get choices functions.
CQueryParseTree * GetAssignmentWhereClause(int index) const
IMacroVar * GetNextVar(Int4 &block_num)
void x_PrintTree(CNcbiOstream &os, CQueryParseTree *tree, const string &title, const string &separator) const
Print a tree with a given header and separator.
CMacroVarAsk(const string &name, const string &def_value)
Constructor.
virtual bool SetGUIResolvedValue(const string &new_value)
Sets GUI resolved value.
void SetFunctionParameterAsString(const string &value, const CQueryParseNode::SSrcLoc &pos)
IMacroVar * x_FindVar(const string &name) const
Locate the variable if it was stored.
TVariables & x_GetOrCreateLastBlock()
Helper function. It finds or creates a block for new variable.
void SetFunctionParameterAsFloat(double value, const CQueryParseNode::SSrcLoc &pos)
void SetVarChoiceBool(bool value)
unique_ptr< CQueryParseTree > m_DoTree
Parsed function calls.
SValue m_DefaultValue
Default value of "ask" variable.
virtual void Print(CNcbiOstream &os) const
Prints variable.
TVarBlocks::iterator m_BlockIter
vector< CQueryParseTree * > m_FuncWhereClauses
Vector of parsed function Where clauses.
SValue m_NewValue
User defined value of "ask" variable.
bool FindVar(const string &name) const
Look up the variable among the stored ones.
void SetFunction(const string &name, const CQueryParseNode::SSrcLoc &pos, CQueryParseTree::TNode *parentNode=0)
Set function name.
size_t m_Selection
User defined selection of choice value.
void SetVarChoiceName(const string &name)
void x_ParseString(const string &str, bool new_value=false)
void Set(const string &str)
virtual SValue x_GetValue() const
Returns the variable value.
void SetVarInt(const string &name, Int8 value)
IMacroVar * GetFirstVar(Int4 &block_num)
Return functions for stored vars.
TVariables::iterator m_VarIter
void SetVarChoiceInt(Int8 value)
unique_ptr< CQueryParseTree > m_WhereTree
Parsed Where-clause.
void SetVarAsk(const string &name, const string &value)
void SetVarChoiceFloat(double value)
void AttachWhereTree(CQueryParseTree *pWhereTree)
Attach where tree after its constrution in qParser.
void AddChoiceString(const string &value)
void AddChoiceBool(bool value)
const string & AsString() const
CQueryParseTree::TNode * m_ActiveNode
Active tree node in where clause.
bool HasIdentifier(const string &ident) const
Return true if identifier is in datasource (only works if m_Exec not NULL)
void SetFunctionParameterAsInt(Int8 value, const CQueryParseNode::SSrcLoc &pos)
void SetVarBool(const string &name, bool value)
void AddChoiceInt(Int8 value)
IMacroVar * GetVar(const string &name) const
Return nullptr when the variable is not found.
bool m_GUIResolvable
True if there is at least one GUI resolvable var.
list< IMacroVar * > TVariables
Typedef vector of variables.
int32_t Int4
4-byte (32-bit) signed integer
int64_t Int8
8-byte (64-bit) signed integer
virtual bool HasIdentifier(const std::string &)
@ eIdentifier
Identifier like db.field (Org, Fld12, etc.)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
static string Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to string.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
static Int8 StringToInt8(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to Int8.
static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)
Convert string to double.
static const string BoolToString(bool value)
Convert bool to string.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
@ fConvErr_NoThrow
Do not throw an exception on error.
void AddNode(TTreeType *subnode)
Add new subnode.
const TValue & GetValue(void) const
Return node's value.
const TTreeType * GetParent(void) const
Get node's parent.
unsigned int
A callback function used to compare two keys in a database.
const GenericPointer< typename T::ValueType > T2 value
Source location (points to the position in the original src) All positions are 0 based.
Variable value storage structure.
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