|
|
|
@ -7,7 +7,8 @@ struct ListString::Cell {
|
|
|
|
|
Cell * m_prev;
|
|
|
|
|
Cell * m_next;
|
|
|
|
|
string m_value;
|
|
|
|
|
Cell(const string &Value = "UNINITIALIZED", Cell *prev = nullptr, Cell *next = nullptr);
|
|
|
|
|
Cell(const string &Value = "UNINITIALIZED",
|
|
|
|
|
Cell *prev = nullptr, Cell *next = nullptr);
|
|
|
|
|
bool phantom() const { return (! m_next) || (! m_prev ); }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -18,6 +19,11 @@ ListString::Cell::Cell(const string & value, Cell *prev, Cell *next )
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unsigned int ListString::size() const
|
|
|
|
|
{
|
|
|
|
|
return m_size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ListString::ListString()
|
|
|
|
|
: m_size{0}
|
|
|
|
|
, m_first{new Cell}
|
|
|
|
@ -44,7 +50,7 @@ void ListString::push_back(const std::string &value) {
|
|
|
|
|
void ListString::insert(const Position & p, const std::string &value)
|
|
|
|
|
{
|
|
|
|
|
Cell *before = p.m_cell;
|
|
|
|
|
Cell *neo = new Cell(value, before, m_first->m_next);
|
|
|
|
|
Cell *neo = new Cell(value, before, before->m_next);
|
|
|
|
|
before->m_next->m_prev = neo;
|
|
|
|
|
before->m_next = neo;
|
|
|
|
|
++m_size;
|
|
|
|
|