1 // $Id: master-header,v 1.15 2003-09-22 12:45:26 mike Exp $
4 // The ZOOM homepage is at http://zoom.z3950.org/
6 // Derived from version 1.3a at
7 // http://zoom.z3950.org/bind/cplusplus/zoom-1.3a.hh
9 #include <stddef.h> // for size_t
14 * * This is a bit stupid. The fact that our ZOOM-C++ implementation is
15 * * based on the ZOOM-C implementation is our Dirty Little Secret, and
16 * * there is in principle no reason why client code need be bothered
17 * * with it. Except of course that the public class declarations in
18 * * C++ have to lay their private parts out for the world to see
19 * * (oo-er). Hence the inclusion of <yaz/zoom.h>
21 *#include <yaz/zoom.h>
24 // Forward declarations for type names.
25 class YAZ_EXPORT query;
26 class YAZ_EXPORT resultSet;
27 class YAZ_EXPORT record;
29 class YAZ_EXPORT connection {
31 * friend class resultSet; // so it can use _getYazConnection()
32 * ZOOM_connection _getYazConnection () const { return c; }
33 // connections are non-copyable.
34 connection (const connection &);
35 connection &operator= (const connection &);
38 connection (const std::string &hostname, int portnum);
40 void connect (const std::string &hostname, int portnum);
41 std::string option (const std::string &key) const;
42 bool option (const std::string &key, const std::string &val);
46 // base class for all query types
47 * friend class resultSet; // so it can use _getYazQuery()
48 * ZOOM_query _getYazQuery () const { return q; }
55 class YAZ_EXPORT prefixQuery : public query {
57 prefixQuery (const std::string &pqn);
61 class YAZ_EXPORT CCLQuery : public query {
63 CCLQuery (const std::string &ccl, void *qualset);
67 class YAZ_EXPORT resultSet {
70 * friend class record; // for _getYazResultSet() & _getYazConnection()
71 * ZOOM_resultset _getYazResultSet () const { return rs; }
72 * ZOOM_connection _getYazConnection () const {
73 * return owner._getYazConnection(); }
74 // resultSets are non-copyable.
75 resultSet (const resultSet &);
76 resultSet &operator= (const resultSet &);
78 resultSet (connection &c, const query &q);
80 std::string option (const std::string &key) const;
81 bool option (const std::string &key, const std::string &val);
85 class YAZ_EXPORT record {
86 * const resultSet &owner;
92 UNKNOWN, GRS1, SUTRS, USMARC, UKMARC, XML
98 operator std::string () const;
99 bool operator== (const syntax &s) const;
100 bool operator== (value rs) const;
101 operator value () const;
104 record (resultSet &rs, size_t num);
106 syntax recsyn () const;
107 std::string render () const;
108 std::string rawdata () const;
111 // Base exception class; from which all other ZOOM exceptions
112 // are derived. Other classes that use this as their base
113 // class may want to provide their own errcode() and errmsg()
114 // functions -- hence they are made virtual.
115 class YAZ_EXPORT exception {
119 exception (int code);
120 virtual ~exception ();
121 virtual int errcode () const;
122 virtual std::string errmsg () const;
125 // systemException could be thrown for timeouts, protocol errors,
127 class YAZ_EXPORT systemException : public exception {
129 systemException (); // Uses value of system `errno'
130 systemException (int code);
131 * virtual std::string errmsg () const; // Why do I have to repeat this?
134 // bib1Exception::errcode() returns a code from the
135 // Bib-1 Diagnostic Set.
136 class YAZ_EXPORT bib1Exception: public exception {
140 bib1Exception (int code, const std::string &addinfo);
141 * virtual std::string errmsg () const; // Why do I have to repeat this?
142 std::string addinfo () const;
145 class YAZ_EXPORT queryException : public exception {
148 * ~queryException ();
149 enum { PREFIX, CCL };
150 queryException (int qtype, const std::string &source);
151 * virtual std::string errmsg () const; // Why do I have to repeat this?
152 std::string addinfo () const;