Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dtinfo / DtMmdb / oliasdb / doc_hd.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /*
24  * $XConsortium: doc_hd.cc /main/4 1996/06/11 17:28:47 cde-hal $
25  *
26  * Copyright (c) 1992 HAL Computer Systems International, Ltd.
27  * All rights reserved.  Unpublished -- rights reserved under
28  * the Copyright Laws of the United States.  USE OF A COPYRIGHT
29  * NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
30  * OR DISCLOSURE.
31  * 
32  * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
33  * SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.  USE,
34  * DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
35  * PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
36  * INTERNATIONAL, LTD.
37  * 
38  *                         RESTRICTED RIGHTS LEGEND
39  * Use, duplication, or disclosure by the Government is subject
40  * to the restrictions as set forth in subparagraph (c)(l)(ii)
41  * of the Rights in Technical Data and Computer Software clause
42  * at DFARS 252.227-7013.
43  *
44  *          HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
45  *                  1315 Dell Avenue
46  *                  Campbell, CA  95008
47  * 
48  */
49
50
51 #include "oliasdb/doc_hd.h"
52
53
54 MMDB_BODIES(doc)
55
56 doc_smart_ptr::
57 doc_smart_ptr(info_lib* lib_ptr, const char* info_base_name, const int seq_num) : 
58 smart_ptr(lib_ptr, info_base_name, 
59                   DOC_SET_POS, 
60                   managers::query_mgr -> form_integer_handler(seq_num),
61                   BASE_COMPONENT_INDEX +3,
62                   smart_ptr::SET 
63                  )
64 {
65    if ( seq_num < 1 ) 
66       throw(boundaryException(1, MAXINT, seq_num));
67 }
68
69 doc_smart_ptr::
70 doc_smart_ptr(info_base* base_ptr, const int seq_num) : 
71 smart_ptr(base_ptr, DOC_SET_POS,    
72                   managers::query_mgr -> form_integer_handler(seq_num),
73                   BASE_COMPONENT_INDEX + 3, smart_ptr::SET)
74 {
75    if ( seq_num < 1 ) 
76       throw(boundaryException(1, MAXINT, seq_num));
77 }
78
79 doc_smart_ptr::
80 doc_smart_ptr(info_lib* lib_ptr, const char* base_name, const oid_t& x_id) : 
81 smart_ptr(lib_ptr, base_name, DOC_SET_POS, 
82           managers::query_mgr -> form_oid_handler(x_id),
83           BASE_COMPONENT_INDEX,
84           smart_ptr::SET
85          )
86 {
87 }
88
89 doc_smart_ptr::
90 doc_smart_ptr(info_base* base_ptr, const oid_t& x_id) : 
91 smart_ptr(base_ptr, DOC_SET_POS, 
92           managers::query_mgr -> form_oid_handler(x_id),
93           BASE_COMPONENT_INDEX,
94           smart_ptr::SET
95          )
96 {
97 }
98
99 doc_smart_ptr::
100 doc_smart_ptr(const oid_t& doc_id, 
101               info_lib* lib_ptr, const char* base_name
102              ) :
103 smart_ptr(
104     lib_ptr->get_info_base(base_name)->get_set(DOC_SET_POS) -> 
105         its_store(),
106     doc_id
107          )
108 {
109 }
110
111 doc_smart_ptr::
112 doc_smart_ptr(const oid_t& doc_id, info_base* base_ptr) :
113   smart_ptr(
114       base_ptr -> get_set(DOC_SET_POS) -> its_store(),
115       doc_id
116            )
117 {
118 }
119
120 oid_t doc_smart_ptr::locator_id()
121 {
122    return get_oid(BASE_COMPONENT_INDEX);
123 }
124
125 const char* doc_smart_ptr::short_title()
126 {
127    return get_string(BASE_COMPONENT_INDEX+1);
128 }
129
130 const char* doc_smart_ptr::long_title()
131 {
132    return get_string(BASE_COMPONENT_INDEX+2);
133 }
134
135 int doc_smart_ptr::seq_num()
136 {
137    return get_int(BASE_COMPONENT_INDEX+3);
138 }
139
140 short_list_handler* doc_smart_ptr::tab_list()
141 {
142    short_list_handler* y = (short_list_handler*)
143           get_handler( BASE_COMPONENT_INDEX + 4, 
144                           SHORT_LIST_CODE 
145                         ); 
146
147    return y;
148 }
149
150 const char* doc_smart_ptr::license_terms()
151 {
152   return get_string(BASE_COMPONENT_INDEX+5);
153 }
154
155 unsigned int doc_smart_ptr::license_terms_size()
156 {
157   return get_string_size(BASE_COMPONENT_INDEX+5);
158 }
159