X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=include%2Fyaz%2Ffacet.h;fp=include%2Fyaz%2Ffacet.h;h=687ce548647863005abfe5c1a683d2123c368c2d;hb=df0a3ba592afe51a91a54152c3add5d1b51604a8;hp=0000000000000000000000000000000000000000;hpb=130d73eaa90fb40dd7d941b6a706036477ea8cdd;p=yaz-moved-to-github.git diff --git a/include/yaz/facet.h b/include/yaz/facet.h new file mode 100644 index 0000000..687ce54 --- /dev/null +++ b/include/yaz/facet.h @@ -0,0 +1,51 @@ + +#ifndef YAZ_FACET_H +#define YAZ_FACET_H + +#include +#include +#include + +YAZ_BEGIN_CDECL + + +/* + * Helper function for extracting facet values from the ASN structures. + * + */ + +/* A helper structure to extract all the attribute stuff + from one Z_AttributesList. The pointers will all be to + the Z-structures, or to constants, so there is no need to + worry about freeing them */ +struct attrvalues { + int errcode; /* set in case of errors */ + char *errstring; /* opt */ + const char *useattr; /* @attr 1, from a string attr */ + /* or number converted to a string */ + /* defaults to 'any' */ + char useattrbuff[30]; /* for converting numbers to strings */ + char *relation; /* @attr 2, defaults to '=' */ + int limit; /* for facet attributes */ +}; + + +/* Use attribute, @attr1, can be numeric or string */ +YAZ_EXPORT +void useattr ( Z_AttributeElement *ae, struct attrvalues *av ); + +YAZ_EXPORT +void relationattr ( Z_AttributeElement *ae, struct attrvalues *av ); + +YAZ_EXPORT +void limitattr ( Z_AttributeElement *ae, struct attrvalues *av ); + +YAZ_EXPORT +void limitattr ( Z_AttributeElement *ae, struct attrvalues *av ); + +YAZ_EXPORT +void facetattrs( Z_AttributeList *attributes, struct attrvalues *av ); + + + +#endif