home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warphead.zip / H / REGISTRY.H < prev    next >
C/C++ Source or Header  |  1997-02-28  |  4KB  |  124 lines

  1. /* @(#)Z 1.4 com/src/registry/Registry.h, odconfig, od96os2, odos29646d 96/11/15 15:49:28 (96/10/29 09:29:32) */
  2. /*====START_GENERATED_PROLOG======================================
  3.  */
  4. /*
  5.  *   COMPONENT_NAME: odconfig
  6.  *
  7.  *   CLASSES:   Node
  8.  *        Path
  9.  *
  10.  *   ORIGINS: 27
  11.  *
  12.  *
  13.  *   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  14.  *   All Rights Reserved
  15.  *   Licensed Materials - Property of IBM
  16.  *   US Government Users Restricted Rights - Use, duplication or
  17.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  18.  *       
  19.  *   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  20.  *   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  21.  *   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  22.  *   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  23.  *   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  24.  *   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  25.  *   OR PERFORMANCE OF THIS SOFTWARE.
  26.  */
  27. /*====END_GENERATED_PROLOG========================================
  28.  */
  29.  
  30. #ifndef REGISTRY_HPP
  31. #define REGISTRY_HPP
  32.  
  33. //#include <ctype.h>
  34. //#include <stdio.h>
  35. //#include <stdlib.h>
  36. //#include <string.h>
  37.  
  38. #include    <rstypes.h>
  39. #include    <name.h>
  40. #include    <unicode.h>
  41.  
  42.  
  43. class Node;
  44. class Path;
  45.  
  46. // ***************************************************************************
  47. // *  CLASS:        Path
  48. // * 
  49. // *  DESCRIPTION:  Wraps naming services APIs and structures for link names 
  50. // *                with a convenient, easy to use class.
  51. // * 
  52. // * 
  53. // * 
  54. // ***************************************************************************
  55.  
  56. class Path
  57. {
  58. public:
  59.     Path( unsigned short count, char* name = 0);
  60.     long setLinkName( unsigned short index, char* name);
  61.     operator ns_path_t () { return path; }
  62.  
  63. private:
  64.     unsigned short count;
  65.     ns_path_t path;
  66. };
  67.  
  68. // ***************************************************************************
  69. // *  CLASS:        Node
  70. // * 
  71. // *  DESCRIPTION:  Wraps naming services APIs and structures for node with a
  72. // *                convenient, easy to use class.
  73. // * 
  74. // * 
  75. // * 
  76. // ***************************************************************************
  77.  
  78. class Node
  79. {
  80. public:
  81.     static Node& getRootNode();
  82.  
  83.     Node( ns_node_handle_t nodeHandle) { handle = nodeHandle; }
  84.     Node( unsigned short attrCount, 
  85.           ns_node_type_t nodeType,
  86.           unsigned short nodeFlags = 0);
  87.  
  88.     ns_error_t addNode( Path& path, Node* newNode, int flags = 0);
  89.     ns_error_t resolve( Path& path, Node** newNode, int flags = 0);
  90.  
  91.     long setAttribute( unsigned short index, const char* name, 
  92.                        const char* value, unsigned short userType = 0 );
  93.  
  94.     long setAttribute( unsigned short index, const char* name, 
  95.                        const short value, unsigned short userType = 0 );
  96.     long setAttribute( unsigned short index, const char* name, 
  97.                        const unsigned short value, unsigned short userType = 0 );
  98.  
  99.     long setAttribute( unsigned short index, const char* name, 
  100.                        const long value, unsigned short userType = 0 );
  101.     long setAttribute( unsigned short index, const char* name, 
  102.                        const unsigned long value, unsigned short userType = 0 );
  103.  
  104.     long setAttribute( unsigned short index, 
  105.                        const char* name,
  106.                        const ns_typed_value_t& value);
  107.  
  108. private:  //## member data ##//
  109.     ns_node_t content;
  110.     ns_node_handle_t handle;
  111.  
  112. private: //## member functions ##//
  113.     ns_attr_t* getAttr( unsigned short index)
  114.     {
  115.         if ( index < content. count)
  116.         {
  117.             return &content. attrs[index];
  118.         }
  119.         return 0;
  120.     }
  121.  
  122. };
  123. #endif
  124.