2023-08-30 18:06:26 +00:00
|
|
|
#ifndef roza_VALUE_HPP
|
|
|
|
#define roza_VALUE_HPP
|
|
|
|
|
|
|
|
#include "commons.hpp"
|
|
|
|
#include "SrcLoc.hpp"
|
|
|
|
#include "Type.hpp"
|
|
|
|
|
|
|
|
namespace roza
|
|
|
|
{
|
|
|
|
class Value
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit Value(int value, SrcLoc loc);
|
2023-08-31 09:07:03 +00:00
|
|
|
explicit Value(bool value, SrcLoc loc);
|
2023-08-30 18:06:26 +00:00
|
|
|
virtual ~Value();
|
|
|
|
|
2023-08-30 22:31:19 +00:00
|
|
|
SrcLoc loc() const { return m_loc; }
|
2023-08-31 09:07:03 +00:00
|
|
|
|
2023-08-30 22:31:19 +00:00
|
|
|
int as_int() const { return m_int_val; }
|
2023-08-31 09:07:03 +00:00
|
|
|
bool as_bool() const { return m_bool_val; }
|
|
|
|
|
2023-08-30 18:06:26 +00:00
|
|
|
std::shared_ptr<Type> type() const { return m_type; }
|
|
|
|
std::string string() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::shared_ptr<Type> m_type;
|
|
|
|
int m_int_val;
|
2023-08-31 09:07:03 +00:00
|
|
|
bool m_bool_val;
|
2023-08-30 18:06:26 +00:00
|
|
|
SrcLoc m_loc;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|