xapian-core  1.4.26
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
Xapian::RangeProcessor Class Reference

Base class for range processors. More...

#include <queryparser.h>

+ Inheritance diagram for Xapian::RangeProcessor:
+ Collaboration diagram for Xapian::RangeProcessor:

Public Member Functions

 RangeProcessor ()
 Default constructor. More...
 
 RangeProcessor (Xapian::valueno slot_, const std::string &str_=std::string(), unsigned flags_=0)
 Constructor. More...
 
virtual ~RangeProcessor ()
 Destructor. More...
 
Xapian::Query check_range (const std::string &b, const std::string &e)
 Check prefix/suffix on range. More...
 
virtual Xapian::Query operator() (const std::string &begin, const std::string &end)
 Check for a valid range of this type. More...
 
RangeProcessorrelease ()
 Start reference counting this object. More...
 
const RangeProcessorrelease () const
 Start reference counting this object. More...
 
- Public Member Functions inherited from Xapian::Internal::opt_intrusive_base
 opt_intrusive_base (const opt_intrusive_base &)
 
opt_intrusive_baseoperator= (const opt_intrusive_base &)
 
 opt_intrusive_base ()
 Construct object which is initially not reference counted. More...
 
virtual ~opt_intrusive_base ()
 
void ref () const
 
void unref () const
 

Protected Attributes

Xapian::valueno slot
 The value slot to process. More...
 
std::string str
 The prefix (or suffix with RP_SUFFIX) string to look for. More...
 
unsigned flags
 Flags. More...
 

Private Member Functions

void operator= (const RangeProcessor &)
 Don't allow assignment. More...
 
 RangeProcessor (const RangeProcessor &)
 Don't allow copying. More...
 

Additional Inherited Members

- Public Attributes inherited from Xapian::Internal::opt_intrusive_base
unsigned _refs
 Reference count. More...
 
- Protected Member Functions inherited from Xapian::Internal::opt_intrusive_base
void release () const
 Start reference counting. More...
 

Detailed Description

Base class for range processors.

Definition at line 140 of file queryparser.h.

Constructor & Destructor Documentation

◆ RangeProcessor() [1/3]

Xapian::RangeProcessor::RangeProcessor ( const RangeProcessor )
private

Don't allow copying.

◆ RangeProcessor() [2/3]

Xapian::RangeProcessor::RangeProcessor ( )
inline

Default constructor.

Definition at line 173 of file queryparser.h.

◆ RangeProcessor() [3/3]

Xapian::RangeProcessor::RangeProcessor ( Xapian::valueno  slot_,
const std::string &  str_ = std::string(),
unsigned  flags_ = 0 
)
inlineexplicit

Constructor.

Parameters
slot_Which value slot to generate ranges over.
str_A string to look for to recognise values as belonging to this range (as a prefix by default, or as a suffix if flags Xapian::RP_SUFFIX is specified).
flags_Zero or more of the following flags, combined with bitwise-or (| in C++):
  • Xapian::RP_SUFFIX - require str_ as a suffix instead of a prefix.
  • Xapian::RP_REPEATED - optionally allow str_ on both ends of the range - e.g. $1..$10 or 5m..50m. By default a prefix is only checked for on the start (e.g. date:1/1/1980..31/12/1989), and a suffix only on the end (e.g. 2..12kg).

Definition at line 191 of file queryparser.h.

◆ ~RangeProcessor()

RangeProcessor::~RangeProcessor ( )
virtual

Destructor.

Definition at line 60 of file queryparser.cc.

Member Function Documentation

◆ check_range()

Xapian::Query Xapian::RangeProcessor::check_range ( const std::string &  b,
const std::string &  e 
)

Check prefix/suffix on range.

If they match, remove the prefix/suffix and then call operator()() to try to handle the range.

Definition at line 261 of file valuerangeproc.cc.

References endswith(), Xapian::Query::OP_INVALID, Xapian::RP_REPEATED, Xapian::RP_SUFFIX, startswith(), and Xapian::Internal::str().

◆ operator()()

Xapian::Query Xapian::RangeProcessor::operator() ( const std::string &  begin,
const std::string &  end 
)
virtual

Check for a valid range of this type.

Override this method to implement your own range handling.

Parameters
beginThe start of the range as specified in the query string by the user.
endThe end of the range as specified in the query string by the user (empty string for no upper limit).
Returns
An OP_VALUE_RANGE Query object (or if end.empty(), an OP_VALUE_GE Query object). Or if the range isn't one which this object can handle then Xapian::Query(Xapian::Query::OP_INVALID) will be returned.

Reimplemented in AuthorRangeProcessor, Xapian::NumberRangeProcessor, Xapian::DateRangeProcessor, and TestRangeProcessor.

Definition at line 303 of file valuerangeproc.cc.

References Xapian::Query::OP_VALUE_GE, and Xapian::Query::OP_VALUE_RANGE.

Referenced by Xapian::QueryParser::add_valuerangeprocessor(), and AuthorRangeProcessor::operator()().

◆ operator=()

void Xapian::RangeProcessor::operator= ( const RangeProcessor )
private

Don't allow assignment.

◆ release() [1/2]

RangeProcessor* Xapian::RangeProcessor::release ( )
inline

Start reference counting this object.

You can transfer ownership of a dynamically allocated RangeProcessor object to Xapian by calling release() and then passing the object to a Xapian method. Xapian will arrange to delete the object once it is no longer required.

Definition at line 231 of file queryparser.h.

Referenced by DEFINE_TESTCASE().

◆ release() [2/2]

const RangeProcessor* Xapian::RangeProcessor::release ( ) const
inline

Start reference counting this object.

You can transfer ownership of a dynamically allocated RangeProcessor object to Xapian by calling release() and then passing the object to a Xapian method. Xapian will arrange to delete the object once it is no longer required.

Definition at line 243 of file queryparser.h.

Member Data Documentation

◆ flags

unsigned Xapian::RangeProcessor::flags
protected

Flags.

Bitwise-or (| in C++) of zero or more of the following:

  • Xapian::RP_SUFFIX - require str as a suffix instead of a prefix.
  • Xapian::RP_REPEATED - optionally allow str on both ends of the range - e.g. $1..$10 or 5m..50m. By default a prefix is only checked for on the start (e.g. date:1/1/1980..31/12/1989), and a suffix only on the end (e.g. 2..12kg).

Definition at line 169 of file queryparser.h.

◆ slot

Xapian::valueno Xapian::RangeProcessor::slot
protected

The value slot to process.

If this range processor isn't value-based, it can ignore this member.

Definition at line 153 of file queryparser.h.

◆ str

std::string Xapian::RangeProcessor::str
protected

The prefix (or suffix with RP_SUFFIX) string to look for.

Definition at line 156 of file queryparser.h.


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