YAZ  5.34.0
Functions | Variables
proxunit.c File Reference

ProximityUnit map to/from string. More...

#include <string.h>
#include <yaz/proxunit.h>
#include <yaz/z-core.h>

Go to the source code of this file.

Functions

const char * z_ProxUnit_to_str (int u)
 converts prox unit integer to string More...
 
int z_str_to_ProxUnit (const char *str)
 converts unit name string to unit integer More...
 

Variables

static const char * units []
 

Detailed Description

ProximityUnit map to/from string.

Definition in file proxunit.c.

Function Documentation

◆ z_ProxUnit_to_str()

const char* z_ProxUnit_to_str ( int  u)

converts prox unit integer to string

Parameters
uunit
Returns
result name or NULL if not-found

Definition at line 33 of file proxunit.c.

References units, Z_ProxUnit_byte, and Z_ProxUnit_character.

Referenced by yaz_prox_unit_name().

◆ z_str_to_ProxUnit()

int z_str_to_ProxUnit ( const char *  str)

converts unit name string to unit integer

Parameters
strunit name
Returns
unit code (positive integer) or 0 if unknown name

Definition at line 40 of file proxunit.c.

References units, and Z_ProxUnit_byte.

Referenced by cql_pr_prox().

Variable Documentation

◆ units

const char* units[]
static
Initial value:
= {
0,
"character",
"word",
"sentence",
"paragraph",
"section",
"chapter",
"document",
"element",
"subelement",
"elementType",
"byte"
}

Definition at line 18 of file proxunit.c.

Referenced by z_ProxUnit_to_str(), and z_str_to_ProxUnit().