xref: /titanic_52/usr/src/lib/libnisdb/db_item_c.x (revision ba4e3c84e6b9390bbf7df80b5f1d11dec34cc525)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  *	db_item_c.x
24  *
25  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
26  * Use is subject to license terms.
27  */
28 
29 %#pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 %
32 % /* A 'counted' string. */
33 %
34 
35 #if RPC_HDR
36 %#ifndef _DB_ITEM_H
37 %#define _DB_ITEM_H
38 #endif /* RPC_HDR */
39 
40 #if RPC_HDR || RPC_XDR
41 #ifdef USINGC
42 struct item{
43   char itemvalue<>;
44 };
45 #endif /* USINGC */
46 #endif /* RPC_HDR */
47 
48 #ifndef USINGC
49 #ifdef RPC_HDR
50 %class item {
51 %  int len;
52 %  char *value;
53 % public:
54 %/* Constructor: creates item using given character sequence and length */
55 %  item( char* str, int len);
56 %
57 %/* Constructor: creates item by copying given item */
58 %  item( item* );
59 %
60 %/* Constructor: creates empty item (zero length and null value). */
61 %  item() {len = 0; value = NULL;}
62 %
63 %/* Destructor: recover space occupied by characters and delete item. */
64 %  ~item() {delete value;}
65 %
66 %/* Equality test.  'casein' TRUE means case insensitive test. */
67 %  bool_t equal( item *, bool_t casein = FALSE );
68 %
69 %/* Equality test.  'casein' TRUE means case insensitive test. */
70 %  bool_t equal( char *, int, bool_t casein = FALSE );
71 %
72 %/* Assignment:  update item by setting pointers.  No space is allocated. */
73 %  void update( char* str, int n) {len = n; value = str;}
74 %
75 %/* Return contents of item. */
76 %  void get_value( char** s, int * n ) { *s = value; *n=len;}
77 %
78 %/* Prints contents of item to stdout */
79 %  void print();
80 %
81 %/* Return hash value.  'casein' TRUE means case insensitive test. */
82 %  unsigned int get_hashval( bool_t casein = FALSE );
83 %};
84 #endif /* RPC_HDR */
85 #endif /* USINGC */
86 
87 #if RPC_HDR
88 %#endif /* _DB_ITEM_H */
89 #endif /* RPC_HDR */
90