687ce548647863005abfe5c1a683d2123c368c2d
[yaz-moved-to-github.git] / include / yaz / facet.h
1
2 #ifndef YAZ_FACET_H
3 #define YAZ_FACET_H
4
5 #include <yaz/yconfig.h>
6 #include <yaz/z-core.h>
7 #include <yaz/log.h>
8
9 YAZ_BEGIN_CDECL
10
11
12 /*
13  * Helper function for extracting facet values from the ASN structures.
14  *
15  */
16
17 /* A helper structure to extract all the attribute stuff
18    from one Z_AttributesList. The pointers will all be to
19    the Z-structures, or to constants, so there is no need to
20    worry about freeing them */
21 struct attrvalues {
22     int  errcode;   /* set in case of errors */
23     char *errstring; /* opt */
24     const char *useattr; /* @attr 1, from a string attr */
25                    /* or number converted to a string */
26                    /* defaults to 'any' */
27     char useattrbuff[30]; /* for converting numbers to strings */
28     char *relation; /* @attr 2, defaults to '=' */
29     int limit; /* for facet attributes */
30 };
31
32
33 /* Use attribute, @attr1, can be numeric or string */
34 YAZ_EXPORT
35 void useattr ( Z_AttributeElement *ae, struct attrvalues *av );
36
37 YAZ_EXPORT
38 void relationattr ( Z_AttributeElement *ae, struct attrvalues *av );
39
40 YAZ_EXPORT
41 void limitattr ( Z_AttributeElement *ae, struct attrvalues *av );
42
43 YAZ_EXPORT
44 void limitattr ( Z_AttributeElement *ae, struct attrvalues *av );
45
46 YAZ_EXPORT
47 void facetattrs( Z_AttributeList *attributes, struct attrvalues *av );
48
49
50
51 #endif