2 // The ZOOM homepage is at http://zoom.z3950.org/
4 // Derived from version 1.3a at
5 // http://zoom.z3950.org/bind/cplusplus/zoom-1.3a.hh
7 #include <stddef.h> // for size_t
12 * * This is a bit stupid. The fact that our ZOOM-C++ implementation is
13 * * based on the ZOOM-C implementation is our Dirty Little Secret, and
14 * * there is in principle no reason why client code need be bothered
15 * * with it. Except of course that the public class declarations in
16 * * C++ have to lay their private parts out for the world to see
17 * * (oo-er). Hence the inclusion of <yaz/zoom.h>
19 *#include <yaz/zoom.h>
22 // Forward declarations for type names.
23 class YAZ_EXPORT query;
24 class YAZ_EXPORT resultSet;
25 class YAZ_EXPORT record;
27 class YAZ_EXPORT connection {
29 * friend class resultSet; // so it can use _getYazConnection()
30 * ZOOM_connection _getYazConnection () const { return c; }
31 // connections are non-copyable.
32 connection (const connection &);
33 connection &operator= (const connection &);
36 connection (const std::string &hostname, int portnum);
38 void connect (const std::string &hostname, int portnum);
39 std::string option (const std::string &key) const;
40 bool option (const std::string &key, const std::string &val);
44 // base class for all query types
45 * friend class resultSet; // so it can use _getYazQuery()
46 * ZOOM_query _getYazQuery () const { return q; }
54 class YAZ_EXPORT prefixQuery : public query {
56 prefixQuery (const std::string &pqn);
60 class YAZ_EXPORT CCLQuery : public query {
62 CCLQuery (const std::string &ccl, void *qualset);
66 class YAZ_EXPORT resultSet {
69 * friend class record; // for _getYazResultSet() & _getYazConnection()
70 * ZOOM_resultset _getYazResultSet () const { return rs; }
71 * ZOOM_connection _getYazConnection () const {
72 * return owner._getYazConnection(); }
73 // resultSets are non-copyable.
74 resultSet (const resultSet &);
75 resultSet &operator= (const resultSet &);
77 resultSet (connection &c, const query &q);
79 std::string option (const std::string &key) const;
80 bool option (const std::string &key, const std::string &val);
84 class YAZ_EXPORT record {
85 * const resultSet &owner;
88 class YAZ_EXPORT syntax {
91 UNKNOWN, GRS1, SUTRS, USMARC, UKMARC, XML
97 operator std::string () const;
98 bool operator== (const syntax &s) const;
99 bool operator== (value rs) const;
100 operator value () const;
103 record (resultSet &rs, size_t num);
105 syntax recsyn () const;
106 std::string render () const;
107 std::string rawdata () const;
110 // Base exception class; from which all other ZOOM exceptions
111 // are derived. Other classes that use this as their base
112 // class may want to provide their own errcode() and errmsg()
113 // functions -- hence they are made virtual.
114 class YAZ_EXPORT exception {
118 exception (int code);
119 virtual ~exception ();
120 virtual int errcode () const;
121 virtual std::string errmsg () const;
124 // systemException could be thrown for timeouts, protocol errors,
126 class YAZ_EXPORT systemException : public exception {
128 systemException (); // Uses value of system `errno'
129 systemException (int code);
130 * virtual std::string errmsg () const; // Why do I have to repeat this?
133 // bib1Exception::errcode() returns a code from the
134 // Bib-1 Diagnostic Set.
135 class YAZ_EXPORT bib1Exception: public exception {
139 bib1Exception (int code, const std::string &addinfo);
140 * virtual std::string errmsg () const; // Why do I have to repeat this?
141 std::string addinfo () const;
144 class YAZ_EXPORT queryException : public exception {
147 * ~queryException ();
148 enum { PREFIX, CCL };
149 queryException (int qtype, const std::string &source);
150 * virtual std::string errmsg () const; // Why do I have to repeat this?
151 std::string addinfo () const;