xc
Operador.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // xc utils library; general purpose classes and functions.
4 //
5 // Copyright (C) Luis C. Pérez Tato
6 //
7 // XC utils is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // This software is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program.
19 // If not, see <http://www.gnu.org/licenses/>.
20 //----------------------------------------------------------------------------
21 //Operador.h
22 
23 #ifndef OPERADOR_H
24 #define OPERADOR_H
25 
26 #include "Operando.h"
27 #include "operator_names.h"
28 
30 class Operador : public Operando
31  {
32  protected:
33  int prioridad;
34  public:
35  friend class Lexico;
36  Operador(void) : Operando()
37  { Put(-1); }
38  Operador(const int &p)
39  : Operando(), prioridad(p) {}
40  Operador(const Operador &otro)
41  : Operando(otro), prioridad(otro.prioridad) {}
42  Operador &operator=(const Operador &otro);
43  void Put(const int &pv)
44  {
45  Operando::Put(0.0);
46  prioridad= pv;
47  }
48  virtual int GetPrioridad(void) const
49  { return prioridad; }
50  virtual const std::string &GetFullString(void) const;
51  };
52 
53 class ParentIzdo : public Operador
54  {
55  public:
56  ParentIzdo(void) : Operador(-1) {}
57  inline virtual Clase GetClase(void) const
58  { return parent_izdo; }
59  inline virtual const std::string &getName(void) const
60  { return nmbParentIzdo; }
61  };
62 
63 class ParentDcho : public Operador
64  {
65  public:
66  ParentDcho(void) : Operador(-1) {}
67  inline virtual Clase GetClase(void) const
68  { return parent_dcho; }
69  inline virtual const std::string &getName(void) const
70  { return nmbParentDcho; }
71  };
72 
73 
74 #endif
75 
76 
77 
Clase base de los operadores unarios y binarios.
Definition: Operador.h:30
virtual const std::string & getName(void) const
Return the operand name.
Definition: Operador.h:69
Definition: Operador.h:63
virtual const std::string & getName(void) const
Return the operand name.
Definition: Operador.h:59
Operando.
Definition: Operando.h:42
virtual const std::string & GetFullString(void) const
Devuelve la cadena de caracteres correspondiente al valor con toda la precisión posible.
Definition: Operador.cc:31
Definition: Lexico.h:42
Definition: Operador.h:53