X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=zoom%2Fzconn.cpp;h=8d9e88c7cba8dde36eaf861db76bc3bd2ed214d8;hb=fa96bc0dcc16f6ac3e33b5144664e51cb7d09874;hp=4edb20c88dc57fc574f647b72eea8d60a89cba17;hpb=bbd559f62b1e582ba4519c31ff1911723744340d;p=yazpp-moved-to-github.git diff --git a/zoom/zconn.cpp b/zoom/zconn.cpp index 4edb20c..8d9e88c 100644 --- a/zoom/zconn.cpp +++ b/zoom/zconn.cpp @@ -1,4 +1,4 @@ -// $Header: /home/cvsroot/yaz++/zoom/zconn.cpp,v 1.8 2005-05-03 16:29:52 mike Exp $ +// $Header: /home/cvsroot/yaz++/zoom/zconn.cpp,v 1.9 2005-06-25 15:53:21 adam Exp $ // Z39.50 Connection class @@ -7,43 +7,51 @@ namespace ZOOM { connection::connection() { - ZOOM_options o = ZOOM_options_create(); - c = ZOOM_connection_create(o); + ZOOM_options o = ZOOM_options_create(); + c = ZOOM_connection_create(o); } void connection::connect(const std::string &hostname, int portnum) { - const char *line_printer_size_hostname = hostname.c_str(); - //###cerr << "opening " << hostname << ":" << portnum << "\n"; - ZOOM_connection_connect(c, line_printer_size_hostname, portnum); - //###cerr << "opened\n"; - - int errcode; - const char *errmsg; // unused: carries same info as `errcode' - const char *addinfo; - if ((errcode = ZOOM_connection_error(c, &errmsg, &addinfo)) != 0) { - //###cerr << "oops: no connect, errcode=" << errcode << "\n"; - throw bib1Exception(errcode, addinfo); - } + const char *line_printer_size_hostname = hostname.c_str(); + //###cerr << "opening " << hostname << ":" << portnum << "\n"; + ZOOM_connection_connect(c, line_printer_size_hostname, portnum); + //###cerr << "opened\n"; + + int errcode; + const char *errmsg; // unused: carries same info as `errcode' + const char *addinfo; + if ((errcode = ZOOM_connection_error(c, &errmsg, &addinfo)) != 0) { + //###cerr << "oops: no connect, errcode=" << errcode << "\n"; + throw bib1Exception(errcode, addinfo); + } } connection::connection(const std::string &hostname, int portnum) { - ZOOM_options o = ZOOM_options_create(); - c = ZOOM_connection_create(o); - connect(hostname, portnum); + ZOOM_options o = ZOOM_options_create(); + c = ZOOM_connection_create(o); + connect(hostname, portnum); } std::string connection::option(const std::string &key) const { - const char* val = ZOOM_connection_option_get(c, key.c_str()); - return (val) ? val : std::string(); + const char* val = ZOOM_connection_option_get(c, key.c_str()); + return (val) ? val : std::string(); } bool connection::option(const std::string &key, const std::string &val) { - // No way to tell whether ZOOM_connection_option_set() accepts key - ZOOM_connection_option_set(c, key.c_str(), val.c_str()); - return true; + // No way to tell whether ZOOM_connection_option_set() accepts key + ZOOM_connection_option_set(c, key.c_str(), val.c_str()); + return true; } connection::~connection() { - ZOOM_connection_destroy(c); + ZOOM_connection_destroy(c); } } +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +