Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
85d65db5
Commit
85d65db5
authored
Dec 02, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refinements after using
parent
fa472950
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
18 deletions
+51
-18
dlist.cpp
common/dlist.cpp
+2
-2
dlist.h
include/dlist.h
+49
-16
No files found.
common/dlist.cpp
View file @
85d65db5
...
...
@@ -34,11 +34,11 @@
DHEAD
::~
DHEAD
()
{
if
(
meOwner
)
De
struct
All
();
De
lete
All
();
}
void
DHEAD
::
De
struct
All
()
void
DHEAD
::
De
lete
All
()
{
EDA_BaseStruct
*
next
;
EDA_BaseStruct
*
item
=
first
;
...
...
include/dlist.h
View file @
85d65db5
...
...
@@ -89,10 +89,11 @@ protected:
public
:
/**
* Function DestructAll
* deletes all items on the list and leaves the list empty.
* Function DeleteAll
* deletes all items on the list and leaves the list empty. The destructor
* for each item is called.
*/
void
De
struct
All
();
void
De
lete
All
();
/**
* Function SetOwnership
...
...
@@ -124,23 +125,30 @@ public:
/**
* operator T*
* is a casting operator that returns \a
first casted to
a T*
* is a casting operator that returns \a
GetFirst(),
a T*
*/
operator
T
*
()
const
{
return
GetFirst
();
}
/**
* operator ->
* is a dereferencing operator that returns \a GetFirst(), a T*
*/
T
*
operator
->
()
const
{
return
GetFirst
();
}
/**
* Function GetFirst
* returns the first T* in the list, or NULL if the list is empty.
* returns the first T* in the list without removing it, or NULL if
* the list is empty.
*/
T
*
GetFirst
()
const
{
return
(
T
*
)
first
;
}
/**
* Function GetLast
* returns the last T* in the list, or NULL if the list is empty.
* returns the last T* in the list without removing it,
* or NULL if the list is empty.
*/
T
*
GetLast
()
const
{
return
(
T
*
)
last
;
}
/**
* Function Append
* adds \a aNewElement to the end of the list.
...
...
@@ -160,15 +168,6 @@ public:
insert
(
aNewElement
,
aElementAfterMe
);
}
/**
* Function Insert
* puts aNewElement in front of list sequence.
*/
void
Insert
(
T
*
aNewElement
)
{
insert
(
aNewElement
);
}
/**
* Function Remove
* removes \a aElement from the list, but does not delete it.
...
...
@@ -180,6 +179,40 @@ public:
return
aElement
;
}
//-----< STL like functions >---------------------------------------
T
*
begin
()
const
{
return
GetFirst
();
}
T
*
end
()
const
{
return
NULL
;
}
T
*
PopFront
()
{
if
(
GetFirst
()
)
return
Remove
(
GetFirst
()
);
return
NULL
;
}
T
*
PopBack
()
{
if
(
GetLast
()
)
return
Remove
(
GetLast
()
);
return
NULL
;
}
/**
* Function PushFront
* puts aNewElement at front of list sequence.
*/
void
PushFront
(
T
*
aNewElement
)
{
insert
(
aNewElement
);
}
void
PushBack
(
T
*
aElement
)
{
append
(
aElement
);
}
//-----</ STL like functions >--------------------------------------
};
#endif // DLIST_H_
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment