KPublicTransport::Feature

Search for usage in LXR

#include <feature.h>

Properties

Availability availability
 
QString description
 
QString displayName
 
KPublicTransport::Disruption::Effect disruptionEffect
 
QString name
 
int quantity
 
Type type
 
QString typeIconName
 

Public Member Functions

 Feature (Type type, Availability availability=Available)
 
QString displayName () const
 
QString typeIconName () const
 

Static Public Member Functions

static std::vector< FeaturefromJson (const QJsonArray &array)
 
static Feature fromJson (const QJsonObject &obj)
 
static bool isSame (const Feature &lhs, const Feature &rhs)
 
static Feature merge (const Feature &lhs, const Feature &rhs)
 
static QJsonObject toJson (const Feature &feature)
 
static QJsonArray toJson (const std::vector< Feature > &features)
 
static QString typeDisplayName (KPublicTransport::Feature::Type type)
 
static QString typeIconName (KPublicTransport::Feature::Type type)
 

Detailed Description

An amenity, facility or other relevant property of a vehicle (train, bus, etc), vehicle part (e.g.

train coach) or location.

Definition at line 20 of file feature.h.

Property Documentation

◆ availability

Availability KPublicTransport::Feature::availability
readwrite

Definition at line 69 of file feature.h.

◆ description

QString KPublicTransport::Feature::description
readwrite

An optional longer human-readable description.

Strongly recommended e.g. for features with limited/condicational availability or with type Other.

Definition at line 37 of file feature.h.

◆ displayName

QString KPublicTransport::Feature::displayName
read

A short humand-readable label for this feature.

Unlike name this returns a default label depending on the type of the feature, even if the data source for this didn't provide a name.

Definition at line 31 of file feature.h.

◆ disruptionEffect

KPublicTransport::Disruption::Effect KPublicTransport::Feature::disruptionEffect
readwrite

Distruption effects on the feature.

Definition at line 72 of file feature.h.

◆ name

QString KPublicTransport::Feature::name
readwrite

A short human-readable label of this feature.

Definition at line 24 of file feature.h.

◆ quantity

int KPublicTransport::Feature::quantity
readwrite

Amount of instances of this feature.

Eg. number of seats/spaces, 0 if unknown.

Definition at line 77 of file feature.h.

◆ type

Type KPublicTransport::Feature::type
readwrite

Definition at line 58 of file feature.h.

◆ typeIconName

QString KPublicTransport::Feature::typeIconName
read

Icon representing the given feature type type.

Can be an qrc: URL or a icon name compatbile with QIcon::fromTheme.

Definition at line 82 of file feature.h.

Constructor & Destructor Documentation

◆ Feature()

Feature::Feature ( Type type,
Availability availability = Available )
explicit

Convenience constructor for a Feature of type type and availability availability.

Definition at line 36 of file feature.cpp.

Member Function Documentation

◆ displayName()

QString Feature::displayName ( ) const
nodiscard

Definition at line 43 of file feature.cpp.

◆ fromJson() [1/2]

std::vector< Feature > Feature::fromJson ( const QJsonArray & array)
staticnodiscard

Deserialize a vector of features from JSON.

Definition at line 148 of file feature.cpp.

◆ fromJson() [2/2]

Feature Feature::fromJson ( const QJsonObject & obj)
staticnodiscard

Deserialize an object from JSON.

Definition at line 143 of file feature.cpp.

◆ isSame()

bool Feature::isSame ( const Feature & lhs,
const Feature & rhs )
staticnodiscard

Returns true if both features refer to the same thing.

This doesn't mean they are identical, nor does this consider the context a feature belongs to.

Definition at line 153 of file feature.cpp.

◆ merge()

Feature Feature::merge ( const Feature & lhs,
const Feature & rhs )
staticnodiscard

Merge two features referring to the same thing.

Definition at line 178 of file feature.cpp.

◆ toJson() [1/2]

QJsonObject Feature::toJson ( const Feature & feature)
staticnodiscard

Serializes one object to JSON.

Definition at line 129 of file feature.cpp.

◆ toJson() [2/2]

QJsonArray Feature::toJson ( const std::vector< Feature > & features)
staticnodiscard

Serializes a vector of features to JSON.

Definition at line 138 of file feature.cpp.

◆ typeDisplayName()

QString Feature::typeDisplayName ( KPublicTransport::Feature::Type type)
staticnodiscard

Generic display name for feature of type.

Definition at line 48 of file feature.cpp.

◆ typeIconName() [1/2]

QString Feature::typeIconName ( ) const
nodiscard

Definition at line 86 of file feature.cpp.

◆ typeIconName() [2/2]

QString Feature::typeIconName ( KPublicTransport::Feature::Type type)
staticnodiscard

Icon representing the given feature type type.

Can be an qrc: URL or a icon name compatbile with QIcon::fromTheme.

Definition at line 91 of file feature.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:57 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.