summaryrefslogtreecommitdiff
path: root/flower/list.inl
blob: d71e947050b17bb55f4e4da99cc22a8142ad63f2 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// -*-c++-*-

#ifndef LIST_INL
#define LIST_INL

template<class T>
inline
List<T>::List()
{
    set_empty();
}

template<class T>
inline void
List<T>::set_empty()
{
    top_ = bottom_ = 0;
    size_ = 0;
}

template<class T>
inline
List<T>::List( const T& thing )
{
    set_empty();
    add( thing, Cursor<T>( *this, bottom_ ) );
}
template<class T>
inline void
List<T>::remove( Cursor<T> me )
{
    if ( me.ok() ){
	Link<T> *lp = me.pointer();	
	lp->remove(*this);
	delete lp;
        size_--;
    }
}

template<class T>
inline int
List<T>::size() const
{ 
    return size_;
}

template<class T>
inline Cursor<T>
List<T>::top()
{
    return Cursor<T>( *this, top_ );
}


template<class T>
inline Cursor<T>
List<T>::bottom()
{
    return Cursor<T>( *this, bottom_ );
}


#endif