ddc
Public Member Functions | Public Attributes | List of all members
CQToken Class Reference

single-token query (abstract) More...

#include <Query.h>

Inheritance diagram for CQToken:
Inheritance graph
[legend]
Collaboration diagram for CQToken:
Collaboration graph
[legend]

Public Member Functions

 CQToken (const string &indexName=string(""), const string &value=string(""), const BYTE matchId=0)
 
virtual ~CQToken ()
 
virtual BYTE GetMatchId () const
 get local match-id More...
 
virtual BYTE SetMatchId (BYTE matchId)
 Set match-id, returns new value. Override sets m_MatchId. More...
 
virtual bool Compile (CQueryCompiler *compiler)
 Compile query. Default implementation just calls CQueryTokenNode::CreateStringPattern(m_IndexName,m_Value) More...
 
virtual bool Create (CQueryTokenNode *pNode)
 
virtual const char * OperatorKey (void) const
 Compilation utility: return query-operator key for use with CConcIndexator::m_OpDefaultIndexNames. More...
 
string IndexName (const string &DefaultIndexName=string(""))
 Compilation utility: get long index name (requires non-NULL compiler), empty string is returned if not found. More...
 
string BreakName (const string &DefaultBreakName=string(""))
 Compilation utility: get long break name (requires non-NULL compiler), empty string is returned if not found. More...
 
virtual string IndexString (void)
 Stringification utility for use by subclasses; returns string "$INDEX=" or empty. More...
 
virtual string ValueString (void)
 Stringification utility for use by subclasses; default returns sqString(m_Value) More...
 
virtual string MatchIdString (void)
 Stringification utility for use by subclasses; default should be sensible. More...
 
virtual string toString (void)
 Default stringification: NegString(IndexString() + ValueString()) More...
 
virtual string jsonValue (void)
 json stringification utility More...
 
virtual string jsonClass ()
 
virtual string jsonData ()
 
- Public Member Functions inherited from CQAtomic
 CQAtomic (const string &label=string(""), bool negated=false)
 Default constructor. More...
 
virtual ~CQAtomic ()
 
- Public Member Functions inherited from CQNegatable
 CQNegatable (const string &label=string(""), bool negated=false)
 Default constructor. More...
 
 CQNegatable (bool negated)
 
virtual ~CQNegatable ()
 
virtual bool Negate (void)
 toggle negation flag; returns new value More...
 
virtual bool Negated ()
 override returns current value of m_Negated More...
 
virtual string NegString (const std::string &s)
 string creation utility More...
 
- Public Member Functions inherited from CQuery
 CQuery (const string &label=string(""))
 Default constructor. More...
 
virtual ~CQuery (void)
 
virtual bool CheckSatisfiable (CQueryCompiler *compiler)
 
virtual bool CompileOptions (CQueryCompiler *compiler=NULL)
 
virtual void Evaluate ()
 
virtual bool HasMatchId () const
 Returns true iff this query uses a nontrival match-id operator; default checks (this->GetMatchId() != 0) More...
 
virtual bool RootOK ()
 Is this query an admissible root of a compiled parse tree (default returns !this->Negated()) More...
 
virtual ddcObjectList Children () const
 
virtual void DisownChildren ()
 
virtual string optionsToString ()
 DEBUG: return canonical option string More...
 
virtual string optionsToJson ()
 return json format option string More...
 
virtual string toJson ()
 
void SetCompiler (CQueryCompiler *compiler)
 
virtual void ClearNode ()
 deletes m_Node if non-NULL More...
 
virtual void ClearOptions ()
 deletes m_Options if non-NULL More...
 
virtual void Clear (bool deep=true)
 clear query contents. if deep is true, propagates operation to daughters More...
 
virtual void SetOptions (CQueryOptions *opts)
 set global query options ; deletes any pre-existing m_Options More...
 
- Public Member Functions inherited from ddcObject
 ddcObject ()
 Default constructor. More...
 
virtual ~ddcObject ()
 virtual destructor does nothing More...
 
template<typename Visit >
ddcObjectTraverse (Visit &visit)
 
template<typename Visit >
ddcObjectTraverse (Visit &visit) const
 
template<typename Visit >
ddcObjectTraverseR (Visit &visit)
 
template<typename Visit >
ddcObjectTraverseR (Visit &visit) const
 
virtual ddcObjectList Descendants () const
 

Public Attributes

string m_IndexName
 name of index to be queried (default="" (->"Token")) More...
 
string m_Value
 value to be searched for (default="") More...
 
BYTE m_MatchId
 
- Public Attributes inherited from CQNegatable
bool m_Negated
 whether this query is negated More...
 
- Public Attributes inherited from CQuery
string m_Label
 arbitrary name for this query node (e.g. string from which it was parsed) More...
 
CQueryCompilerm_Compiler
 associated query compiler (only set on Compile()) More...
 
CQueryNodem_Node
 underlying CQueryNode (DDC-v1.x API) More...
 
CQueryOptionsm_Options
 root-level options (root queries only) More...
 
- Public Attributes inherited from ddcObject
void * m_User
 user data associated with this object (for use e.g. by perl wrappers) More...
 

Detailed Description

single-token query (abstract)

Constructor & Destructor Documentation

◆ CQToken()

CQToken::CQToken ( const string &  indexName = string(""),
const string &  value = string(""),
const BYTE  matchId = 0 
)
inline

◆ ~CQToken()

virtual CQToken::~CQToken ( )
inlinevirtual

References CQuery::Compile(), CQuery::GetMatchId(), and CQuery::SetMatchId().

Here is the call graph for this function:

Member Function Documentation

◆ GetMatchId()

BYTE CQToken::GetMatchId ( ) const
virtual

get local match-id

Reimplemented from CQuery.

◆ SetMatchId()

BYTE CQToken::SetMatchId ( BYTE  matchId)
virtual

Set match-id, returns new value. Override sets m_MatchId.

Reimplemented from CQuery.

◆ Compile()

bool CQToken::Compile ( CQueryCompiler compiler)
virtual

Compile query. Default implementation just calls CQueryTokenNode::CreateStringPattern(m_IndexName,m_Value)

Reimplemented from CQNegatable.

References CQNegatable::Compile(), CQueryTokenNode::CreateNullPattern(), errParseError, CQueryCompiler::GetNewNodeIndex(), CQueryCompiler::m_bSatisfiable, CQuery::m_Node, CQueryCompiler::m_pHolder, CQuery::SetCompiler(), and CQuery::toString().

Here is the call graph for this function:

◆ Create()

bool CQToken::Create ( CQueryTokenNode pNode)
virtual

Compilation utility called by default Compile() method

  • SetCompiler() has already been called when this method runs
  • pNode = this->m_Node is the local CQueryTokenNode created for this query
  • default implementation just calls pNode->CreateStringPattern(m_IndexName,m_Value)

Reimplemented in CQTokFile, CQTokChunk, CQTokThes, CQTokLemma, CQTokMorph, CQTokInfixSet, CQTokSuffixSet, CQTokPrefixSet, CQTokInfix, CQTokSuffix, CQTokPrefix, CQTokSetInfl, CQTokInfl, CQTokSet, CQTokRegex, CQTokAnchor, and CQTokAny.

References CQueryTokenNode::CreateStringPattern(), CQuery::m_Compiler, and CQueryCompiler::m_pHolder.

Referenced by CQTokLemma::Create().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OperatorKey()

virtual const char* CQToken::OperatorKey ( void  ) const
inlinevirtual

Compilation utility: return query-operator key for use with CConcIndexator::m_OpDefaultIndexNames.

Reimplemented in CQTokFile, CQTokChunk, CQTokThes, CQTokLemma, CQTokMorph, CQTokInfixSet, CQTokSuffixSet, CQTokPrefixSet, CQTokInfix, CQTokSuffix, CQTokPrefix, CQTokInfl, CQTokSet, CQTokRegex, CQTokAnchor, CQTokAny, and CQTokExact.

References CQuery::toString().

Here is the call graph for this function:

◆ IndexName()

string CQToken::IndexName ( const string &  DefaultIndexName = string(""))

Compilation utility: get long index name (requires non-NULL compiler), empty string is returned if not found.

References CStringIndexator::GetIndexByAlias(), CQuery::m_Compiler, CStringIndexSet::m_Name, CConcordance::m_OpDefaultIndexNames, CConcSession::m_pConcordance, and CQueryCompiler::m_pHolder.

Here is the call graph for this function:

◆ BreakName()

string CQToken::BreakName ( const string &  DefaultBreakName = string(""))

Compilation utility: get long break name (requires non-NULL compiler), empty string is returned if not found.

References CHitBorders::GetBreakCollectionByName(), CQuery::m_Compiler, CHitBorders::CBreakCollection::m_LongName, CConcordance::m_OpDefaultIndexNames, CConcSession::m_pConcordance, and CQueryCompiler::m_pHolder.

Here is the call graph for this function:

◆ IndexString()

string CQToken::IndexString ( void  )
virtual

Stringification utility for use by subclasses; returns string "$INDEX=" or empty.

Reimplemented in CQTokAnchor.

◆ ValueString()

string CQToken::ValueString ( void  )
virtual

Stringification utility for use by subclasses; default returns sqString(m_Value)

Reimplemented in CQTokFile, CQTokChunk, CQTokThes, CQTokLemma, CQTokMorph, CQTokInfixSet, CQTokSuffixSet, CQTokPrefixSet, CQTokInfix, CQTokSuffix, CQTokPrefix, CQTokSetInfl, CQTokInfl, CQTokSet, CQTokRegex, CQTokAnchor, CQTokAny, and CQTokExact.

References sqString().

Referenced by CQTokInfl::ValueString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MatchIdString()

string CQToken::MatchIdString ( void  )
virtual

Stringification utility for use by subclasses; default should be sensible.

References Format().

Here is the call graph for this function:

◆ toString()

string CQToken::toString ( void  )
virtual

Default stringification: NegString(IndexString() + ValueString())

Reimplemented from CQuery.

◆ jsonValue()

string CQToken::jsonValue ( void  )
virtual

json stringification utility

Reimplemented in CQTokLemma, CQTokMorph, CQTokSetInfl, CQTokInfl, CQTokSet, and CQTokAnchor.

References jsonStr().

Referenced by CQTokInfl::jsonValue(), and CQTokLemma::jsonValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ jsonClass()

virtual string CQToken::jsonClass ( void  )
inlinevirtual

class-name for json strinfication

  • default implementation returns C++ class name

Reimplemented from CQAtomic.

Reimplemented in CQTokFile, CQTokChunk, CQTokThes, CQTokLemma, CQTokMorph, CQTokInfixSet, CQTokSuffixSet, CQTokPrefixSet, CQTokInfix, CQTokSuffix, CQTokPrefix, CQTokSetInfl, CQTokInfl, CQTokSet, CQTokRegex, CQTokAnchor, CQTokAny, and CQTokExact.

References CQuery::jsonData().

Here is the call graph for this function:

◆ jsonData()

string CQToken::jsonData ( void  )
virtual

instance data for json stringification

  • default implementation returns "NODATA":1, for strict syntax compliance

Reimplemented from CQNegatable.

Reimplemented in CQTokInfl.

References Format(), CQNegatable::jsonData(), and jsonStr().

Referenced by CQTokInfl::jsonData().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_IndexName

string CQToken::m_IndexName

name of index to be queried (default="" (->"Token"))

◆ m_Value

string CQToken::m_Value

value to be searched for (default="")

◆ m_MatchId

BYTE CQToken::m_MatchId

match-id for highlighting (TODO: and context-sort reference) initialized to 0; anything other than 0 is considered a non-trivial user-specified match-id


The documentation for this class was generated from the following files: