Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F116469
helper.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
helper.hpp
View Options
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2020-2023 tusooa <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#pragma once
#include
<libkazv-config.hpp>
#include
<immer/config.hpp>
// https://github.com/arximboldi/immer/issues/168
#include
<immer/array.hpp>
#include
<QString>
#include
<QStringList>
#include
<zug/transducer/map.hpp>
#include
<cursorutil.hpp>
#include
<device-list-tracker.hpp>
namespace
Kazv
{
namespace
detail
{
struct
StrToQtT
{
template
<
class
T
>
auto
operator
()(
T
&&
x
)
{
return
QString
::
fromStdString
(
std
::
forward
<
T
>
(
x
));
}
};
struct
QStringToStdT
{
template
<
class
T
>
auto
operator
()(
T
&&
x
)
{
return
std
::
forward
<
T
>
(
x
).
toStdString
();
}
};
struct
ContainerSizeT
{
template
<
class
T
>
auto
operator
()(
T
&&
x
)
->
int
{
return
std
::
forward
<
T
>
(
x
).
size
();
}
};
}
}
constexpr
auto
strToQt
=
zug
::
map
(
::
Kazv
::
detail
::
StrToQtT
{});
constexpr
auto
strListToQtF
=
[](
auto
container
)
{
return
zug
::
into
(
QStringList
{},
strToQt
,
std
::
move
(
container
));
};
constexpr
auto
strListToQt
=
zug
::
map
(
strListToQtF
);
constexpr
auto
qStringToStd
=
zug
::
map
(
::
Kazv
::
detail
::
QStringToStdT
{});
constexpr
auto
qStringListToStdF
=
[](
auto
container
)
{
return
Kazv
::
intoImmer
(
immer
::
array
<
std
::
string
>
{},
qStringToStd
,
std
::
move
(
container
));
};
constexpr
auto
containerSize
=
zug
::
map
(
::
Kazv
::
detail
::
ContainerSizeT
{});
QString
trustLevelToQStringFunc
(
Kazv
::
DeviceTrustLevel
trustLevel
);
Kazv
::
DeviceTrustLevel
qStringToTrustLevelFunc
(
QString
trustLevel
);
constexpr
auto
trustLevelToQString
=
zug
::
map
(
trustLevelToQStringFunc
);
constexpr
auto
qStringToTrustLevel
=
zug
::
map
(
qStringToTrustLevelFunc
);
inline
auto
roomMemberToAvatar
=
Kazv
::
eventContent
|
Kazv
::
jsonAtOr
(
std
::
string
(
"avatar_url"
),
std
::
string
(
""
));
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sun, Dec 1, 4:02 PM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41741
Default Alt Text
helper.hpp (1 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment