Use AM_LDFLAGS instead of LDFLAGS
[yazpp-moved-to-github.git] / zoom / master-header
1 // $Id: master-header,v 1.17 2003-09-24 18:07:31 adam Exp $
2 //
3 // ZOOM C++ Binding.
4 // The ZOOM homepage is at http://zoom.z3950.org/
5 //
6 // Derived from version 1.3a at
7 //      http://zoom.z3950.org/bind/cplusplus/zoom-1.3a.hh
8
9 #include <stddef.h>             // for size_t
10 #include <string>
11
12
13 */*
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>
20 * */
21 *#include <yaz/zoom.h>
22 *
23 namespace ZOOM {
24   // Forward declarations for type names.
25   class YAZ_EXPORT query;
26   class YAZ_EXPORT resultSet;
27   class YAZ_EXPORT record;
28
29   class YAZ_EXPORT connection {
30 *   ZOOM_connection c;
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 &);
36   public:
37     connection ();
38     connection (const std::string &hostname, int portnum);
39     ~connection ();
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);
43   };
44
45   class query {
46       // base class for all query types
47 *   friend class resultSet; // so it can use _getYazQuery()
48 *   ZOOM_query _getYazQuery () const { return q; }
49 * protected:
50 *   ZOOM_query q;
51   public:
52     query ();
53     virtual ~query ();
54   };
55
56   class YAZ_EXPORT prefixQuery : public query {
57   public:
58     prefixQuery (const std::string &pqn);
59     ~prefixQuery ();
60   };
61
62   class YAZ_EXPORT CCLQuery : public query {
63   public:
64     CCLQuery (const std::string &ccl, void *qualset);
65     ~CCLQuery ();
66   };
67
68   class YAZ_EXPORT resultSet {
69 *   connection &owner;
70 *   ZOOM_resultset rs;
71 *   friend class record; // for _getYazResultSet() & _getYazConnection()
72 *   ZOOM_resultset _getYazResultSet () const { return rs; }
73 *   ZOOM_connection _getYazConnection () const {
74 *       return owner._getYazConnection(); }
75     // resultSets are non-copyable.
76     resultSet (const resultSet &);
77     resultSet &operator= (const resultSet &);
78   public:
79     resultSet (connection &c, const query &q);
80     ~resultSet ();
81     std::string option (const std::string &key) const;
82     bool option (const std::string &key, const std::string &val);
83     size_t size () const;
84   };
85
86   class YAZ_EXPORT record {
87 *   const resultSet &owner;
88 *   ZOOM_record r;
89   public:
90     class YAZ_EXPORT syntax {
91     public:
92       enum value {
93         UNKNOWN, GRS1, SUTRS, USMARC, UKMARC, XML
94       };
95 *   private:
96 *     enum value val;
97 *   public:
98       syntax (value rs);
99       operator std::string () const;
100       bool operator== (const syntax &s) const;
101       bool operator== (value rs) const;
102       operator value () const;
103     };
104
105     record (resultSet &rs, size_t num);
106     ~record ();
107     syntax recsyn () const;
108     std::string render () const;
109     std::string rawdata () const;
110   };
111
112   // Base exception class; from which all other ZOOM exceptions
113   // are derived. Other classes that use this as their base
114   // class may want to provide their own errcode() and errmsg()
115   // functions -- hence they are made virtual.
116   class YAZ_EXPORT exception {
117 * protected:
118 *   int code;
119   public:
120     exception (int code);
121     virtual ~exception ();
122     virtual int errcode () const;
123     virtual std::string errmsg () const;
124   };
125
126   // systemException could be thrown for timeouts, protocol errors,
127   // network outages.
128   class YAZ_EXPORT systemException : public exception {
129   public:
130     systemException ();         // Uses value of system `errno'
131     systemException (int code);
132 *   virtual std::string errmsg () const; // Why do I have to repeat this?
133   };
134
135   // bib1Exception::errcode() returns a code from the
136   // Bib-1 Diagnostic Set.
137   class YAZ_EXPORT bib1Exception: public exception {
138 *   std::string info;
139   public:
140 *   ~bib1Exception ();
141     bib1Exception (int code, const std::string &addinfo);
142 *   virtual std::string errmsg () const; // Why do I have to repeat this?
143     std::string addinfo () const;
144   };
145
146   class YAZ_EXPORT queryException : public exception {
147 *   std::string q;
148   public:
149 *   ~queryException ();
150     enum { PREFIX, CCL };
151     queryException (int qtype, const std::string &source);
152 *   virtual std::string errmsg () const; // Why do I have to repeat this?
153     std::string addinfo () const;
154   };
155 }