Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / tt / bin / ttdbserverd / tt_isam_record.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_record.h /main/3 1995/10/20 16:45:07 rswiston $                                                      */
28 /*
29  * tt_isam_record.h - Defines the TT ISAM record class.  This class simplifies
30  *                    putting data in a record.  To get an empty record ready
31  *                    to be filled with data, call the _Tt_isam_file::getEmptyRecord.
32  *
33  * Copyright (c) 1992 by Sun Microsystems, Inc.
34  */
35
36 #ifndef  _TT_ISAM_RECORD_H
37 #define  _TT_ISAM_RECORD_H
38
39 #include "util/tt_object.h"
40 #include "util/tt_string.h"
41 #include "tt_isam_key_descriptor_utils.h"
42
43 class _Tt_isam_record : public _Tt_object {
44 public:
45   // Dummy constructor needed to make tt_isam_record_utils.cc happy
46   _Tt_isam_record () {}
47
48   // Real constructor
49   _Tt_isam_record (const _Tt_isam_key_descriptor_list_ptr &key_descriptor_list,
50                    int                                     max_record_length,
51                    int                                     min_record_length);
52   ~_Tt_isam_record ();
53
54   int                         getNumberOfKeys () const;
55   _Tt_isam_key_descriptor_ptr getKeyDescriptor (int) const;
56
57   _Tt_string getKeyPartValue (int, int) const;
58   void       setKeyPartValue (int, int, const _Tt_string&);
59
60   _Tt_string getBytes (int, int) const;
61   void       setBytes (int, const _Tt_string&);
62   void       setBytes (int, int, const _Tt_string&);
63
64   void setLength (int length)
65     {
66       currentLength = length;
67     }
68
69   int getLength () const
70     {
71       return currentLength;
72     }
73
74   int getMaxLength () const
75     {
76       return maxLength;
77     }
78
79   int getMinLength () const
80     {
81       return minLength;
82     }
83
84   const _Tt_string &getRecord () const
85     {
86       return buffer;
87     }
88
89 private:
90   _Tt_string                       buffer;
91   _Tt_isam_key_descriptor_list_ptr keyDescriptorList;
92   int                              currentLength;
93   int                              maxLength; 
94   int                              minLength; 
95 };
96
97 #endif  /* _TT_ISAM_RECORD_H */