From ddac2b650c387c8ab108827c8ead16371f16340d Mon Sep 17 00:00:00 2001 From: ja7 Date: Thu, 29 Aug 2002 19:36:09 +0000 Subject: [PATCH] Added YAZ_EXPORT const char* yaz_z3950_oid_value_to_str(oid_value ov, oid_class oc); Used for gettting ui friendly names for oid_value's --- include/yaz/proto.h | 10 +++++++++- zutil/z3950oid.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/include/yaz/proto.h b/include/yaz/proto.h index be0d05b..ccdff59 100644 --- a/include/yaz/proto.h +++ b/include/yaz/proto.h @@ -4,7 +4,12 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: proto.h,v $ - * Revision 1.2 2002-02-11 23:25:26 adam + * Revision 1.3 2002-08-29 19:36:09 ja7 + * Added + * YAZ_EXPORT const char* yaz_z3950_oid_value_to_str(oid_value ov, oid_class oc); + * Used for gettting ui friendly names for oid_value's + * + * Revision 1.2 2002/02/11 23:25:26 adam * Rustam's patch * * Revision 1.1 2001/10/23 21:00:19 adam @@ -79,6 +84,7 @@ #include #include #include +#include YAZ_BEGIN_CDECL @@ -143,6 +149,8 @@ YAZ_EXPORT Odr_oid *yaz_str_to_z3950oid (ODR o, int oid_class, const char *str); YAZ_EXPORT const char *yaz_z3950oid_to_str (Odr_oid *oid, int *oid_class); +YAZ_EXPORT const char* yaz_z3950_oid_value_to_str(oid_value ov, oid_class oc); + YAZ_END_CDECL #include diff --git a/zutil/z3950oid.c b/zutil/z3950oid.c index b0b6a59..2622d8e 100644 --- a/zutil/z3950oid.c +++ b/zutil/z3950oid.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2002, Index Data * See the file LICENSE for details. * - * $Id: z3950oid.c,v 1.2 2002-01-28 09:27:17 adam Exp $ + * $Id: z3950oid.c,v 1.3 2002-08-29 19:36:09 ja7 Exp $ */ #if HAVE_CONFIG_H @@ -50,3 +50,31 @@ const char *yaz_z3950oid_to_str (Odr_oid *oid, int *oid_class) *oid_class = ident->oclass; return ident->desc; } + + +const char* yaz_z3950_oid_value_to_str(oid_value ov, oid_class oc) { + struct oident tmpentry; + int tmp_oid[OID_SIZE]; + + + tmpentry.proto = PROTO_Z3950; + tmpentry.oclass = oc; + tmpentry.value = ov; + + if( oid_ent_to_oid(&tmpentry,tmp_oid) ) + { + return tmpentry.desc; + } + else + { + return ""; + }; +}; + + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + */ -- 1.7.10.4