disable-zoom configure option
[yazpp-moved-to-github.git] / zoom / zquery.cpp
1 // $Header: /home/cvsroot/yaz++/zoom/zquery.cpp,v 1.4 2002-11-30 22:33:21 mike Exp $
2
3 // Z39.50 Query classes
4
5 #include "zoom.h"
6
7
8 namespace ZOOM {
9     query::~query() {
10         ZOOM_query_destroy(q);
11         q = 0;
12     }
13
14
15
16     prefixQuery::prefixQuery(const string &pqn) {
17         q = ZOOM_query_create();
18         if (ZOOM_query_prefix(q, pqn.c_str()) == -1) {
19             ZOOM_query_destroy(q);
20             throw queryException(queryException::PREFIX, pqn);
21         }
22     }
23
24     // The binding specification says we have to have destructors for
25     // the query subclasses, so in they go -- even though they don't
26     // actually _do_ anything that inheriting the base query type's
27     // destructor wouldn't do.  It's an irritant of C++ that the
28     // declaration of a subclass has to express explicitly the
29     // implementation detail of whether destruction is implemented
30     // by a specific destructor or by inheritance.  Oh well.
31     //
32     // ### Not sure whether I need to do nothing at all, and the
33     // superclass destructor gets called anyway (I think that only
34     // works when you _don't_ define a destructor so that the default
35     // one pertains) or whether I need to duplicate the functionality
36     // of that destructor.  Let's play safe by assuming the latter and
37     // zeroing what we free so that we get bitten if we're wrong.
38     //
39     prefixQuery::~prefixQuery() {
40         ZOOM_query_destroy(q);
41         q = 0;
42     }
43
44
45
46     CCLQuery::CCLQuery(const string &ccl, void *qualset) {
47         throw "Oops.  No CCL support in ZOOM-C yet.  Sorry.";
48     }
49
50     CCLQuery::~CCLQuery() {
51         ZOOM_query_destroy(q);
52         q = 0;
53     }
54 }