Commit 09942669 authored by Volker Krause's avatar Volker Krause
Browse files

Don't restrict AlphaId to 16bit storage

Needed to support 3 byte Via Rail station codes.
parent 9995f644
......@@ -8,9 +8,9 @@
using namespace KItinerary;
uint16_t KnowledgeDb::Internal::alphaIdFromString(QStringView s, int size)
uint32_t KnowledgeDb::Internal::alphaIdFromString(QStringView s, int size)
{
uint16_t res = {};
uint32_t res = {};
if (size != s.size()) {
return res;
}
......@@ -26,7 +26,7 @@ uint16_t KnowledgeDb::Internal::alphaIdFromString(QStringView s, int size)
return res;
}
QString KnowledgeDb::Internal::alphaIdToString(uint16_t id, int size)
QString KnowledgeDb::Internal::alphaIdToString(uint32_t id, int size)
{
if (id == 0) {
return {};
......
......@@ -21,8 +21,8 @@ namespace KnowledgeDb {
///@cond internal
namespace Internal {
// "private" API for the template code below
KITINERARY_EXPORT uint16_t alphaIdFromString(QStringView s, int size);
KITINERARY_EXPORT QString alphaIdToString(uint16_t id, int size);
KITINERARY_EXPORT uint32_t alphaIdFromString(QStringView s, int size);
KITINERARY_EXPORT QString alphaIdToString(uint32_t id, int size);
}
///@endcond
......@@ -49,7 +49,6 @@ public:
/** Create identifier from a QString. */
inline explicit AlphaId(QStringView s)
{
static_assert(sizeof(decltype(Internal::alphaIdFromString(s, N))) <= sizeof(T), "alphaIdFromString truncates result");
m_id = Internal::alphaIdFromString(s, N);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment