idNode.h
Ir a la documentación de este archivo.
1 //idNode.h
2 //-------------------------------------------------------------------------------------------
3 /*
4  * Fco. Javier Bohórquez Ogalla
5  * 75766599-E
6  * Puerto Real (Cádiz)
7  * powersgame@gmail.com
8  */
9 //-------------------------------------------------------------------------------------------
10 /*
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program 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
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24  * MA 02110-1301, USA.
25  */
26 //-------------------------------------------------------------------------------------------
35 //-------------------------------------------------------------------------------------------
36 #ifndef _RUN_TABLE_IDNODE_
37 #define _RUN_TABLE_IDNODE_
38 
39 #include "sTable.h"
40 #include "../tree/expNode.h"
41 //-------------------------------------------------------------------------------------------
42 
43 //-------------------------------------------------------------------------------------------
59 class idNode :
60  public nexpNode {
61  public:
66  idNode (string id);
80  void run ();
86  virtual void run (bool resolvkey);
91  virtual void runf ();
96  virtual void runc ();
101  inline refNode* ref () {
102  return ref_;
103  }
108  inline refNode* reff () { return reff_; }
113  inline refNode* refc () { return refc_; }
119  inline runNode* nodeval () const { return ref_?ref_->getRef():NULL; }
125  inline runNode* nodevalf () const { return reff_?reff_->getRef():NULL; }
131  inline runNode* nodevalc () const {
132  return refc_?refc_->getRef():NULL;
133  }
137  void clear ();
143  void noderef (runNode* node);
149  void nodereff (runNode* node);
155  void noderefc (runNode* node);
162  virtual bool exist (bool func = true);
168  inline bool existf () const {
169  return existf_;
170  }
176  inline bool existc () const {
177  return existc_;
178  }
184  virtual bool existfunction ();
195  static runNode* resolved (runNode* &id, runNode* default_val=NULL, bool check_privat = false, sTable* check_table = NULL);
209  static runNode* resolvedAsStr (runNode* &id, bool isfunc = true, bool check_private = false, sTable* check_table = NULL, bool force_str = false);
214  inline string name () const { return id_; }
219  inline void setName (string name) { id_ = name; }
224  refNode* getRef () const;
229  refNode* getReff () const;
234  refNode* getRefc () const;
235  protected:
236  string id_;
237  bool exist_;
238  refNode* reff_;
239  bool existf_;
240  refNode* refc_;
241  bool existc_;
242  runNode * key_point_;
243 };
244 //-------------------------------------------------------------------------------------------
245 
246 //-------------------------------------------------------------------------------------------
258 class idgetNode: public idNode {
259  public:
265  idgetNode (runNode *exp);
282  void run ();
292  void run (bool resolvkey);
300  virtual void runf ();
308  void runc ();
313  void clear ();
320  bool exist (bool func = true);
326  bool existf () const;
332  bool existc () const;
337  string name () const;
343  bool existfunction ();
349  idNode* getId ();
350  private:
351  void setId ();
352  runNode *exp_;
353  idNode *id_;
354 };
355 //-------------------------------------------------------------------------------------------
356 
357 //-------------------------------------------------------------------------------------------
366 class globalNode :
367  public runNode {
368  public:
373  globalNode (runNode* id);
379  void run ();
380  private:
381  runNode *id_;
382 };
383 //-------------------------------------------------------------------------------------------
384 
385 //-------------------------------------------------------------------------------------------
386 #endif
387 //-------------------------------------------------------------------------------------------
388 //Fco. Javier Bohórquez Ogalla
void run()
Definition: idNode.cpp:299
Nodo identificador.
Definition: idNode.h:59
string name() const
Definition: idNode.h:214
runNode * getRef() const
Definition: runTree.cpp:417
void clear()
Definition: idNode.cpp:256
refNode * getReff() const
Definition: idNode.cpp:212
bool exist(bool func=true)
Definition: idNode.cpp:261
bool existfunction()
Definition: idNode.cpp:269
idgetNode(runNode *exp)
Definition: idNode.cpp:225
idNode * getId()
Definition: idNode.cpp:292
void clear()
Definition: idNode.cpp:155
string name() const
Definition: idNode.cpp:286
virtual void runf()
Definition: idNode.cpp:244
refNode * reff()
Definition: idNode.h:108
globalNode(runNode *id)
Definition: idNode.cpp:297
virtual bool existfunction()
Definition: idNode.cpp:76
void noderefc(runNode *node)
Definition: idNode.cpp:141
void noderef(runNode *node)
Definition: idNode.cpp:109
void run()
Definition: idNode.cpp:227
void setName(string name)
Definition: idNode.h:219
runNode * nodeval() const
Definition: idNode.h:119
void run()
Definition: idNode.cpp:41
Nodo ejecutable.
Definition: runTree.h:123
bool existf() const
Definition: idNode.h:168
refNode * getRef() const
Definition: idNode.cpp:207
void nodereff(runNode *node)
Definition: idNode.cpp:127
static runNode * resolved(runNode *&id, runNode *default_val=NULL, bool check_privat=false, sTable *check_table=NULL)
Definition: idNode.cpp:160
refNode * refc()
Definition: idNode.h:113
runNode * nodevalc() const
Definition: idNode.h:131
bool existc() const
Definition: idNode.h:176
virtual void runc()
Definition: idNode.cpp:96
bool existf() const
Definition: idNode.cpp:274
Contexto de tablas de símbolos.
Definition: sTable.h:121
virtual bool exist(bool func=true)
Definition: idNode.cpp:69
Nodo referencia.
Definition: runTree.h:279
Nodo identificador obtenido.
Definition: idNode.h:258
bool existc() const
Definition: idNode.cpp:280
refNode * getRefc() const
Definition: idNode.cpp:217
idNode(string id)
Definition: idNode.cpp:39
Tabla de símbolos.
refNode * ref()
Definition: idNode.h:101
virtual void runf()
Definition: idNode.cpp:81
runNode * nodevalf() const
Definition: idNode.h:125
static runNode * resolvedAsStr(runNode *&id, bool isfunc=true, bool check_private=false, sTable *check_table=NULL, bool force_str=false)
Definition: idNode.cpp:180
void runc()
Definition: idNode.cpp:250
Nodo expresión de tipo no definido.
Definition: expNode.h:164
Nodo identificador global.
Definition: idNode.h:366