#ifndef ALREADY_INCLUDED_2006_LIBD__INTEGER_HH
#define ALREADY_INCLUDED_2006_LIBD__INTEGER_HH
#include "libd.hh"
namespace dmp
{
class Integer : private Single
{
public:
int v;
POOL1;
rtti_same(Integer);
private:
Integer(int v) : Single(DCODE_INTEGER)
{
this->v = v;
}
public:
static ptr<Integer> ctor()
{
return new Integer(0);
}
static ptr<Integer> ctor(int v)
{
return new Integer(v);
}
ptr<Integer> clone_shallow()
{
return new Integer(this->v);
}
ptr<Integer> clone_deep()
{
return new Integer(this->v);
}
private:
friend class ptr<Integer>;
~Integer()
{
}
private:
Integer(const Integer&);
Integer& operator = (const Integer&);
friend bool operator == (const Integer& i1, const Integer& i2)
{
return i1.v == i2.v;
}
friend bool operator != (const Integer& i1, const Integer& i2)
{
return i1.v != i2.v;
}
#ifdef DAVINS_IO_ONLINE
friend dmp::string_buffer operator + (const dmp::string& s, const Integer& i)
{
dmp::string_buffer sb;
sb << s;
sb << i.v;
return sb;
}
friend dmp::string_buffer operator + (const dmp::string_buffer& csb, const Integer& i)
{
dmp::string_buffer sb = const_cast<dmp::string_buffer&>(csb);
sb << i.v;
return sb;
}
friend dmp::Writer& operator << (dmp::Writer& w, const Integer& i)
{
ASSERT(&w != null);
ASSERT(&i != null);
w << i.v;
return w;
}
friend dmp::Reader& operator >> (dmp::Reader& r, Integer& i)
{
ASSERT(&r != null);
ASSERT(&i != null);
r >> i.v;
return r;
}
#endif
};
}
#endif