c_api_dlp.C 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 libraries 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. // $XConsortium: c_api_dlp.cc /main/4 1996/06/11 17:27:07 cde-hal $
  24. #include "oliasdb/c_api_common.h"
  25. static dlp_smart_ptr*
  26. getDlpUsingProid(DtMmdbInfoRequest* request)
  27. {
  28. mtry {
  29. info_base* x = getBookCase(request -> bookcase_descriptor);
  30. if ( x == 0 ) return 0;
  31. oid_t * id = getPrimiaryOid(request);
  32. if ( id ) {
  33. return new dlp_smart_ptr(x, *id);
  34. }
  35. return 0;
  36. }
  37. mcatch (mmdbException &,e)
  38. {
  39. return 0;
  40. } end_try;
  41. return 0;
  42. }
  43. DtMmdbHandle*
  44. DtMmdbDlpGetPrevSectionId(DtMmdbInfoRequest* request)
  45. {
  46. mtry {
  47. dlp_smart_ptr* x = getDlpUsingProid(request);
  48. if ( x == 0 ) return 0;
  49. DtMmdbHandle *z = 0;
  50. if ( x -> prev_node_oid() == ground )
  51. z = DtMmdbGroundId;
  52. else
  53. z = newDtMmdbHandle(x -> prev_node_oid());
  54. delete x;
  55. return z;
  56. }
  57. mcatch (mmdbException &,e)
  58. {
  59. return 0;
  60. } end_try;
  61. return 0;
  62. }
  63. DtMmdbHandle*
  64. DtMmdbDlpGetNextSectionId(DtMmdbInfoRequest* request)
  65. {
  66. mtry {
  67. dlp_smart_ptr* x = getDlpUsingProid(request);
  68. if ( x == 0 ) return 0;
  69. DtMmdbHandle *z = 0;
  70. if ( x -> next_node_oid() == ground)
  71. z = DtMmdbGroundId;
  72. else
  73. z = newDtMmdbHandle(x -> next_node_oid());
  74. delete x;
  75. return z;
  76. }
  77. mcatch (mmdbException &,e)
  78. {
  79. return 0;
  80. } end_try;
  81. return 0;
  82. }