BusBricks: /Users/felixschulke/Developement/Arduino/Modbus_RTU/Modbus_RTU/Modbus-RTU/lib/Frame/CharArray.h Source File
BusBricks  0.1
Customize bus-communication
Loading...
Searching...
No Matches
CharArray.h
Go to the documentation of this file.
1
24#ifndef CHARARRAY_H
25#define CHARARRAY_H
26
27#ifdef ARDUINO
28 #include <Arduino.h> // include Arduino-Library for platformIO-build
29#else
30 #include <mockArduino.h>
31 using namespace arduinoMocking;
32#endif
33
38class CharArray {
39private:
41 char* data;
42
44 size_t size;
45
52 void extendArray(size_t extendedSize);
53
54public:
59 CharArray();
60
61
66 ~CharArray();
67
75 CharArray(const String& str);
76
87 CharArray(const CharArray& other);
88
100 CharArray& operator=(const CharArray& other);
101
111 CharArray& operator=(const String& other);
112
122 char& operator[](size_t index);
123
133 const char& operator[](size_t index) const;
134
135
142 CharArray& operator+=(char c);
143
150 bool operator==(const CharArray& other) const;
151
158 bool operator!=(const CharArray& other) const;
159
160
168 size_t getSize() const;
169
178 const char* getData() const;
179
186};
187
188
189
190#endif // CHARARRAY_H
Class for storing char-array (byte-array) together with size. The Array is stored on Heap-memory and ...
Definition CharArray.h:38
CharArray()
Construct a new empty Char Array object (0 byte)
Definition CharArray.cpp:30
size_t getSize() const
Retrieves the size of the char array.
Definition CharArray.cpp:213
char & operator[](size_t index)
Write-Access the element at the specified index.
Definition CharArray.cpp:132
CharArray & operator=(const CharArray &other)
Assignment operator.
Definition CharArray.cpp:79
String getHexString()
Get the Hex-Values of the Array as a String.
Definition CharArray.cpp:229
bool operator!=(const CharArray &other) const
Inequality Operator.
Definition CharArray.cpp:202
const char * getData() const
Provides direct access to the internal char array.
Definition CharArray.cpp:225
bool operator==(const CharArray &other) const
Equality Operator.
Definition CharArray.cpp:180
~CharArray()
Destroy the Char Array object.
Definition CharArray.cpp:36
CharArray & operator+=(char c)
+= Operator to append a single character
Definition CharArray.cpp:145
Provides mock implementations of Arduino framework functions and classes for native builds.
Definition mockArduino.cpp:28
std::string String
Alias for std::string to simulate Arduino's String type.
Definition mockArduino.h:51