/* */ #include "PStringSegment.h" #include "FatalException.h" #include "PStringVisitor.h" namespace aria2 { PStringSegment::PStringSegment(const std::string& value, const SharedHandle& next): _value(value), _next(next) {} PStringSegment::PStringSegment(const std::string& value): _value(value) {} PStringSegment::~PStringSegment() {} void PStringSegment::accept(PStringVisitor* visitor) { PStringSegmentVisitor* v = dynamic_cast(visitor); if(!v) { throw FatalException("Class cast exception"); } v->hello(this); if(!_next.isNull()) { _next->accept(visitor); } v->goodbye(this); } const std::string& PStringSegment::getValue() const { return _value; } bool PStringSegment::hasNext() const { return !_next.isNull(); } SharedHandle PStringSegment::getNext() const { return _next; } } // namespace aria2