*** empty log message ***
This commit is contained in:
parent
554f75c99c
commit
a458ba0d3d
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: wasastringtoquery.cpp,v 1.1 2006-11-30 18:12:16 dockes Exp $ (C) 2006 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: wasastringtoquery.cpp,v 1.2 2006-12-08 10:54:38 dockes Exp $ (C) 2006 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -135,8 +135,7 @@ public:
|
|||||||
if (m_rxneedsfree)
|
if (m_rxneedsfree)
|
||||||
regfree(&m_rx);
|
regfree(&m_rx);
|
||||||
}
|
}
|
||||||
bool StringToWasaQuery::Internal::checkSubMatch(int i, char *match,
|
bool checkSubMatch(int i, char *match, string& reason)
|
||||||
string& reason)
|
|
||||||
{
|
{
|
||||||
if (i < 0 || i >= int(NMATCH) || m_pmatch[i].rm_so == -1)
|
if (i < 0 || i >= int(NMATCH) || m_pmatch[i].rm_so == -1)
|
||||||
return false;
|
return false;
|
||||||
@ -171,7 +170,6 @@ StringToWasaQuery::~StringToWasaQuery()
|
|||||||
delete internal;
|
delete internal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WasaQuery *
|
WasaQuery *
|
||||||
StringToWasaQuery::stringToQuery(const string& str, string& reason)
|
StringToWasaQuery::stringToQuery(const string& str, string& reason)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#ifndef _WASASTRINGTOQUERY_H_INCLUDED_
|
#ifndef _WASASTRINGTOQUERY_H_INCLUDED_
|
||||||
#define _WASASTRINGTOQUERY_H_INCLUDED_
|
#define _WASASTRINGTOQUERY_H_INCLUDED_
|
||||||
/* @(#$Id: wasastringtoquery.h,v 1.1 2006-11-30 18:12:16 dockes Exp $ (C) 2006 J.F.Dockes */
|
/* @(#$Id: wasastringtoquery.h,v 1.2 2006-12-08 10:54:38 dockes Exp $ (C) 2006 J.F.Dockes */
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -24,7 +24,12 @@
|
|||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
// A simple class to represent a parsed wasabi query string.
|
/**
|
||||||
|
* A simple class to represent a parsed wasabiSimple query
|
||||||
|
* string. Can hold a string value or an array of subqueries.
|
||||||
|
* The value can hold one or several words. In the latter case, it should
|
||||||
|
* be interpreted as a phrase (comes from a user-entered "quoted string").
|
||||||
|
*/
|
||||||
class WasaQuery {
|
class WasaQuery {
|
||||||
public:
|
public:
|
||||||
enum Op {OP_NULL, OP_LEAF, OP_EXCL, OP_OR, OP_AND};
|
enum Op {OP_NULL, OP_LEAF, OP_EXCL, OP_OR, OP_AND};
|
||||||
@ -33,17 +38,23 @@ public:
|
|||||||
WasaQuery() : m_op(OP_NULL) {}
|
WasaQuery() : m_op(OP_NULL) {}
|
||||||
~WasaQuery();
|
~WasaQuery();
|
||||||
|
|
||||||
// Get string describing this query
|
// Get string describing the query tree from this point
|
||||||
void describe(string &desc) const;
|
void describe(string &desc) const;
|
||||||
|
|
||||||
WasaQuery::Op m_op;
|
WasaQuery::Op m_op;
|
||||||
string m_fieldspec;
|
string m_fieldspec;
|
||||||
vector<WasaQuery*> m_subs;
|
/* Valid for op == OP_LEAF */
|
||||||
string m_value;
|
string m_value;
|
||||||
|
/* Valid for conjunctions */
|
||||||
|
vector<WasaQuery*> m_subs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Wasabi query string parser class.
|
/**
|
||||||
|
* Wasabi query string parser class. Could be a simple function
|
||||||
|
* really, but there might be some parser initialization work done in
|
||||||
|
* the constructor.
|
||||||
|
*/
|
||||||
class StringToWasaQuery {
|
class StringToWasaQuery {
|
||||||
public:
|
public:
|
||||||
StringToWasaQuery();
|
StringToWasaQuery();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user