Skip to content

Commit

Permalink
- Remove development-file
Browse files Browse the repository at this point in the history
- Format all files
  • Loading branch information
nkaaf committed Nov 25, 2023
1 parent 7847ae5 commit 0586314
Show file tree
Hide file tree
Showing 40 changed files with 77 additions and 79 deletions.
3 changes: 2 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,15 @@ CompactNamespaces: false
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentPPDirectives: None
InsertNewlineAtEOF: true
IndentWidth: 2
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PointerAlignment: Right
ReflowComments: false
ReflowComments: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
Expand Down
Empty file removed .development
Empty file.
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# List
![Build Status](https://github.com/nkaaf/Arduino-List/workflows/Arduino%20Library%20CI/badge.svg)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/nkaaf/library/List.svg)](https://registry.platformio.org/libraries/nkaaf/List)
[![arduino-library-badge](https://www.ardu-badge.com/badge/List.svg)](https://www.ardu-badge.com/List)
![Image indicating the latest Build Status](https://github.com/nkaaf/Arduino-List/workflows/Arduino%20Library%20CI/badge.svg "Build Status")
[![Image indicating the latest version in the PlatformIO Registry](https://badges.registry.platformio.org/packages/nkaaf/library/List.svg "PlatformIO Registry")](https://registry.platformio.org/libraries/nkaaf/List)
[![Image indicating the latest version in the Arduino Library Registry](https://www.ardu-badge.com/badge/List.svg "Arduino Library Registry")](https://www.ardu-badge.com/List)

## Intention
Library to extend the Arduino Ecosystem with different List Implementations.

Documentation: [https://nkaaf.github.io/Arduino-List/](https://nkaaf.github.io/Arduino-List/)
## Documentation
The documentation can be found [here](https://nkaaf.github.io/Arduino-List/).

https://semver.org/ compliant

## Arduino Library References

* https://docs.arduino.cc/learn/contributions/arduino-writing-style-guide
* https://docs.arduino.cc/learn/contributions/arduino-library-style-guide
* https://arduino.github.io/arduino-cli/0.34/library-specification/
## Trivia
This library is [Semantic Versioning 2.0.0](https://semver.org/) compliant.
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ void setup() {
Serial.println("Elements of mutable lists can be manipulate via the same variable; immutable lists cannot!");
}

void loop() {}
void loop() {}
10 changes: 5 additions & 5 deletions examples/List/ManageElements/ManageElements.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ void setup() {

// Add the first element to the list
int setup1 = 25;
list.add(setup1); // add() will always place the element at the end of the list. Its synonym is addLast(). addFirst() will place the element directly at the front of the list.
list.add(setup1);// add() will always place the element at the end of the list. Its synonym is addLast(). addFirst() will place the element directly at the front of the list.
Serial.println("Inserted the first element");

Serial.println();

// Get the first element
Serial.print("The value of the first element with the getValue() method is: ");
Serial.println(list.get(0)); // The most comfortable way to get the first elements value is to call the getValue() method. You cannot get the address of the element with the getValue() method!
Serial.println(list.get(0));// The most comfortable way to get the first elements value is to call the getValue() method. You cannot get the address of the element with the getValue() method!

// Get the first element (alternative)
Serial.print("The value of the first element with the [] operator is: ");
int firstElement = list[0]; // The '[]' Operator is a synonym for the getValue() method.
int firstElement = list[0];// The '[]' Operator is a synonym for the getValue() method.
Serial.println(firstElement);

// TODO: add getMutableValue for mutable lists
Expand All @@ -42,7 +42,7 @@ void setup() {
}

// Remove element from list
list.remove(3); // With this, you will remove the third element of the list.
list.remove(3);// With this, you will remove the third element of the list.
Serial.print("After the deletion of the third element, the list has: ");
Serial.print(list.getSize());
Serial.println(" element(s)");
Expand All @@ -61,4 +61,4 @@ void setup() {
Serial.println(" element(s)");
}

void loop() {}
void loop() {}
30 changes: 15 additions & 15 deletions examples/List/UtilsAndHelper/UtilsAndHelper.ino
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@ void setup() {
Serial.println("Inserted another element");

// Convert list to array
//int *array = list.toArray();
// int *array = list.toArray();
//// Print every element from the new array
//Serial.print("The list contains the following values which are get by converting the list to an array: [");
//for (int i = 0; i < list.getSize(); ++i) {
// Serial.print(array[i]);
// if (i != list.getSize() - 1) { // only add the ',' if the element is not the last; otherwise the output would be: [2,2,]; but now it is [2,2]
// Serial.print(",");
// }
//}
//Serial.println("]");
// Serial.print("The list contains the following values which are get by converting the list to an array: [");
// for (int i = 0; i < list.getSize(); ++i) {
// Serial.print(array[i]);
// if (i != list.getSize() - 1) { // only add the ',' if the element is not the last; otherwise the output would be: [2,2,]; but now it is [2,2]
// Serial.print(",");
// }
// }
// Serial.println("]");
//// free memory space generated by toArray(), because it is not used anymore
//free(array);
// free(array);

Serial.println();

// Compare two lists
List<int> secondList; // Create second list
List<int> secondList;// Create second list
if (list.equals(secondList)) {
Serial.println("The two lists are identical.");
} else {
Expand All @@ -62,7 +62,7 @@ void setup() {
secondList.add(setup2);

// Check another time
if (list == secondList) { // The '==' operator is a synonym for the equals() method.
if (list == secondList) {// The '==' operator is a synonym for the equals() method.
Serial.println("The two lists are identical.");
} else {
Serial.println("The two lists aren't identical.");
Expand All @@ -73,7 +73,7 @@ void setup() {
Serial.println("Add two more elements to the second list.");
int setup3 = 12;
int setup4 = 41;
secondList.add(setup3); // add two more values to the second List
secondList.add(setup3);// add two more values to the second List
secondList.add(setup4);

// Add one list to another
Expand All @@ -84,11 +84,11 @@ void setup() {
Serial.print("The list contains the following values: [");
for (int i = 0; i < list.getSize(); ++i) {
Serial.print(list[i]);
if (i != list.getSize() - 1) { // only add the ',' if the element is not the last; otherwise the output would be: [2,2,]; but now it is [2,2]
if (i != list.getSize() - 1) {// only add the ',' if the element is not the last; otherwise the output would be: [2,2,]; but now it is [2,2]
Serial.print(",");
}
}
Serial.println("]");
}

void loop() {}
void loop() {}
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@
"LICENSE"
]
}
}
}
22 changes: 11 additions & 11 deletions src/AbstractList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class AbstractList {
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
/*!
* @copydoc AbstractList::addAtIndex()
* @note If the list is mutable nothing happen.
* @note If the list is mutable nothing happen.
*/
virtual void addAtIndex(int index, T &&value) {
if (this->isMutable()) {
Expand Down Expand Up @@ -194,7 +194,7 @@ class AbstractList {
/*!
* @brief Add all entries from the given list at the end of the list.
* @note The elements from the other list, remain untouched.
* @note If the other list is mutable and the values saved in the lists are primitives, nothing happens.
* @note If the other list is mutable and the values saved in the lists are primitives, nothing happens.
*
* @param list Other list to copy from.
*/
Expand All @@ -205,7 +205,7 @@ class AbstractList {
* The original entry at this index, and followings, will be placed
* directly after the entries of the given list.
* @note The elements from the other list, remain untouched.
* @note If this list is mutable, ensure, that the other lists do not go out-of-scope during all operations of this list. If the other list is mutable, all values added to this lists are immutable.
* @note If this list is mutable, ensure, that the other lists do not go out-of-scope during all operations of this list. If the other list is mutable, all values added to this lists are immutable.
*
* @param index Index of this list, at which all entries should be added.
* @param arr Array.
Expand Down Expand Up @@ -233,31 +233,31 @@ class AbstractList {
/*!
* @brief Add a new entry at the beginning of the list.
* @note If this list is mutable, ensure, that all variables added to the lists do not go out-of-scope during all operations of the list.
*
*
* @param value Value to add.
*/
void addFirst(T &value) { addAtIndex(0, value); }

#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
/*!
* @copydoc AbstractList::addFirst()
* @note If the list is mutable and the values saved in the list are not primitives, nothing happen.
* @note If the list is mutable and the values saved in the list are not primitives, nothing happen.
*/
void addFirst(T &&value) { addAtIndex(0, value); }
#endif

/*!
* @brief Add a new entry at the end of the list.
* @note If this list is mutable, ensure, that all variables added to the lists do not go out-of-scope during all operations of the list.
*
*
* @param value Value to add.
*/
void addLast(T &value) { addAtIndex(getSize(), value); }

#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
/*!
* @copydoc AbstractList::addLast()
* @note If the list is mutable and the values saved in the list are not primitives, nothing happen.
* @note If the list is mutable and the values saved in the list are not primitives, nothing happen.
*/
void addLast(T &&value) { addAtIndex(getSize(), value); }
#endif
Expand Down Expand Up @@ -413,15 +413,15 @@ class AbstractList {
/*!
* @copydoc AbstractList::add()
* @see add()
* @note If the list is mutable and the values saved in the list are not primitives, nothing happen.
*/
* @note If the list is mutable and the values saved in the list are not primitives, nothing happen.
*/
void operator+(T &&value) { this->add(value); }
#endif

/*!
* @copydoc AbstractList::addAll(AbstractList<T>&)
* @note If the other list is mutable and the values saved in the lists are primitives, nothing happens.
* @see addAll(AbstractList<T>&)
* @note If the other list is mutable and the values saved in the lists are primitives, nothing happens.
* @see addAll(AbstractList<T>&)
*/
void operator+(AbstractList<T> &list) { this->addAll(list); }
};
Expand Down
4 changes: 2 additions & 2 deletions src/DoubleLinkedList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ class DoubleLinkedList : public AbstractList<T> {
~DoubleLinkedList() { this->clear(); }

using AbstractList<T>::addAtIndex;///'Using' the addAtIndex method, to
///prevent name hiding of the addAtIndex
///method from AbstractList
/// prevent name hiding of the addAtIndex
/// method from AbstractList

/*!
* @copydoc AbstractList::addAtIndex()
Expand Down
4 changes: 2 additions & 2 deletions src/SingleLinkedList.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ class SingleLinkedList : public AbstractList<T> {
~SingleLinkedList() { this->clear(); }

using AbstractList<T>::addAtIndex;///'Using' the addAtIndex method, to
///prevent name hiding of the addAtIndex
///method from AbstractList
/// prevent name hiding of the addAtIndex
/// method from AbstractList

/*!
* @copydoc AbstractList::addAtIndex()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,4 @@ void setup() {
}

void loop() {
}
}
2 changes: 1 addition & 1 deletion test/test_immutable_list_+/test_immutable_list_+.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,4 @@ void setup() {
}

void loop() {
}
}
2 changes: 1 addition & 1 deletion test/test_immutable_list_add/test_immutable_list_add.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,4 +181,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ void setup() {
}

void loop() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,4 @@ void setup() {
}

void loop() {
}
}
2 changes: 1 addition & 1 deletion test/test_immutable_list_get/test_immutable_list_get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ void setup() {
}

void loop() {
}
}
Loading

0 comments on commit 0586314

Please sign in to comment.