Skip to content

Commit

Permalink
Version 3.0.0 (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
nkaaf committed Dec 16, 2023
1 parent cf453aa commit 609a084
Show file tree
Hide file tree
Showing 44 changed files with 6,344 additions and 313 deletions.
66 changes: 66 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: None
AlignOperands: DontAlign
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 2
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PointerAlignment: Right
ReflowComments: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 0
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ html
# VSCode
.vscode

# PlatformIO for testing
# PlatformIO
.pio
test
lib
src/main.cpp
include
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Arduino List Library"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 2.1.4
PROJECT_NUMBER = 3.0.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +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.33/library-specification/
* https://arduino.github.io/arduino-cli/0.33/sketch-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 @@ -20,9 +20,9 @@ void setup() {

// Get the first element of both lists
Serial.print("The first element of the first list is: ");
Serial.println(mutableList.getValue(0));
Serial.println(mutableList.get(0));
Serial.print("The first element of the second list is: ");
Serial.println(immutableList.getValue(0));
Serial.println(immutableList.get(0));

Serial.println("All three values are logically the same!");
Serial.println();
Expand All @@ -35,12 +35,12 @@ void setup() {

// Get the first element of both lists
Serial.print("The first element of the first list is: ");
Serial.println(mutableList.getValue(0));
Serial.println(mutableList.get(0));
Serial.print("The first element of the second list is: ");
Serial.println(immutableList.getValue(0));
Serial.println(immutableList.get(0));

Serial.println("You see, that the first element of the first list has the the new value and the first element of the second list has not changed.");
Serial.println("Elements of mutable lists can be manipulate via the same variable; immutable lists cannot!");
}

void loop() {}
void loop() {}
17 changes: 7 additions & 10 deletions examples/List/ManageElements/ManageElements.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,27 @@
// Create an immutable list
List<int> list;

// TODO: rvalue
void setup() {
Serial.begin(9600);

// 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.getValue(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);

// Get the first element (alternative)
Serial.print("The value of the first element with the getPointer() method and '*' is: ");
int *firstElementPtr = list.getPointer(0); // Here, have to be the '*' to get the int Value, because otherwise a pointer (memory address) will be returned.
Serial.println(*firstElementPtr);
free(firstElementPtr); // free the pointer because it is an immutable list
// TODO: add getMutableValue for mutable lists

Serial.println("As you can see, there are three possible ways to get the value. The last way is not for beginners because you have to handle pointers.");
Serial.println();
Expand All @@ -45,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 @@ -64,4 +61,4 @@ void setup() {
Serial.println(" element(s)");
}

void loop() {}
void loop() {}
34 changes: 17 additions & 17 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();
// 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("]");
// free memory space generated by toArray(), because it is not used anymore
free(array);
// 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("]");
//// free memory space generated by toArray(), because it is not used anymore
// 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() {}
7 changes: 2 additions & 5 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@ addAll KEYWORD2
addFirst KEYWORD2
addLast KEYWORD2
clear KEYWORD2
getValue KEYWORD2
getPointer KEYWORD2
get KEYWORD2
getMutableValue KEYWORD2
remove KEYWORD2
removeFirst KEYWORD2
removeLast KEYWORD2
removeAll KEYWORD2
getSize KEYWORD2
isMutable KEYWORD2
isEmpty KEYWORD2
toArray KEYWORD2
fromArray KEYWORD2
sort KEYWORD2
equals KEYWORD2
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "List",
"version": "2.1.4",
"version": "3.0.0",
"description": "The Ultimate Collection of Lists. This library extends the Arduino ecosystem with the functionality of several easy-to-use lists for numerous purposes.",
"keywords": [
"arduino",
Expand Down Expand Up @@ -54,4 +54,4 @@
"LICENSE"
]
}
}
}
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=List
version=2.1.4
version=3.0.0
author=Niklas Kaaf <[email protected]>
maintainer=Niklas Kaaf <[email protected]>
sentence=The Ultimate Collection of Lists
Expand Down
Loading

0 comments on commit 609a084

Please sign in to comment.