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_locator.cc /main/3 1996/06/11 17:27:38 cde-hal $
25 #include "oliasdb/c_api_common.h"
27 static locator_smart_ptr*
28 getLocatorUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = false)
31 info_base* x = getBookCase(request -> bookcase_descriptor);
32 if ( x == 0 ) return 0;
34 const char* str = getLocator(request);
37 return new locator_smart_ptr(x, str);
42 if ( checkLocOnly == true ) return 0;
44 oid_t * id = getPrimiaryOid(request);
46 if ( id == 0 ) return 0;
48 return new locator_smart_ptr(x, *id);
52 mcatch (mmdbException &,e)
60 DtMmdbLocatorGetSectionLoc(DtMmdbInfoRequest* request)
63 locator_smart_ptr* x = getLocatorUsingLocAndProid(request, false);
65 if ( x == 0 ) return 0;
66 const char* y = x -> inside_node_locator_str();
71 mcatch (mmdbException &,e)
79 DtMmdbLocatorGetSectionObjectId(DtMmdbInfoRequest* request)
82 locator_smart_ptr* x = getLocatorUsingLocAndProid(request, true);
83 if ( x == 0 ) return 0;
84 DtMmdbHandle *z = newDtMmdbHandle(x -> node_id());
89 mcatch (mmdbException &,e)