Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / tt / bin / ttdbserverd / tt_isam_key_descriptor.h
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 /*%%  (c) Copyright 1993, 1994 Hewlett-Packard Company                   */
24 /*%%  (c) Copyright 1993, 1994 International Business Machines Corp.     */
25 /*%%  (c) Copyright 1993, 1994 Sun Microsystems, Inc.                    */
26 /*%%  (c) Copyright 1993, 1994 Novell, Inc.                              */
27 /*%%  $XConsortium: tt_isam_key_descriptor.h /main/3 1995/10/20 16:44:29 rswiston $                                                      */
28 /*
29  * tt_isam_key_descriptor.h - Defines the TT ISAM key descriptor class.
30  *                 This class is used to hold the information required
31  *                 to create a NetISAM key descriptor.  It also makes
32  *                 it very easy to construct the descriptor.
33  *
34  * Copyright (c) 1992 by Sun Microsystems, Inc.
35  */
36
37 #ifndef  _TT_ISAM_KEY_DESCRIPTOR_H
38 #define  _TT_ISAM_KEY_DESCRIPTOR_H
39
40 #include "util/tt_object.h"
41 #include "tt_isam.h"
42
43 class _Tt_isam_key_descriptor : public _Tt_object {
44 public:
45   _Tt_isam_key_descriptor ();
46   ~_Tt_isam_key_descriptor ();
47
48   void setCompress (bool_t flag)
49     {
50       if (flag) {
51         keyDescriptor.k_flags |= COMPRESS;
52       }
53       else {
54         keyDescriptor.k_flags &= (short) (0xFFFF - COMPRESS);
55       }
56     }
57
58   bool_t isCompressSet ()
59     {
60       return ((keyDescriptor.k_flags & COMPRESS) ? TRUE : FALSE);
61     }
62
63   void setDuplicates (bool_t flag)
64     {
65       if (flag) {
66         keyDescriptor.k_flags &= (short) (0xFFFF - ISNODUPS);
67         keyDescriptor.k_flags |= ISDUPS;
68       }
69       else {
70         keyDescriptor.k_flags &= (short) (0xFFFF - ISDUPS);
71         keyDescriptor.k_flags |= ISNODUPS;
72       }
73     }
74
75   bool_t isDuplicatesSet ()
76     {
77       return ((keyDescriptor.k_flags & ISDUPS) ? TRUE : FALSE);
78     }
79
80   short addKeyPart (short start, short length, short type);
81   short setKeyPart (short index, short start, short length, short type);
82
83   short getKeyPart (short  index,
84                     short &start,
85                     short &length,
86                     short &type) const;
87
88   short getNumberOfParts () const
89     {
90       return keyDescriptor.k_nparts;
91     }
92
93 private:
94   struct keydesc keyDescriptor;
95
96   keydesc *getKeyDescriptor ()
97     {
98       return &keyDescriptor;
99     }
100   
101 friend class _Tt_isam_file;
102 };
103
104 #endif  /* _TT_ISAM_KEY_DESCRIPTOR_H */