• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

  • tdeio
  • tdeio
ktraderparsetree.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef __parse_tree_h__
21#define __parse_tree_h__
22
23#include <tqstring.h>
24#include <tqstringlist.h>
25#include <tqvaluelist.h>
26#include <tqmap.h>
27#include <tqshared.h>
28
29#include <kservice.h>
30#include <kuserprofile.h>
31
32#include "ktrader.h"
33
34namespace TDEIO {
35
36class ParseTreeBase;
37
39struct TDEIO_EXPORT PreferencesReturn
40{
41 enum Type { PRT_DOUBLE, PRT_ERROR };
42
43 PreferencesReturn() { type = PRT_ERROR; }
44
45 PreferencesReturn( const PreferencesReturn& _r )
46 {
47 type = _r.type;
48 f = _r.f;
49 }
50
51 Type type;
52 double f;
53};
54
55
62TDEIO_EXPORT int matchConstraint( const ParseTreeBase *_tree, const KService::Ptr &,
63 const KServiceTypeProfile::OfferList& );
64
69TDEIO_EXPORT PreferencesReturn matchPreferences( const ParseTreeBase *_tree, const KService::Ptr &,
70 const KServiceTypeProfile::OfferList& );
71
75struct TDEIO_EXPORT PreferencesMaxima
76{
77 enum Type { PM_ERROR, PM_INVALID_INT, PM_INVALID_DOUBLE, PM_DOUBLE, PM_INT };
78
79 Type type;
80 int iMax;
81 int iMin;
82 double fMax;
83 double fMin;
84};
85
89class TDEIO_EXPORT ParseContext
90{
91public:
95 ParseContext( const ParseContext* _ctx ) : service( _ctx->service ), maxima( _ctx->maxima ),
96 offers( _ctx->offers ) {}
97 ParseContext( const KService::Ptr & _service, const KServiceTypeProfile::OfferList& _offers,
98 TQMap<TQString,PreferencesMaxima>& _m )
99 : service( _service ), maxima( _m ), offers( _offers ) {}
100
101 bool initMaxima( const TQString& _prop);
102
103 enum Type { T_STRING = 1, T_DOUBLE = 2, T_NUM = 3, T_BOOL = 4,
104 T_STR_SEQ = 5, T_SEQ = 6 };
105
106 TQString str;
107 int i;
108 double f;
109 bool b;
110 TQValueList<TQVariant> seq;
111 TQStringList strSeq;
112 Type type;
113
114 KService::Ptr service;
115
116 TQMap<TQString,PreferencesMaxima>& maxima;
117 const KServiceTypeProfile::OfferList& offers;
118};
119
123class TDEIO_EXPORT ParseTreeBase : public TDEShared
124{
125public:
126 typedef TDESharedPtr<ParseTreeBase> Ptr;
127 ParseTreeBase() { }
128
129 virtual bool eval( ParseContext *_context ) const = 0;
130protected:
131 virtual ~ParseTreeBase() { };
132};
133
134TDEIO_EXPORT ParseTreeBase::Ptr parseConstraints( const TQString& _constr );
135TDEIO_EXPORT ParseTreeBase::Ptr parsePreferences( const TQString& _prefs );
136
140class TDEIO_EXPORT ParseTreeOR : public ParseTreeBase
141{
142public:
143 ParseTreeOR( ParseTreeBase *_ptr1, ParseTreeBase *_ptr2 ) { m_pLeft = _ptr1; m_pRight = _ptr2; }
144
145 bool eval( ParseContext *_context ) const;
146
147protected:
148 ParseTreeBase::Ptr m_pLeft;
149 ParseTreeBase::Ptr m_pRight;
150};
151
155class TDEIO_EXPORT ParseTreeAND : public ParseTreeBase
156{
157public:
158 ParseTreeAND( ParseTreeBase *_ptr1, ParseTreeBase *_ptr2 ) { m_pLeft = _ptr1; m_pRight = _ptr2; }
159
160 bool eval( ParseContext *_context ) const;
161
162protected:
163 ParseTreeBase::Ptr m_pLeft;
164 ParseTreeBase::Ptr m_pRight;
165};
166
170class TDEIO_EXPORT ParseTreeCMP : public ParseTreeBase
171{
172public:
173 ParseTreeCMP( ParseTreeBase *_ptr1, ParseTreeBase *_ptr2, int _i ) { m_pLeft = _ptr1; m_pRight = _ptr2; m_cmd = _i; }
174
175 bool eval( ParseContext *_context ) const;
176
177protected:
178 ParseTreeBase::Ptr m_pLeft;
179 ParseTreeBase::Ptr m_pRight;
180 int m_cmd;
181};
182
186class TDEIO_EXPORT ParseTreeIN : public ParseTreeBase
187{
188public:
189 ParseTreeIN( ParseTreeBase *_ptr1, ParseTreeBase *_ptr2 ) { m_pLeft = _ptr1; m_pRight = _ptr2; }
190
191 bool eval( ParseContext *_context ) const;
192
193protected:
194 ParseTreeBase::Ptr m_pLeft;
195 ParseTreeBase::Ptr m_pRight;
196};
197
201class TDEIO_EXPORT ParseTreeMATCH : public ParseTreeBase
202{
203public:
204 ParseTreeMATCH( ParseTreeBase *_ptr1, ParseTreeBase *_ptr2 ) { m_pLeft = _ptr1; m_pRight = _ptr2; }
205
206 bool eval( ParseContext *_context ) const;
207
208protected:
209 ParseTreeBase::Ptr m_pLeft;
210 ParseTreeBase::Ptr m_pRight;
211};
212
216class TDEIO_EXPORT ParseTreeCALC : public ParseTreeBase
217{
218public:
219 ParseTreeCALC( ParseTreeBase *_ptr1, ParseTreeBase *_ptr2, int _i ) { m_pLeft = _ptr1; m_pRight = _ptr2; m_cmd = _i; }
220
221 bool eval( ParseContext *_context ) const;
222
223protected:
224 ParseTreeBase::Ptr m_pLeft;
225 ParseTreeBase::Ptr m_pRight;
226 int m_cmd;
227};
228
232class TDEIO_EXPORT ParseTreeBRACKETS : public ParseTreeBase
233{
234public:
235 ParseTreeBRACKETS( ParseTreeBase *_ptr ) { m_pLeft = _ptr; }
236
237 bool eval( ParseContext *_context ) const { return m_pLeft->eval( _context ); }
238
239protected:
240 ParseTreeBase::Ptr m_pLeft;
241};
242
246class TDEIO_EXPORT ParseTreeNOT : public ParseTreeBase
247{
248public:
249 ParseTreeNOT( ParseTreeBase *_ptr ) { m_pLeft = _ptr; }
250
251 bool eval( ParseContext *_context ) const;
252
253protected:
254 ParseTreeBase::Ptr m_pLeft;
255};
256
260class TDEIO_EXPORT ParseTreeEXIST : public ParseTreeBase
261{
262public:
263 ParseTreeEXIST( const char *_id ) { m_id = _id; }
264
265 bool eval( ParseContext *_context ) const;
266
267protected:
268 TQString m_id;
269};
270
274class TDEIO_EXPORT ParseTreeID : public ParseTreeBase
275{
276public:
277 ParseTreeID( const char *arg ) { m_str = arg; }
278
279 bool eval( ParseContext *_context ) const;
280
281protected:
282 TQString m_str;
283};
284
288class TDEIO_EXPORT ParseTreeSTRING : public ParseTreeBase
289{
290public:
291 ParseTreeSTRING( const char *arg ) { m_str = arg; }
292
293 bool eval( ParseContext *_context ) const { _context->type = ParseContext::T_STRING; _context->str = m_str; return true; }
294
295protected:
296 TQString m_str;
297};
298
302class TDEIO_EXPORT ParseTreeNUM : public ParseTreeBase
303{
304public:
305 ParseTreeNUM( int arg ) { m_int = arg; }
306
307 bool eval( ParseContext *_context ) const { _context->type = ParseContext::T_NUM; _context->i = m_int; return true; }
308
309protected:
310 int m_int;
311};
312
316class TDEIO_EXPORT ParseTreeDOUBLE : public ParseTreeBase
317{
318public:
319 ParseTreeDOUBLE( double arg ) { m_double = arg; }
320
321 bool eval( ParseContext *_context ) const { _context->type = ParseContext::T_DOUBLE; _context->f = m_double; return true; }
322
323protected:
324 double m_double;
325};
326
330class TDEIO_EXPORT ParseTreeBOOL : public ParseTreeBase
331{
332public:
333 ParseTreeBOOL( bool arg ) { m_bool = arg; }
334
335 bool eval( ParseContext *_context ) const { _context->type = ParseContext::T_BOOL; _context->b = m_bool; return true; }
336
337protected:
338 bool m_bool;
339};
340
344class TDEIO_EXPORT ParseTreeMAX2 : public ParseTreeBase
345{
346public:
347 ParseTreeMAX2( const char *_id ) { m_strId = _id; }
348
349 bool eval( ParseContext *_context ) const;
350
351protected:
352 TQString m_strId;
353};
354
358class TDEIO_EXPORT ParseTreeMIN2 : public ParseTreeBase
359{
360public:
361 ParseTreeMIN2( const char *_id ) { m_strId = _id; }
362
363 bool eval( ParseContext *_context ) const;
364
365protected:
366 TQString m_strId;
367};
368
369}
370
371#endif
TDEIO
A namespace for TDEIO globals.
Definition authinfo.h:29

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.9.8
This website is maintained by Timothy Pearson.