Skip to content

Commit 0950f1a

Browse files
authored
Version 0.6 (#4)
* Added missing keywords * Updated tutorial * fix for memory problem on item removing * Fixed comments * Removed doxygen * New version
1 parent 0307f1f commit 0950f1a

File tree

5 files changed

+24
-32
lines changed

5 files changed

+24
-32
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# QList
22
Linked list library for Arduino
33

4-
Purpose of this library is to enable programers to create lists of things
4+
Purpose of this library is to enable programmers to create lists of things
55

66
Before we can start using library, we need to include library to our sketch
77
``` C++
@@ -48,6 +48,7 @@ Items on the list can accessed:
4848
*/
4949
int val3 = list.at(index);
5050
int val3 = list.get(index);
51+
int val3 = list[index];
5152
```
5253

5354
Values of items that are already in the list, can be changed:

keywords.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ get KEYWORD2
99
size KEYWORD2
1010
clear KEYWORD2
1111
at KEYWORD2
12+
length KEYWORD2
13+
indexOf KEYWORD2

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=QList
2-
version=0.5.1
2+
version=0.6.0
33
author=SloCompTech
44
maintainer=SloCompTech <[email protected]>
55
sentence=Library implements linked lists

src/QList.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void QList<T>::clear()
129129
{
130130
tmp = start;
131131
start = start->next;
132-
delete tmp;
132+
delete tmp; // Delete item
133133
len--; // Decrease counter
134134
}
135135
end = NULL;
@@ -153,6 +153,7 @@ void QList<T>::clear(unsigned int index)
153153
end = tmp->prev;
154154

155155
len--; // Decrease counter
156+
delete tmp; // Delete item
156157
break;
157158
}
158159
}

src/QList.h

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,10 @@
1-
/**
2-
* @file
3-
* @author SloCompTech <[email protected]>
4-
* @version 1.0
5-
*
6-
* @section DESCRIPTION
7-
*
8-
* This class enables to use linked lists
9-
*/
10-
111
#ifndef LIB_SCP_QLIST
122
#define LIB_SCP_QLIST
133

144
#ifndef NULL
15-
#define NULL 0
5+
#define NULL 0
166
#endif
177

18-
19-
208
template<class T>
219
class QList
2210
{
@@ -27,24 +15,24 @@ class QList
2715
node *next,*prev;
2816
}node;
2917

30-
int len; //!< Size of list >
31-
node *start,*end; //!< Pointers to start and end >
18+
int len; // Size of list
19+
node *start,*end; // Pointers to start and end
3220

3321
public:
34-
QList(); //!< Class constructor >
35-
~QList(); //!< Class destructor >
36-
37-
void push_back(const T i); //!< Push item at the back of list >
38-
void push_front(const T i);//!< Push item at the front of the list >
39-
void pop_back(); //!< Pops item from back >
40-
void pop_front(); //!< Pops item from front >
41-
T front(); //!< get item from front >
42-
T back(); //!< get item from back >
43-
int size(); //!< Returns size of list >
44-
void clear(); //!< Clears list >
45-
void clear(unsigned int index); //!< Clears list >
46-
T get(unsigned int index); //!< Get item at given index >
47-
T& at(unsigned int index); //!< Get item at given index >
22+
QList(); // Class constructor
23+
~QList(); // Class destructor
24+
25+
void push_back(const T i); // Push item at the back of list
26+
void push_front(const T i);// Push item at the front of the list
27+
void pop_back(); // Pops item from back
28+
void pop_front(); // Pops item from front
29+
T front(); // get item from front
30+
T back(); // get item from back
31+
int size(); // Returns size of list
32+
void clear(); // Clears list
33+
void clear(unsigned int index); // Clears list
34+
T get(unsigned int index); // Get item at given index
35+
T& at(unsigned int index); // Get item at given index
4836

4937
// Array operator
5038
T& operator[](unsigned int index);

0 commit comments

Comments
 (0)