1 /* @include ajquery ***********************************************************
2 **
3 ** AJAX Query parsing functions
4 **
5 ** @author Copyright (C) 2011 Peter Rice
6 ** @version $Revision: 1.10 $
7 ** @modified Jul 15 pmr First version with code from all datatypes merged
8 ** @modified $Date: 2012/09/03 14:26:04 $ by $Author: rice $
9 ** @@
10 **
11 ** This library is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU Lesser General Public
13 ** License as published by the Free Software Foundation; either
14 ** version 2.1 of the License, or (at your option) any later version.
15 **
16 ** This library is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 ** Lesser General Public License for more details.
20 **
21 ** You should have received a copy of the GNU Lesser General Public
22 ** License along with this library; if not, write to the Free Software
23 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24 ** MA  02110-1301,  USA.
25 **
26 ******************************************************************************/
27 
28 #ifndef AJQUERY_H
29 #define AJQUERY_H
30 
31 /* ========================================================================= */
32 /* ============================= include files ============================= */
33 /* ========================================================================= */
34 
35 #include "ajdefine.h"
36 #include "ajstr.h"
37 #include "ajlist.h"
38 #include "ajquerydata.h"
39 #include "ajtextdata.h"
40 
41 AJ_BEGIN_DECLS
42 
43 
44 
45 
46 /* ========================================================================= */
47 /* =============================== constants =============================== */
48 /* ========================================================================= */
49 
50 
51 
52 
53 /* ========================================================================= */
54 /* ============================== public data ============================== */
55 /* ========================================================================= */
56 
57 
58 
59 
60 /* ========================================================================= */
61 /* =========================== public functions ============================ */
62 /* ========================================================================= */
63 
64 
65 
66 
67 /*
68 ** Prototype definitions
69 */
70 
71 AjPQuery      ajQueryNew(AjEDataType datatype);
72 void          ajQueryDel(AjPQuery* pthis);
73 void          ajQueryTrace(const AjPQuery thys);
74 void          ajQueryClear(AjPQuery thys);
75 const AjPStr  ajQuerystrParseFormat(AjPStr *Pqry, AjPTextin textin,
76                                     AjBool findformat(const AjPStr format,
77                                                       ajint *iformat));
78 AjBool        ajQuerystrParseListfile(AjPStr *Pqry);
79 AjBool        ajQuerystrParseRange(AjPStr *Pqry,
80                                    ajint *Pbegin, ajint *Pend, AjBool *Prev);
81 AjBool        ajQuerystrParseRead(AjPStr *Pqry,
82                                   AjPTextin textin,
83                                   AjBool findformat(const AjPStr format,
84                                                     ajint *iformat),
85                                   AjBool *Pnontext);
86 void          ajQueryStarclear(AjPQuery thys);
87 AjBool        ajQueryDefinedFieldC(const AjPQuery qry, const char* fieldtxt);
88 AjBool        ajQueryDefinedFieldS(const AjPQuery qry, const AjPStr field);
89 AjBool        ajQueryKnownFieldC(const AjPQuery qry, const char* fieldtxt);
90 AjBool        ajQueryKnownFieldS(const AjPQuery qry, const AjPStr field);
91 AjBool        ajQueryAddFieldAndC(AjPQuery qry, const char* fieldtxt,
92                                   const char* wildquerytxt);
93 AjBool        ajQueryAddFieldAndS(AjPQuery qry, const AjPStr field,
94                                   const AjPStr wildquery);
95 AjBool        ajQueryAddFieldElseC(AjPQuery qry, const char* fieldtxt,
96                                    const char* wildquerytxt);
97 AjBool        ajQueryAddFieldElseS(AjPQuery qry, const AjPStr field,
98                                    const AjPStr wildquery);
99 AjBool        ajQueryAddFieldEorC(AjPQuery qry, const char* fieldtxt,
100                                   const char* wildquerytxt);
101 AjBool        ajQueryAddFieldEorS(AjPQuery qry, const AjPStr field,
102                                   const AjPStr wildquery);
103 AjBool        ajQueryAddFieldNotC(AjPQuery qry, const char* fieldtxt,
104                                   const char* wildquerytxt);
105 AjBool        ajQueryAddFieldNotS(AjPQuery qry, const AjPStr field,
106                                   const AjPStr wildquery);
107 AjBool        ajQueryAddFieldOrC(AjPQuery qry, const char* fieldtxt,
108                                  const char* wildquerytxt);
109 AjBool        ajQueryAddFieldOrS(AjPQuery qry, const AjPStr field,
110                                  const AjPStr wildquery);
111 const AjPList ajQueryGetallFields(const AjPQuery query);
112 const char*   ajQueryGetDatatype(const AjPQuery query);
113 const AjPStr  ajQueryGetFormat(const AjPQuery query);
114 const AjPStr  ajQueryGetId(const AjPQuery query);
115 AjBool        ajQueryGetQuery(const AjPQuery query, AjPStr* Pdest);
116 AjBool        ajQueryIsSet(const AjPQuery thys);
117 AjBool        ajQuerySetWild(AjPQuery thys);
118 
119 AjPQueryField ajQueryfieldNewC(const char* fieldtxt,
120                                const char* wildtxt,
121                                AjEQryLink oper);
122 AjPQueryField ajQueryfieldNewS(const AjPStr field,
123                                const AjPStr wild,
124                                AjEQryLink oper);
125 void          ajQueryfieldDel(AjPQueryField *Pthis);
126 void          ajQuerylistTrace(const AjPList list);
127 
128 void          ajQueryExit(void);
129 
130 /*
131 ** End of prototype definitions
132 */
133 
134 
135 
136 
137 AJ_END_DECLS
138 
139 #endif /* !AJQUERY_H */
140