Prison::MeCard Class

class Prison::MeCard
Header: #include <Prison/MeCard>
CMake: find_package(KF6 REQUIRED COMPONENTS Prison)
target_link_libraries(mytarget PRIVATE KF6::Prison)
Since: 5.101

Public Functions

QString header() const
QStringView headerView() const
QVariantMap toVariantMap() const
QString value(QStringView key) const
QStringList values(QStringView key) const

Static Public Members

std::optional<Prison::MeCard> parse(const QString &data)

Detailed Description

Parser for the MeCard format. This was originally used for a more compact vCard representation, but today is mostly relevant for Wifi configuration QR codes.

See also https://en.wikipedia.org/wiki/MeCard_(QR_code) and https://github.com/zxing/zxing/wiki/Barcode-Contents#wi-fi-network-config-android-ios-11.

Member Function Documentation

Get the MeCard header.

If you just want to identify the card, use headerView() instead.

QStringView MeCard::headerView() const

Get the MeCard header as a string view.

Useful for identifying the type of card.

[static] std::optional<Prison::MeCard> MeCard::parse(const QString &data)

Parse the given string

data The string to parse

Returns a MeCard, if parsing was successful, a nullopt otherwise.

QVariantMap MeCard::toVariantMap() const

Get the parsed data as QVariantMap.

QString MeCard::value(QStringView key) const

Get the value for a given key.

Convenience method for getting the first value if only one value is expected.

QStringList MeCard::values(QStringView key) const

Get the list of values for a given key.