00001 //--------------------------------------------------------------------------- 00002 #ifndef UNarithmH 00003 #define UNarithmH 00004 //--------------------------------------------------------------------------- 00005 00006 #define OP_MULT 1 00007 #define OP_PLUS 2 00008 #define OP_MOIN 3 00009 #define OP_DIVI 4 00010 #define DT_INT 5 00011 #define DT_TAG 6 00012 #define DT_BYTE 7 00013 00014 typedef struct noeud 00015 { 00016 int Ident; // identificateur du libelle contenu dans le noeud 00017 unsigned long Ulong; 00018 AnsiString libelle; // donne le libelle d'une variable contenant la valeur 00019 noeud * Gauche; 00020 noeud * Droite; 00021 noeud * Pere; 00022 } noeud; 00023 00024 00025 class Arithm 00026 { 00027 noeud * Arbre; 00028 00029 AnsiString Traitement; 00030 TStrings * ListOfValues; 00031 unsigned char * data; 00032 00033 public: 00034 Arithm(); 00035 ~Arithm(); 00036 00037 void setString(AnsiString trait) { Traitement = trait; } 00038 AnsiString getString() { return Traitement; } 00039 void setValuesList(TStrings * sl) { ListOfValues = sl; } 00040 00041 void parse(AnsiString trait) { setString(trait); parse(); } 00042 void parse(); 00043 noeud * add(noeud * courant, int ident, unsigned long val = 0); 00044 noeud * add(noeud * courant, int ident, AnsiString val); 00045 noeud * getPere(noeud * courant); 00046 noeud * addGauche(noeud * courant); 00047 noeud * addDroite(noeud * courant); 00048 void destructionArbre(); 00049 void detruitNoeud(noeud * courant); 00050 void afficheArbre(TStrings * sl); 00051 void afficheNoeud(noeud * courant, AnsiString decal, TStrings * sl); 00052 unsigned long eval(); 00053 unsigned long eval(unsigned char * dat) { data = dat; return eval(); } 00054 unsigned long evalNoeud(noeud * courant); 00055 00056 unsigned long valueOf(AnsiString libelle); 00057 unsigned long valueOfByte(AnsiString libelle); 00058 }; 00059 00060 00061 #endif