libuutil: move under bmake
[unleashed.git] / usr / src / lib / libnisdb / db_query_c.x
blob483b92b0e89d0ddc0f4c6101a103f77368e672e5
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  */
23  *      db_query_c.x
24  *
25  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
26  * Use is subject to license terms.
27  */
29 %#pragma ident  "%Z%%M% %I%     %E% SMI"
31 #if RPC_HDR
32 %#ifndef _DB_QUERY_H
33 %#define _DB_QUERY_H
36 %/* db_query is the structure that contains the components of a query.
37 %   It contains the values for searching the indices. */
40 #ifdef USINGC
41 %#include "db_item_c.h"
42 %#include "db_entry_c.h"
43 %#include "db_scheme_c.h"
44 #else
45 %#include "db_item.h"
46 %#include "db_entry.h"
47 %#include "db_scheme.h"
48 #endif /* USINGC */
49 #endif /* RPC_HDR */
51 %/* A component of a query */
52 struct db_qcomp {
53   int which_index;             /* identifies which index is being used */
54   item* index_value;           /* value to be used in search */
57 #if RPC_HDR || RPC_XDR
58 #ifdef USINGC
59 struct db_query {
60   db_qcomp components<>;
62 #endif /* USINGC */
63 #endif /* RPC_HDR */
65 #ifndef USINGC
66 #ifdef RPC_HDR
68 %class db_query {
69 %protected:
70 %  int num_components;
71 %  db_qcomp* components;
72 % public:
73 %/* Accessor:  returns number of components */
74 %  int size() { return num_components; }
76 %/* Accessor:  returns location of start of query */
77 %   db_qcomp* queryloc() { return components; }
80 %/* Null constructor:  returns empty empty query. */
81 %  db_query() { num_components = 0; components = NULL; }
83 %/* Returns a db_query containing the index values as obtained from
84 %   'attrlist.' */
85 %  db_query( db_scheme*, int, nis_attr* );
87 %/* Returns a newly db_query containing the index values as
88 %   obtained from the given object.  The object itself, 
89 %   along with information on the scheme given, will determine 
90 %   which values are extracted from the object and placed into the query.
91 %   Returns an empty query if 'obj' is not a valid entry.
92 %   Note that space is allocated for the query and the index values 
93 %   (i.e. do not share pointers with strings in 'obj'.)
94 %*/
95 %  db_query( db_scheme*, entry_object_p );
97 %  /* destructor (frees all components) */
98 %  ~db_query();
100 %  /* clear component structure */
101 %  void clear_components( int );
103 %/* Print all components of this query to stdout. */
104 %  void print();
106 %typedef class db_query * db_query_p;
107 #endif /* RPC_HDR */
108 #endif /* USINGC */
110 #if RPC_HDR
111 %#endif /* _DB_QUERY_H */
112 #endif /* RPC_HDR */