removed lots of signals/slots

This commit is contained in:
csoler 2021-12-05 22:14:19 +01:00
parent bb37e2692b
commit e75d312724
20 changed files with 401 additions and 335 deletions

View file

@ -4,6 +4,7 @@
#include <string.h>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
@ -42,7 +43,7 @@ public:
{
std::istringstream is(toString().c_str());
int res = 0;
int res = -1;
is >> res ;
return res;
@ -103,6 +104,8 @@ public:
return res;
}
// Splits the byte array using sep as separator.
std::list<ByteArray> split(unsigned char sep)
{
std::list<ByteArray> res;
@ -120,6 +123,25 @@ public:
return res;
}
// Splits the byte array using any of the characters in sep as separators.
std::list<ByteArray> split(const ByteArray& sep)
{
std::list<ByteArray> res;
ByteArray current_block;
for(uint32_t i=0;i<size();++i)
if(std::find(sep.begin(),sep.end(),operator[](i)) != sep.end())
{
res.push_back(current_block);
current_block.clear();
}
else
current_block += operator[](i);
return res;
}
// Removes the following characters from the beginning and from the end of the array:
// '\t', '\n', '\v', '\f', '\r', and ' '.