| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# ktraderparse.cpp

    00001 /* This file is part of the KDE project
    00002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
    00003
    00004    This library is free software; you can redistribute it and/or
    00005    modify it under the terms of the GNU Library General Public
    00006    License as published by the Free Software Foundation; either
    00007    version 2 of the License, or (at your option) any later version.
    00008
    00009    This library is distributed in the hope that it will be useful,
    00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012    Library General Public License for more details.
    00013
    00014    You should have received a copy of the GNU Library General Public License
    00015    along with this library; see the file COPYING.LIB.  If not, write to
    00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017    Boston, MA 02111-1307, USA.
    00018 */
    00019
    00020 #include <assert.h>
    00021 #include <stdlib.h>
    00022
    00023 // TODO: Torben: On error free memory!
    00024
    00025 extern "C"
    00026 {
    00027 #include "ktraderparse.h"
    00028
    00029 void KTraderParse_mainParse( const char *_code );
    00030 }
    00031
    00032 #include "ktraderparsetree.h"
    00033
    00034 using namespace KIO;
    00035
    00036 ParseTreeBase::Ptr *pTree = 0L;
    00037
    00038 ParseTreeBase::Ptr KIO::parseConstraints( const QString& _constr )
    00039 {
    00040   KTraderParse_mainParse( _constr.ascii() );
    00041   assert( pTree );
    00042   return *pTree;
    00043 }
    00044
    00045 ParseTreeBase::Ptr KIO::parsePreferences( const QString& _prefs )
    00046 {
    00047   KTraderParse_mainParse( _prefs.ascii() );
    00048   assert( pTree );
    00049   return *pTree;
    00050 }
    00051
    00052 void KTraderParse_setParseTree( void *_ptr1 )
    00053 {
    00054   if ( !pTree )
    00055     pTree = new ParseTreeBase::Ptr; // ### leak
    00056   *pTree = static_cast<ParseTreeBase*>( _ptr1 );
    00057 }
    00058
    00059 void* KTraderParse_newOR( void *_ptr1, void *_ptr2 )
    00060 {
    00061   return new ParseTreeOR( (ParseTreeBase*)_ptr1, (ParseTreeBase*)_ptr2 );
    00062 }
    00063
    00064 void* KTraderParse_newAND( void *_ptr1, void *_ptr2 )
    00065 {
    00066   return new ParseTreeAND( (ParseTreeBase*)_ptr1, (ParseTreeBase*)_ptr2 );
    00067 }
    00068
    00069 void* KTraderParse_newCMP( void *_ptr1, void *_ptr2, int _i )
    00070 {
    00071   return new ParseTreeCMP( (ParseTreeBase*)_ptr1, (ParseTreeBase*)_ptr2, _i );
    00072 }
    00073
    00074 void* KTraderParse_newIN( void *_ptr1, void *_ptr2 )
    00075 {
    00076   return new ParseTreeIN( (ParseTreeBase*)_ptr1, (ParseTreeBase*)_ptr2 );
    00077 }
    00078
    00079 void* KTraderParse_newMATCH( void *_ptr1, void *_ptr2 )
    00080 {
    00081   return new ParseTreeMATCH( (ParseTreeBase*)_ptr1, (ParseTreeBase*)_ptr2 );
    00082 }
    00083
    00084 void* KTraderParse_newCALC( void *_ptr1, void *_ptr2, int _i )
    00085 {
    00086   return new ParseTreeCALC( (ParseTreeBase*)_ptr1, (ParseTreeBase*)_ptr2, _i );
    00087 }
    00088
    00089 void* KTraderParse_newBRACKETS( void *_ptr1 )
    00090 {
    00091   return new ParseTreeBRACKETS( (ParseTreeBase*)_ptr1 );
    00092 }
    00093
    00094 void* KTraderParse_newNOT( void *_ptr1 )
    00095 {
    00096   return new ParseTreeNOT( (ParseTreeBase*)_ptr1 );
    00097 }
    00098
    00099 void* KTraderParse_newEXIST( char *_ptr1 )
    00100 {
    00101   ParseTreeEXIST *t = new ParseTreeEXIST( _ptr1 );
    00102   free(_ptr1);
    00103   return t;
    00104 }
    00105
    00106 void* KTraderParse_newID( char *_ptr1 )
    00107 {
    00108   ParseTreeID *t = new ParseTreeID( _ptr1 );
    00109   free(_ptr1);
    00110   return t;
    00111 }
    00112
    00113 void* KTraderParse_newSTRING( char *_ptr1 )
    00114 {
    00115   ParseTreeSTRING *t = new ParseTreeSTRING( _ptr1 );
    00116   free(_ptr1);
    00117   return t;
    00118 }
    00119
    00120 void* KTraderParse_newNUM( int _i )
    00121 {
    00122   return new ParseTreeNUM( _i );
    00123 }
    00124
    00125 void* KTraderParse_newFLOAT( float _f )
    00126 {
    00127   return new ParseTreeDOUBLE( _f );
    00128 }
    00129
    00130 void* KTraderParse_newBOOL( char _b )
    00131 {
    00132   return new ParseTreeBOOL( (bool)_b );
    00133 }
    00134
    00135 void* KTraderParse_newMAX2( char *_id )
    00136 {
    00137   ParseTreeMAX2 *t = new ParseTreeMAX2( _id );
    00138   free(_id);
    00139   return t;
    00140 }
    00141
    00142 void* KTraderParse_newMIN2( char *_id )
    00143 {
    00144   ParseTreeMIN2 *t = new ParseTreeMIN2( _id );
    00145   free(_id);
    00146   return t;
    00147 }

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:14:29 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001