Changes in src/SynTree/Constant.h [2c37f34:ca35c51]
- File:
-
- 1 edited
-
src/SynTree/Constant.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Constant.h
r2c37f34 rca35c51 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Th r Jun 22 10:13:00 201713 // Update Count : 1511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 30 13:33:17 2016 13 // Update Count : 6 14 14 // 15 15 … … 23 23 class Constant { 24 24 public: 25 Constant( Type * type, std::string rep, unsigned long long val ); 26 Constant( Type * type, std::string rep, double val ); 27 Constant( const Constant & other ); 25 Constant( Type *type, std::string value ); 26 Constant( const Constant &other ); 28 27 virtual ~Constant(); 29 28 30 Type * get_type() { return type; }31 void set_type( Type * newValue ) { type = newValue; }32 std::string & get_value() { return rep; }33 void set_value( std::string newValue ) { rep= newValue; }29 Type *get_type() { return type; } 30 void set_type( Type *newValue ) { type = newValue; } 31 std::string &get_value() { return value; } 32 void set_value( std::string newValue ) { value = newValue; } 34 33 35 /// generates a boolean constant of the given bool36 static Constant from_bool( bool b );37 34 /// generates an integer constant of the given int 38 35 static Constant from_int( int i ); … … 42 39 static Constant from_double( double d ); 43 40 44 virtual void accept( Visitor & v ) { v.visit( this ); } 45 virtual Constant * acceptMutator( Mutator & m ) { return m.mutate( this ); } 46 virtual void print( std::ostream & os ) const; 41 virtual Constant *clone() const; 42 virtual void accept( Visitor &v ) { v.visit( this ); } 43 virtual Constant *acceptMutator( Mutator &m ) { return m.mutate( this ); } 44 virtual void print( std::ostream &os ) const; 47 45 private: 48 Type * type; 49 std::string rep; 50 union Val { 51 unsigned long long ival; 52 double dval; 53 Val( unsigned long long ival ) : ival( ival ) {} 54 Val( double dval ) : dval( dval ) {} 55 } val; 46 Type *type; 47 std::string value; 56 48 }; 57 49
Note:
See TracChangeset
for help on using the changeset viewer.