Merge branch 'master' of git+ssh://ares@repo.or.cz/srv/git/lispp
[lispp.git] / LispString.h
blobbf5d20ba146c69791b363806cc4255bf22e7519c
1 #if !defined(H_LISPSTRING)
2 #define H_LISPSTRING
4 namespace Lisp
6 class String;
8 class String : public Obj
10 public:
12 typedef String* StringPtr;
13 typedef String& StringRef;
15 String() : value_("")
16 {};
18 String( const String& other )
20 if (this != &other)
21 value_ = other.value_;
24 virtual eObjectType getObjectType() const
26 return eStringObj;
29 virtual String* create(void) const
31 StringPtr result = new String();
32 return result;
35 virtual String* clone() const
37 StringPtr result = new String(*this);
40 void print(std::ostream& out) const
42 out << "\"" << value_ << "\"";
45 bool operator==(const Obj* other)
47 bool result = false;
48 if (other->getObjectType() == eStringObj)
49 result = ( value_ == dynamic_cast<const String*>(other)->value_ );
50 return result;
52 private:
53 StringValue value_;
57 #endif