#ifndef ALREADY_INCLUDED_2006_LIBD__STRING_HH
#define ALREADY_INCLUDED_2006_LIBD__STRING_HH
#include "libd.hh"
namespace dmp
{
class String : private Single
{
POOL1;
public:
dmp::string v;
private:
String(dmp::string v) : Single(DCODE_STRING)
{
this->v = v;
}
public:
static ptr<String> ctor()
{
return new String("");
}
static ptr<String> ctor(dmp::string s)
{
return new String(s);
}
private:
NOTE: opens up ~String() to ptr class template <class T> friend class ptr;
~String()
{
NOTE: do nothing }
#ifdef DAVINS_IO_ONLINE
friend dmp::Writer& operator << (dmp::Writer& w, const String& s)
{
ASSERT(&w != null);
if (&s == null) {
w << "null";
}
else
{
w << s.v;
}
return w;
}
friend dmp::Reader& operator >> (dmp::Reader& r, String& s)
{
r >> s.v;
return r;
}
#endif
NOTE: disables passing and returning by value private:
String(const String&);
String& operator = (const String&);
friend bool operator == (const String& i1, const String& i2)
{
return dmp::strings_equal(i1.v, i2.v);
}
friend bool operator != (const String& i1, const String& i2)
{
return !dmp::strings_equal(i1.v, i2.v);
}
};
}
#endif