Merge branch 'master' of git+ssh://ares@repo.or.cz/srv/git/lispp
[lispp.git] / LispFixnum.h
blob53b9d6fb0ec8f5cf407a126f123007ba0a02071d
2 #ifndef LISP_FIXNUM_H_INCLUDED
3 #define LISP_FIXNUM_H_INCLUDED
5 namespace Lisp
8 class Fixnum;
10 class Fixnum : public Obj
12 public:
14 typedef Fixnum* FixnumPtr;
15 typedef Fixnum& FixnumRef;
17 Fixnum() : value_(0)
18 {};
20 Fixnum(const Fixnum& other)
22 if (this != &other)
23 value_ = other.value_;
26 virtual eObjectType getObjectType() const
28 return eFixnumObj;
31 virtual Fixnum* create(void) const
33 FixnumPtr result = new Fixnum();
34 return result;
37 virtual Fixnum* clone() const
39 FixnumPtr result = new Fixnum(*this);
40 return result;
43 void print(std::ostream& out) const
45 out << value_;
48 // bool identify(std::string in) const
49 // {
50 // in >> value_;
51 // }
53 bool operator==(const Obj* other)
55 bool result = false;
56 if (other->getObjectType() == eFixnumObj)
57 result = ( value_ == dynamic_cast<const Fixnum*>(other)->value_ );
58 return result;
60 private:
61 FixnumValue value_;
67 #endif