DLL exports
[yazpp-moved-to-github.git] / zoom / master-header
1 // $Header: /home/cvsroot/yaz++/zoom/master-header,v 1.6 2002-10-30 10:03:52 adam Exp $
2 //
3 // ZOOM C++ Binding.
4 // The ZOOM homepage is at http://zoom.z3950.org/
5 //
6 // Derived from version 1.0g at
7 //      http://zoom.z3950.org/bind/cplusplus/zoom-1.0g.hh
8
9 #include <stddef.h>             // for size_t
10
11 */*
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>
18 * */
19 *#include <yaz/zoom.h>
20 *
21
22 namespace ZOOM {
23   // Forward declarations for type names.
24   class YAZ_EXPORT query;
25   class YAZ_EXPORT resultSet;
26   class YAZ_EXPORT record;
27
28   const char *option (const char *key);
29   const char *option (const char *key, const char *val);
30   int errcode ();
31   char *errmsg ();
32   char *addinfo ();
33
34   class YAZ_EXPORT connection {
35 *   ZOOM_connection c;
36 *   friend class resultSet; // so it can use _getYazConnection()
37 *   ZOOM_connection _getYazConnection () const { return c; }
38   public:
39     connection (const char *hostname, int portnum);
40     ~connection ();
41     const char *option (const char *key) const;
42     const char *option (const char *key, const char *val);
43   };
44
45   class query {
46       // pure virtual class: derive concrete subclasses from it.
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     virtual ~query ();
53   };
54
55   class YAZ_EXPORT prefixQuery : public query {
56   public:
57     prefixQuery (const char *pqn);
58     ~prefixQuery ();
59   };
60
61   class YAZ_EXPORT CCLQuery : public query {
62   public:
63     CCLQuery (const char *ccl, void *qualset);
64     ~CCLQuery ();
65   };
66
67   class YAZ_EXPORT resultSet {
68 *   connection &owner;
69 *   ZOOM_resultset rs;
70   public:
71     resultSet (connection &c, const query &q);
72     ~resultSet ();
73     const char *option (const char *key) const;
74     const char *option (const char *key, const char *val);
75     size_t size () const;
76     const record *getRecord (size_t i) const;
77   };
78
79   class YAZ_EXPORT record {
80 *   const resultSet *owner;
81 *   ZOOM_record r;
82 *   friend class resultSet; // so it can use this constructor
83 *   record::record (const resultSet *rs, ZOOM_record rec):
84 *       owner (rs), r (rec) {}
85   public:
86     ~record ();
87     enum syntax {
88       UNKNOWN, GRS1, SUTRS, USMARC, UKMARC, XML
89     };
90     record *clone () const;
91     syntax recsyn () const;
92     const char *render () const;
93     const char *rawdata () const;
94   };
95
96   class YAZ_EXPORT exception {
97 * protected:
98 *   int code;
99   public:
100     exception (int code);
101     int errcode () const;
102     const char *errmsg () const;
103   };
104
105   class YAZ_EXPORT systemException: public exception {
106   public:
107     systemException ();
108     int errcode () const;
109     const char *errmsg () const;
110   };
111
112   class YAZ_EXPORT bib1Exception: public exception {
113 *   const char *info;
114   public:
115 *   ~bib1Exception ();
116     bib1Exception (int errcode, const char *addinfo);
117     int errcode () const;
118     const char *errmsg () const;
119     const char *addinfo () const;
120   };
121
122   class YAZ_EXPORT queryException: public exception {
123 *   const char *q;
124   public:
125 *   ~queryException ();
126     enum {
127      PREFIX = 1,
128      CCL = 2
129     };
130     queryException (int qtype, const char *source);
131     int errcode () const;
132     const char *errmsg () const;
133     const char *addinfo () const;
134   };
135 }