Switch to unified view

a/src/query/wasastringtoquery.h b/src/query/wasastringtoquery.h
1
#ifndef _WASASTRINGTOQUERY_H_INCLUDED_
1
#ifndef _WASASTRINGTOQUERY_H_INCLUDED_
2
#define _WASASTRINGTOQUERY_H_INCLUDED_
2
#define _WASASTRINGTOQUERY_H_INCLUDED_
3
/* @(#$Id: wasastringtoquery.h,v 1.2 2006-12-08 10:54:38 dockes Exp $  (C) 2006 J.F.Dockes */
3
/* @(#$Id: wasastringtoquery.h,v 1.3 2006-12-10 17:03:08 dockes Exp $  (C) 2006 J.F.Dockes */
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
8
 *   (at your option) any later version.
8
 *   (at your option) any later version.
...
...
33
class WasaQuery {
33
class WasaQuery {
34
public:
34
public:
35
    enum Op {OP_NULL, OP_LEAF, OP_EXCL, OP_OR, OP_AND};
35
    enum Op {OP_NULL, OP_LEAF, OP_EXCL, OP_OR, OP_AND};
36
    typedef vector<WasaQuery*> subqlist_t;
36
    typedef vector<WasaQuery*> subqlist_t;
37
37
38
    WasaQuery() :  m_op(OP_NULL) {}
38
    WasaQuery() 
39
  : m_op(OP_NULL), m_typeKind(WQTK_NONE)
40
    {}
39
    ~WasaQuery();
41
    ~WasaQuery();
40
42
41
    // Get string describing the query tree from this point
43
    // Get string describing the query tree from this point
42
    void describe(string &desc) const;
44
    void describe(string &desc) const;
43
45
44
    WasaQuery::Op            m_op;
46
    WasaQuery::Op      m_op;
45
    string                   m_fieldspec;
47
    string             m_fieldspec;
46
    /* Valid for op == OP_LEAF */
48
    /* Valid for op == OP_LEAF */
47
    string                   m_value;
49
    string             m_value;
48
    /* Valid for conjunctions */
50
    /* Valid for conjunctions */
49
    vector<WasaQuery*>       m_subs;
51
    vector<WasaQuery*> m_subs;
52
    
53
    /* Restrict results to some file type, defined by either mime, app group, 
54
     * or extension */
55
    enum TypeKind {WQTK_NONE, WQTK_MIME, WQTK_GROUP, WQTK_EXT};
56
    TypeKind           m_typeKind;
57
    vector<string>     m_types;
58
59
    /* Sort on relevance, date, name or group */
60
    enum SortKind {WQSK_REL, WQSK_DATE, WQSK_ALPHA, WQSK_GROUP};
61
    vector<SortKind>   m_sortSpec;
50
};
62
};
51
52
63
53
/**
64
/**
54
 * Wasabi query string parser class. Could be a simple function
65
 * Wasabi query string parser class. Could be a simple function
55
 * really, but there might be some parser initialization work done in
66
 * really, but there might be some parser initialization work done in
56
 * the constructor.
67
 * the constructor.