repo.or.cz
/
opsoft_test.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
current version
[opsoft_test.git]
/
silentbob
/
gclib
/
src
/
elist.cxx
blob
3c6853a7ddc2fcbe9f482df9756203d953637ad0
1
/*
2
* (c) Oleg Puchinin 2006
3
* graycardinalster@gmail.com
4
*
5
*/
6
7
#include <gclib/gclib.h>
8
9
EList
::
EList
()
10
{
11
pos
=
NULL
;
12
}
13
14
EList
::~
EList
()
15
{
16
}
17
18
char
*
EList
::
get
()
19
{
20
if
(!
pos
)
21
return
NULL
;
22
else
23
return
pos
->
data
;
24
}
25
26
char
*
EList
::
first
()
27
{
28
pos
=
get_head
();
29
return
get
();
30
}
31
32
char
*
EList
::
last
()
33
{
34
pos
=
get_tail
();
35
return
get
();
36
}
37
38
char
*
EList
::
next
()
39
{
40
if
(!
pos
->
next
)
41
pos
=
NULL
;
42
else
43
pos
=
pos
->
next
;
44
return
get
();
45
}
46
47
char
*
EList
::
prev
()
48
{
49
if
(!
pos
->
prev
)
50
pos
=
NULL
;
51
else
52
pos
=
pos
->
prev
;
53
return
get
();
54
}
55
56
char
*
EList
::
rm
()
57
{
58
__dlist_entry_t
*
ptr
;
59
char
*
Ret
;
60
61
if
(!
pos
)
62
return
NULL
;
63
64
ptr
=
pos
;
65
Ret
=
ptr
->
data
;
66
67
if
(
ptr
->
next
)
68
pos
=
ptr
->
next
;
69
else if
(
ptr
->
prev
)
70
pos
=
ptr
->
prev
;
71
else
72
pos
=
NULL
;
73
74
DList
::
rm
(
ptr
);
75
return
Ret
;
76
}
77
78
EList
&
EList
::
operator
<< (
char
*
S
)
79
{
80
add_tail
(
S
);
81
return
*
this
;
82
}
83
84
bool
EList
::
eol
()
85
{
86
return
pos
?
false
:
true
;
87
}
88