Changes in src/SynTree/Constant.h [c36298d:6c89ecc]
- File:
-
- 1 edited
-
src/SynTree/Constant.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Constant.h
rc36298d r6c89ecc 18 18 #include <iosfwd> // for ostream 19 19 #include <string> // for string 20 #include <optional> // for optional21 20 22 21 #include "BaseSyntaxNode.h" … … 28 27 class Constant : public BaseSyntaxNode { 29 28 public: 30 Constant( Type * type, std::string rep, std::optional<unsigned long long> i ); 29 Constant( Type * type, std::string rep, unsigned long long val ); 30 Constant( Type * type, std::string rep, double val ); 31 31 Constant( const Constant & other ); 32 32 virtual ~Constant(); … … 39 39 void set_value( std::string newValue ) { rep = newValue; } 40 40 unsigned long long get_ival() const; 41 double get_dval() const; 41 42 42 43 /// generates a boolean constant of the given bool 43 44 static Constant from_bool( bool b ); 45 /// generates a char constant of the given char 46 static Constant from_char( char c ); 44 47 /// generates an integer constant of the given int 45 48 static Constant from_int( int i ); 46 49 /// generates an integer constant of the given unsigned long int 47 50 static Constant from_ulong( unsigned long i ); 51 /// generates a floating point constant of the given double 52 static Constant from_double( double d ); 53 /// generates an array of chars constant of the given string 54 static Constant from_string( std::string const & s ); 48 55 49 56 /// generates a null pointer value for the given type. void * if omitted. … … 56 63 Type * type; 57 64 std::string rep; 58 std::optional<unsigned long long> ival; 59 60 friend class ConverterOldToNew; 65 union Val { 66 unsigned long long ival; 67 double dval; 68 Val( unsigned long long ival ) : ival( ival ) {} 69 Val( double dval ) : dval( dval ) {} 70 } val; 61 71 }; 62 72
Note:
See TracChangeset
for help on using the changeset viewer.