YAZ  5.23.1
facet.h
Go to the documentation of this file.
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) Index Data.
3  * All rights reserved.
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of Index Data nor the names of its contributors
13  * may be used to endorse or promote products derived from this
14  * software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
20  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
33 #ifndef YAZ_FACET_H
34 #define YAZ_FACET_H
35 
36 #include <yaz/yconfig.h>
37 #include <yaz/odr.h>
38 #include <yaz/z-core.h>
39 #include <yaz/z-facet-1.h>
40 #include <yaz/log.h>
41 
43 
44 /*
45  * Helper function for extracting facet values from the ASN structures.
46  *
47  */
48 
54  int errcode; /* set in case of errors */
55  char *errstring; /* opt */
56  const char *useattr; /* @attr 1, from a string attr */
57  /* or number converted to a string */
58  /* defaults to 'any' */
59  char useattrbuff[30]; /* for converting numbers to strings */
60  int sortorder;
61  int limit;
62  int start;
63 };
64 
65 YAZ_EXPORT
66 void yaz_facet_attr_init(struct yaz_facet_attr *attr_values);
67 
68 YAZ_EXPORT
70  struct yaz_facet_attr *av);
71 
72 YAZ_EXPORT
73 Z_FacetTerm *facet_term_create_cstr(ODR odr, const char *cstr, Odr_int freq);
74 
75 YAZ_EXPORT
77  int num_terms);
78 
79 YAZ_EXPORT
81  Z_FacetTerm *facetTerm, int index);
82 
83 YAZ_EXPORT
84 Z_FacetList* facet_list_create(ODR odr, int num_facets);
85 
86 YAZ_EXPORT
88  int index);
89 YAZ_EXPORT
91  Z_OtherInformation **otherInformation, ODR odr, Z_FacetList *facet_list);
92 
93 YAZ_EXPORT
95 
96 YAZ_EXPORT
97 void yaz_oi_set_facetlist(Z_OtherInformation **otherInformation, ODR odr,
98  Z_FacetList *facet_list);
99 
100 
102 
103 #endif
104 /*
105  * Local variables:
106  * c-basic-offset: 4
107  * c-file-style: "Stroustrup"
108  * indent-tabs-mode: nil
109  * End:
110  * vim: shiftwidth=4 tabstop=8 expandtab
111  */
112 
Header for ODR (Open Data Representation)
Z_FacetTerm * facet_term_create_cstr(ODR odr, const char *cstr, Odr_int freq)
Definition: facet.c:189
ASN.1 Module Z39-50-APDU-1995.
Z_FacetField * facet_field_create(ODR odr, Z_AttributeList *attributes, int num_terms)
Definition: facet.c:198
Z_FacetList * yaz_oi_get_facetlist(Z_OtherInformation **otherInformation)
Definition: facet.c:44
int errcode
Definition: facet.h:54
#define YAZ_END_CDECL
Definition: yconfig.h:57
int start
Definition: facet.h:62
void facet_list_field_set(ODR odr, Z_FacetList *list, Z_FacetField *field, int index)
Definition: facet.c:224
ASN.1 Module UserInfoFormat-facet-1.
nmem_int_t Odr_int
Definition: odr.h:47
void yaz_facet_attr_init(struct yaz_facet_attr *attr_values)
Definition: facet.c:68
void yaz_facet_attr_get_z_attributes(const Z_AttributeList *attributes, struct yaz_facet_attr *av)
Definition: facet.c:147
Header with fundamental macros.
char * errstring
Definition: facet.h:55
Definition: odr.h:124
void facet_field_term_set(ODR odr, Z_FacetField *field, Z_FacetTerm *facetTerm, int index)
Definition: facet.c:208
const char * useattr
Definition: facet.h:56
char useattrbuff[30]
Definition: facet.h:59
Logging utility.
void yaz_oi_set_facetlist(Z_OtherInformation **otherInformation, ODR odr, Z_FacetList *facet_list)
Definition: facet.c:23
int sortorder
Definition: facet.h:60
int limit
Definition: facet.h:61
Z_FacetList * facet_list_create(ODR odr, int num_facets)
Definition: facet.c:215
#define YAZ_BEGIN_CDECL
Definition: yconfig.h:56