Skip to content

Commit fbbbace

Browse files
authored
Merge pull request #16 from nkaaf/road_to_2_1_0
PR for 2.1.0
2 parents 2fe5514 + 5cf8de8 commit fbbbace

File tree

7 files changed

+58
-30
lines changed

7 files changed

+58
-30
lines changed

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "Arduino List Library"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = 2.0.0
41+
PROJECT_NUMBER = 2.1.0
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

examples/List/ManageElements/ManageElements.ino

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,21 @@ void setup() {
4141
Serial.print("After the deletion, the list has: ");
4242
Serial.print(list.getSize());
4343
Serial.println(" element(s)");
44+
45+
// Add 10 more elements
46+
int e = 0;
47+
for (int i = 0; i < 10; ++i) {
48+
list.add(e);
49+
}
50+
Serial.print("After the insertion, the list has: ");
51+
Serial.print(list.getSize());
52+
Serial.println(" element(s)");
53+
54+
// Clear list
55+
list.clear();
56+
Serial.print("After the clear, the list has: ");
57+
Serial.print(list.getSize());
58+
Serial.println(" element(s)");
4459
}
4560

4661
void loop() {}

keywords.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ addAtIndex KEYWORD2
2020
addAll KEYWORD2
2121
addFirst KEYWORD2
2222
addLast KEYWORD2
23+
clear KEYWORD2
2324
getValue KEYWORD2
2425
getPointer KEYWORD2
2526
remove KEYWORD2
27+
removeAll KEYWORD2
2628
getSize KEYWORD2
2729
isMutable KEYWORD2
2830
isEmpty KEYWORD2

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=List
2-
version=2.0.0
2+
version=2.1.0
33
author=Niklas Kaaf <nkaaf@protonmail.com>
44
maintainer=Niklas Kaaf <nkaaf@protonmail.com>
55
sentence=The Ultimate Collection of Lists

src/AbstractList.hpp

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ template <typename T> class AbstractList {
125125

126126
public:
127127
/*!
128-
* @brief Add a new entry at the end of the list.
128+
* @copybrief AbstractList::addLast()
129+
* @note Alias of addLast().
129130
* @see addLast()
130131
*
131132
* @param value Value to add.
@@ -166,7 +167,7 @@ template <typename T> class AbstractList {
166167

167168
/*!
168169
* @brief Add all entries from the given list at the end of the list.
169-
* @see addLast()
170+
* @see addAll()
170171
*
171172
* @param list Other list to copy from.
172173
*/
@@ -188,13 +189,9 @@ template <typename T> class AbstractList {
188189
void addLast(T &value) { addAtIndex(getSize(), value); }
189190

190191
/*!
191-
* @brief Get a pointer to the entry at the given index. If the given index
192-
* does not exists, null will be returned.
193-
* @note If the list is immutable, the returned pointer has to be free'd with
194-
* free() in order to prevent memory leaks.
195-
*
196-
* @param index Index of element to get.
197-
* @return Pointer to the element.
192+
* @copydoc AbstractList::get()
193+
* @note Alias of get().
194+
* @see get()
198195
*/
199196
T *getPointer(int index) { return get(index); }
200197

@@ -228,8 +225,9 @@ template <typename T> class AbstractList {
228225
virtual void remove(int index) = 0;
229226

230227
/*!
231-
* @brief Remove all elements from the List.
228+
* @copybrief AbstractList::clear()
232229
* @note Alias of clear().
230+
* @see clear().
233231
*/
234232
void removeAll() { clear(); }
235233

@@ -301,37 +299,26 @@ template <typename T> class AbstractList {
301299
}
302300

303301
/*!
304-
* @brief Get the value of the element at the index.
302+
* @copydoc AbstractList::getValue()
305303
* @see getValue()
306-
*
307-
* @param index Index of the element to get.
308-
* @return Value of the element.
309304
*/
310305
T operator[](int index) { return getValue(index); }
311306

312307
/*!
313-
* @brief Compare two lists whether their attributes and entries are equal.
308+
* @copydoc AbstractList::equals()
314309
* @see equals()
315-
*
316-
* @param list Second list to compare.
317-
* @return true if the lists are equal; false otherwise.
318310
*/
319311
bool operator==(AbstractList<T> &list) { return equals(list); }
320312

321313
/*!
322-
* @brief Add a new entry at the end of the list.
323-
* @see add()
324-
* @see addLast()
325-
*
326-
* @param value Value to add.
314+
* @copydoc AbstractList::add()
315+
* @see add()
327316
*/
328317
void operator+(T &value) { this->add(value); }
329318

330319
/*!
331-
* @brief Add all entries from the given list at the end of the list.
332-
* @see addAll()
333-
*
334-
* @param list Other list to copy from.
320+
* @copydoc AbstractList::addAll(AbstractList<T>&)
321+
* @see addAll(AbstractList<T>&)
335322
*/
336323
void operator+(AbstractList<T> &list) { this->addAll(list); }
337324
};

src/DoubleLinkedList.hpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* @file SingleLinkedList.hpp
2+
* @file DoubleLinkedList.hpp
33
*
44
* This file is part of the List library. It extends the arduino ecosystem with
55
* easy-to-use list implementations. They are specially designed and optimized
@@ -84,6 +84,9 @@ template <typename T> class DoubleLinkedList : public AbstractList<T> {
8484
Entry *tail = nullptr; /// The last entry of the list.
8585

8686
protected:
87+
/*!
88+
* @copydoc AbstractList::get()
89+
*/
8790
T *get(int index) override {
8891
if (this->isIndexOutOfBounds(index)) {
8992
return nullptr;
@@ -128,6 +131,9 @@ template <typename T> class DoubleLinkedList : public AbstractList<T> {
128131
*/
129132
~DoubleLinkedList() { this->clear(); }
130133

134+
/*!
135+
* @copydoc AbstractList::addAtIndex()
136+
*/
131137
void addAtIndex(int index, T &value) override {
132138
// it is allowed, that index == this->getSize() to insert it behind the last
133139
// entry
@@ -188,6 +194,9 @@ template <typename T> class DoubleLinkedList : public AbstractList<T> {
188194
this->increaseSize();
189195
};
190196

197+
/*!
198+
* @copydoc AbstractList::clear()
199+
*/
191200
void clear() override {
192201
if (this->getSize() > 0) {
193202
Entry *current = head;
@@ -209,6 +218,9 @@ template <typename T> class DoubleLinkedList : public AbstractList<T> {
209218
tail = nullptr;
210219
}
211220

221+
/*!
222+
* @copydoc AbstractList::remove()
223+
*/
212224
void remove(int index) override {
213225
if (this->isIndexOutOfBounds(index)) {
214226
return;

src/SingleLinkedList.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ template <typename T> class SingleLinkedList : public AbstractList<T> {
6969
Entry *tail = nullptr; /// The last entry of the list.
7070

7171
protected:
72+
/*!
73+
* @copydoc AbstractList::get()
74+
*/
7275
T *get(int index) override {
7376
if (this->isIndexOutOfBounds(index)) {
7477
return nullptr;
@@ -106,6 +109,9 @@ template <typename T> class SingleLinkedList : public AbstractList<T> {
106109
*/
107110
~SingleLinkedList() { this->clear(); }
108111

112+
/*!
113+
* @copydoc AbstractList::addAtIndex()
114+
*/
109115
void addAtIndex(int index, T &value) override {
110116
// it is allowed, that index == this->getSize() to insert it behind the last
111117
// entry
@@ -149,6 +155,9 @@ template <typename T> class SingleLinkedList : public AbstractList<T> {
149155
this->increaseSize();
150156
};
151157

158+
/*!
159+
* @copydoc AbstractList::clear()
160+
*/
152161
void clear() override {
153162
if (this->getSize() > 0) {
154163
Entry *current = head;
@@ -170,6 +179,9 @@ template <typename T> class SingleLinkedList : public AbstractList<T> {
170179
}
171180
}
172181

182+
/*!
183+
* @copydoc AbstractList::remove()
184+
*/
173185
void remove(int index) override {
174186
if (this->isIndexOutOfBounds(index)) {
175187
return;

0 commit comments

Comments
 (0)