KItinerary::MergeUtil

Search for usage in LXR

KItinerary::MergeUtil Class Reference

#include <mergeutil.h>

Static Public Member Functions

static bool hasSameArrival (const QVariant &lhs, const QVariant &rhs)
 
static bool hasSameDeparture (const QVariant &lhs, const QVariant &rhs)
 
static bool isSame (const QVariant &lhs, const QVariant &rhs)
 
static bool isSameIncidence (const QVariant &lhs, const QVariant &rhs)
 
static bool isSamePerson (const Person &lhs, const Person &rhs)
 
static QVariant merge (const QVariant &lhs, const QVariant &rhs)
 
template<typename T >
static void registerComparator (bool(*func)(const T &, const T &))
 

Detailed Description

Utilities for merging reservations or elements of them.

Definition at line 20 of file mergeutil.h.

Member Function Documentation

◆ hasSameArrival()

bool MergeUtil::hasSameArrival ( const QVariant & lhs,
const QVariant & rhs )
static

Checks whether two transport reservation elements refer to the same arrival.

This considers time, location and mode of transport.

Definition at line 875 of file mergeutil.cpp.

◆ hasSameDeparture()

bool MergeUtil::hasSameDeparture ( const QVariant & lhs,
const QVariant & rhs )
static

Checks whether two transport reservation elements refer to the same departure.

This considers time, location and mode of transport.

Definition at line 848 of file mergeutil.cpp.

◆ isSame()

bool MergeUtil::isSame ( const QVariant & lhs,
const QVariant & rhs )
static

Checks if two Reservation or Trip values refer to the same booking element.

This does not mean being exactly equal, but having matching identifying properties. What this means exactly depends on the data type:

  • Flights: booking reference, flight number and departure day match
  • Train trip: booking reference, train number and departure day match
  • Bus trip: booking ref and/or number and departure time match
  • Hotel booking: hotel name, booking reference and checkin day match

For all reservation types, the Reservation::underName property is checked and either needs to be equal or absent in one of the values.

Definition at line 155 of file mergeutil.cpp.

◆ isSameIncidence()

bool MergeUtil::isSameIncidence ( const QVariant & lhs,
const QVariant & rhs )
static

Checks whether to elements refer to the same thing, just for different people.

For example two reservations for the same trip or event, but with separate tickets for different attendees. This is useful for batching elements together.

Since
5.23.41

Definition at line 668 of file mergeutil.cpp.

◆ isSamePerson()

bool MergeUtil::isSamePerson ( const Person & lhs,
const Person & rhs )
static

Checks if two Person objects refer to the same person.

Essentially a case-insensitive comparison of the name components.

Definition at line 623 of file mergeutil.cpp.

◆ merge()

QVariant MergeUtil::merge ( const QVariant & lhs,
const QVariant & rhs )
static

Merge the two given objects.

This is the same as JsonLdDocument::apply in most cases, but if one side can be determined to be "better", that one is preferred.

Definition at line 764 of file mergeutil.cpp.

◆ registerComparator()

template<typename T >
static void KItinerary::MergeUtil::registerComparator ( bool(*)(const T &, const T &) func)
inlinestatic

Register a comparator function for a custom type that will be used by isSame.

Definition at line 75 of file mergeutil.h.


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 Fri May 17 2024 11:50:52 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.