5a1ef6b6ca94059a9adf143d783bed326208a597
[yaz-moved-to-github.git] / include / prt-dat.h
1 /*
2  * This file is part of the YAZ toolkit:
3  * Copyright (c) 1998, Index Data.
4  * See the file LICENSE for details.
5  * Sebastian Hammer, Adam Dickmeiss
6  *
7  * Contribution by Ronald van Der Meer (RVDM):
8  *  Databasix Information Systems B.V., Utrecht, The Netherlands.
9  *
10  * $Log: prt-dat.h,v $
11  * Revision 1.2  1999-04-20 09:56:48  adam
12  * Added 'name' paramter to encoder/decoder routines (typedef Odr_fun).
13  * Modified all encoders/decoders to reflect this change.
14  *
15  * Revision 1.1  1998/02/10 15:31:52  adam
16  * Implemented date and time structure. Changed the Update Extended
17  * Service.
18  *
19  */
20
21 #ifndef __PRT_DAT_H
22 #define __PRT_DAT_H
23
24 #include <yconfig.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 typedef struct Z_MonthAndDay
31 {
32     int *month;
33     int *day;                               /* OPTIONAL */
34 } Z_MonthAndDay;
35
36 typedef struct Z_Quarter
37 {
38     int which;
39 #define Z_Quarter_first         0
40 #define Z_Quarter_second        1
41 #define Z_Quarter_third         2
42 #define Z_Quarter_fourth        3
43     union
44     {
45         Odr_null *first;
46         Odr_null *second;
47         Odr_null *third;
48         Odr_null *fourth;
49     } u;
50 } Z_Quarter;
51
52 typedef struct Z_Season
53 {
54     int which;
55 #define Z_Season_winter         0
56 #define Z_Season_spring         1
57 #define Z_Season_summer         2
58 #define Z_Season_autumn         3
59     union
60     {
61         Odr_null *winter;
62         Odr_null *spring;
63         Odr_null *summer;
64         Odr_null *autumn;
65     } u;
66 } Z_Season;
67
68 typedef struct Z_PartOfYear
69 {
70     int which;
71 #define Z_PartOfYear_monthAndDay        0
72 #define Z_PartOfYear_julianDay          1
73 #define Z_PartOfYear_weekNumber         2
74 #define Z_PartOfYear_quarter            3
75 #define Z_PartOfYear_season             4
76     union
77     {
78         Z_MonthAndDay *monthAndDay;
79         int *julianDay; 
80         int *weekNumber; 
81         Z_Quarter *quarter;
82         Z_Season *season;
83     } u;
84 } Z_PartOfYear;
85
86 typedef struct Z_Era
87 {
88     int which;
89 #define Z_Era_decade            0
90 #define Z_Era_century           1
91 #define Z_Era_millennium        2
92     union
93     {
94         Odr_null *decade;
95         Odr_null *century;
96         Odr_null *millennium;
97     } u;
98 } Z_Era;
99
100 typedef struct Z_DateFlags
101 {
102     Odr_null *circa;                        /* OPTIONAL */
103     Z_Era *era;                             /* OPTIONAL */
104 } Z_DateFlags;
105
106 typedef struct Z_Date
107 {
108     int *year;
109     Z_PartOfYear *partOfYear;               /* OPTIONAL */
110     Z_DateFlags *flags;                     /* OPTIONAL */
111 } Z_Date;
112
113 typedef struct Z_Zone
114 {
115     int which;
116 #define Z_Zone_local            0
117 #define Z_Zone_utc              1
118 #define Z_Zone_utcOffset        2
119     union
120     {
121         Odr_null *local;
122         Odr_null *utc;
123         int *utcOffset;
124     } u;
125 } Z_Zone;
126
127 typedef struct Z_Time
128 {
129     int *hour;
130     int *minute;                            /* OPTIONAL */
131     int *second;                            /* OPTIONAL */
132     Z_IntUnit *partOfSecond;                /* OPTIONAL */
133     Z_Zone *zone;                           /* OPTIONAL */
134 } Z_Time;
135
136 typedef struct Z_DateTime
137 {
138     Z_Date *z3950Date;                      /* OPTIONAL */
139     Z_Time *z3950Time;                      /* OPTIONAL */
140 } Z_DateTime;
141
142 YAZ_EXPORT int z_DateTime(ODR o, Z_DateTime **p, int opt, const char *name);
143
144 #ifdef __cplusplus
145 }
146 #endif
147
148 #endif