From a458ba0d3dc3fcf8a07d053fc2067554d6b1a7f5 Mon Sep 17 00:00:00 2001 From: dockes Date: Fri, 8 Dec 2006 10:54:38 +0000 Subject: [PATCH] *** empty log message *** --- src/query/wasastringtoquery.cpp | 6 ++---- src/query/wasastringtoquery.h | 21 ++++++++++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/query/wasastringtoquery.cpp b/src/query/wasastringtoquery.cpp index d5fa8fe3..cf815af2 100644 --- a/src/query/wasastringtoquery.cpp +++ b/src/query/wasastringtoquery.cpp @@ -1,5 +1,5 @@ #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 /* * This program is free software; you can redistribute it and/or modify @@ -135,8 +135,7 @@ public: if (m_rxneedsfree) regfree(&m_rx); } - bool StringToWasaQuery::Internal::checkSubMatch(int i, char *match, - string& reason) + bool checkSubMatch(int i, char *match, string& reason) { if (i < 0 || i >= int(NMATCH) || m_pmatch[i].rm_so == -1) return false; @@ -171,7 +170,6 @@ StringToWasaQuery::~StringToWasaQuery() delete internal; } - WasaQuery * StringToWasaQuery::stringToQuery(const string& str, string& reason) { diff --git a/src/query/wasastringtoquery.h b/src/query/wasastringtoquery.h index 5afe231f..dd765f19 100644 --- a/src/query/wasastringtoquery.h +++ b/src/query/wasastringtoquery.h @@ -1,6 +1,6 @@ #ifndef _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 * it under the terms of the GNU General Public License as published by @@ -24,7 +24,12 @@ using std::string; 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 { public: enum Op {OP_NULL, OP_LEAF, OP_EXCL, OP_OR, OP_AND}; @@ -33,17 +38,23 @@ public: WasaQuery() : m_op(OP_NULL) {} ~WasaQuery(); - // Get string describing this query + // Get string describing the query tree from this point void describe(string &desc) const; WasaQuery::Op m_op; string m_fieldspec; - vector m_subs; + /* Valid for op == OP_LEAF */ string m_value; + /* Valid for conjunctions */ + vector 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 { public: StringToWasaQuery();