Commit Graph

13 Commits

Author SHA1 Message Date
tomFlowee c7192dff41 Add text-limit argument to writeHex
The BufferPool::writeHex() method takes a string-pointer, we add an int
max-number-of-chars to be parsed on that string.
This allows us to not just stop at the first non-hex char, but also
after a set number of characters.

This effectively allows us to use non-zere-terminated strings as
argument too.
2024-10-03 14:07:10 +02:00
tomFlowee 6a84a262cc Add more ConstBuffer helper methods
This adds endsWith() and an extra startsWith() overload.

We also added tests for the case when either the argument or the object
are empty and specify the behavior. I copied the behavior of QString.

See unit tests that specify the behavior with empties.
2024-06-11 17:57:17 +02:00
tomFlowee bc47a700a4 Refactor; wrap BufferPool in shared_ptr
As we moved most of the creation of a BufferPool to be via the
Streaming::pool() method, which uses a thread-local, it makes sense
to start cleaning up the design and make it more modern C++.
The above mentioned method would return a reference and you'd see
loads of places use `auto &pool =` which is less than ideal.

As the number of places where we actually instantiate a BufferPool
goes down, the usage of some sort of smart pointer makes more sense.

This now makes all APIs use BufferPool be wrapped in a shared_ptr.
2023-12-21 15:23:23 +01:00
tomFlowee 1e3a4aeee3 Add out of bounds check for MessageParser 2023-07-09 17:09:07 +02:00
tomFlowee 26262783de Allow mid(1, 0) to be called
This now creates a zero size, empty, result.
2022-02-10 18:02:50 +01:00
tomFlowee 41e00b134f Add convenience methods on ConstBuffer
this adds indexOf() and toString()
2022-01-25 23:59:54 +01:00
tomFlowee ae78dd0bb8 Update email address 2021-06-20 22:44:44 +02:00
tomFlowee 407dd2f2ab Simplify messageparser.
Remove some unused methods and complexity.
2021-01-06 19:37:27 +01:00
TomZ 72f1f3733c make clang happy; implicit coversion 2020-05-27 12:14:27 +02:00
TomZ 3315aec93f Add ConstBuffer::operator==() 2019-12-30 17:37:23 +01:00
TomZ 0b152570ee Add ConstBuffer::startsWith()
and include unit test.
2019-08-26 20:48:12 +02:00
TomZ 4a877fcbfa Add unit test for MessageBuilder::reply() 2019-06-26 22:50:20 +02:00
TomZ 18d032a556 Transfer more to QTestLib
As boost testlib is extremely IDE unfriendly, as well as human
unfriendly with lots of macros for basic C++ functions (like methods!!)
this is better for me.

But the real reason is that its just unstable. I get double deletes
on some releases of boost and I'm missing plain features that all
other test frameworks have.
For instance a QCOMPARE shows what is expected vs what we got. Boost
just fails.
In QTestLib I can mark a test as "expect fail" an idea that boost
tried and failed (can easily create false positives).
2018-12-28 16:21:49 +01:00