2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 // $XConsortium: c_api_section.cc /main/3 1996/06/11 17:27:53 cde-hal $
25 #include "oliasdb/c_api_common.h"
28 DtMmdbSectionGetLoc(DtMmdbInfoRequest* request)
31 info_base* x = getBookCase(request -> bookcase_descriptor);
32 if ( x == 0 ) return 0;
34 oid_t * id = getPrimiaryOid(request);
36 if ( id == 0 ) return 0;
38 node_smart_ptr y(x, *id);
43 catch (mmdbException &,e)
50 static node_smart_ptr*
51 getSectionUsingLocAndProid(DtMmdbInfoRequest* request)
54 info_base* x = getBookCase(request -> bookcase_descriptor);
55 if ( x == 0 ) return 0;
57 const char* str = getLocator(request);
60 return new node_smart_ptr(x, str);
63 oid_t * id = getPrimiaryOid(request);
65 if ( id == 0 ) return 0;
67 return new node_smart_ptr(x, *id);
70 catch (mmdbException &,e)
78 DtMmdbSectionGetLongTitle(
79 DtMmdbInfoRequest* request,
80 unsigned int* title_length
84 node_smart_ptr* x = getSectionUsingLocAndProid(request);
86 if ( x == 0 ) return 0;
89 fprintf(stderr, " mmdb_oid = ");
90 (*x).its_oid().asciiOut(cerr); cerr << "\n";
94 const char* y = x -> long_title();
96 if ( title_length ) *title_length = strlen(y);
101 catch (mmdbException &,e)
109 DtMmdbSectionGetShortTitle(
110 DtMmdbInfoRequest* request,
111 unsigned int* title_length
115 node_smart_ptr* x = getSectionUsingLocAndProid(request);
117 if ( x == 0 ) return 0;
118 const char* y = x -> short_title();
120 if ( title_length ) *title_length = strlen(y);
125 catch (mmdbException &,e)
135 DtMmdbInfoRequest* request,
136 unsigned int* data_length
140 node_smart_ptr* x = getSectionUsingLocAndProid(request);
142 if ( x == 0 ) return 0;
143 const char* y = x -> data();
145 if ( data_length ) *data_length = strlen(y);
150 catch (mmdbException &,e)
157 int DtMmdbSectionGetDataSize(DtMmdbInfoRequest* request)
160 node_smart_ptr* x = getSectionUsingLocAndProid(request);
162 if ( x == 0 ) return -1;
164 int y = x -> data_size();
170 catch (mmdbException &,e)
178 const char* DtMmdbSectionGetTocLoc(DtMmdbInfoRequest* request)
181 node_smart_ptr* x = getSectionUsingLocAndProid(request);
183 if ( x == 0 ) return 0;
184 const char* y = x -> toc_node_loc();
190 catch (mmdbException &,e)
199 DtMmdbSectionGetBookId(DtMmdbInfoRequest* request)
202 node_smart_ptr* x = getSectionUsingLocAndProid(request);
204 if ( x == 0 ) return 0;
206 DtMmdbHandle *z = newDtMmdbHandle(x -> doc_id());
212 catch (mmdbException &,e)
220 DtMmdbSectionGetStyleSheetId(DtMmdbInfoRequest* request)
223 node_smart_ptr* x = getSectionUsingLocAndProid(request);
225 if ( x == 0 ) return 0;
227 DtMmdbHandle *z = newDtMmdbHandle(x -> stylesheet_id());
233 catch (mmdbException &,e)