projects
/
goodguy
/
history.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rework histogram_bezier, init wm icon set_icon(gg), update de.po+msg/txt
[goodguy/history.git]
/
cinelerra-5.1
/
guicast
/
linklist.h
diff --git
a/cinelerra-5.1/guicast/linklist.h
b/cinelerra-5.1/guicast/linklist.h
index 284a0ebfaeed2fc65eabf340c58a31853eb8d1a3..0c580defded3c95b8ff8836fbdf562c98ebd9792 100644
(file)
--- a/
cinelerra-5.1/guicast/linklist.h
+++ b/
cinelerra-5.1/guicast/linklist.h
@@
-7,18
+7,17
@@
template<class TYPE>
class ListItem {
public:
TYPE *previous, *next;
class ListItem {
public:
TYPE *previous, *next;
- List<TYPE> *
owner
;
+ List<TYPE> *
list
;
- int get_item_number() { return !
owner ? -1 : owner
->number_of(this); }
- ListItem() {
owner
= 0; previous = next = 0; }
- ListItem(List<TYPE> &me) {
owner
= me; previous = next = 0; }
- virtual ~ListItem() { if(
owner ) owner
->remove_pointer(this); }
+ int get_item_number() { return !
list ? -1 : list
->number_of(this); }
+ ListItem() {
list
= 0; previous = next = 0; }
+ ListItem(List<TYPE> &me) {
list
= me; previous = next = 0; }
+ virtual ~ListItem() { if(
list ) list
->remove_pointer(this); }
};
template<class TYPE>
class List {
TYPE *split(int (*cmpr)(TYPE *a, TYPE *b),TYPE *l, TYPE *r);
};
template<class TYPE>
class List {
TYPE *split(int (*cmpr)(TYPE *a, TYPE *b),TYPE *l, TYPE *r);
- void sort(int (*cmpr)(TYPE *a, TYPE *b),TYPE *ll, TYPE *rr);
static int cmpr(TYPE *a, TYPE *b) {
if( *a == *b ) return 0;
return *a > *b ? 1 : -1;
static int cmpr(TYPE *a, TYPE *b) {
if( *a == *b ) return 0;
return *a > *b ? 1 : -1;
@@
-26,7
+25,7
@@
class List {
public:
TYPE *first, *last;
void remove(TYPE *item) { if(item) delete item; }
public:
TYPE *first, *last;
void remove(TYPE *item) { if(item) delete item; }
- void remove_pointer(ListItem<TYPE> *item);
+ void remove_pointer(ListItem<TYPE> *item);
TYPE *append(TYPE *new_item);
TYPE *append() { return append(new TYPE()); }
TYPE *insert_before(TYPE *here, TYPE *item);
TYPE *append(TYPE *new_item);
TYPE *append() { return append(new TYPE()); }
TYPE *insert_before(TYPE *here, TYPE *item);
@@
-44,8
+43,8
@@
public:
return p ? i : -1;
}
void swap(TYPE *item1, TYPE *item2);
return p ? i : -1;
}
void swap(TYPE *item1, TYPE *item2);
- void sort(
int (*cmp)(TYPE *a, TYPE *b) = 0) {
- return sort(cmp ? cmp : cmpr,0,0); }
+ void sort(
TYPE *ap=0, TYPE *bp=0) { return sort(cmpr,ap,bp); }
+ void sort(int (*cmp)(TYPE *a, TYPE *b), TYPE *ap=0, TYPE *bp=0);
List() { first = last = 0; }
virtual ~List() { while(last) delete last; }
};
List() { first = last = 0; }
virtual ~List() { while(last) delete last; }
};
@@
-57,7
+56,7
@@
public:
template<class TYPE>
TYPE* List<TYPE>::append(TYPE *item)
{
template<class TYPE>
TYPE* List<TYPE>::append(TYPE *item)
{
- item->
owner
= this; item->next = 0;
+ item->
list
= this; item->next = 0;
if( !last ) { item->previous = 0; first = item; }
else { item->previous = last; last->next = item; }
return last = item;
if( !last ) { item->previous = 0; first = item; }
else { item->previous = last; last->next = item; }
return last = item;
@@
-67,7
+66,7
@@
template<class TYPE>
TYPE* List<TYPE>::insert_before(TYPE *here, TYPE *item)
{
if( !here || !last ) return append(item);
TYPE* List<TYPE>::insert_before(TYPE *here, TYPE *item)
{
if( !here || !last ) return append(item);
- item->
owner
= this; item->next = here;
+ item->
list
= this; item->next = here;
*( !(item->previous=here->previous) ? &first : &here->previous->next ) = item;
return here->previous = item;
}
*( !(item->previous=here->previous) ? &first : &here->previous->next ) = item;
return here->previous = item;
}
@@
-76,7
+75,7
@@
template<class TYPE>
TYPE* List<TYPE>::insert_after(TYPE *here, TYPE *item)
{
if( !here || !last ) return append(item);
TYPE* List<TYPE>::insert_after(TYPE *here, TYPE *item)
{
if( !here || !last ) return append(item);
- item->
owner
= this; item->previous = here;
+ item->
list
= this; item->previous = here;
*( !(item->next=here->next) ? &last : &here->next->previous ) = item;
return here->next = item;
}
*( !(item->next=here->next) ? &last : &here->next->previous ) = item;
return here->next = item;
}
@@
-89,7
+88,7
@@
void List<TYPE>::remove_pointer(ListItem<TYPE> *item)
TYPE *previous = item->previous, *next = item->next;
*( previous ? &previous->next : &first ) = next;
*( next ? &next->previous : &last ) = previous;
TYPE *previous = item->previous, *next = item->next;
*( previous ? &previous->next : &first ) = next;
*( next ? &next->previous : &last ) = previous;
- item->
owner
= 0;
+ item->
list
= 0;
}
template<class TYPE>
}
template<class TYPE>