...
This commit is contained in:
@@ -76,7 +76,7 @@ public:
|
||||
if constexpr (traits::adc_input_char_range<T>) {
|
||||
std::ranges::copy(v, std::back_inserter(_storageSequence.emplace_back()));
|
||||
} else if constexpr (traits::formattable<T>) {
|
||||
std::format_to(std::back_inserter(_storageSequence.emplace_back()), v);
|
||||
std::format_to(std::back_inserter(_storageSequence.emplace_back()), "{}", v);
|
||||
} else {
|
||||
static_assert(false, "UNSUPPORTED TYPE!!!");
|
||||
}
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
template <traits::adc_output_char_range R>
|
||||
template <traits::adc_output_char_range<char> R>
|
||||
size_t bytes(R& r)
|
||||
{
|
||||
if (_outputSequence.empty()) {
|
||||
@@ -154,7 +154,7 @@ protected:
|
||||
|
||||
output_seq_t _outputSequence;
|
||||
|
||||
AdcNetMessageInterface() : _storageSequence(), _outputSequence() {};
|
||||
AdcNetMessageInterface() : _storageSequence(), _outputSequence(){};
|
||||
|
||||
template <typename T, typename... Ts>
|
||||
AdcNetMessageInterface(const T& v, const Ts&... vs) : AdcNetMessageInterface()
|
||||
@@ -240,6 +240,10 @@ public:
|
||||
template <typename T, typename... Ts>
|
||||
void appendTokens(const T& v, const Ts&... vs)
|
||||
{
|
||||
if (_storageSequence.size()) { // some tokens are already in storage
|
||||
_outputSequence.emplace_back(tokenDelimiter); // add delimiter in output sequence
|
||||
}
|
||||
|
||||
if constexpr (traits::adc_input_char_range<T> || traits::formattable<T>) {
|
||||
this->appendBytes(v);
|
||||
} else if constexpr (std::ranges::input_range<T>) {
|
||||
@@ -254,7 +258,7 @@ public:
|
||||
}
|
||||
|
||||
} else {
|
||||
static_assert(false, "INVALID TYPE OF INPUT TOKENS!!!");
|
||||
static_assert(false, "UNSUPPORTED (CANNOT BE SERIALIZED TO BYTES) TYPE OF INPUT TOKENS!!!");
|
||||
}
|
||||
|
||||
if constexpr (sizeof...(Ts)) {
|
||||
@@ -347,13 +351,13 @@ public:
|
||||
|
||||
|
||||
protected:
|
||||
void updateState() override
|
||||
{
|
||||
if (_outputSequence.size()) {
|
||||
_outputSequence.emplace_back(tokenDelimiter); // add delimiter in output sequence
|
||||
}
|
||||
_outputSequence.emplace_back(_storageSequence.back());
|
||||
}
|
||||
// void updateState() override
|
||||
// {
|
||||
// if (_outputSequence.size()) { // some tokens are already in storage
|
||||
// _outputSequence.emplace_back(tokenDelimiter); // add delimiter in output sequence
|
||||
// }
|
||||
// _outputSequence.emplace_back(_storageSequence.back());
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
@@ -404,7 +408,8 @@ public:
|
||||
this->_outputSequence.emplace_back(_key);
|
||||
|
||||
if constexpr (sizeof...(ParamTs)) {
|
||||
this->setTokens(params...);
|
||||
this->_outputSequence.emplace_back(keyparamDelimiter); // add key-param delimiter in output sequence
|
||||
this->appendTokens(params...);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
net/adc_netproto.h
Normal file
1
net/adc_netproto.h
Normal file
@@ -0,0 +1 @@
|
||||
#pragma once
|
||||
Reference in New Issue
Block a user