diff options
author | cathook <cat.hook31894@gmail.com> | 2013-11-27 03:05:29 +0800 |
---|---|---|
committer | cathook <cat.hook31894@gmail.com> | 2013-11-27 03:05:29 +0800 |
commit | 035cbbee37df98b51c97f342917c6d2b80a565d5 (patch) | |
tree | 11db374894e7918d770669410f493caa1be6336b | |
parent | 9a7f815fdd5c74c460a42b6b9cb7204394c1caa8 (diff) | |
download | ctl-035cbbee37df98b51c97f342917c6d2b80a565d5.tar.gz ctl-035cbbee37df98b51c97f342917c6d2b80a565d5.tar.zst ctl-035cbbee37df98b51c97f342917c6d2b80a565d5.zip |
update README file
-rw-r--r-- | README | 120 | ||||
-rw-r--r-- | include/list.h | 16 |
2 files changed, 131 insertions, 5 deletions
@@ -112,6 +112,126 @@ Target/goal: reverse order. -list: + This object is a double link list. + methods: + init(addr of the list, size per entry, list size) + The list's type depends on what user want to store + . For example: if you want a list for int, you s- + hould declare like "int* v", and call the init() + like "init(&v, sizeof(int), 5)", which will creat + a double link list with 5 elements. + + free(addr of the list) + Free the memory the list use. You should call it + when you don't need the container. + + + getSize(addr of the list) + Return the number of elements. + + getEntrySize(addr of the list) + Return the size per entry, it dependent on what + type of data you store in the container. + + getFront(addr of the list) + Return a const pointer which point to the entry + at the head of the list. + + getBack(addr of the list) + Return a const pointer which point to the entry + at the end of the list. + + getBegin(addr of the list) + Return a pointer which point to the iterator at + the head of the list. + + getEnd(addr of the list) + Return a pointer which point to the iterator at + the end of the list (which cannot be modified). + + + setSize(addr of the list, new_size) + Resize the lsit to new_size at the back of the + list. Note that it won't initalize the newly ele- + ments when you increase the size. + + setFront(addr of the list, data) + Let the first element be the data you given. + + setBack(addr of the list, data) + Let the last element be the data you given. + + + addBack(addr of the list, data) + Add an element which contain data at the back of + the list. + + delBack(addr of the list) + Remove the last element of the list. + + addFront(addr of the vector, data) + Add an element which contain data at the front of + the list. + + delFront(addr of the list) + Remove the first element of the list. + + + rm(addr of the list, addr of the iter1, iter2) + Remove the part of iter1 ~ iter2 (include iter1 + but not iter2) + + copy(addr of the list, addr of the iter1, iter2, + addr of the list2) + Create a new list which contain the part of the + iter1 ~ iter2 (include iter1 but not iter2) and + saved it to list2. + + move(addr of the list, addr of the iter1, iter2, + addr of the list2) + Move the part iter1 ~ iter2 to list2. + + swap(addr of the l1, addr of the iter. i1, i2, + addr of the l2, addr of the iter. j1, j2) + Swap the part of l1 from i1 to i2.previous and + the part of l2 from j1 to j2.previous. + + + iterGetEntry(addr of the iteator) + Return a const pointer which point to the data of + the iterator. + + iterGetNext(addr of the iterator) + Return a pointer which point to the next iterator + + iterGetPrev(addr of the iterator) + Return a pointer which point to the previous ite- + ator. + + + iterSetEntry(addr of the iterator, data) + Let the data which is stored in iterator be the + data you given. + + iterGoNext(addr of the iterator) + Instead of return a pointer, it will change the + pointer you given. + + iterGoPrev(addr of the iterator) + Instead of return a pointer, it will change the + pointer you given. + + + iterDel(addr of the iterator) + Delete the iterator you given, returning a pointer + to the next iterator + + iterDelPrev(addr of the iterator) + Delete the previous of the iterator you given. + + iterDelPrev(addr of the iterator) + Delete the next of the iterator you given. + -stack: -queue: -dequeue: diff --git a/include/list.h b/include/list.h index 55377b4..902a39c 100644 --- a/include/list.h +++ b/include/list.h @@ -33,13 +33,13 @@ /* Return a const pointer which point to the entry */ /* at the end of the list. */ /* */ -/* getFirst(addr of the list) */ +/* getBegin(addr of the list) */ /* Return a pointer which point to the iterator at */ /* the head of the list. */ /* */ -/* getLast(addr of the list) */ +/* getEnd(addr of the list) */ /* Return a pointer which point to the iterator at */ -/* the end of the list. */ +/* the end of the list (which cannot be modified). */ /* */ /* */ /* setSize(addr of the list, new_size) */ @@ -73,9 +73,15 @@ /* Remove the part of iter1 ~ iter2 (include iter1 */ /* but not iter2) */ /* */ -/* cutout(addr of the list, addr of the iter1, iter2) */ +/* copy(addr of the list, addr of the iter1, iter2, */ +/* addr of the list2) */ /* Create a new list which contain the part of the */ -/* iter1 ~ iter2 (include iter1 but not iter2) */ +/* iter1 ~ iter2 (include iter1 but not iter2) and */ +/* saved it to list2. */ +/* */ +/* move(addr of the list, addr of the iter1, iter2, */ +/* addr of the list2) */ +/* Move the part iter1 ~ iter2 to list2. */ /* */ /* swap(addr of the l1, addr of the iter. i1, i2, */ /* addr of the l2, addr of the iter. j1, j2) */ |